Tax Categories
Tax Categories define how Products are to be taxed in different countries.
A maximum number of 100 TaxCategories can be created per Project. Learn more about this limit.
Representations
TaxCategory
idString | Unique identifier of the TaxCategory. |
versionInt | Current version of the TaxCategory. |
keyString | User-defined unique identifier of the TaxCategory. MinLength:2MaxLength: 256Pattern: ^[A-Za-z0-9_-]+$ |
nameString | Name of the TaxCategory. |
descriptionString | Description of the TaxCategory. |
ratesArray of TaxRate | Tax rates and subrates of states and countries. Each TaxRate in the array has a unique ID. |
createdAt | Date and time (UTC) the TaxCategory was initially created. |
createdByBETA | IDs and references that created the TaxCategory. |
lastModifiedAt | Date and time (UTC) the TaxCategory was last updated. |
lastModifiedByBETA | IDs and references that last modified the TaxCategory. |
TaxCategoryDraft
keyString | User-defined unique identifier for the TaxCategory. MinLength:2MaxLength: 256Pattern: ^[A-Za-z0-9_-]+$ |
nameString | Name of the TaxCategory. |
descriptionString | Description of the TaxCategory. |
ratesArray of TaxRateDraft | Tax rates and subrates of states and countries. |
TaxCategoryPagedQueryResponse
PagedQueryResult with results containing an array of TaxCategory.
limitInt | Number of results requested. Default:20Maximum: 500 |
offsetInt | Number of elements skipped. Default:0Maximum: 10 000 |
countInt | Actual number of results returned. |
totalInt | Total number of results matching the query.
This number is an estimation that is not strongly consistent.
This field is returned by default.
For improved performance, calculating this field can be deactivated by using the query parameter |
resultsArray of TaxCategory | TaxCategories matching the query. |
TaxCategoryReference
Reference to a TaxCategory.
idString | Unique identifier of the referenced TaxCategory. |
typeId | "tax-category"References a TaxCategory. |
obj | Contains the representation of the expanded TaxCategory. Only present in responses to requests with Reference Expansion for TaxCategories. |
TaxCategoryResourceIdentifier
ResourceIdentifier to a TaxCategory. Either id or key is required. If both are set, an InvalidJsonInput error is returned.
idString | Unique identifier of the referenced TaxCategory. Required if |
keyString | User-defined unique identifier of the referenced TaxCategory. Required if 2MaxLength: 256Pattern: ^[A-Za-z0-9_-]+$ |
typeId | "tax-category"References a TaxCategory. |
TaxRate
This type is equivalent to TaxRate and TaxRateInput in the GraphQL API.
idString | Present if the TaxRate is part of a TaxCategory. Absent for external TaxRates in LineItem, CustomLineItem, and ShippingInfo. |
keyString | User-defined unique identifier of the TaxRate. Present when set using TaxRateDraft. Not available for external TaxRates created using ExternalTaxRateDraft. MinLength:2MaxLength: 256Pattern: ^[a-zA-Z0-9_-] |
nameString | Name of the TaxRate. |
amountFloat | Tax rate. If subrates are used, the amount is the sum of all rates in 1 |
includedInPriceBoolean | If |
country | Country in which the tax rate is applied in ISO 3166-1 alpha-2 format. Pattern:^[A-Z]{2}$ |
stateString | State within the country, such as Texas in the United States. |
subRatesArray of SubRate | Used when the total tax is a combination of multiple taxes (for example, local, state/provincial, and/or federal taxes). The total of all subrates must equal the TaxRate |
SubRate
It is used to calculate the taxPortions field in a Cart or Order.
nameString | Name of the SubRate. |
amountFloat | Maximum: 1 |
TaxRateDraft
keyString | User-defined unique identifier of the TaxRate. MinLength:2MaxLength: 256Pattern: ^[a-zA-Z0-9_-] |
nameString | Name of the TaxRate. |
amountFloat | Tax rate.
Must be supplied if no 1 |
includedInPriceBoolean | If |
country | Country in which the tax rate is applied in ISO 3166-1 alpha-2 format. Pattern:^[A-Z]{2}$ |
stateString | State within the country, such as Texas in the United States. |
subRatesArray of SubRate | Used when the total tax is a combination of multiple taxes (for example, local, state/provincial, and/or federal taxes). The total of all subrates must equal the TaxRate |
Get TaxCategory
Get TaxCategory by ID
view_products:{projectKey}view_tax_categories:{projectKey}regionString | Region in which the Project is hosted. |
projectKeyString |
|
idString |
|
expand | The parameter can be passed multiple times. |
application/jsoncurl --get https://api.{region}.commercetools.com/{projectKey}/tax-categories/{id} -i \--header "Authorization: Bearer ${BEARER_TOKEN}"
{"id": "c60f7377-2643-4e99-adb5-b2909657444d","version": 1,"name": "test-tax-category","rates": [{"name": "HST Ontario","amount": 0.13,"includedInPrice": true,"country": "CA","state": "ON","subRates": [{"name": "Federal rate (GST 5%)","amount": 0.05},{"name": "Provincial rate (PST 8%)","amount": 0.08}]}],"createdAt": "2016-02-24T15:33:40.811Z","lastModifiedAt": "2016-02-24T15:33:40.811Z"}
Get TaxCategory by Key
view_products:{projectKey}view_tax_categories:{projectKey}regionString | Region in which the Project is hosted. |
projectKeyString |
|
keyString |
|
expand | The parameter can be passed multiple times. |
application/jsoncurl --get https://api.{region}.commercetools.com/{projectKey}/tax-categories/key={key} -i \--header "Authorization: Bearer ${BEARER_TOKEN}"
{"id": "c60f7377-2643-4e99-adb5-b2909657444d","version": 1,"name": "test-tax-category","rates": [{"name": "HST Ontario","amount": 0.13,"includedInPrice": true,"country": "CA","state": "ON","subRates": [{"name": "Federal rate (GST 5%)","amount": 0.05},{"name": "Provincial rate (PST 8%)","amount": 0.08}]}],"createdAt": "2016-02-24T15:33:40.811Z","lastModifiedAt": "2016-02-24T15:33:40.811Z"}
Query TaxCategories
view_products:{projectKey}view_tax_categories:{projectKey}regionString | Region in which the Project is hosted. |
projectKeyString |
|
where | The parameter can be passed multiple times. |
sort | The parameter can be passed multiple times. |
expand | The parameter can be passed multiple times. |
limitInt | Number of results requested. Default: 20 |
offsetInt | Number of elements skipped. Default: 0 |
withTotalBoolean | Controls the calculation of the total number of query results. Set to Default: true |
var.<varName>String | Predicate parameter values. The parameter can be passed multiple times. |
application/jsoncurl --get https://api.{region}.commercetools.com/{projectKey}/tax-categories -i \--header "Authorization: Bearer ${BEARER_TOKEN}"
{"limit": 20,"offset": 0,"count": 1,"total": 1,"results": [{"id": "c60f7377-2643-4e99-adb5-b2909657444d","version": 1,"name": "test-tax-category","rates": [{"name": "HST Ontario","amount": 0.13,"includedInPrice": true,"country": "CA","state": "ON","subRates": [{"name": "Federal rate (GST 5%)","amount": 0.05},{"name": "Provincial rate (PST 8%)","amount": 0.08}]}],"createdAt": "2016-02-24T15:33:40.811Z","lastModifiedAt": "2016-02-24T15:33:40.811Z"}]}
Check if TaxCategory exists
Check if TaxCategory exists by ID
Checks if a TaxCategory exists for a given id. Returns a 200 OK status if the TaxCategory exists or a 404 Not Found otherwise.
view_products:{projectKey}view_tax_categories:{projectKey}regionString | Region in which the Project is hosted. |
projectKeyString |
|
idString |
|
curl --head https://api.{region}.commercetools.com/{projectKey}/tax-categories/{id} -i \--header "Authorization: Bearer ${BEARER_TOKEN}"
Check if TaxCategory exists by Key
Checks if a TaxCategory exists for a given key. Returns a 200 OK status if the Tax Category exists or a 404 Not Found otherwise.
view_products:{projectKey}view_tax_categories:{projectKey}regionString | Region in which the Project is hosted. |
projectKeyString |
|
keyString |
|
curl --head https://api.{region}.commercetools.com/{projectKey}/tax-categories/key={key} -i \--header "Authorization: Bearer ${BEARER_TOKEN}"
Check if TaxCategory exists by Query Predicate
Checks if a TaxCategory exists for a given Query Predicate. Returns a 200 OK status if any TaxCategories match the Query Predicate, or a 404 Not Found otherwise.
view_products:{projectKey}view_tax_categories:{projectKey}regionString | Region in which the Project is hosted. |
projectKeyString |
|
where | The parameter can be passed multiple times. |
curl --head https://api.{region}.commercetools.com/{projectKey}/tax-categories -i \--header "Authorization: Bearer ${BEARER_TOKEN}"
Create TaxCategory
manage_products:{projectKey}manage_tax_categories:{projectKey}regionString | Region in which the Project is hosted. |
projectKeyString |
|
expand | The parameter can be passed multiple times. |
application/jsonapplication/jsoncurl https://api.{region}.commercetools.com/{projectKey}/tax-categories -i \--header "Authorization: Bearer ${BEARER_TOKEN}" \--header 'Content-Type: application/json' \--data-binary @- << DATA{"name" : "test-tax-category","rates" : [ {"name" : "HST Ontario","amount" : 0.13,"includedInPrice" : true,"country" : "CA","state" : "ON","subRates" : [ {"name" : "Federal rate (GST 5%)","amount" : 0.05}, {"name" : "Provincial rate (PST 8%)","amount" : 0.08} ]} ]}DATA
{"id": "c60f7377-2643-4e99-adb5-b2909657444d","version": 1,"name": "test-tax-category","rates": [{"name": "HST Ontario","amount": 0.13,"includedInPrice": true,"country": "CA","state": "ON","subRates": [{"name": "Federal rate (GST 5%)","amount": 0.05},{"name": "Provincial rate (PST 8%)","amount": 0.08}]}],"createdAt": "2016-02-24T15:33:40.811Z","lastModifiedAt": "2016-02-24T15:33:40.811Z"}
Update TaxCategory
Update TaxCategory by ID
manage_products:{projectKey}manage_tax_categories:{projectKey}regionString | Region in which the Project is hosted. |
projectKeyString |
|
idString |
|
expand | The parameter can be passed multiple times. |
application/jsonversionInt | Expected version of the TaxCategory on which the changes should be applied. If the expected version does not match the actual version, a ConcurrentModification error will be returned. |
actionsArray of TaxCategoryUpdateAction | Update actions to be performed on the TaxCategory. |
application/jsoncurl https://api.{region}.commercetools.com/{projectKey}/tax-categories/{id} -i \--header "Authorization: Bearer ${BEARER_TOKEN}" \--header 'Content-Type: application/json' \--data-binary @- << DATA{"version" : 1,"actions" : [ {"action" : "changeName","name" : "New Name"} ]}DATA
{"id": "c60f7377-2643-4e99-adb5-b2909657444d","version": 1,"name": "test-tax-category","rates": [{"name": "HST Ontario","amount": 0.13,"includedInPrice": true,"country": "CA","state": "ON","subRates": [{"name": "Federal rate (GST 5%)","amount": 0.05},{"name": "Provincial rate (PST 8%)","amount": 0.08}]}],"createdAt": "2016-02-24T15:33:40.811Z","lastModifiedAt": "2016-02-24T15:33:40.811Z"}
Update TaxCategory by Key
manage_products:{projectKey}manage_tax_categories:{projectKey}regionString | Region in which the Project is hosted. |
projectKeyString |
|
keyString |
|
expand | The parameter can be passed multiple times. |
application/jsonversionInt | Expected version of the TaxCategory on which the changes should be applied. If the expected version does not match the actual version, a ConcurrentModification error will be returned. |
actionsArray of TaxCategoryUpdateAction | Update actions to be performed on the TaxCategory. |
application/jsoncurl https://api.{region}.commercetools.com/{projectKey}/tax-categories/key={key} -i \--header "Authorization: Bearer ${BEARER_TOKEN}" \--header 'Content-Type: application/json' \--data-binary @- << DATA{"version" : 1,"actions" : [ {"action" : "changeName","name" : "New Name"} ]}DATA
{"id": "c60f7377-2643-4e99-adb5-b2909657444d","version": 1,"name": "test-tax-category","rates": [{"name": "HST Ontario","amount": 0.13,"includedInPrice": true,"country": "CA","state": "ON","subRates": [{"name": "Federal rate (GST 5%)","amount": 0.05},{"name": "Provincial rate (PST 8%)","amount": 0.08}]}],"createdAt": "2016-02-24T15:33:40.811Z","lastModifiedAt": "2016-02-24T15:33:40.811Z"}
Update actions
Change Name
actionString | "changeName" |
nameString | New value to set. Must not be empty. |
{"action": "changeName","name": "New Name"}
Set Key
actionString | "setKey" |
keyString | Value to set. If empty, any existing value will be removed. MinLength:2MaxLength: 256Pattern: ^[A-Za-z0-9_-]+$ |
{"action": "setKey","key": "keyString"}
Set Description
actionString | "setDescription" |
descriptionString | Value to set. If empty, any existing value will be removed. |
{"action": "setDescription","description": "new Description"}
Add TaxRate
actionString | "addTaxRate" |
taxRate | Value to append to the |
{"action": "addTaxRate","taxRate": {"name": "TaxRateName","amount": 0.3,"includedInPrice": true,"country": "DE"}}
Replace TaxRate
actionString | "replaceTaxRate" |
taxRateIdString | ID of the TaxRate to replace.
Either |
taxRateKeyString | Key of the TaxRate to replace.
Either |
taxRate | New TaxRate to replace with. |
{"action": "replaceTaxRate","taxRateId": "{{taxRateID}}","taxRate": {"name": "TaxRateName","amount": 0.4,"includedInPrice": true,"country": "DE"}}
Remove TaxRate
actionString | "removeTaxRate" |
taxRateIdString | ID of the TaxRate to remove.
Either |
taxRateKeyString | Key of the TaxRate to remove.
Either |
{"action": "removeTaxRate","taxRateId": "{{taxRateID}}"}
Delete TaxCategory
Delete TaxCategory by ID
manage_products:{projectKey}manage_tax_categories:{projectKey}regionString | Region in which the Project is hosted. |
projectKeyString |
|
idString |
|
versionInt | Last seen version of the resource. |
expand | The parameter can be passed multiple times. |
application/jsoncurl -X DELETE https://api.{region}.commercetools.com/{projectKey}/tax-categories/{id}?version={version} -i \--header "Authorization: Bearer ${BEARER_TOKEN}"
{"id": "c60f7377-2643-4e99-adb5-b2909657444d","version": 1,"name": "test-tax-category","rates": [{"name": "HST Ontario","amount": 0.13,"includedInPrice": true,"country": "CA","state": "ON","subRates": [{"name": "Federal rate (GST 5%)","amount": 0.05},{"name": "Provincial rate (PST 8%)","amount": 0.08}]}],"createdAt": "2016-02-24T15:33:40.811Z","lastModifiedAt": "2016-02-24T15:33:40.811Z"}
Delete TaxCategory by Key
manage_products:{projectKey}manage_tax_categories:{projectKey}regionString | Region in which the Project is hosted. |
projectKeyString |
|
keyString |
|
versionInt | Last seen version of the resource. |
expand | The parameter can be passed multiple times. |
application/jsoncurl -X DELETE https://api.{region}.commercetools.com/{projectKey}/tax-categories/key={key}?version={version} -i \--header "Authorization: Bearer ${BEARER_TOKEN}"
{"id": "c60f7377-2643-4e99-adb5-b2909657444d","version": 1,"name": "test-tax-category","rates": [{"name": "HST Ontario","amount": 0.13,"includedInPrice": true,"country": "CA","state": "ON","subRates": [{"name": "Federal rate (GST 5%)","amount": 0.05},{"name": "Provincial rate (PST 8%)","amount": 0.08}]}],"createdAt": "2016-02-24T15:33:40.811Z","lastModifiedAt": "2016-02-24T15:33:40.811Z"}