Update workspace GST settings
/firm-partners/workspace/workspace/gst-settingsUpdates one or more GST settings on the workspace.
A partial update — send only what you want to change, but send at least one field. The body is strict: an unrecognised key is rejected rather than ignored. `filingFrequency` and `accountingBasis` are matched case-insensitively. This route additionally requires the consenting user to hold the `manage_settings` permission in the workspace, and returns 403 when they do not.
Headers
count-workspace-iduuidrequiredUUID 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
enabledbooleanWhether GST is enabled for the workspace.
irdNumberstringIRD number, 50 characters or fewer. Never validated for format. Pass an empty string or null to clear it.
filingFrequencyenumHow often the workspace files a GST return.
One of: monthly, 2-monthly, 6-monthly
accountingBasisenumWhether GST is accounted for when invoiced or when paid. Cannot be changed once the workspace has filed a return.
One of: invoice, payments
Responses
200The full GST settings after the patch is applied.400Empty body, an unrecognised key, an invalid filingFrequency or accountingBasis, or an irdNumber over 50 characters.401Missing signing headers, an invalid HMAC signature, or a timestamp more than 5 minutes off. Troubleshoot403The consenting user does not hold the manage_settings permission in this workspace. Troubleshoot404No workspace exists with the `count-workspace-id` UUID.409The GST accounting basis cannot be changed once returns have been filed — filed periods were snapshotted on the previous basis.429Rate limit exceeded (100 requests per minute per firm user of each app, or 10,000 per minute per app). Troubleshoothttps://api.getcount.com/firm-partners/workspace/workspace/gst-settingsimport 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 = 'PATCH';
const signingPath = '/workspace/workspace/gst-settings';
const timestamp = Math.floor(Date.now() / 1000).toString();
const body = {
"enabled": true,
"filingFrequency": "2-monthly",
"accountingBasis": "invoice",
"irdNumber": "123-456-789"
};
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/workspace/gst-settings`, {
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());{
"status": "success",
"message": "Workspace GST settings updated successfully.",
"data": {
"gstSettings": {
"enabled": true,
"irdNumber": "123-456-789",
"filingFrequency": "2-monthly",
"accountingBasis": "invoice",
"taxRegime": "NZ_GST",
"accountingBasisLocked": false
}
}
}