Apply a country tax preset
Writes a whole country's rate table in one transaction. CA writes the federal GST 5% plus every province's HST or PST/QST, already flagged so GST and PST/QST stack correctly and HST does not. IL writes one rate, VAT 18% for all of Israel; it does not switch the store to VAT-inclusive prices (that is the store's pricesIncludeTax setting) and does not handle the Eilat exemption. Refuses with 409 when the store already has rates for that country — delete them first to replace them. Supports Idempotency-Key for safe retries.
Admin API key (server-to-server). Issue via the dashboard at Settings → API keys. Plain-text key is shown once — store in a secret manager. Format: Authorization: Bearer brainerce_xxxxxxxxx.
In: header
Path Parameters
Preset key: CA (Canada) or IL (Israel)
Header Parameters
Client-supplied key (a UUID v4 is the recommended form, max 255 characters) that makes this mutation safe to retry.
- Replay window: 24 hours. The first response for a key is cached; a retry inside the window with the same request body returns the original status and body without re-running the handler.
- Reusing a key with a different body returns
409 Conflictwithcode: "IDEMPOTENCY_KEY_REUSED". The request fingerprint (method + path + body hash) is compared against the stored one; a mismatch is refused rather than served the old response. - Keys are scoped to the calling credential and store — two API keys may safely use the same key value.
- Error responses are cached too, so a retry of a request that failed validation returns the same 400 immediately.
- Sending this header on a
GETreturns400withcode: "IDEMPOTENCY_KEY_NOT_SUPPORTED"— GETs are already idempotent. - Support is per-route and this parameter is the authoritative signal: a key sent to a route that does not declare it is accepted and silently ignored.
length <= 255curl -X POST "https://api.brainerce.com/api/v1/tax/presets/string/apply" \ -H "Idempotency-Key: string"{
"preset": "CA",
"created": 14,
"rates": [
{
"id": "clx1a2b3c4d5e6f7g8h9",
"accountId": "clx1a2b3c4d5e6f7g8h9",
"storeId": "clx1a2b3c4d5e6f7g8h9",
"name": "California Sales Tax",
"country": "IL",
"region": "Ontario",
"postalCode": "6578301",
"rate": "8.25",
"taxType": "vat",
"isInclusive": true,
"priority": 1,
"stackable": true,
"appliesToShipping": true,
"exceptionCountries": [
"string"
],
"isActive": true,
"taxClassId": "clx1a2b3c4d5e6f7g8h9",
"effectiveFrom": "2019-08-24T14:15:22Z",
"effectiveTo": "2019-08-24T14:15:22Z",
"source": "preset:IL",
"sourceVerifiedAt": "2019-08-24T14:15:22Z",
"createdAt": "2019-08-24T14:15:22Z",
"updatedAt": "2019-08-24T14:15:22Z"
}
]
}{
"statusCode": 400,
"code": "VALIDATION_FAILED",
"message": "name should not be empty, price must be a positive number",
"timestamp": "2026-08-23T10:15:00.000Z",
"path": "/api/v1/tax/presets/{presetKey}/apply"
}{
"statusCode": 401,
"code": "UNAUTHORIZED",
"message": "Invalid or expired credential",
"timestamp": "2026-08-23T10:15:00.000Z",
"path": "/api/v1/tax/presets/{presetKey}/apply"
}{
"statusCode": 403,
"code": "INSUFFICIENT_SCOPE",
"message": "API key does not have the required scope: products:write",
"timestamp": "2026-08-23T10:15:00.000Z",
"path": "/api/v1/tax/presets/{presetKey}/apply"
}{
"statusCode": 409,
"code": "CONFLICT",
"message": "The request conflicts with the current state of the resource",
"timestamp": "2026-08-23T10:15:00.000Z",
"path": "/api/v1/tax/presets/{presetKey}/apply"
}{
"statusCode": 429,
"code": "RATE_LIMITED",
"message": "Too many requests",
"details": {
"retryAfterSeconds": 12
},
"timestamp": "2026-08-23T10:15:00.000Z",
"path": "/api/v1/store"
}