TaxesCreate a tax code

Create a tax code

POST/firm-partners/workspace/taxes

Creates a tax code and its liability account.

The code is created enabled and editable. COUNT also creates its `Tax: <name>` liability account; in a US workspace the account sits under the shared Sales Tax Payable parent, which is created the first time it is needed.

HMAC signature only

Headers

count-workspace-iduuidrequired

UUID of the client workspace to act on. It must be one of your firm's client workspaces (or the firm's own workspace) and within the API key's client workspaces.

Request body

namestringrequired

Display name, up to 255 characters.

percentagestringrequired

Rate as a percentage, zero or more: a number (`12.5`) or an unsigned numeric string (`"12.5"`). Stored to four decimal places.

descriptionstring

Description, or null.

Responses

201The new tax code.
400Validation failed (missing name, or a negative or non-numeric percentage), or a tax code with this name and percentage already exists.
401Missing signing headers, an invalid HMAC signature, or a timestamp more than 5 minutes off. Troubleshoot
403The key is inactive or its scope does not allow this request, the workspace is not managed by your firm or is outside the key's client workspaces, the workspace has no active subscription, or it is portal-only and the route needs bookkeeping. Troubleshoot
404No workspace exists with the `count-workspace-id` UUID.
429Rate limit exceeded (100 requests per minute per firm user of each app, or 10,000 per minute per app). Troubleshoot
POSThttps://api.getcount.com/firm-partners/workspace/taxes
Request
import crypto from 'node:crypto';

const BASE_URL = 'https://api.getcount.com';
const CLIENT_ID = process.env.COUNT_CLIENT_ID;
const CLIENT_SECRET = process.env.COUNT_CLIENT_SECRET;

const method = 'POST';
const signingPath = '/workspace/taxes';
const timestamp = Math.floor(Date.now() / 1000).toString();
const body = {
  "name": "GST",
  "percentage": "15",
  "description": "Goods and services tax"
};
const bodyString = JSON.stringify(body);

const bodyHash = crypto.createHash('sha256').update(bodyString).digest('hex');
const baseString = `${method}:${signingPath}:${timestamp}:${bodyHash}`;
const signature = crypto.createHmac('sha256', CLIENT_SECRET).update(baseString).digest('hex');

const response = await fetch(`${BASE_URL}/firm-partners/workspace/taxes`, {
  method,
  headers: {
    'x-client-id': CLIENT_ID,
    'x-timestamp': timestamp,
    'x-signature': signature,
    'Content-Type': 'application/json',
    'count-workspace-id': '5e4d3c2b-1a09-4f8e-8d7c-6b5a49382716',
  },
  body: bodyString,
});

console.log(await response.json());
Response · 201
{
  "status": "success",
  "message": "Success on creating tax",
  "data": {
    "tax": {
      "id": "3f6c2a1e-8b4d-4e7a-9c2f-1d5e8a7b6c40",
      "name": "GST",
      "percentage": "15.0000",
      "type": "Sales Tax",
      "description": "Goods and services tax",
      "enabled": true,
      "editable": true,
      "systemCreated": false,
      "country": "NZ",
      "state": null,
      "county": null,
      "city": null,
      "zipCode": null,
      "locationCode": null
    }
  }
}