Aller au contenu
Ressource · Accounting

Tax types

A tax type sets a tax rate and the accounts that book the tax.

tax-types:readtax-types:write
MéthodeCheminRésumé
GET…/tax-typesList tax types in the workspace
POST…/tax-typesCreate a tax type
PATCH…/tax-types/{taxTypeId}Update a tax type
DELETE…/tax-types/{taxTypeId}Delete a tax type

Les chemins commencent par /workspaces/{workspaceId}. Les endpoints GET demandent tax-types:read, les autres tax-types:write.

L’objet TaxType

firestoreIdstringobligatoire

ID of the tax type.

workspaceIdstringobligatoire

ID of the workspace.

namestringobligatoire
descriptionstring
ratenumberobligatoire
externalIdstringobligatoire
codestring
Afficher les 10 champs
ledgerAccountstring
milliRoundingFactornumber
creationobjectobligatoire

When and by whom the resource was created.

Afficher les 2 champs enfants
creationDateTimestringdate-timeobligatoire

Date and time when the resource was created.

createdBystring

ID of the user who created the resource, when recorded.

L’objet TaxType
{
  "firestoreId": "Tt9mC5rL2wQz7nVb4kHp",
  "workspaceId": "Wk7fQ2xR9bLm4tZp8sNv",
  "name": "string",
  "description": "string",
  "rate": 0,
  "externalId": "string",
  "code": "string",
  "ledgerAccount": "string",
  "milliRoundingFactor": 0,
  "creation": {
    "creationDateTime": "2026-03-02T09:15:00.000Z",
    "createdBy": "Xq3vT9mB2kLpR7sN4wYc8dZf1aHj"
  }
}
GET/workspaces/{workspaceId}/tax-types

List tax types in the workspace

Portéetax-types:read

Paramètres de chemin

workspaceIdstringobligatoire

ID of the workspace.

Paramètres de requête

limitinteger

Maximum number of items to return, from 1 to 100. A missing, invalid or non-positive value falls back to 20, and a larger value to 100.

Par défaut20

startAfterstring

Cursor of the page to return: the nextCursor of the previous page.

fieldsstring

Comma-separated property paths to include in the response, or in each item of a list. Use dots for nested paths.

idsstring[]

Comma-separated IDs of the items to return, up to 30. When set, limit, startAfter and the filters are ignored.

Renvoie

200

List of items

dataTaxType[]obligatoire

Items of the page, in list order.

limitintegerobligatoire

Page size of the request, or the number of requested ids.

nextCursorstring

Cursor of the next page, to pass as startAfter. Absent when the page holds fewer items than limit; a full last page still has one, and the page it points to is empty.

curl 'https://api.business.swayapp.io/v1/workspaces/Wk7fQ2xR9bLm4tZp8sNv/tax-types' \
  -H "Authorization: Bearer $SWAY_API_KEY"
{
  "data": [
    {
      "firestoreId": "Tt9mC5rL2wQz7nVb4kHp",
      "workspaceId": "Wk7fQ2xR9bLm4tZp8sNv",
      "name": "string",
      "description": "string",
      "rate": 0,
      "externalId": "string",
      "code": "string",
      "ledgerAccount": "string",
      "milliRoundingFactor": 0,
      "creation": {
        "creationDateTime": "2026-03-02T09:15:00.000Z",
        "createdBy": "Xq3vT9mB2kLpR7sN4wYc8dZf1aHj"
      }
    }
  ],
  "limit": 0,
  "nextCursor": "string"
}
POST/workspaces/{workspaceId}/tax-types

Create a tax type

Portéetax-types:write

Paramètres de chemin

workspaceIdstringobligatoire

ID of the workspace.

Paramètres de requête

fieldsstring

Comma-separated property paths to include in the response, or in each item of a list. Use dots for nested paths.

Corps de la requête

namestringobligatoire
descriptionstring
ratenumberobligatoire
externalIdstringobligatoire
codestring
ledgerAccountstring
milliRoundingFactornumber

Renvoie

200

Successful response

dataTaxTypeobligatoire
curl -X POST 'https://api.business.swayapp.io/v1/workspaces/Wk7fQ2xR9bLm4tZp8sNv/tax-types' \
  -H "Authorization: Bearer $SWAY_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{
  "name": "string",
  "description": "string",
  "rate": 0,
  "externalId": "string",
  "code": "string",
  "ledgerAccount": "string",
  "milliRoundingFactor": 0
}'
{
  "data": {
    "firestoreId": "Tt9mC5rL2wQz7nVb4kHp",
    "workspaceId": "Wk7fQ2xR9bLm4tZp8sNv",
    "name": "string",
    "description": "string",
    "rate": 0,
    "externalId": "string",
    "code": "string",
    "ledgerAccount": "string",
    "milliRoundingFactor": 0,
    "creation": {
      "creationDateTime": "2026-03-02T09:15:00.000Z",
      "createdBy": "Xq3vT9mB2kLpR7sN4wYc8dZf1aHj"
    }
  }
}
PATCH/workspaces/{workspaceId}/tax-types/{taxTypeId}

Update a tax type

Portéetax-types:write

Paramètres de chemin

workspaceIdstringobligatoire

ID of the workspace.

taxTypeIdstringobligatoire

ID of the tax type.

Corps de la requête

namestring
descriptionstring | null
ratenumber
externalIdstring
codestring | null
ledgerAccountstring | null
milliRoundingFactornumber | null

Renvoie

204

No content

curl -X PATCH 'https://api.business.swayapp.io/v1/workspaces/Wk7fQ2xR9bLm4tZp8sNv/tax-types/Tt9mC5rL2wQz7nVb4kHp' \
  -H "Authorization: Bearer $SWAY_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{
  "name": "string",
  "description": "string",
  "rate": 0,
  "externalId": "string",
  "code": "string",
  "ledgerAccount": "string",
  "milliRoundingFactor": 0
}'
{
  "error": {
    "code": "invalid-argument",
    "message": "Invalid request"
  }
}
DELETE/workspaces/{workspaceId}/tax-types/{taxTypeId}

Delete a tax type

Portéetax-types:write

Paramètres de chemin

workspaceIdstringobligatoire

ID of the workspace.

taxTypeIdstringobligatoire

ID of the tax type.

Renvoie

204

No content

curl -X DELETE 'https://api.business.swayapp.io/v1/workspaces/Wk7fQ2xR9bLm4tZp8sNv/tax-types/Tt9mC5rL2wQz7nVb4kHp' \
  -H "Authorization: Bearer $SWAY_API_KEY"
{
  "error": {
    "code": "invalid-argument",
    "message": "Invalid request"
  }
}

Construisez sur vos propres données.

Créez un compte, ouvrez Profil › Développeur et créez une clé limitée aux ressources dont vous avez besoin. Une question sur une intégration ? L’équipe y répond lors d’un appel.