# Preview tax on a basket (writes nothing)

`POST /api/v1/tax-rates/calculate`

Needs the `catalog:read` scope, or a full-access key.

## Request body

JSON Schema:

```json
{
  "type": "object",
  "properties": {
    "customer_id": {
      "type": "string",
      "format": "uuid",
      "example": "3fa85f64-5717-4562-b3fc-2c963f66afa6"
    },
    "currency": {
      "type": "string",
      "enum": [
        "USD",
        "AUD",
        "CAD",
        "GBP",
        "EUR",
        "INR",
        "NPR"
      ],
      "example": "USD"
    },
    "lines": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "description": {
            "type": "string"
          },
          "amount_cents": {
            "type": "string",
            "pattern": "^-?\\d+$",
            "description": "Line amount.",
            "example": "-1500"
          },
          "discount_cents": {
            "type": "string",
            "pattern": "^\\d+$",
            "description": "Pre-tax discount on this line.",
            "example": "1999"
          },
          "taxable": {
            "type": "boolean"
          }
        },
        "required": [
          "description",
          "amount_cents"
        ]
      }
    }
  },
  "required": [
    "customer_id",
    "currency",
    "lines"
  ]
}
```

## Responses

### 200

Per-line tax, tax lines and totals.

JSON Schema:

```json
{
  "type": "object",
  "properties": {
    "data": {
      "type": "object",
      "properties": {
        "rate": {
          "type": [
            "object",
            "null"
          ],
          "properties": {
            "id": {
              "type": "string",
              "format": "uuid",
              "example": "3fa85f64-5717-4562-b3fc-2c963f66afa6"
            },
            "name": {
              "type": "string"
            },
            "percentage": {
              "type": "string"
            }
          },
          "required": [
            "id",
            "name",
            "percentage"
          ]
        },
        "lines": {
          "type": "array",
          "items": {
            "type": "object",
            "additionalProperties": {}
          }
        },
        "tax_lines": {
          "type": "array",
          "items": {
            "type": "object",
            "additionalProperties": {}
          }
        },
        "totals": {
          "type": "object",
          "properties": {
            "currency": {
              "type": "string",
              "enum": [
                "USD",
                "AUD",
                "CAD",
                "GBP",
                "EUR",
                "INR",
                "NPR"
              ],
              "example": "USD"
            },
            "subtotal_cents": {
              "type": "string",
              "pattern": "^-?\\d+$",
              "description": "Discounted subtotal.",
              "example": "-1500"
            },
            "inclusive_tax_cents": {
              "type": "string",
              "pattern": "^-?\\d+$",
              "description": "Tax inside the prices.",
              "example": "-1500"
            },
            "exclusive_tax_cents": {
              "type": "string",
              "pattern": "^-?\\d+$",
              "description": "Tax added on top.",
              "example": "-1500"
            },
            "tax_cents": {
              "type": "string",
              "pattern": "^-?\\d+$",
              "description": "All tax.",
              "example": "-1500"
            },
            "total_cents": {
              "type": "string",
              "pattern": "^-?\\d+$",
              "description": "subtotal + exclusive tax.",
              "example": "-1500"
            }
          },
          "required": [
            "currency",
            "subtotal_cents",
            "inclusive_tax_cents",
            "exclusive_tax_cents",
            "tax_cents",
            "total_cents"
          ]
        },
        "reverse_charge": {
          "type": "boolean"
        },
        "notes": {
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      },
      "required": [
        "rate",
        "lines",
        "tax_lines",
        "totals",
        "reverse_charge",
        "notes"
      ]
    },
    "_agent": {
      "type": "object",
      "properties": {
        "summary": {
          "type": "string"
        },
        "status": {
          "type": "string",
          "enum": [
            "ok"
          ]
        },
        "next_actions": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "warnings": {
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      },
      "required": [
        "summary",
        "status",
        "next_actions",
        "warnings"
      ]
    },
    "api_version": {
      "type": "string",
      "example": "2026-07-01"
    }
  },
  "required": [
    "data",
    "_agent",
    "api_version"
  ]
}
```
