> 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/endpoints.md).

# Endpoints

## Get the webstore's information

> Gets the webstore associated with the provided token

```json
{"openapi":"3.1.0","info":{"title":"Tebex Headless API","version":"2.0.0"},"tags":[{"name":"Headless","description":"Main API scoped to public token"}],"servers":[{"url":"https://headless.tebex.io/api/accounts/{token}","description":"Main API scoped to public token","variables":{"token":{"default":"","description":"The store's public token"}}}],"paths":{"/":{"get":{"tags":["Headless"],"operationId":"getWebstore","summary":"Get the webstore's information","description":"Gets the webstore associated with the provided token","responses":{"200":{"description":"Successful response returns the webstore's information.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebstoreResponse"}}}}}}}},"components":{"schemas":{"WebstoreResponse":{"type":"object","properties":{"data":{"type":"object","$ref":"#/components/schemas/Webstore"}},"description":"Wrapped webstore information in a \"data\" object."},"Webstore":{"type":"object","properties":{"id":{"type":"integer"},"description":{"type":"string","description":"Store description in HTML format"},"name":{"type":"string","description":"Name of the store"},"webstore_url":{"type":"string","format":"uri","description":"URL of the webstore"},"currency":{"type":"string","description":"Currency used in the store"},"lang":{"type":"string","description":"Language of the store"},"logo":{"type":"string","format":"uri","description":"URL of the store's logo","nullable":true},"platform_type":{"type":"string","description":"Platform type for the store"},"platform_type_id":{"type":"string"},"disabled":{"type":"boolean","description":"True if the store is disabled."},"created_at":{"type":"string","format":"date-time","description":"The date and time when the store was created"}}}}}}
```

## Get custom pages defined for the webstore.

> Gets a list of custom pages associated with the webstore. These contain a \`content\` variable with the HTML content of the page.

```json
{"openapi":"3.1.0","info":{"title":"Tebex Headless API","version":"2.0.0"},"tags":[{"name":"Headless","description":"Main API scoped to public token"}],"servers":[{"url":"https://headless.tebex.io/api/accounts/{token}","description":"Main API scoped to public token","variables":{"token":{"default":"","description":"The store's public token"}}}],"paths":{"/pages":{"get":{"tags":["Headless"],"operationId":"getCustomPages","summary":"Get custom pages defined for the webstore.","description":"Gets a list of custom pages associated with the webstore. These contain a `content` variable with the HTML content of the page.","responses":{"200":{"description":"Successful response returns the webstore's pages.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CMSPagesResponse"}}}}}}}},"components":{"schemas":{"CMSPagesResponse":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/CMSPage"}}}},"CMSPage":{"type":"object","properties":{"id":{"type":"integer"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"},"account_id":{"type":"integer"},"title":{"type":"string"},"slug":{"type":"string"},"private":{"type":"boolean"},"hidden":{"type":"boolean"},"disabled":{"type":"boolean"},"sequence":{"type":"boolean"},"content":{"type":"string"}}}}}}
```

## Get a basket

> Gets a basket associated with the provided identifier.

```json
{"openapi":"3.1.0","info":{"title":"Tebex Headless API","version":"2.0.0"},"tags":[{"name":"Headless","description":"Main API scoped to public token"}],"servers":[{"url":"https://headless.tebex.io/api/accounts/{token}","description":"Main API scoped to public token","variables":{"token":{"default":"","description":"The store's public token"}}}],"paths":{"/baskets/{basketIdent}":{"get":{"tags":["Headless"],"operationId":"getBasket","summary":"Get a basket","parameters":[{"$ref":"#/components/parameters/basketIdent"}],"description":"Gets a basket associated with the provided identifier.","responses":{"200":{"description":"Successful response returns the basket information.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BasketResponse"}}}}}}}},"components":{"parameters":{"basketIdent":{"name":"basketIdent","in":"path","required":true,"schema":{"type":"string"},"description":"The basket identifier."}},"schemas":{"BasketResponse":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Basket"}}},"Basket":{"type":"object","properties":{"id":{"type":"string"},"ident":{"type":"string"},"complete":{"type":"boolean"},"email":{"type":"string","nullable":true},"username":{"type":"string","nullable":true},"coupons":{"type":"array","items":{"$ref":"#/components/schemas/Coupon"}},"giftcards":{"type":"array","items":{"$ref":"#/components/schemas/GiftCard"}},"creator_code":{"type":"string","description":"The creator code is used to share a percentage of the payment with another party. See more about creator codes at https://docs.tebex.io/creators/tebex-control-panel/engagement/creator-codes"},"cancel_url":{"type":"string"},"complete_url":{"type":"string","nullable":true},"complete_auto_redirect":{"type":"boolean"},"country":{"type":"string","description":"A two-character country code"},"ip":{"type":"string"},"username_id":{"type":"integer"},"base_price":{"type":"number","format":"float"},"sales_tax":{"type":"number","format":"float"},"total_price":{"type":"number","format":"float"},"currency":{"type":"string","description":"A 3 character currency code"},"packages":{"type":"array","items":{"$ref":"#/components/schemas/BasketPackage"}},"custom":{"type":"object","nullable":true},"links":{"$ref":"#/components/schemas/BasketLinks"}}},"Coupon":{"type":"object","properties":{"code":{"type":"string"}}},"GiftCard":{"type":"object","properties":{"card_number":{"type":"string"}}},"BasketPackage":{"type":"object","description":"A package within an existing basket.","properties":{"id":{"type":"integer","description":"The package ID"},"description":{"type":"string"},"image":{"type":"string"},"name":{"type":"string"},"slug":{"type":"string"},"in_basket":{"type":"object","properties":{"quantity":{"type":"integer","description":"The quantity of `package` in this basket. This is not the total quantity of overall items in the basket."},"price":{"type":"number","format":"float"},"gift_username_id":{"type":"string","description":"The username id of the user this package is gifted to"},"gift_username":{"type":"string","description":"The username of the user this package is gifted to."}}},"type":{"type":"string","enum":["single","subscription"],"description":"The type of payment, either `single` for one-time payments or `subscription`."},"revenue_share":{"type":"array","description":"An array of payment destination objects describing how the purchase should be split between multiple wallets. **Only available with pre-agreement from Tebex.**","items":{"$ref":"#/components/schemas/RevenueShare"}}}},"RevenueShare":{"type":"object","properties":{"wallet_ref":{"type":"string"},"amount":{"type":"number","description":"A float (decimal) value representing the amount of this payment in your account currency that is credited to the `wallet_ref`"},"gateway_fee_percent":{"type":"number","description":"A float (decimal) value representing the percentage of the gateway fee that should be dedicated from this wallet’s revenue share. This optional value can be anywhere between 0 - 100."}}},"BasketLinks":{"type":"object","properties":{"payment":{"type":"string","description":"The `links.payment` property is only returned if the basket has been paid for and a payment exists with the `complete`,`refund`, or `chargeback` status."},"checkout":{"type":"string","description":"The `links.checkout` property is only returned if the basket has not been paid, and is the URL to send the customer to make payment"}}}}}}
```

## Create a new basket

> Creates a new basket for use during checkout.

```json
{"openapi":"3.1.0","info":{"title":"Tebex Headless API","version":"2.0.0"},"tags":[{"name":"Headless","description":"Main API scoped to public token"}],"servers":[{"url":"https://headless.tebex.io/api/accounts/{token}","description":"Main API scoped to public token","variables":{"token":{"default":"","description":"The store's public token"}}}],"paths":{"/baskets":{"post":{"tags":["Headless"],"operationId":"createBasket","summary":"Create a new basket","description":"Creates a new basket for use during checkout.","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"complete_url":{"type":"string","description":"A URL the user can return to when checkout is completed."},"cancel_url":{"type":"string","description":"A URL the user can return to when cancelling checkout."},"custom":{"type":"object","description":"Custom data you wish to associate with the basket. This data will be included with webhook responses and GET requests associated with the Basket."},"complete_auto_redirect":{"type":"boolean","description":"True if the user should automatically be redirected to the relevant complete/cancel URL"}}}}}},"responses":{"200":{"description":"Successful response returns the basket information.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BasketResponse"}}}},"422":{"description":"The provided webstore ID is invalid."}}}}},"components":{"schemas":{"BasketResponse":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Basket"}}},"Basket":{"type":"object","properties":{"id":{"type":"string"},"ident":{"type":"string"},"complete":{"type":"boolean"},"email":{"type":"string","nullable":true},"username":{"type":"string","nullable":true},"coupons":{"type":"array","items":{"$ref":"#/components/schemas/Coupon"}},"giftcards":{"type":"array","items":{"$ref":"#/components/schemas/GiftCard"}},"creator_code":{"type":"string","description":"The creator code is used to share a percentage of the payment with another party. See more about creator codes at https://docs.tebex.io/creators/tebex-control-panel/engagement/creator-codes"},"cancel_url":{"type":"string"},"complete_url":{"type":"string","nullable":true},"complete_auto_redirect":{"type":"boolean"},"country":{"type":"string","description":"A two-character country code"},"ip":{"type":"string"},"username_id":{"type":"integer"},"base_price":{"type":"number","format":"float"},"sales_tax":{"type":"number","format":"float"},"total_price":{"type":"number","format":"float"},"currency":{"type":"string","description":"A 3 character currency code"},"packages":{"type":"array","items":{"$ref":"#/components/schemas/BasketPackage"}},"custom":{"type":"object","nullable":true},"links":{"$ref":"#/components/schemas/BasketLinks"}}},"Coupon":{"type":"object","properties":{"code":{"type":"string"}}},"GiftCard":{"type":"object","properties":{"card_number":{"type":"string"}}},"BasketPackage":{"type":"object","description":"A package within an existing basket.","properties":{"id":{"type":"integer","description":"The package ID"},"description":{"type":"string"},"image":{"type":"string"},"name":{"type":"string"},"slug":{"type":"string"},"in_basket":{"type":"object","properties":{"quantity":{"type":"integer","description":"The quantity of `package` in this basket. This is not the total quantity of overall items in the basket."},"price":{"type":"number","format":"float"},"gift_username_id":{"type":"string","description":"The username id of the user this package is gifted to"},"gift_username":{"type":"string","description":"The username of the user this package is gifted to."}}},"type":{"type":"string","enum":["single","subscription"],"description":"The type of payment, either `single` for one-time payments or `subscription`."},"revenue_share":{"type":"array","description":"An array of payment destination objects describing how the purchase should be split between multiple wallets. **Only available with pre-agreement from Tebex.**","items":{"$ref":"#/components/schemas/RevenueShare"}}}},"RevenueShare":{"type":"object","properties":{"wallet_ref":{"type":"string"},"amount":{"type":"number","description":"A float (decimal) value representing the amount of this payment in your account currency that is credited to the `wallet_ref`"},"gateway_fee_percent":{"type":"number","description":"A float (decimal) value representing the percentage of the gateway fee that should be dedicated from this wallet’s revenue share. This optional value can be anywhere between 0 - 100."}}},"BasketLinks":{"type":"object","properties":{"payment":{"type":"string","description":"The `links.payment` property is only returned if the basket has been paid for and a payment exists with the `complete`,`refund`, or `chargeback` status."},"checkout":{"type":"string","description":"The `links.checkout` property is only returned if the basket has not been paid, and is the URL to send the customer to make payment"}}}}}}
```

## Get auth links for basket

> Fetches a basket's auth URL. The player should be directed here in order for them to authorize their account.\
> When complete, they will be returned to the provided \`returnUrl\` and the basket will be authorized from that moment onwards.

```json
{"openapi":"3.1.0","info":{"title":"Tebex Headless API","version":"2.0.0"},"tags":[{"name":"Headless","description":"Main API scoped to public token"}],"servers":[{"url":"https://headless.tebex.io/api/accounts/{token}","description":"Main API scoped to public token","variables":{"token":{"default":"","description":"The store's public token"}}}],"paths":{"/baskets/{basketIdent}/auth?returnUrl={returnUrl}":{"get":{"tags":["Headless"],"operationId":"getBasketAuthUrl","summary":"Get auth links for basket","parameters":[{"$ref":"#/components/parameters/basketIdent"},{"in":"path","name":"returnUrl","description":"The URL you would like to redirect the user to after successful basket authentication.","schema":{"type":"string"},"required":true}],"description":"Fetches a basket's auth URL. The player should be directed here in order for them to authorize their account.\nWhen complete, they will be returned to the provided `returnUrl` and the basket will be authorized from that moment onwards.","responses":{"200":{"description":"Successful response returns the auth provider options and URLs of the sign-in link.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BasketAuthResponse"}}}},"422":{"description":"The provided webstore ID or basket ID is invalid."}}}}},"components":{"parameters":{"basketIdent":{"name":"basketIdent","in":"path","required":true,"schema":{"type":"string"},"description":"The basket identifier."}},"schemas":{"BasketAuthResponse":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"url":{"type":"string"}}}}}}}
```

## Add packages to a dynamic category for a basket.

> Populates a dynamic category with custom packages for the given basket. Dynamic categories are created in the creator panel with the type \`dynamic\`, and are typically populated in response to a \`basket.authenticated\` webhook.\
> \
> Once created, the packages can be fetched using the category endpoints with both \`includePackages=1\` and \`basketIdent\` provided.

```json
{"openapi":"3.1.0","info":{"title":"Tebex Headless API","version":"2.0.0"},"tags":[{"name":"Headless","description":"Main API scoped to public token"}],"servers":[{"url":"https://headless.tebex.io/api/accounts/{token}","description":"Main API scoped to public token","variables":{"token":{"default":"","description":"The store's public token"}}}],"paths":{"/baskets/{basketIdent}/dynamic-packages":{"put":{"tags":["Headless"],"operationId":"createDynamicPackage","summary":"Add packages to a dynamic category for a basket.","parameters":[{"$ref":"#/components/parameters/basketIdent"}],"description":"Populates a dynamic category with custom packages for the given basket. Dynamic categories are created in the creator panel with the type `dynamic`, and are typically populated in response to a `basket.authenticated` webhook.\n\nOnce created, the packages can be fetched using the category endpoints with both `includePackages=1` and `basketIdent` provided.","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DynamicPackagesRequest"}}}},"responses":{"200":{"description":"Successful response confirms the dynamic packages were created.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DynamicPackagesResponse"}}}},"422":{"description":"The provided request is invalid. The error response will include detail as to which parameter failed validation."}}}}},"components":{"parameters":{"basketIdent":{"name":"basketIdent","in":"path","required":true,"schema":{"type":"string"},"description":"The basket identifier."}},"schemas":{"DynamicPackagesRequest":{"type":"object","required":["username","category_id","packages"],"properties":{"username":{"type":"string","description":"The username of the authenticated customer the packages are being created for."},"category_id":{"type":"integer","description":"The ID of the dynamic category to populate."},"packages":{"type":"array","items":{"$ref":"#/components/schemas/DynamicPackageInput"}}}},"DynamicPackageInput":{"type":"object","description":"A custom package to add to a dynamic category.","required":["name","price","slug"],"properties":{"name":{"type":"string"},"price":{"type":"number","format":"float"},"slug":{"type":"string"},"description":{"type":"string"},"image_url":{"type":"string"},"custom":{"type":"object","description":"Arbitrary custom key/value data to associate with the package.","additionalProperties":{"type":"string"}}}},"DynamicPackagesResponse":{"type":"object","properties":{"message":{"type":"string"}}}}}}
```

## Get all categories

> Gets all categories from a webstore. This does not include package information. To include package information, add \`?includePackages=1\` to the URL.

```json
{"openapi":"3.1.0","info":{"title":"Tebex Headless API","version":"2.0.0"},"tags":[{"name":"Headless","description":"Main API scoped to public token"}],"servers":[{"url":"https://headless.tebex.io/api/accounts/{token}","description":"Main API scoped to public token","variables":{"token":{"default":"","description":"The store's public token"}}}],"paths":{"/categories":{"get":{"tags":["Headless"],"operationId":"getCategories","summary":"Get all categories","description":"Gets all categories from a webstore. This does not include package information. To include package information, add `?includePackages=1` to the URL.","responses":{"200":{"description":"Successful response returns a list of category information.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CategoryResponse"}}}}}}}},"components":{"schemas":{"CategoryResponse":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Category"}}}},"Category":{"type":"object","properties":{"id":{"type":"integer"},"name":{"type":"string","description":"User-friendly name of the category"},"slug":{"type":"string","description":"Short identifier slug for the category","nullable":true},"parent":{"type":"object","description":"Parent category, if applicable","format":"Category","nullable":true},"tiered":{"type":"boolean","description":"True if this is a tiered category"},"active_tier":{"description":"If this is a tiered category and the usernameId is provided, this will be the active tier information for this category.","nullable":true,"$ref":"#/components/schemas/Tier"},"description":{"type":"string","description":"HTML description of the category"},"packages":{"type":"array","description":"Packages within the category. For dynamic categories, packages use the `DynamicPackage` shape and are only populated when a `basketIdent` is provided.","items":{"$ref":"#/components/schemas/Package"},"nullable":true},"order":{"type":"integer","description":"The numeric order in which to display the category."},"display_type":{"type":"string","enum":["list","grid"],"description":"How the category should be displayed"},"image_url":{"type":"string","format":"uri","nullable":true,"description":"URL of the category image, if set."},"dynamic":{"type":"boolean","description":"True if this is a dynamic category. Dynamic categories are populated with custom packages per-basket using the Add Dynamic Packages endpoint, and their packages can only be fetched by providing a `basketIdent`."}}},"Tier":{"type":"object","properties":{"id":{"type":"integer"},"created_at":{"type":"string","format":"date-time","description":"The date and time when the tier became active"},"username_id":{"type":"string","description":"The user's username ID. For Steam, this is a numeric representation of their Steam64ID"},"package":{"$ref":"#/components/schemas/Package"},"active":{"type":"boolean","description":"True if the tier is currently active."},"recurring_payment_reference":{"type":"string","description":"The ID of the recurring payment this tier is attached to."},"next_payment_date":{"type":"string","format":"date-time","description":"The date and time of the next payment for this tier."},"status":{"type":"object","properties":{"id":{"type":"integer"},"description":{"type":"string"}}},"pending_downgrade_package":{"type":"object","properties":{"id":{"type":"integer"},"name":{"type":"string"}},"description":"The package this tier is downgrading to if a downgrade is pending.","nullable":true}}},"Package":{"type":"object","properties":{"id":{"type":"integer"},"name":{"type":"string"},"description":{"type":"string"},"image":{"type":"string","nullable":true},"type":{"type":"string"},"category":{"type":"object","properties":{"id":{"type":"integer"},"name":{"type":"string"}}},"base_price":{"type":"number","format":"float"},"sales_tax":{"type":"number","format":"float"},"total_price":{"type":"number","format":"float"},"currency":{"type":"string"},"prorate_price":{"type":"number","format":"float","description":"If this package is part of a tiered category, this is the difference on upgrade pricing from the current active tier.","nullable":true},"discount":{"type":"number","format":"float"},"disable_quantity":{"type":"boolean"},"disable_gifting":{"type":"boolean"},"expiration_date":{"type":"string","nullable":true,"format":"date-time"},"media":{"type":"array","items":{"$ref":"#/components/schemas/PackageMedia"}},"order":{"type":"integer"},"slug":{"type":"string"},"user_limit":{"type":"integer"},"creator_meta_data":{"type":"object"},"options":{"type":"array"},"variables":{"type":"array"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}}},"PackageMedia":{"properties":{"type":{"type":"string","enum":["video","image"]},"name":{"type":"string","description":"A file name for the media, if applicable.","nullable":true},"url":{"type":"string","description":"The URL of the package media."},"featured":{"type":"boolean","description":"True if this media should be featured more prominently than others."},"primary":{"type":"boolean","description":"True if this is the primary media for the package."}}}}}}
```

## Gets all categories and packages

> Gets all categories from a webstore including packages.

```json
{"openapi":"3.1.0","info":{"title":"Tebex Headless API","version":"2.0.0"},"tags":[{"name":"Headless","description":"Main API scoped to public token"}],"servers":[{"url":"https://headless.tebex.io/api/accounts/{token}","description":"Main API scoped to public token","variables":{"token":{"default":"","description":"The store's public token"}}}],"paths":{"/categories?includePackages=1":{"get":{"tags":["Headless"],"operationId":"getCategoriesIncludePackages","summary":"Gets all categories and packages","description":"Gets all categories from a webstore including packages.","responses":{"200":{"description":"Successful response returns a list of category information.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CategoryResponse"}}}}}}}},"components":{"schemas":{"CategoryResponse":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Category"}}}},"Category":{"type":"object","properties":{"id":{"type":"integer"},"name":{"type":"string","description":"User-friendly name of the category"},"slug":{"type":"string","description":"Short identifier slug for the category","nullable":true},"parent":{"type":"object","description":"Parent category, if applicable","format":"Category","nullable":true},"tiered":{"type":"boolean","description":"True if this is a tiered category"},"active_tier":{"description":"If this is a tiered category and the usernameId is provided, this will be the active tier information for this category.","nullable":true,"$ref":"#/components/schemas/Tier"},"description":{"type":"string","description":"HTML description of the category"},"packages":{"type":"array","description":"Packages within the category. For dynamic categories, packages use the `DynamicPackage` shape and are only populated when a `basketIdent` is provided.","items":{"$ref":"#/components/schemas/Package"},"nullable":true},"order":{"type":"integer","description":"The numeric order in which to display the category."},"display_type":{"type":"string","enum":["list","grid"],"description":"How the category should be displayed"},"image_url":{"type":"string","format":"uri","nullable":true,"description":"URL of the category image, if set."},"dynamic":{"type":"boolean","description":"True if this is a dynamic category. Dynamic categories are populated with custom packages per-basket using the Add Dynamic Packages endpoint, and their packages can only be fetched by providing a `basketIdent`."}}},"Tier":{"type":"object","properties":{"id":{"type":"integer"},"created_at":{"type":"string","format":"date-time","description":"The date and time when the tier became active"},"username_id":{"type":"string","description":"The user's username ID. For Steam, this is a numeric representation of their Steam64ID"},"package":{"$ref":"#/components/schemas/Package"},"active":{"type":"boolean","description":"True if the tier is currently active."},"recurring_payment_reference":{"type":"string","description":"The ID of the recurring payment this tier is attached to."},"next_payment_date":{"type":"string","format":"date-time","description":"The date and time of the next payment for this tier."},"status":{"type":"object","properties":{"id":{"type":"integer"},"description":{"type":"string"}}},"pending_downgrade_package":{"type":"object","properties":{"id":{"type":"integer"},"name":{"type":"string"}},"description":"The package this tier is downgrading to if a downgrade is pending.","nullable":true}}},"Package":{"type":"object","properties":{"id":{"type":"integer"},"name":{"type":"string"},"description":{"type":"string"},"image":{"type":"string","nullable":true},"type":{"type":"string"},"category":{"type":"object","properties":{"id":{"type":"integer"},"name":{"type":"string"}}},"base_price":{"type":"number","format":"float"},"sales_tax":{"type":"number","format":"float"},"total_price":{"type":"number","format":"float"},"currency":{"type":"string"},"prorate_price":{"type":"number","format":"float","description":"If this package is part of a tiered category, this is the difference on upgrade pricing from the current active tier.","nullable":true},"discount":{"type":"number","format":"float"},"disable_quantity":{"type":"boolean"},"disable_gifting":{"type":"boolean"},"expiration_date":{"type":"string","nullable":true,"format":"date-time"},"media":{"type":"array","items":{"$ref":"#/components/schemas/PackageMedia"}},"order":{"type":"integer"},"slug":{"type":"string"},"user_limit":{"type":"integer"},"creator_meta_data":{"type":"object"},"options":{"type":"array"},"variables":{"type":"array"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}}},"PackageMedia":{"properties":{"type":{"type":"string","enum":["video","image"]},"name":{"type":"string","description":"A file name for the media, if applicable.","nullable":true},"url":{"type":"string","description":"The URL of the package media."},"featured":{"type":"boolean","description":"True if this media should be featured more prominently than others."},"primary":{"type":"boolean","description":"True if this is the primary media for the package."}}}}}}
```

## Get user's tiered categories

> Gets all categories from the webstore, returning active tier information for the given player.

```json
{"openapi":"3.1.0","info":{"title":"Tebex Headless API","version":"2.0.0"},"tags":[{"name":"Headless","description":"Main API scoped to public token"}],"servers":[{"url":"https://headless.tebex.io/api/accounts/{token}","description":"Main API scoped to public token","variables":{"token":{"default":"","description":"The store's public token"}}}],"security":[{"basicAuth":[]}],"components":{"securitySchemes":{"basicAuth":{"type":"http","scheme":"basic"}},"schemas":{"CategoryResponse":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Category"}}}},"Category":{"type":"object","properties":{"id":{"type":"integer"},"name":{"type":"string","description":"User-friendly name of the category"},"slug":{"type":"string","description":"Short identifier slug for the category","nullable":true},"parent":{"type":"object","description":"Parent category, if applicable","format":"Category","nullable":true},"tiered":{"type":"boolean","description":"True if this is a tiered category"},"active_tier":{"description":"If this is a tiered category and the usernameId is provided, this will be the active tier information for this category.","nullable":true,"$ref":"#/components/schemas/Tier"},"description":{"type":"string","description":"HTML description of the category"},"packages":{"type":"array","description":"Packages within the category. For dynamic categories, packages use the `DynamicPackage` shape and are only populated when a `basketIdent` is provided.","items":{"$ref":"#/components/schemas/Package"},"nullable":true},"order":{"type":"integer","description":"The numeric order in which to display the category."},"display_type":{"type":"string","enum":["list","grid"],"description":"How the category should be displayed"},"image_url":{"type":"string","format":"uri","nullable":true,"description":"URL of the category image, if set."},"dynamic":{"type":"boolean","description":"True if this is a dynamic category. Dynamic categories are populated with custom packages per-basket using the Add Dynamic Packages endpoint, and their packages can only be fetched by providing a `basketIdent`."}}},"Tier":{"type":"object","properties":{"id":{"type":"integer"},"created_at":{"type":"string","format":"date-time","description":"The date and time when the tier became active"},"username_id":{"type":"string","description":"The user's username ID. For Steam, this is a numeric representation of their Steam64ID"},"package":{"$ref":"#/components/schemas/Package"},"active":{"type":"boolean","description":"True if the tier is currently active."},"recurring_payment_reference":{"type":"string","description":"The ID of the recurring payment this tier is attached to."},"next_payment_date":{"type":"string","format":"date-time","description":"The date and time of the next payment for this tier."},"status":{"type":"object","properties":{"id":{"type":"integer"},"description":{"type":"string"}}},"pending_downgrade_package":{"type":"object","properties":{"id":{"type":"integer"},"name":{"type":"string"}},"description":"The package this tier is downgrading to if a downgrade is pending.","nullable":true}}},"Package":{"type":"object","properties":{"id":{"type":"integer"},"name":{"type":"string"},"description":{"type":"string"},"image":{"type":"string","nullable":true},"type":{"type":"string"},"category":{"type":"object","properties":{"id":{"type":"integer"},"name":{"type":"string"}}},"base_price":{"type":"number","format":"float"},"sales_tax":{"type":"number","format":"float"},"total_price":{"type":"number","format":"float"},"currency":{"type":"string"},"prorate_price":{"type":"number","format":"float","description":"If this package is part of a tiered category, this is the difference on upgrade pricing from the current active tier.","nullable":true},"discount":{"type":"number","format":"float"},"disable_quantity":{"type":"boolean"},"disable_gifting":{"type":"boolean"},"expiration_date":{"type":"string","nullable":true,"format":"date-time"},"media":{"type":"array","items":{"$ref":"#/components/schemas/PackageMedia"}},"order":{"type":"integer"},"slug":{"type":"string"},"user_limit":{"type":"integer"},"creator_meta_data":{"type":"object"},"options":{"type":"array"},"variables":{"type":"array"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}}},"PackageMedia":{"properties":{"type":{"type":"string","enum":["video","image"]},"name":{"type":"string","description":"A file name for the media, if applicable.","nullable":true},"url":{"type":"string","description":"The URL of the package media."},"featured":{"type":"boolean","description":"True if this media should be featured more prominently than others."},"primary":{"type":"boolean","description":"True if this is the primary media for the package."}}}}},"paths":{"/categories?usernameId={usernameId}&includePackages=1":{"get":{"tags":["Headless"],"operationId":"getUserTieredCategories","summary":"Get user's tiered categories","parameters":[{"in":"path","name":"usernameId","schema":{"type":"integer"},"required":true}],"description":"Gets all categories from the webstore, returning active tier information for the given player.","responses":{"200":{"description":"Successful response returns a list of category information.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CategoryResponse"}}}}}}}}}
```

## Get Dynamic Categories

> Gets all categories from a webstore including packages. When \`basketIdent\` is provided, dynamic categories are populated with the packages associated with that basket.\
> \
> If a basket identifier is not provided, dynamic categories will be empty as the basket is required to relate packages to the category.

```json
{"openapi":"3.1.0","info":{"title":"Tebex Headless API","version":"2.0.0"},"tags":[{"name":"Headless","description":"Main API scoped to public token"}],"servers":[{"url":"https://headless.tebex.io/api/accounts/{token}","description":"Main API scoped to public token","variables":{"token":{"default":"","description":"The store's public token"}}}],"paths":{"/categories?includePackages=1&basketIdent={basketIdent}":{"get":{"tags":["Headless"],"operationId":"getDynamicCategories","summary":"Get Dynamic Categories","parameters":[{"$ref":"#/components/parameters/basketIdent"}],"description":"Gets all categories from a webstore including packages. When `basketIdent` is provided, dynamic categories are populated with the packages associated with that basket.\n\nIf a basket identifier is not provided, dynamic categories will be empty as the basket is required to relate packages to the category.","responses":{"200":{"description":"Successful response returns a list of category information.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CategoryResponse"}}}}}}}},"components":{"parameters":{"basketIdent":{"name":"basketIdent","in":"path","required":true,"schema":{"type":"string"},"description":"The basket identifier."}},"schemas":{"CategoryResponse":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Category"}}}},"Category":{"type":"object","properties":{"id":{"type":"integer"},"name":{"type":"string","description":"User-friendly name of the category"},"slug":{"type":"string","description":"Short identifier slug for the category","nullable":true},"parent":{"type":"object","description":"Parent category, if applicable","format":"Category","nullable":true},"tiered":{"type":"boolean","description":"True if this is a tiered category"},"active_tier":{"description":"If this is a tiered category and the usernameId is provided, this will be the active tier information for this category.","nullable":true,"$ref":"#/components/schemas/Tier"},"description":{"type":"string","description":"HTML description of the category"},"packages":{"type":"array","description":"Packages within the category. For dynamic categories, packages use the `DynamicPackage` shape and are only populated when a `basketIdent` is provided.","items":{"$ref":"#/components/schemas/Package"},"nullable":true},"order":{"type":"integer","description":"The numeric order in which to display the category."},"display_type":{"type":"string","enum":["list","grid"],"description":"How the category should be displayed"},"image_url":{"type":"string","format":"uri","nullable":true,"description":"URL of the category image, if set."},"dynamic":{"type":"boolean","description":"True if this is a dynamic category. Dynamic categories are populated with custom packages per-basket using the Add Dynamic Packages endpoint, and their packages can only be fetched by providing a `basketIdent`."}}},"Tier":{"type":"object","properties":{"id":{"type":"integer"},"created_at":{"type":"string","format":"date-time","description":"The date and time when the tier became active"},"username_id":{"type":"string","description":"The user's username ID. For Steam, this is a numeric representation of their Steam64ID"},"package":{"$ref":"#/components/schemas/Package"},"active":{"type":"boolean","description":"True if the tier is currently active."},"recurring_payment_reference":{"type":"string","description":"The ID of the recurring payment this tier is attached to."},"next_payment_date":{"type":"string","format":"date-time","description":"The date and time of the next payment for this tier."},"status":{"type":"object","properties":{"id":{"type":"integer"},"description":{"type":"string"}}},"pending_downgrade_package":{"type":"object","properties":{"id":{"type":"integer"},"name":{"type":"string"}},"description":"The package this tier is downgrading to if a downgrade is pending.","nullable":true}}},"Package":{"type":"object","properties":{"id":{"type":"integer"},"name":{"type":"string"},"description":{"type":"string"},"image":{"type":"string","nullable":true},"type":{"type":"string"},"category":{"type":"object","properties":{"id":{"type":"integer"},"name":{"type":"string"}}},"base_price":{"type":"number","format":"float"},"sales_tax":{"type":"number","format":"float"},"total_price":{"type":"number","format":"float"},"currency":{"type":"string"},"prorate_price":{"type":"number","format":"float","description":"If this package is part of a tiered category, this is the difference on upgrade pricing from the current active tier.","nullable":true},"discount":{"type":"number","format":"float"},"disable_quantity":{"type":"boolean"},"disable_gifting":{"type":"boolean"},"expiration_date":{"type":"string","nullable":true,"format":"date-time"},"media":{"type":"array","items":{"$ref":"#/components/schemas/PackageMedia"}},"order":{"type":"integer"},"slug":{"type":"string"},"user_limit":{"type":"integer"},"creator_meta_data":{"type":"object"},"options":{"type":"array"},"variables":{"type":"array"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}}},"PackageMedia":{"properties":{"type":{"type":"string","enum":["video","image"]},"name":{"type":"string","description":"A file name for the media, if applicable.","nullable":true},"url":{"type":"string","description":"The URL of the package media."},"featured":{"type":"boolean","description":"True if this media should be featured more prominently than others."},"primary":{"type":"boolean","description":"True if this is the primary media for the package."}}}}}}
```

## Get specific category

> Gets information about a category and returns the packages in that category.

```json
{"openapi":"3.1.0","info":{"title":"Tebex Headless API","version":"2.0.0"},"tags":[{"name":"Headless","description":"Main API scoped to public token"}],"servers":[{"url":"https://headless.tebex.io/api/accounts/{token}","description":"Main API scoped to public token","variables":{"token":{"default":"","description":"The store's public token"}}}],"paths":{"/categories/{categoryId}":{"get":{"tags":["Headless"],"operationId":"getCategory","summary":"Get specific category","parameters":[{"$ref":"#/components/parameters/basketIdent"}],"description":"Gets information about a category and returns the packages in that category.","responses":{"200":{"description":"Successful response returns the category without package information.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CategoryResponse"}}}}}}}},"components":{"parameters":{"basketIdent":{"name":"basketIdent","in":"path","required":true,"schema":{"type":"string"},"description":"The basket identifier."}},"schemas":{"CategoryResponse":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Category"}}}},"Category":{"type":"object","properties":{"id":{"type":"integer"},"name":{"type":"string","description":"User-friendly name of the category"},"slug":{"type":"string","description":"Short identifier slug for the category","nullable":true},"parent":{"type":"object","description":"Parent category, if applicable","format":"Category","nullable":true},"tiered":{"type":"boolean","description":"True if this is a tiered category"},"active_tier":{"description":"If this is a tiered category and the usernameId is provided, this will be the active tier information for this category.","nullable":true,"$ref":"#/components/schemas/Tier"},"description":{"type":"string","description":"HTML description of the category"},"packages":{"type":"array","description":"Packages within the category. For dynamic categories, packages use the `DynamicPackage` shape and are only populated when a `basketIdent` is provided.","items":{"$ref":"#/components/schemas/Package"},"nullable":true},"order":{"type":"integer","description":"The numeric order in which to display the category."},"display_type":{"type":"string","enum":["list","grid"],"description":"How the category should be displayed"},"image_url":{"type":"string","format":"uri","nullable":true,"description":"URL of the category image, if set."},"dynamic":{"type":"boolean","description":"True if this is a dynamic category. Dynamic categories are populated with custom packages per-basket using the Add Dynamic Packages endpoint, and their packages can only be fetched by providing a `basketIdent`."}}},"Tier":{"type":"object","properties":{"id":{"type":"integer"},"created_at":{"type":"string","format":"date-time","description":"The date and time when the tier became active"},"username_id":{"type":"string","description":"The user's username ID. For Steam, this is a numeric representation of their Steam64ID"},"package":{"$ref":"#/components/schemas/Package"},"active":{"type":"boolean","description":"True if the tier is currently active."},"recurring_payment_reference":{"type":"string","description":"The ID of the recurring payment this tier is attached to."},"next_payment_date":{"type":"string","format":"date-time","description":"The date and time of the next payment for this tier."},"status":{"type":"object","properties":{"id":{"type":"integer"},"description":{"type":"string"}}},"pending_downgrade_package":{"type":"object","properties":{"id":{"type":"integer"},"name":{"type":"string"}},"description":"The package this tier is downgrading to if a downgrade is pending.","nullable":true}}},"Package":{"type":"object","properties":{"id":{"type":"integer"},"name":{"type":"string"},"description":{"type":"string"},"image":{"type":"string","nullable":true},"type":{"type":"string"},"category":{"type":"object","properties":{"id":{"type":"integer"},"name":{"type":"string"}}},"base_price":{"type":"number","format":"float"},"sales_tax":{"type":"number","format":"float"},"total_price":{"type":"number","format":"float"},"currency":{"type":"string"},"prorate_price":{"type":"number","format":"float","description":"If this package is part of a tiered category, this is the difference on upgrade pricing from the current active tier.","nullable":true},"discount":{"type":"number","format":"float"},"disable_quantity":{"type":"boolean"},"disable_gifting":{"type":"boolean"},"expiration_date":{"type":"string","nullable":true,"format":"date-time"},"media":{"type":"array","items":{"$ref":"#/components/schemas/PackageMedia"}},"order":{"type":"integer"},"slug":{"type":"string"},"user_limit":{"type":"integer"},"creator_meta_data":{"type":"object"},"options":{"type":"array"},"variables":{"type":"array"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}}},"PackageMedia":{"properties":{"type":{"type":"string","enum":["video","image"]},"name":{"type":"string","description":"A file name for the media, if applicable.","nullable":true},"url":{"type":"string","description":"The URL of the package media."},"featured":{"type":"boolean","description":"True if this media should be featured more prominently than others."},"primary":{"type":"boolean","description":"True if this is the primary media for the package."}}}}}}
```

## Get a category with all packages

> Gets information about a category and returns the packages in that category.

```json
{"openapi":"3.1.0","info":{"title":"Tebex Headless API","version":"2.0.0"},"tags":[{"name":"Headless","description":"Main API scoped to public token"}],"servers":[{"url":"https://headless.tebex.io/api/accounts/{token}","description":"Main API scoped to public token","variables":{"token":{"default":"","description":"The store's public token"}}}],"paths":{"/categories/{categoryId}?includePackages=1":{"get":{"tags":["Headless"],"operationId":"getCategoryIncludePackages","summary":"Get a category with all packages","parameters":[{"in":"path","name":"categoryId","required":true,"schema":{"type":"string"},"description":"The ID or slug of the category to fetch."}],"description":"Gets information about a category and returns the packages in that category.","responses":{"200":{"description":"Successful response returns the category with package information.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CategoryResponse"}}}}}}}},"components":{"schemas":{"CategoryResponse":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Category"}}}},"Category":{"type":"object","properties":{"id":{"type":"integer"},"name":{"type":"string","description":"User-friendly name of the category"},"slug":{"type":"string","description":"Short identifier slug for the category","nullable":true},"parent":{"type":"object","description":"Parent category, if applicable","format":"Category","nullable":true},"tiered":{"type":"boolean","description":"True if this is a tiered category"},"active_tier":{"description":"If this is a tiered category and the usernameId is provided, this will be the active tier information for this category.","nullable":true,"$ref":"#/components/schemas/Tier"},"description":{"type":"string","description":"HTML description of the category"},"packages":{"type":"array","description":"Packages within the category. For dynamic categories, packages use the `DynamicPackage` shape and are only populated when a `basketIdent` is provided.","items":{"$ref":"#/components/schemas/Package"},"nullable":true},"order":{"type":"integer","description":"The numeric order in which to display the category."},"display_type":{"type":"string","enum":["list","grid"],"description":"How the category should be displayed"},"image_url":{"type":"string","format":"uri","nullable":true,"description":"URL of the category image, if set."},"dynamic":{"type":"boolean","description":"True if this is a dynamic category. Dynamic categories are populated with custom packages per-basket using the Add Dynamic Packages endpoint, and their packages can only be fetched by providing a `basketIdent`."}}},"Tier":{"type":"object","properties":{"id":{"type":"integer"},"created_at":{"type":"string","format":"date-time","description":"The date and time when the tier became active"},"username_id":{"type":"string","description":"The user's username ID. For Steam, this is a numeric representation of their Steam64ID"},"package":{"$ref":"#/components/schemas/Package"},"active":{"type":"boolean","description":"True if the tier is currently active."},"recurring_payment_reference":{"type":"string","description":"The ID of the recurring payment this tier is attached to."},"next_payment_date":{"type":"string","format":"date-time","description":"The date and time of the next payment for this tier."},"status":{"type":"object","properties":{"id":{"type":"integer"},"description":{"type":"string"}}},"pending_downgrade_package":{"type":"object","properties":{"id":{"type":"integer"},"name":{"type":"string"}},"description":"The package this tier is downgrading to if a downgrade is pending.","nullable":true}}},"Package":{"type":"object","properties":{"id":{"type":"integer"},"name":{"type":"string"},"description":{"type":"string"},"image":{"type":"string","nullable":true},"type":{"type":"string"},"category":{"type":"object","properties":{"id":{"type":"integer"},"name":{"type":"string"}}},"base_price":{"type":"number","format":"float"},"sales_tax":{"type":"number","format":"float"},"total_price":{"type":"number","format":"float"},"currency":{"type":"string"},"prorate_price":{"type":"number","format":"float","description":"If this package is part of a tiered category, this is the difference on upgrade pricing from the current active tier.","nullable":true},"discount":{"type":"number","format":"float"},"disable_quantity":{"type":"boolean"},"disable_gifting":{"type":"boolean"},"expiration_date":{"type":"string","nullable":true,"format":"date-time"},"media":{"type":"array","items":{"$ref":"#/components/schemas/PackageMedia"}},"order":{"type":"integer"},"slug":{"type":"string"},"user_limit":{"type":"integer"},"creator_meta_data":{"type":"object"},"options":{"type":"array"},"variables":{"type":"array"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}}},"PackageMedia":{"properties":{"type":{"type":"string","enum":["video","image"]},"name":{"type":"string","description":"A file name for the media, if applicable.","nullable":true},"url":{"type":"string","description":"The URL of the package media."},"featured":{"type":"boolean","description":"True if this media should be featured more prominently than others."},"primary":{"type":"boolean","description":"True if this is the primary media for the package."}}}}}}
```

## Gets a specific category including packages, populating a dynamic category for the given basket.

> Gets information about a category and returns the packages in that category. When the category is dynamic and \`basketIdent\` is provided, the category is populated with the packages associated with that basket.\
> \
> If a basket identifier is not provided, a dynamic category will be empty as the basket is required to relate packages to the category.

```json
{"openapi":"3.1.0","info":{"title":"Tebex Headless API","version":"2.0.0"},"tags":[{"name":"Headless","description":"Main API scoped to public token"}],"servers":[{"url":"https://headless.tebex.io/api/accounts/{token}","description":"Main API scoped to public token","variables":{"token":{"default":"","description":"The store's public token"}}}],"paths":{"/categories/{categoryId}?includePackages=1&basketIdent={basketIdent}":{"get":{"tags":["Headless"],"operationId":"getCategoryIncludeDynamicPackages","summary":"Gets a specific category including packages, populating a dynamic category for the given basket.","parameters":[{"in":"path","name":"categoryId","required":true,"schema":{"type":"string"},"description":"The ID or slug of the category to fetch."},{"$ref":"#/components/parameters/basketIdent"}],"description":"Gets information about a category and returns the packages in that category. When the category is dynamic and `basketIdent` is provided, the category is populated with the packages associated with that basket.\n\nIf a basket identifier is not provided, a dynamic category will be empty as the basket is required to relate packages to the category.","responses":{"200":{"description":"Successful response returns the category with package information.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CategoryResponse"}}}}}}}},"components":{"parameters":{"basketIdent":{"name":"basketIdent","in":"path","required":true,"schema":{"type":"string"},"description":"The basket identifier."}},"schemas":{"CategoryResponse":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Category"}}}},"Category":{"type":"object","properties":{"id":{"type":"integer"},"name":{"type":"string","description":"User-friendly name of the category"},"slug":{"type":"string","description":"Short identifier slug for the category","nullable":true},"parent":{"type":"object","description":"Parent category, if applicable","format":"Category","nullable":true},"tiered":{"type":"boolean","description":"True if this is a tiered category"},"active_tier":{"description":"If this is a tiered category and the usernameId is provided, this will be the active tier information for this category.","nullable":true,"$ref":"#/components/schemas/Tier"},"description":{"type":"string","description":"HTML description of the category"},"packages":{"type":"array","description":"Packages within the category. For dynamic categories, packages use the `DynamicPackage` shape and are only populated when a `basketIdent` is provided.","items":{"$ref":"#/components/schemas/Package"},"nullable":true},"order":{"type":"integer","description":"The numeric order in which to display the category."},"display_type":{"type":"string","enum":["list","grid"],"description":"How the category should be displayed"},"image_url":{"type":"string","format":"uri","nullable":true,"description":"URL of the category image, if set."},"dynamic":{"type":"boolean","description":"True if this is a dynamic category. Dynamic categories are populated with custom packages per-basket using the Add Dynamic Packages endpoint, and their packages can only be fetched by providing a `basketIdent`."}}},"Tier":{"type":"object","properties":{"id":{"type":"integer"},"created_at":{"type":"string","format":"date-time","description":"The date and time when the tier became active"},"username_id":{"type":"string","description":"The user's username ID. For Steam, this is a numeric representation of their Steam64ID"},"package":{"$ref":"#/components/schemas/Package"},"active":{"type":"boolean","description":"True if the tier is currently active."},"recurring_payment_reference":{"type":"string","description":"The ID of the recurring payment this tier is attached to."},"next_payment_date":{"type":"string","format":"date-time","description":"The date and time of the next payment for this tier."},"status":{"type":"object","properties":{"id":{"type":"integer"},"description":{"type":"string"}}},"pending_downgrade_package":{"type":"object","properties":{"id":{"type":"integer"},"name":{"type":"string"}},"description":"The package this tier is downgrading to if a downgrade is pending.","nullable":true}}},"Package":{"type":"object","properties":{"id":{"type":"integer"},"name":{"type":"string"},"description":{"type":"string"},"image":{"type":"string","nullable":true},"type":{"type":"string"},"category":{"type":"object","properties":{"id":{"type":"integer"},"name":{"type":"string"}}},"base_price":{"type":"number","format":"float"},"sales_tax":{"type":"number","format":"float"},"total_price":{"type":"number","format":"float"},"currency":{"type":"string"},"prorate_price":{"type":"number","format":"float","description":"If this package is part of a tiered category, this is the difference on upgrade pricing from the current active tier.","nullable":true},"discount":{"type":"number","format":"float"},"disable_quantity":{"type":"boolean"},"disable_gifting":{"type":"boolean"},"expiration_date":{"type":"string","nullable":true,"format":"date-time"},"media":{"type":"array","items":{"$ref":"#/components/schemas/PackageMedia"}},"order":{"type":"integer"},"slug":{"type":"string"},"user_limit":{"type":"integer"},"creator_meta_data":{"type":"object"},"options":{"type":"array"},"variables":{"type":"array"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}}},"PackageMedia":{"properties":{"type":{"type":"string","enum":["video","image"]},"name":{"type":"string","description":"A file name for the media, if applicable.","nullable":true},"url":{"type":"string","description":"The URL of the package media."},"featured":{"type":"boolean","description":"True if this media should be featured more prominently than others."},"primary":{"type":"boolean","description":"True if this is the primary media for the package."}}}}}}
```

## Get package

> Gets a package from a webstore by its ID or slug.\
> \
> Note: this endpoint does not support packages belonging to dynamic categories. Use the category endpoints with \`includePackages=1\` and \`basketIdent\` to fetch dynamic packages.

```json
{"openapi":"3.1.0","info":{"title":"Tebex Headless API","version":"2.0.0"},"tags":[{"name":"Headless","description":"Main API scoped to public token"}],"servers":[{"url":"https://headless.tebex.io/api/accounts/{token}","description":"Main API scoped to public token","variables":{"token":{"default":"","description":"The store's public token"}}}],"paths":{"/packages/{packageId}":{"get":{"tags":["Headless"],"operationId":"getPackage","summary":"Get package","parameters":[{"in":"path","name":"packageId","schema":{"type":"string"},"required":true,"description":"The package's ID or slug."}],"description":"Gets a package from a webstore by its ID or slug.\n\nNote: this endpoint does not support packages belonging to dynamic categories. Use the category endpoints with `includePackages=1` and `basketIdent` to fetch dynamic packages.","responses":{"200":{"description":"Successful response returns the package information.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PackageResponse"}}}}}}}},"components":{"schemas":{"PackageResponse":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Package"}}}},"Package":{"type":"object","properties":{"id":{"type":"integer"},"name":{"type":"string"},"description":{"type":"string"},"image":{"type":"string","nullable":true},"type":{"type":"string"},"category":{"type":"object","properties":{"id":{"type":"integer"},"name":{"type":"string"}}},"base_price":{"type":"number","format":"float"},"sales_tax":{"type":"number","format":"float"},"total_price":{"type":"number","format":"float"},"currency":{"type":"string"},"prorate_price":{"type":"number","format":"float","description":"If this package is part of a tiered category, this is the difference on upgrade pricing from the current active tier.","nullable":true},"discount":{"type":"number","format":"float"},"disable_quantity":{"type":"boolean"},"disable_gifting":{"type":"boolean"},"expiration_date":{"type":"string","nullable":true,"format":"date-time"},"media":{"type":"array","items":{"$ref":"#/components/schemas/PackageMedia"}},"order":{"type":"integer"},"slug":{"type":"string"},"user_limit":{"type":"integer"},"creator_meta_data":{"type":"object"},"options":{"type":"array"},"variables":{"type":"array"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}}},"PackageMedia":{"properties":{"type":{"type":"string","enum":["video","image"]},"name":{"type":"string","description":"A file name for the media, if applicable.","nullable":true},"url":{"type":"string","description":"The URL of the package media."},"featured":{"type":"boolean","description":"True if this media should be featured more prominently than others."},"primary":{"type":"boolean","description":"True if this is the primary media for the package."}}}}}}
```

## Get all packages

> Gets all packages from a webstore.\
> \
> Note: this endpoint does not support packages belonging to dynamic categories. Use the category endpoints with \`includePackages=1\` and \`basketIdent\` to fetch dynamic packages.

```json
{"openapi":"3.1.0","info":{"title":"Tebex Headless API","version":"2.0.0"},"tags":[{"name":"Headless","description":"Main API scoped to public token"}],"servers":[{"url":"https://headless.tebex.io/api/accounts/{token}","description":"Main API scoped to public token","variables":{"token":{"default":"","description":"The store's public token"}}}],"paths":{"/packages":{"get":{"tags":["Headless"],"operationId":"getAllPackages","summary":"Get all packages","description":"Gets all packages from a webstore.\n\nNote: this endpoint does not support packages belonging to dynamic categories. Use the category endpoints with `includePackages=1` and `basketIdent` to fetch dynamic packages.","responses":{"200":{"description":"Successful response returns a list of package information.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PackageResponse"}}}}}}}},"components":{"schemas":{"PackageResponse":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Package"}}}},"Package":{"type":"object","properties":{"id":{"type":"integer"},"name":{"type":"string"},"description":{"type":"string"},"image":{"type":"string","nullable":true},"type":{"type":"string"},"category":{"type":"object","properties":{"id":{"type":"integer"},"name":{"type":"string"}}},"base_price":{"type":"number","format":"float"},"sales_tax":{"type":"number","format":"float"},"total_price":{"type":"number","format":"float"},"currency":{"type":"string"},"prorate_price":{"type":"number","format":"float","description":"If this package is part of a tiered category, this is the difference on upgrade pricing from the current active tier.","nullable":true},"discount":{"type":"number","format":"float"},"disable_quantity":{"type":"boolean"},"disable_gifting":{"type":"boolean"},"expiration_date":{"type":"string","nullable":true,"format":"date-time"},"media":{"type":"array","items":{"$ref":"#/components/schemas/PackageMedia"}},"order":{"type":"integer"},"slug":{"type":"string"},"user_limit":{"type":"integer"},"creator_meta_data":{"type":"object"},"options":{"type":"array"},"variables":{"type":"array"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}}},"PackageMedia":{"properties":{"type":{"type":"string","enum":["video","image"]},"name":{"type":"string","description":"A file name for the media, if applicable.","nullable":true},"url":{"type":"string","description":"The URL of the package media."},"featured":{"type":"boolean","description":"True if this media should be featured more prominently than others."},"primary":{"type":"boolean","description":"True if this is the primary media for the package."}}}}}}
```

## Get packages

> Gets all packages from a webstore.

```json
{"openapi":"3.1.0","info":{"title":"Tebex Headless API","version":"2.0.0"},"tags":[{"name":"Headless","description":"Main API scoped to public token"}],"servers":[{"url":"https://headless.tebex.io/api/accounts/{token}","description":"Main API scoped to public token","variables":{"token":{"default":"","description":"The store's public token"}}}],"paths":{"/packages?ipAddress={ipAddress}":{"get":{"tags":["Headless"],"operationId":"getAllPackagesWithAuthedIP","summary":"Get packages","parameters":[{"in":"path","name":"ipAddress","required":true,"schema":{"type":"string"},"description":"An IP address can be provided with authenticated requests"}],"description":"Gets all packages from a webstore.","responses":{"200":{"description":"Successful response returns a list of package information.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PackageResponse"}}}},"422":{"description":"The provided request is invalid."}}}}},"components":{"schemas":{"PackageResponse":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Package"}}}},"Package":{"type":"object","properties":{"id":{"type":"integer"},"name":{"type":"string"},"description":{"type":"string"},"image":{"type":"string","nullable":true},"type":{"type":"string"},"category":{"type":"object","properties":{"id":{"type":"integer"},"name":{"type":"string"}}},"base_price":{"type":"number","format":"float"},"sales_tax":{"type":"number","format":"float"},"total_price":{"type":"number","format":"float"},"currency":{"type":"string"},"prorate_price":{"type":"number","format":"float","description":"If this package is part of a tiered category, this is the difference on upgrade pricing from the current active tier.","nullable":true},"discount":{"type":"number","format":"float"},"disable_quantity":{"type":"boolean"},"disable_gifting":{"type":"boolean"},"expiration_date":{"type":"string","nullable":true,"format":"date-time"},"media":{"type":"array","items":{"$ref":"#/components/schemas/PackageMedia"}},"order":{"type":"integer"},"slug":{"type":"string"},"user_limit":{"type":"integer"},"creator_meta_data":{"type":"object"},"options":{"type":"array"},"variables":{"type":"array"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}}},"PackageMedia":{"properties":{"type":{"type":"string","enum":["video","image"]},"name":{"type":"string","description":"A file name for the media, if applicable.","nullable":true},"url":{"type":"string","description":"The URL of the package media."},"featured":{"type":"boolean","description":"True if this media should be featured more prominently than others."},"primary":{"type":"boolean","description":"True if this is the primary media for the package."}}}}}}
```

## Get packages available for basket

> Gets all packages available to the provided basket.

```json
{"openapi":"3.1.0","info":{"title":"Tebex Headless API","version":"2.0.0"},"tags":[{"name":"Headless","description":"Main API scoped to public token"}],"servers":[{"url":"https://headless.tebex.io/api/accounts/{token}","description":"Main API scoped to public token","variables":{"token":{"default":"","description":"The store's public token"}}}],"paths":{"/packages?basketIdent={basketIdent}":{"get":{"tags":["Headless"],"operationId":"getPackagesForBasket","summary":"Get packages available for basket","parameters":[{"$ref":"#/components/parameters/basketIdent"}],"description":"Gets all packages available to the provided basket.","responses":{"200":{"description":"Successful response returns a list of package information.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PackageResponse"}}}},"422":{"description":"The provided request is invalid."}}}}},"components":{"parameters":{"basketIdent":{"name":"basketIdent","in":"path","required":true,"schema":{"type":"string"},"description":"The basket identifier."}},"schemas":{"PackageResponse":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Package"}}}},"Package":{"type":"object","properties":{"id":{"type":"integer"},"name":{"type":"string"},"description":{"type":"string"},"image":{"type":"string","nullable":true},"type":{"type":"string"},"category":{"type":"object","properties":{"id":{"type":"integer"},"name":{"type":"string"}}},"base_price":{"type":"number","format":"float"},"sales_tax":{"type":"number","format":"float"},"total_price":{"type":"number","format":"float"},"currency":{"type":"string"},"prorate_price":{"type":"number","format":"float","description":"If this package is part of a tiered category, this is the difference on upgrade pricing from the current active tier.","nullable":true},"discount":{"type":"number","format":"float"},"disable_quantity":{"type":"boolean"},"disable_gifting":{"type":"boolean"},"expiration_date":{"type":"string","nullable":true,"format":"date-time"},"media":{"type":"array","items":{"$ref":"#/components/schemas/PackageMedia"}},"order":{"type":"integer"},"slug":{"type":"string"},"user_limit":{"type":"integer"},"creator_meta_data":{"type":"object"},"options":{"type":"array"},"variables":{"type":"array"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}}},"PackageMedia":{"properties":{"type":{"type":"string","enum":["video","image"]},"name":{"type":"string","description":"A file name for the media, if applicable.","nullable":true},"url":{"type":"string","description":"The URL of the package media."},"featured":{"type":"boolean","description":"True if this media should be featured more prominently than others."},"primary":{"type":"boolean","description":"True if this is the primary media for the package."}}}}}}
```

## Get packages available for IP and basket

> Gets all packages from a webstore.

```json
{"openapi":"3.1.0","info":{"title":"Tebex Headless API","version":"2.0.0"},"tags":[{"name":"Headless","description":"Main API scoped to public token"}],"servers":[{"url":"https://headless.tebex.io/api/accounts/{token}","description":"Main API scoped to public token","variables":{"token":{"default":"","description":"The store's public token"}}}],"paths":{"/packages?ipAddress={ipAddress}&basketIdent={basketIdent}":{"get":{"tags":["Headless"],"operationId":"getAllPackagesWithAuthedIPAndBasket","summary":"Get packages available for IP and basket","parameters":[{"$ref":"#/components/parameters/basketIdent"},{"in":"path","name":"ipAddress","required":true,"schema":{"type":"string"},"description":"An IP address can be provided with authenticated requests."}],"description":"Gets all packages from a webstore.","responses":{"200":{"description":"Successful response returns a list of package information.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PackageResponse"}}}},"422":{"description":"The provided request is invalid."}}}}},"components":{"parameters":{"basketIdent":{"name":"basketIdent","in":"path","required":true,"schema":{"type":"string"},"description":"The basket identifier."}},"schemas":{"PackageResponse":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Package"}}}},"Package":{"type":"object","properties":{"id":{"type":"integer"},"name":{"type":"string"},"description":{"type":"string"},"image":{"type":"string","nullable":true},"type":{"type":"string"},"category":{"type":"object","properties":{"id":{"type":"integer"},"name":{"type":"string"}}},"base_price":{"type":"number","format":"float"},"sales_tax":{"type":"number","format":"float"},"total_price":{"type":"number","format":"float"},"currency":{"type":"string"},"prorate_price":{"type":"number","format":"float","description":"If this package is part of a tiered category, this is the difference on upgrade pricing from the current active tier.","nullable":true},"discount":{"type":"number","format":"float"},"disable_quantity":{"type":"boolean"},"disable_gifting":{"type":"boolean"},"expiration_date":{"type":"string","nullable":true,"format":"date-time"},"media":{"type":"array","items":{"$ref":"#/components/schemas/PackageMedia"}},"order":{"type":"integer"},"slug":{"type":"string"},"user_limit":{"type":"integer"},"creator_meta_data":{"type":"object"},"options":{"type":"array"},"variables":{"type":"array"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}}},"PackageMedia":{"properties":{"type":{"type":"string","enum":["video","image"]},"name":{"type":"string","description":"A file name for the media, if applicable.","nullable":true},"url":{"type":"string","description":"The URL of the package media."},"featured":{"type":"boolean","description":"True if this media should be featured more prominently than others."},"primary":{"type":"boolean","description":"True if this is the primary media for the package."}}}}}}
```

## Apply a creator code

> Applies a creator code to a basket.

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

## Remove a creator code from the basket.

> Applies a creator code to a basket.

```json
{"openapi":"3.1.0","info":{"title":"Tebex Headless API","version":"2.0.0"},"tags":[{"name":"Headless","description":"Main API scoped to public token"}],"servers":[{"url":"https://headless.tebex.io/api/accounts/{token}","description":"Main API scoped to public token","variables":{"token":{"default":"","description":"The store's public token"}}}],"paths":{"/baskets/{basketIdent}/creator-codes/remove":{"post":{"tags":["Headless"],"operationId":"removeCreatorCode","summary":"Remove a creator code from the basket.","parameters":[{"$ref":"#/components/parameters/basketIdent"}],"description":"Applies a creator code to a basket.","responses":{"200":{"description":"Creator code removed successfully."},"422":{"description":"The provided request is invalid. The error response will include detail as to which parameter failed validation."}}}}},"components":{"parameters":{"basketIdent":{"name":"basketIdent","in":"path","required":true,"schema":{"type":"string"},"description":"The basket identifier."}}}}
```

## Apply a gift card

> Applies a creator code to a basket.

```json
{"openapi":"3.1.0","info":{"title":"Tebex Headless API","version":"2.0.0"},"tags":[{"name":"Headless","description":"Main API scoped to public token"}],"servers":[{"url":"https://headless.tebex.io/api/accounts/{token}","description":"Main API scoped to public token","variables":{"token":{"default":"","description":"The store's public token"}}}],"paths":{"/baskets/{basketIdent}/giftcards":{"post":{"tags":["Headless"],"operationId":"applyGiftCard","summary":"Apply a gift card","parameters":[{"$ref":"#/components/parameters/basketIdent"}],"description":"Applies a creator code to a basket.","requestBody":{"description":"Provide a `card_number` to apply to the basket.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GiftCard"}}}},"responses":{"200":{"description":"Successful response returns a success message.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"message":{"type":"string"}}}}}}}}}},"components":{"parameters":{"basketIdent":{"name":"basketIdent","in":"path","required":true,"schema":{"type":"string"},"description":"The basket identifier."}},"schemas":{"GiftCard":{"type":"object","properties":{"card_number":{"type":"string"}}}}}}
```

## Remove a gift card from the basket.

> Removes a gift card from the basket.

```json
{"openapi":"3.1.0","info":{"title":"Tebex Headless API","version":"2.0.0"},"tags":[{"name":"Headless","description":"Main API scoped to public token"}],"servers":[{"url":"https://headless.tebex.io/api/accounts/{token}","description":"Main API scoped to public token","variables":{"token":{"default":"","description":"The store's public token"}}}],"paths":{"/baskets/{basketIdent}/giftcards/remove":{"post":{"tags":["Headless"],"operationId":"removeGiftCard","summary":"Remove a gift card from the basket.","parameters":[{"$ref":"#/components/parameters/basketIdent"}],"description":"Removes a gift card from the basket.","requestBody":{"description":"Provide the `card_number` to remove from the basket.","content":{"application/json":{"schema":{"type":"object","properties":{"card_number":{"type":"string"}}}}}},"responses":{"200":{"description":"Gift card removed successfully."},"422":{"description":"The provided request is invalid. The error response will include detail as to which parameter failed validation."}}}}},"components":{"parameters":{"basketIdent":{"name":"basketIdent","in":"path","required":true,"schema":{"type":"string"},"description":"The basket identifier."}}}}
```

## Apply a coupon

> Applies a coupon to a basket.

```json
{"openapi":"3.1.0","info":{"title":"Tebex Headless API","version":"2.0.0"},"tags":[{"name":"Headless","description":"Main API scoped to public token"}],"servers":[{"url":"https://headless.tebex.io/api/accounts/{token}","description":"Main API scoped to public token","variables":{"token":{"default":"","description":"The store's public token"}}}],"paths":{"/baskets/{basketIdent}/coupons":{"post":{"tags":["Headless"],"operationId":"applyCoupon","summary":"Apply a coupon","parameters":[{"$ref":"#/components/parameters/basketIdent"}],"description":"Applies a coupon to a basket.","requestBody":{"description":"Provide a `coupon_code` to apply to the basket.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApplyCouponRequest"}}}},"responses":{"200":{"description":"Successful response returns a success message.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"message":{"type":"string"}}}}}}}}}},"components":{"parameters":{"basketIdent":{"name":"basketIdent","in":"path","required":true,"schema":{"type":"string"},"description":"The basket identifier."}},"schemas":{"ApplyCouponRequest":{"type":"object","properties":{"coupon_code":{"type":"string"}}}}}}
```

## Remove a coupon from the basket.

> Removes a coupon code from a basket

```json
{"openapi":"3.1.0","info":{"title":"Tebex Headless API","version":"2.0.0"},"tags":[{"name":"Headless","description":"Main API scoped to public token"}],"servers":[{"url":"https://headless.tebex.io/api/accounts/{token}","description":"Main API scoped to public token","variables":{"token":{"default":"","description":"The store's public token"}}}],"paths":{"/baskets/{basketIdent}/coupons/remove":{"post":{"tags":["Headless"],"operationId":"removeCoupon","summary":"Remove a coupon from the basket.","parameters":[{"$ref":"#/components/parameters/basketIdent"}],"description":"Removes a coupon code from a basket","requestBody":{"description":"Provide a `coupon_code` to remove from the basket.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApplyCouponRequest"}}}},"responses":{"200":{"description":"Successful response."},"422":{"description":"The provided request is invalid. The error response will include detail as to which parameter failed validation."}}}}},"components":{"parameters":{"basketIdent":{"name":"basketIdent","in":"path","required":true,"schema":{"type":"string"},"description":"The basket identifier."}},"schemas":{"ApplyCouponRequest":{"type":"object","properties":{"coupon_code":{"type":"string"}}}}}}
```

## Add package to basket

> Add a package with the given ID to the basket.\
> \
> To add a package belonging to a dynamic category, set \`dynamic\` to \`true\`. Without this property the API will treat the request as a normal package ID.

```json
{"openapi":"3.1.0","info":{"title":"Tebex Headless API","version":"2.0.0"},"tags":[{"name":"Baskets","description":"Endpoints requiring only a basket ident with no token"}],"servers":[{"url":"https://headless.tebex.io/api/accounts/{token}","description":"Main API scoped to public token","variables":{"token":{"default":"","description":"The store's public token"}}}],"paths":{"/{basketIdent}/packages":{"post":{"tags":["Baskets"],"operationId":"addBasketPackage","summary":"Add package to basket","parameters":[{"$ref":"#/components/parameters/basketIdent"}],"description":"Add a package with the given ID to the basket.\n\nTo add a package belonging to a dynamic category, set `dynamic` to `true`. Without this property the API will treat the request as a normal package ID.","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"package_id":{"type":"string"},"quantity":{"type":"integer"},"dynamic":{"type":"boolean","description":"Set to `true` when adding a package that belongs to a dynamic category. When omitted, the API acts as if a normal package ID was provided."}}}}}},"responses":{"200":{"description":"Successful response.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Basket"}}}},"422":{"description":"The provided request is invalid. The error response will include detail as to which parameter failed validation."}}}}},"components":{"parameters":{"basketIdent":{"name":"basketIdent","in":"path","required":true,"schema":{"type":"string"},"description":"The basket identifier."}},"schemas":{"Basket":{"type":"object","properties":{"id":{"type":"string"},"ident":{"type":"string"},"complete":{"type":"boolean"},"email":{"type":"string","nullable":true},"username":{"type":"string","nullable":true},"coupons":{"type":"array","items":{"$ref":"#/components/schemas/Coupon"}},"giftcards":{"type":"array","items":{"$ref":"#/components/schemas/GiftCard"}},"creator_code":{"type":"string","description":"The creator code is used to share a percentage of the payment with another party. See more about creator codes at https://docs.tebex.io/creators/tebex-control-panel/engagement/creator-codes"},"cancel_url":{"type":"string"},"complete_url":{"type":"string","nullable":true},"complete_auto_redirect":{"type":"boolean"},"country":{"type":"string","description":"A two-character country code"},"ip":{"type":"string"},"username_id":{"type":"integer"},"base_price":{"type":"number","format":"float"},"sales_tax":{"type":"number","format":"float"},"total_price":{"type":"number","format":"float"},"currency":{"type":"string","description":"A 3 character currency code"},"packages":{"type":"array","items":{"$ref":"#/components/schemas/BasketPackage"}},"custom":{"type":"object","nullable":true},"links":{"$ref":"#/components/schemas/BasketLinks"}}},"Coupon":{"type":"object","properties":{"code":{"type":"string"}}},"GiftCard":{"type":"object","properties":{"card_number":{"type":"string"}}},"BasketPackage":{"type":"object","description":"A package within an existing basket.","properties":{"id":{"type":"integer","description":"The package ID"},"description":{"type":"string"},"image":{"type":"string"},"name":{"type":"string"},"slug":{"type":"string"},"in_basket":{"type":"object","properties":{"quantity":{"type":"integer","description":"The quantity of `package` in this basket. This is not the total quantity of overall items in the basket."},"price":{"type":"number","format":"float"},"gift_username_id":{"type":"string","description":"The username id of the user this package is gifted to"},"gift_username":{"type":"string","description":"The username of the user this package is gifted to."}}},"type":{"type":"string","enum":["single","subscription"],"description":"The type of payment, either `single` for one-time payments or `subscription`."},"revenue_share":{"type":"array","description":"An array of payment destination objects describing how the purchase should be split between multiple wallets. **Only available with pre-agreement from Tebex.**","items":{"$ref":"#/components/schemas/RevenueShare"}}}},"RevenueShare":{"type":"object","properties":{"wallet_ref":{"type":"string"},"amount":{"type":"number","description":"A float (decimal) value representing the amount of this payment in your account currency that is credited to the `wallet_ref`"},"gateway_fee_percent":{"type":"number","description":"A float (decimal) value representing the percentage of the gateway fee that should be dedicated from this wallet’s revenue share. This optional value can be anywhere between 0 - 100."}}},"BasketLinks":{"type":"object","properties":{"payment":{"type":"string","description":"The `links.payment` property is only returned if the basket has been paid for and a payment exists with the `complete`,`refund`, or `chargeback` status."},"checkout":{"type":"string","description":"The `links.checkout` property is only returned if the basket has not been paid, and is the URL to send the customer to make payment"}}}}}}
```

## Remove a package from a basket

> Remove the given package ID from the basket.

```json
{"openapi":"3.1.0","info":{"title":"Tebex Headless API","version":"2.0.0"},"tags":[{"name":"Baskets","description":"Endpoints requiring only a basket ident with no token"}],"servers":[{"url":"https://headless.tebex.io/api/accounts/{token}","description":"Main API scoped to public token","variables":{"token":{"default":"","description":"The store's public token"}}}],"paths":{"/{basketIdent}/packages/remove":{"post":{"tags":["Baskets"],"operationId":"removeBasketPackage","summary":"Remove a package from a basket","parameters":[{"$ref":"#/components/parameters/basketIdent"}],"description":"Remove the given package ID from the basket.","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"package_id":{"type":"string"}}}}}},"responses":{"200":{"description":"Successful response returns the basket.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Basket"}}}},"422":{"description":"The provided request is invalid. The error response will include detail as to which parameter failed validation."}}}}},"components":{"parameters":{"basketIdent":{"name":"basketIdent","in":"path","required":true,"schema":{"type":"string"},"description":"The basket identifier."}},"schemas":{"Basket":{"type":"object","properties":{"id":{"type":"string"},"ident":{"type":"string"},"complete":{"type":"boolean"},"email":{"type":"string","nullable":true},"username":{"type":"string","nullable":true},"coupons":{"type":"array","items":{"$ref":"#/components/schemas/Coupon"}},"giftcards":{"type":"array","items":{"$ref":"#/components/schemas/GiftCard"}},"creator_code":{"type":"string","description":"The creator code is used to share a percentage of the payment with another party. See more about creator codes at https://docs.tebex.io/creators/tebex-control-panel/engagement/creator-codes"},"cancel_url":{"type":"string"},"complete_url":{"type":"string","nullable":true},"complete_auto_redirect":{"type":"boolean"},"country":{"type":"string","description":"A two-character country code"},"ip":{"type":"string"},"username_id":{"type":"integer"},"base_price":{"type":"number","format":"float"},"sales_tax":{"type":"number","format":"float"},"total_price":{"type":"number","format":"float"},"currency":{"type":"string","description":"A 3 character currency code"},"packages":{"type":"array","items":{"$ref":"#/components/schemas/BasketPackage"}},"custom":{"type":"object","nullable":true},"links":{"$ref":"#/components/schemas/BasketLinks"}}},"Coupon":{"type":"object","properties":{"code":{"type":"string"}}},"GiftCard":{"type":"object","properties":{"card_number":{"type":"string"}}},"BasketPackage":{"type":"object","description":"A package within an existing basket.","properties":{"id":{"type":"integer","description":"The package ID"},"description":{"type":"string"},"image":{"type":"string"},"name":{"type":"string"},"slug":{"type":"string"},"in_basket":{"type":"object","properties":{"quantity":{"type":"integer","description":"The quantity of `package` in this basket. This is not the total quantity of overall items in the basket."},"price":{"type":"number","format":"float"},"gift_username_id":{"type":"string","description":"The username id of the user this package is gifted to"},"gift_username":{"type":"string","description":"The username of the user this package is gifted to."}}},"type":{"type":"string","enum":["single","subscription"],"description":"The type of payment, either `single` for one-time payments or `subscription`."},"revenue_share":{"type":"array","description":"An array of payment destination objects describing how the purchase should be split between multiple wallets. **Only available with pre-agreement from Tebex.**","items":{"$ref":"#/components/schemas/RevenueShare"}}}},"RevenueShare":{"type":"object","properties":{"wallet_ref":{"type":"string"},"amount":{"type":"number","description":"A float (decimal) value representing the amount of this payment in your account currency that is credited to the `wallet_ref`"},"gateway_fee_percent":{"type":"number","description":"A float (decimal) value representing the percentage of the gateway fee that should be dedicated from this wallet’s revenue share. This optional value can be anywhere between 0 - 100."}}},"BasketLinks":{"type":"object","properties":{"payment":{"type":"string","description":"The `links.payment` property is only returned if the basket has been paid for and a payment exists with the `complete`,`refund`, or `chargeback` status."},"checkout":{"type":"string","description":"The `links.checkout` property is only returned if the basket has not been paid, and is the URL to send the customer to make payment"}}}}}}
```

## Update package quantity

> Sets the quantity of the given item in the basket. The user must be logged in before the quantity can be changed.

```json
{"openapi":"3.1.0","info":{"title":"Tebex Headless API","version":"2.0.0"},"tags":[{"name":"Baskets","description":"Endpoints requiring only a basket ident with no token"}],"servers":[{"url":"https://headless.tebex.io/api/accounts/{token}","description":"Main API scoped to public token","variables":{"token":{"default":"","description":"The store's public token"}}}],"paths":{"/{basketIdent}/packages/{packageId}":{"put":{"tags":["Baskets"],"operationId":"updatePackageQuantity","summary":"Update package quantity","parameters":[{"$ref":"#/components/parameters/basketIdent"}],"description":"Sets the quantity of the given item in the basket. The user must be logged in before the quantity can be changed.","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"quantity":{"type":"integer"}}}}}},"responses":{"200":{"description":"Successful response."},"422":{"description":"The provided request is invalid. The error response will include detail as to which parameter failed validation."}}}}},"components":{"parameters":{"basketIdent":{"name":"basketIdent","in":"path","required":true,"schema":{"type":"string"},"description":"The basket identifier."}}}}
```

## Update user's tier to a new package

> Updates a tier to a new package. A recurring payment updated webhook is sent when an update is successful.

```json
{"openapi":"3.1.0","info":{"title":"Tebex Headless API","version":"2.0.0"},"tags":[{"name":"Headless","description":"Main API scoped to public token"}],"servers":[{"url":"https://headless.tebex.io/api/accounts/{token}","description":"Main API scoped to public token","variables":{"token":{"default":"","description":"The store's public token"}}}],"security":[{"basicAuth":[]}],"components":{"securitySchemes":{"basicAuth":{"type":"http","scheme":"basic"}},"schemas":{"UpdateTierResponse":{"type":"object","properties":{"success":{"type":"boolean"},"message":{"type":"string"}}}}},"paths":{"/tiers/{tierId}":{"patch":{"tags":["Headless"],"operationId":"updateTier","summary":"Update user's tier to a new package","parameters":[{"in":"path","name":"tierId","required":true,"schema":{"type":"integer"},"description":"The tier identifier"}],"description":"Updates a tier to a new package. A recurring payment updated webhook is sent when an update is successful.","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"package_id":{"type":"integer"}}}}}},"responses":{"200":{"description":"Successful response.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateTierResponse"}}}}}}}}}
```

## Retrieves the available sidebar modules.

> Retrieves the available sidebar modules configured for the store.

```json
{"openapi":"3.1.0","info":{"title":"Tebex Headless API","version":"2.0.0"},"tags":[{"name":"Headless","description":"Main API scoped to public token"}],"servers":[{"url":"https://headless.tebex.io/api/accounts/{token}","description":"Main API scoped to public token","variables":{"token":{"default":"","description":"The store's public token"}}}],"paths":{"/sidebar":{"get":{"tags":["Headless"],"operationId":"getSidebar","summary":"Retrieves the available sidebar modules.","parameters":[{"in":"path","name":"token","required":true,"schema":{"type":"string"},"description":"The webstore identifier."}],"description":"Retrieves the available sidebar modules configured for the store.","responses":{"200":{"description":"Successful response.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ModulesResponse"}}}}}}}},"components":{"schemas":{"ModulesResponse":{"type":"object","required":["data"],"properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Module"}}}},"Module":{"oneOf":[{"$ref":"#/components/schemas/TopCustomerModule"},{"$ref":"#/components/schemas/TextboxModule"},{"$ref":"#/components/schemas/RecentPaymentsModule"},{"$ref":"#/components/schemas/FeaturedPackageModule"},{"$ref":"#/components/schemas/GiftcardBalanceModule"},{"$ref":"#/components/schemas/ServerStatusModule"},{"$ref":"#/components/schemas/PaymentGoalModule"},{"$ref":"#/components/schemas/CommunityGoalModule"}],"discriminator":{"propertyName":"type","mapping":{"top_customer":"#/components/schemas/TopCustomerModule","textbox":"#/components/schemas/TextboxModule","recent_payments":"#/components/schemas/RecentPaymentsModule","featured_package":"#/components/schemas/FeaturedPackageModule","giftcard_balance":"#/components/schemas/GiftcardBalanceModule","server_status":"#/components/schemas/ServerStatusModule","payment_goal":"#/components/schemas/PaymentGoalModule","community_goal":"#/components/schemas/CommunityGoalModule"}}},"TopCustomerModule":{"allOf":[{"$ref":"#/components/schemas/ModuleBase"},{"type":"object","properties":{"type":{"const":"top_customer"},"data":{"$ref":"#/components/schemas/TopCustomerData"}},"required":["data"]}]},"ModuleBase":{"type":"object","required":["id","type","start_time","data"],"properties":{"id":{"type":"integer","format":"int64"},"type":{"type":"string","description":"Discriminator for module kind."},"start_time":{"type":"string","format":"date-time"},"end_time":{"type":["null","string"],"format":"date-time","description":"Nullable; when null the module is ongoing."},"data":{"type":"object","description":"Type-specific payload."}}},"TopCustomerData":{"type":"object","required":["header","username","username_id"],"properties":{"header":{"type":"string"},"username":{"type":"string"},"username_id":{"type":"string","description":"User identifier."},"total":{"type":"number","description":"Optional, present depending on module configuration."}}},"TextboxModule":{"allOf":[{"$ref":"#/components/schemas/ModuleBase"},{"type":"object","properties":{"type":{"const":"textbox"},"data":{"$ref":"#/components/schemas/TextboxData"}},"required":["data"]}]},"TextboxData":{"type":"object","required":["header","text"],"properties":{"header":{"type":"string"},"text":{"type":"string","description":"HTML supported."}}},"RecentPaymentsModule":{"allOf":[{"$ref":"#/components/schemas/ModuleBase"},{"type":"object","properties":{"type":{"const":"recent_payments"},"data":{"$ref":"#/components/schemas/RecentPaymentsData"}},"required":["data"]}]},"RecentPaymentsData":{"type":"object","required":["header","payments"],"properties":{"header":{"type":"string"},"payments":{"type":"array","items":{"$ref":"#/components/schemas/RecentPayment"}}}},"RecentPayment":{"type":"object","required":["username","username_id","package"],"properties":{"username":{"type":"string"},"username_id":{"type":"string"},"package":{"type":"object","required":["name"],"properties":{"name":{"type":"string"}}},"created_at":{"type":["null","string"],"format":"date-time","description":"Optional, present depending on module configuration."},"price":{"type":["null","number"],"description":"Optional, present depending on module configuration."},"currency":{"type":["null","string"],"description":"Optional, present depending on module configuration."}}},"FeaturedPackageModule":{"allOf":[{"$ref":"#/components/schemas/ModuleBase"},{"type":"object","properties":{"type":{"const":"featured_package"},"data":{"$ref":"#/components/schemas/FeaturedPackageData"}},"required":["data"]}]},"FeaturedPackageData":{"type":"object","required":["header","package"],"properties":{"header":{"type":"string"},"package":{"$ref":"#/components/schemas/Package"}}},"Package":{"type":"object","properties":{"id":{"type":"integer"},"name":{"type":"string"},"description":{"type":"string"},"image":{"type":"string","nullable":true},"type":{"type":"string"},"category":{"type":"object","properties":{"id":{"type":"integer"},"name":{"type":"string"}}},"base_price":{"type":"number","format":"float"},"sales_tax":{"type":"number","format":"float"},"total_price":{"type":"number","format":"float"},"currency":{"type":"string"},"prorate_price":{"type":"number","format":"float","description":"If this package is part of a tiered category, this is the difference on upgrade pricing from the current active tier.","nullable":true},"discount":{"type":"number","format":"float"},"disable_quantity":{"type":"boolean"},"disable_gifting":{"type":"boolean"},"expiration_date":{"type":"string","nullable":true,"format":"date-time"},"media":{"type":"array","items":{"$ref":"#/components/schemas/PackageMedia"}},"order":{"type":"integer"},"slug":{"type":"string"},"user_limit":{"type":"integer"},"creator_meta_data":{"type":"object"},"options":{"type":"array"},"variables":{"type":"array"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}}},"PackageMedia":{"properties":{"type":{"type":"string","enum":["video","image"]},"name":{"type":"string","description":"A file name for the media, if applicable.","nullable":true},"url":{"type":"string","description":"The URL of the package media."},"featured":{"type":"boolean","description":"True if this media should be featured more prominently than others."},"primary":{"type":"boolean","description":"True if this is the primary media for the package."}}},"GiftcardBalanceModule":{"allOf":[{"$ref":"#/components/schemas/ModuleBase"},{"type":"object","properties":{"type":{"const":"giftcard_balance"},"data":{"$ref":"#/components/schemas/GiftcardBalanceData"}},"required":["data"]}]},"GiftcardBalanceData":{"type":"object","required":["header"],"properties":{"header":{"type":"string"}}},"ServerStatusModule":{"allOf":[{"$ref":"#/components/schemas/ModuleBase"},{"type":"object","properties":{"type":{"const":"server_status"},"data":{"$ref":"#/components/schemas/ServerStatusData"}},"required":["data"]}]},"ServerStatusData":{"type":"object","required":["header","hostname","port","online","players"],"properties":{"header":{"type":"string"},"hostname":{"type":"string"},"port":{"type":"integer"},"online":{"type":"boolean"},"players":{"description":"Nullable object; null when server is offline.","oneOf":[{"type":"null"},{"$ref":"#/components/schemas/Players"}]}}},"Players":{"type":"object","required":["online","max"],"properties":{"online":{"type":"integer"},"max":{"type":"integer"}}},"PaymentGoalModule":{"allOf":[{"$ref":"#/components/schemas/ModuleBase"},{"type":"object","properties":{"type":{"const":"payment_goal"},"data":{"$ref":"#/components/schemas/PaymentGoalData"}},"required":["data"]}]},"PaymentGoalData":{"type":"object","required":["header","percentage","bar_style","bar_animated"],"properties":{"header":{"type":"string"},"percentage":{"type":"number","minimum":0,"maximum":100},"bar_style":{"type":"string","enum":["normal","striped"]},"bar_animated":{"type":"boolean"},"total":{"type":["null","number"],"description":"Optional, present depending on module configuration."},"target":{"type":["null","number"],"description":"Optional, present depending on module configuration."}}},"CommunityGoalModule":{"allOf":[{"$ref":"#/components/schemas/ModuleBase"},{"type":"object","properties":{"type":{"const":"community_goal"},"data":{"$ref":"#/components/schemas/CommunityGoalData"}},"required":["data"]}]},"CommunityGoalData":{"type":"object","required":["header","bar_style","bar_animated","percentage"],"properties":{"header":{"type":"string"},"bar_style":{"type":"string","enum":["normal","striped"]},"bar_animated":{"type":"boolean"},"percentage":{"type":"number","minimum":0,"maximum":100},"total_payments":{"type":["null","number"],"description":"Optional, present depending on module configuration."},"target":{"type":["null","number"],"description":"Optional, present depending on module configuration."},"times_achieved":{"type":["null","integer"],"description":"Optional, present depending on module configuration."}}}}}}
```
