# Tax rates

Manage named tax lines for every zone and class coordinate, individually or atomically in a batch.

Tax rates belong to a market and use `read_markets` / `write_markets`. A line connects one zone to one class and carries an internal name, a customer-facing display name, a percentage, and a compound mode. Search and coverage endpoints are paginated. The atomic save endpoint is the preferred path for an editor because it validates creates, updates, and deletes as one proposed state and commits all of them or none.

## General tax settings

Three settings on the market itself decide how all of this applies: `tax_enabled` (whether tax is collected at all; when false, orders in the market carry no tax whatever the classes, zones and rates say), `tax_included` (whether catalog prices are entered with tax included) and `tax_display_mode` (`inclusive` or `exclusive`: how storefront prices are shown, independently of how they are entered). Read them on the market and change them with Update a market (`PATCH /api/2025-01/markets/{marketId}`) on the [Markets](/store-api/markets/markets) page; changing `tax_included` asks for confirmation first. New markets collect tax with tax-exclusive prices, shown without tax.

## Connect zones and classes

Every rate line belongs to one tax zone and one tax class. That pair is a coordinate. A coordinate can contain several named lines, such as a 9% state line and a 9% central line. `added_to` lines are each calculated from the taxable amount and then summed. `compounded` lines use the taxable amount plus the complete `added_to` total. Tringify applies that order consistently; clients choose the mode, not a line sequence.

## Save several changes atomically

```json
// PUT /api/2025-01/markets/{marketId}/tax-rates
{
  "creates": [{
    "client_id": "draft-1",
    "tax_zone_id": "9b2d7c41-3e8a-4f60-a1d2-5c7e9f013b48",
    "tax_class_id": "7c9e4f2b-1a3d-4e5f-8b6c-2d0e1f3a4b5c",
    "name": "State tax",
    "display_name": "State tax 9%",
    "rate": "9.00",
    "compound_mode": "added_to"
  }],
  "updates": [],
  "deletes": []
}
```

The batch endpoint validates the complete proposed result before writing. A duplicate name, stale update, invalid coordinate, or exceeded limit rejects the whole request. A successful response reports created, updated, and deleted counts. The saved changes and their webhook events become visible together only after the complete batch succeeds.

## Endpoints

## Get tax rate limits

`GET /api/2025-01/markets/{marketId}/tax-rates/limits`

Returns every live tax-rate limit: 500 lines per market, 10 lines per zone-and-class coordinate, the name length cap (counted in characters), and list pagination bounds. Read this endpoint instead of hardcoding numbers.

Scope: `read_markets`

Response:

```json
{
  "success": true,
  "data": {
    "limits": {
      "name_max_length": 100,
      "max_per_market": 500,
      "max_per_coordinate": 10,
      "max_zones_per_market": 200,
      "max_classes_per_market": 80,
      "list_page_size": 20,
      "list_max_limit": 200,
      "search_max_length": 100,
      "page_size_options": [10, 20, 50, 100, 200]
    }
  }
}
```

## Search tax rates

`GET /api/2025-01/markets/{marketId}/tax-rates/search`

Returns paginated rate lines — one row per line, a (zone, class) coordinate may hold several. Free-text `search` matches the zone or class name; `zone_id`, `class_id`, and `compound_mode` each narrow further. The response also carries the market's coverage figures: `total_combinations` (zones × classes) and `configured_combinations` (coordinates holding at least one rate) — server-computed so every client agrees.

Scope: `read_markets`

Response:

```json
{
  "success": true,
  "data": {
    "tax_rates": [{
    "id": "3f8c2d1e-9a4b-4c5d-8e6f-0a1b2c3d4e5f",
    "store_id": "1f0e2d3c-4b5a-6978-8695-a4b3c2d1e0f9",
    "market_id": "9a1f2c3d-4e5f-6789-abcd-ef0123456789",
    "tax_zone_id": "7c9e4f2b-1a3d-4e5f-8b6c-2d0e1f3a4b5c",
    "tax_class_id": "4e2b8c1a-7f3d-4a5b-9c6d-1e0f2a3b4c5d",
    "name": "State tax",
    "display_name": "NY State tax 4%",
    "rate": "4",
    "compound_mode": "added_to",
    "tax_zone_name": "New York",
    "tax_class_name": "Standard",
    "created_at": "2026-07-01T10:15:00-04:00",
    "updated_at": "2026-07-09T18:40:00-04:00",
    "version": "2026-07-09T13:10:00.123456Z"
  }],
    "total": 1,
    "page": 1,
    "per_page": 20,
    "market_total": 1,
    "total_combinations": 6,
    "configured_combinations": 4
  }
}
```

## List coverage gaps

`GET /api/2025-01/markets/{marketId}/tax-rates/coverage-gaps`

Returns the paginated (zone, class) coordinates carrying zero rate lines — the cells still to fill. Same filter semantics as search, and the same coverage figures ride along. An unfilled coordinate means items of that class sold into that zone carry no tax from zone rates.

Scope: `read_markets`

Response:

```json
{
  "success": true,
  "data": {
    "coordinates": [
      {
        "tax_zone_id": "7c9e4f2b-1a3d-4e5f-8b6c-2d0e1f3a4b5c",
        "tax_zone_name": "New York",
        "tax_class_id": "0b9a8c7d-6e5f-4a3b-2c1d-e0f9a8b7c6d5",
        "tax_class_name": "Reduced rate"
      }
    ],
    "total": 2,
    "page": 1,
    "per_page": 20,
    "market_total": 4,
    "total_combinations": 6,
    "configured_combinations": 4
  }
}
```

## Create a tax rate

`POST /api/2025-01/markets/{marketId}/tax-rates`

Creates a rate line. `name`, `display_name` (what the customer sees on orders and invoices), `rate` (a decimal string, 0–100), `tax_zone_id`, and `tax_class_id` are required; `compound_mode` defaults to `added_to`. A coordinate may hold multiple lines (state tax + county tax), but each line name must be unique within its coordinate, ignoring case — a duplicate is rejected, never silently stacked. Fires `tax_rates/create`.

Scope: `write_markets`

Response:

```json
{
  "success": true,
  "data": {
    "tax_rate": {
    "id": "3f8c2d1e-9a4b-4c5d-8e6f-0a1b2c3d4e5f",
    "store_id": "1f0e2d3c-4b5a-6978-8695-a4b3c2d1e0f9",
    "market_id": "9a1f2c3d-4e5f-6789-abcd-ef0123456789",
    "tax_zone_id": "7c9e4f2b-1a3d-4e5f-8b6c-2d0e1f3a4b5c",
    "tax_class_id": "4e2b8c1a-7f3d-4a5b-9c6d-1e0f2a3b4c5d",
    "name": "State tax",
    "display_name": "NY State tax 4%",
    "rate": "4",
    "compound_mode": "added_to",
    "tax_zone_name": "New York",
    "tax_class_name": "Standard",
    "created_at": "2026-07-01T10:15:00-04:00",
    "updated_at": "2026-07-09T18:40:00-04:00",
    "version": "2026-07-09T13:10:00.123456Z"
  }
  }
,"code":"TAX_RATE_CREATED","message":"Tax rate created."}
```

## Save tax rate changes

`PUT /api/2025-01/markets/{marketId}/tax-rates`

Applies the complete change set atomically: either every create, update, and delete succeeds or none of them do. Updates and deletes must include the opaque `version` returned by the read APIs; a stale version rejects the whole change set. The service validates the final market state, so valid line-name swaps work and no intermediate write can violate a limit. Each written rate still emits its canonical create, update, or delete webhook. The response counts the changes and lists `rates`: each created line's `client_id`, `id` and `version` in request order, then each updated line's `id` and new `version`, ready for the next save.

Scope: `write_markets`

Response:

```json
{"success":true,"data":{"created":1,"updated":1,"deleted":1,"rates":[{"client_id":"draft-1","id":"9b1d2c3e-4f5a-4b6c-8d7e-0f1a2b3c4d5e","version":"2026-08-01T09:30:00.123456Z"},{"id":"5a6b7c8d-9e0f-4a1b-8c2d-3e4f5a6b7c8d","version":"2026-08-01T09:30:00.123456Z"}]},"code":"TAX_RATES_SAVED","message":"Tax rates saved."}
```

## Get a tax rate

`GET /api/2025-01/markets/{marketId}/tax-rates/{taxRateId}`

Returns the rate line, with its zone and class names joined.

Scope: `read_markets`

Response:

```json
{
  "success": true,
  "data": {
    "tax_rate": {
    "id": "3f8c2d1e-9a4b-4c5d-8e6f-0a1b2c3d4e5f",
    "store_id": "1f0e2d3c-4b5a-6978-8695-a4b3c2d1e0f9",
    "market_id": "9a1f2c3d-4e5f-6789-abcd-ef0123456789",
    "tax_zone_id": "7c9e4f2b-1a3d-4e5f-8b6c-2d0e1f3a4b5c",
    "tax_class_id": "4e2b8c1a-7f3d-4a5b-9c6d-1e0f2a3b4c5d",
    "name": "State tax",
    "display_name": "NY State tax 4%",
    "rate": "4",
    "compound_mode": "added_to",
    "tax_zone_name": "New York",
    "tax_class_name": "Standard",
    "created_at": "2026-07-01T10:15:00-04:00",
    "updated_at": "2026-07-09T18:40:00-04:00",
    "version": "2026-07-09T13:10:00.123456Z"
  }
  }
}
```

## Update a tax rate

`PUT /api/2025-01/markets/{marketId}/tax-rates/{taxRateId}`

Updates the line's name, display name, rate, compound mode, and optionally moves it to another class (`tax_class_id`). Renaming must not collide with a sibling line at the same coordinate. Fires `tax_rates/update`.

Scope: `write_markets`

Response:

```json
{
  "success": true,
  "data": {
    "tax_rate": {
    "id": "3f8c2d1e-9a4b-4c5d-8e6f-0a1b2c3d4e5f",
    "store_id": "1f0e2d3c-4b5a-6978-8695-a4b3c2d1e0f9",
    "market_id": "9a1f2c3d-4e5f-6789-abcd-ef0123456789",
    "tax_zone_id": "7c9e4f2b-1a3d-4e5f-8b6c-2d0e1f3a4b5c",
    "tax_class_id": "4e2b8c1a-7f3d-4a5b-9c6d-1e0f2a3b4c5d",
    "name": "State tax",
    "display_name": "NY State tax 4%",
    "rate": "4",
    "compound_mode": "added_to",
    "tax_zone_name": "New York",
    "tax_class_name": "Standard",
    "created_at": "2026-07-01T10:15:00-04:00",
    "updated_at": "2026-07-09T18:40:00-04:00",
    "version": "2026-07-09T13:10:00.123456Z"
  }
  }
,"code":"TAX_RATE_UPDATED","message":"Tax rate updated."}
```

## Delete a tax rate

`DELETE /api/2025-01/markets/{marketId}/tax-rates/{taxRateId}`

Deletes the rate line. If it was the coordinate's only line, that (zone, class) combination becomes unconfigured and items of that class in that zone carry no tax from zone rates. Fires `tax_rates/delete`.

Scope: `write_markets`

Response:

```json
{
  "success": true,
  "data": { "success": true }
,"code":"TAX_RATE_DELETED","message":"Tax rate deleted."}
```

## Webhook events

Atomic saves publish the corresponding create, update, and delete event for every changed line only after the complete batch succeeds. No change or event is published when any part of the batch is rejected.

## Tax rate created

Event: `tax_rates/create` · App scope: `read_markets` · Staff permission: `markets:write`

Subscribe to receive a tax rate line after it is created at a market's zone-and-class coordinate.

```json
{
  "tax_rate": {
    "compound_mode": "added_to",
    "created_at": "2026-06-09T12:00:00-04:00",
    "display_name": "State tax 9%",
    "id": "3f8c2d1e-9a4b-4c5d-8e6f-0a1b2c3d4e5f",
    "market_id": "9a1f2c3d-4e5f-6789-abcd-ef0123456789",
    "name": "State tax",
    "rate": "9",
    "tax_class_id": "4e2b8c1a-7f3d-4a5b-9c6d-1e0f2a3b4c5d",
    "tax_class_name": "Reduced rate",
    "tax_zone_id": "7c9e4f2b-1a3d-4e5f-8b6c-2d0e1f3a4b5c",
    "tax_zone_name": "California",
    "updated_at": "2026-06-09T12:00:00-04:00",
    "version": "2026-07-15T12:00:00.123456Z"
  }
}
```

## Tax rate updated

Event: `tax_rates/update` · App scope: `read_markets` · Staff permission: `markets:write`

Subscribe to receive the current tax rate line after its name, display name, rate, compound mode, or tax class changes.

```json
{
  "changed_fields": [
    "rate",
    "display_name"
  ],
  "tax_rate": {
    "compound_mode": "added_to",
    "created_at": "2026-06-09T12:00:00-04:00",
    "display_name": "State tax 9%",
    "id": "3f8c2d1e-9a4b-4c5d-8e6f-0a1b2c3d4e5f",
    "market_id": "9a1f2c3d-4e5f-6789-abcd-ef0123456789",
    "name": "State tax",
    "rate": "9",
    "tax_class_id": "4e2b8c1a-7f3d-4a5b-9c6d-1e0f2a3b4c5d",
    "tax_class_name": "Reduced rate",
    "tax_zone_id": "7c9e4f2b-1a3d-4e5f-8b6c-2d0e1f3a4b5c",
    "tax_zone_name": "California",
    "updated_at": "2026-06-09T12:00:00-04:00",
    "version": "2026-07-15T12:00:00.123456Z"
  }
}
```

## Tax rate deleted

Event: `tax_rates/delete` · App scope: `read_markets` · Staff permission: `markets:write`

Subscribe to remove a deleted tax rate line from your integration. The payload keeps the ids and last known name needed to identify it.

```json
{
  "tax_rate": {
    "id": "3f8c2d1e-9a4b-4c5d-8e6f-0a1b2c3d4e5f",
    "market_id": "9a1f2c3d-4e5f-6789-abcd-ef0123456789",
    "name": "State tax",
    "tax_class_id": "4e2b8c1a-7f3d-4a5b-9c6d-1e0f2a3b4c5d",
    "tax_zone_id": "7c9e4f2b-1a3d-4e5f-8b6c-2d0e1f3a4b5c"
  }
}
```

