> For the complete documentation index, see [llms.txt](https://docs.tebex.io/developers/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.tebex.io/developers/headless-api/guides/creator-codes/apply-creator-code.md).

# Apply Creator Code

See [Creator Codes](https://docs.tebex.io/creators/tebex-control-panel/engagement/creator-codes) in our Creators documentation for an in-depth guide on Creator Codes. These are used to attribute purchases to influencers. These codes can optionally apply a customer discount when used.

## Apply a creator code

> Applies a creator code to a basket.

```json
{"openapi":"3.1.0","info":{"title":"Tebex Headless API","version":"2.1.0"},"tags":[{"description":"Main API scoped to public token","name":"Headless"}],"servers":[{"description":"Main API scoped to public token","url":"https://headless.tebex.io/api/accounts/{token}","variables":{"token":{"default":"YOUR_PUBLIC_TOKEN","description":"The store's public token"}}}],"paths":{"/baskets/{basketIdent}/creator-codes":{"post":{"description":"Applies a creator code to a basket.","operationId":"applyCreatorCode","parameters":[{"$ref":"#/components/parameters/basketIdent"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/applyCreatorCode_request"}}},"description":"Provide a `creator_code` to apply to the basket."},"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/applyCreatorCode_200_response"}}},"description":"Successful response returns a success object"},"422":{"description":"The provided request is invalid. The error response will include detail as to which parameter failed validation."}},"summary":"Apply a creator code","tags":["Headless"]}}},"components":{"parameters":{"basketIdent":{"description":"The basket identifier.","explode":false,"in":"path","name":"basketIdent","required":true,"schema":{"type":"string"},"style":"simple"}},"schemas":{"applyCreatorCode_request":{"properties":{"creator_code":{"type":"string"}}},"applyCreatorCode_200_response":{"properties":{"success":{"type":"boolean"},"message":{"type":"string"}}}}}}
```
