Aller au contenu
Ressource · Billing

Products

A product is a good or a service with the sale and purchase details used on invoices.

products:readproducts:write
MéthodeCheminRésumé
GET…/productsList products in the workspace catalog
POST…/productsCreate a product
PATCH…/products/{productId}Update a product
DELETE…/products/{productId}Soft-delete (archive) a product
POST…/products/{productId}/restoreRestore a previously deleted product

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

L’objet Product

firestoreIdstringobligatoire

ID of the product.

workspaceIdstringobligatoire

ID of the workspace.

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.

activationobjectobligatoire

Whether the resource is enabled, and when and by whom it was last enabled or disabled.

Afficher les 3 champs enfants
enabledbooleanobligatoire

Whether the resource is enabled.

updateDateTimestringdate-timeobligatoire

Date and time when enabled was last set.

updatedBystring

ID of the user who last set enabled, when recorded.

codestringobligatoire
nameobjectobligatoire
Afficher 1 champ enfant
defaultstringobligatoire

Text in the default language.

unitobject
Afficher 1 champ enfant
defaultstringobligatoire

Text in the default language.

Afficher les 21 champs
purchaseNameobject
Afficher 1 champ enfant
defaultstringobligatoire

Text in the default language.

purchaseCurrencystring

ISO 4217 currency code

purchaseMilliAmountnumber
purchaseDescriptionobject
Afficher 1 champ enfant
defaultstringobligatoire

Text in the default language.

purchaseAccountstring

Code of an account in the chart of accounts.

purchaseTaxTypeIdstring

ID of the tax type.

saleNameobject
Afficher 1 champ enfant
defaultstringobligatoire

Text in the default language.

saleCurrencystring

ISO 4217 currency code

saleMilliAmountnumber
saleDescriptionobject
Afficher 1 champ enfant
defaultstringobligatoire

Text in the default language.

saleAccountstring

Code of an account in the chart of accounts.

saleTaxTypeIdstring

ID of the tax type.

supplierReferencesobject[]obligatoire
Afficher les 3 champs enfants
counterpartyIdstring

ID of the counterparty.

codestring
namestring
tagsstring[]obligatoire
L’objet Product
{
  "firestoreId": "Pr4wJ8tM1xNq6zRb3vKf",
  "workspaceId": "Wk7fQ2xR9bLm4tZp8sNv",
  "creation": {
    "creationDateTime": "2026-03-02T09:15:00.000Z",
    "createdBy": "Xq3vT9mB2kLpR7sN4wYc8dZf1aHj"
  },
  "activation": {
    "enabled": true,
    "updateDateTime": "2026-03-02T09:15:00.000Z",
    "updatedBy": "Xq3vT9mB2kLpR7sN4wYc8dZf1aHj"
  },
  "code": "string",
  "name": {
    "default": "string"
  },
  "unit": {
    "default": "string"
  },
  "purchaseName": {
    "default": "string"
  },
  "purchaseCurrency": "CHF",
  "purchaseMilliAmount": 0,
  "purchaseDescription": {
    "default": "string"
  },
  "purchaseAccount": "1020",
  "purchaseTaxTypeId": "Tt9mC5rL2wQz7nVb4kHp",
  "saleName": {
    "default": "string"
  },
  "saleCurrency": "CHF",
  "saleMilliAmount": 0,
  "saleDescription": {
    "default": "string"
  },
  "saleAccount": "1020",
  "saleTaxTypeId": "Tt9mC5rL2wQz7nVb4kHp",
  "supplierReferences": [
    {
      "counterpartyId": "Cp2nG7vB4xLq9wRt5hMz",
      "code": "string",
      "name": "string"
    }
  ],
  "tags": [
    "string"
  ]
}
GET/workspaces/{workspaceId}/products

List products in the workspace catalog

Portéeproducts: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.

activation.enabledboolean

Whether the resource is enabled.

Renvoie

200

List of items

dataProduct[]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/products' \
  -H "Authorization: Bearer $SWAY_API_KEY"
{
  "data": [
    {
      "firestoreId": "Pr4wJ8tM1xNq6zRb3vKf",
      "workspaceId": "Wk7fQ2xR9bLm4tZp8sNv",
      "creation": {
        "creationDateTime": "2026-03-02T09:15:00.000Z",
        "createdBy": "Xq3vT9mB2kLpR7sN4wYc8dZf1aHj"
      },
      "activation": {
        "enabled": true,
        "updateDateTime": "2026-03-02T09:15:00.000Z",
        "updatedBy": "Xq3vT9mB2kLpR7sN4wYc8dZf1aHj"
      },
      "code": "string",
      "name": {
        "default": "string"
      },
      "unit": {
        "default": "string"
      },
      "purchaseName": {
        "default": "string"
      },
      "purchaseCurrency": "CHF",
      "purchaseMilliAmount": 0,
      "purchaseDescription": {
        "default": "string"
      },
      "purchaseAccount": "1020",
      "purchaseTaxTypeId": "Tt9mC5rL2wQz7nVb4kHp",
      "saleName": {
        "default": "string"
      },
      "saleCurrency": "CHF",
      "saleMilliAmount": 0,
      "saleDescription": {
        "default": "string"
      },
      "saleAccount": "1020",
      "saleTaxTypeId": "Tt9mC5rL2wQz7nVb4kHp",
      "supplierReferences": […],
      "tags": [
        "string"
      ]
    }
  ],
  "limit": 0,
  "nextCursor": "string"
}
POST/workspaces/{workspaceId}/products

Create a product

Portéeproducts: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

codestringobligatoire
nameobjectobligatoire
Afficher 1 champ enfant
defaultstringobligatoire

Text in the default language.

unitobject
Afficher 1 champ enfant
defaultstringobligatoire

Text in the default language.

purchaseNameobject
Afficher 1 champ enfant
defaultstringobligatoire

Text in the default language.

purchaseCurrencystring

ISO 4217 currency code

purchaseMilliAmountnumber
purchaseDescriptionobject
Afficher 1 champ enfant
defaultstringobligatoire

Text in the default language.

purchaseAccountstring

Code of an account in the chart of accounts.

purchaseTaxTypeIdstring

ID of the tax type.

saleNameobject
Afficher 1 champ enfant
defaultstringobligatoire

Text in the default language.

saleCurrencystring

ISO 4217 currency code

saleMilliAmountnumber
saleDescriptionobject
Afficher 1 champ enfant
defaultstringobligatoire

Text in the default language.

saleAccountstring

Code of an account in the chart of accounts.

saleTaxTypeIdstring

ID of the tax type.

supplierReferencesobject[]

Par défaut[]

Afficher les 3 champs enfants
counterpartyIdstring

ID of the counterparty.

codestring
namestring
tagsstring[]

Par défaut[]

Renvoie

200

Successful response

dataProductobligatoire
curl -X POST 'https://api.business.swayapp.io/v1/workspaces/Wk7fQ2xR9bLm4tZp8sNv/products' \
  -H "Authorization: Bearer $SWAY_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{
  "code": "string",
  "name": {
    "default": "string"
  },
  "unit": {
    "default": "string"
  },
  "purchaseName": {
    "default": "string"
  },
  "purchaseCurrency": "CHF",
  "purchaseMilliAmount": 0,
  "purchaseDescription": {
    "default": "string"
  },
  "purchaseAccount": "1020",
  "purchaseTaxTypeId": "Tt9mC5rL2wQz7nVb4kHp",
  "saleName": {
    "default": "string"
  },
  "saleCurrency": "CHF",
  "saleMilliAmount": 0,
  "saleDescription": {
    "default": "string"
  },
  "saleAccount": "1020",
  "saleTaxTypeId": "Tt9mC5rL2wQz7nVb4kHp",
  "supplierReferences": [],
  "tags": []
}'
{
  "data": {
    "firestoreId": "Pr4wJ8tM1xNq6zRb3vKf",
    "workspaceId": "Wk7fQ2xR9bLm4tZp8sNv",
    "creation": {
      "creationDateTime": "2026-03-02T09:15:00.000Z",
      "createdBy": "Xq3vT9mB2kLpR7sN4wYc8dZf1aHj"
    },
    "activation": {
      "enabled": true,
      "updateDateTime": "2026-03-02T09:15:00.000Z",
      "updatedBy": "Xq3vT9mB2kLpR7sN4wYc8dZf1aHj"
    },
    "code": "string",
    "name": {
      "default": "string"
    },
    "unit": {
      "default": "string"
    },
    "purchaseName": {
      "default": "string"
    },
    "purchaseCurrency": "CHF",
    "purchaseMilliAmount": 0,
    "purchaseDescription": {
      "default": "string"
    },
    "purchaseAccount": "1020",
    "purchaseTaxTypeId": "Tt9mC5rL2wQz7nVb4kHp",
    "saleName": {
      "default": "string"
    },
    "saleCurrency": "CHF",
    "saleMilliAmount": 0,
    "saleDescription": {
      "default": "string"
    },
    "saleAccount": "1020",
    "saleTaxTypeId": "Tt9mC5rL2wQz7nVb4kHp",
    "supplierReferences": […],
    "tags": [
      "string"
    ]
  }
}
PATCH/workspaces/{workspaceId}/products/{productId}

Update a product

Portéeproducts:write

Paramètres de chemin

workspaceIdstringobligatoire

ID of the workspace.

productIdstringobligatoire

ID of the product.

Corps de la requête

codestring
nameobject
Afficher 1 champ enfant
defaultstringobligatoire

Text in the default language.

unitobject | null
Afficher 1 champ enfant
defaultstringobligatoire

Text in the default language.

purchaseNameobject | null
Afficher 1 champ enfant
defaultstringobligatoire

Text in the default language.

purchaseCurrencystring | null

ISO 4217 currency code

purchaseMilliAmountnumber | null
purchaseDescriptionobject | null
Afficher 1 champ enfant
defaultstringobligatoire

Text in the default language.

purchaseAccountstring | null

Code of an account in the chart of accounts.

purchaseTaxTypeIdstring | null

ID of the tax type.

saleNameobject | null
Afficher 1 champ enfant
defaultstringobligatoire

Text in the default language.

saleCurrencystring | null

ISO 4217 currency code

saleMilliAmountnumber | null
saleDescriptionobject | null
Afficher 1 champ enfant
defaultstringobligatoire

Text in the default language.

saleAccountstring | null

Code of an account in the chart of accounts.

saleTaxTypeIdstring | null

ID of the tax type.

supplierReferencesobject[]
Afficher les 3 champs enfants
counterpartyIdstring

ID of the counterparty.

codestring
namestring
tagsstring[]

Renvoie

204

No content

curl -X PATCH 'https://api.business.swayapp.io/v1/workspaces/Wk7fQ2xR9bLm4tZp8sNv/products/Pr4wJ8tM1xNq6zRb3vKf' \
  -H "Authorization: Bearer $SWAY_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{
  "purchaseCurrency": "CHF",
  "purchaseAccount": "1020",
  "purchaseTaxTypeId": "Tt9mC5rL2wQz7nVb4kHp",
  "saleCurrency": "CHF",
  "saleAccount": "1020",
  "saleTaxTypeId": "Tt9mC5rL2wQz7nVb4kHp",
  "supplierReferences": [
    {
      "counterpartyId": "Cp2nG7vB4xLq9wRt5hMz"
    }
  ]
}'
{
  "error": {
    "code": "invalid-argument",
    "message": "Invalid request"
  }
}
DELETE/workspaces/{workspaceId}/products/{productId}

Soft-delete (archive) a product

Portéeproducts:write

Paramètres de chemin

workspaceIdstringobligatoire

ID of the workspace.

productIdstringobligatoire

ID of the product.

Renvoie

204

No content

curl -X DELETE 'https://api.business.swayapp.io/v1/workspaces/Wk7fQ2xR9bLm4tZp8sNv/products/Pr4wJ8tM1xNq6zRb3vKf' \
  -H "Authorization: Bearer $SWAY_API_KEY"
{
  "error": {
    "code": "invalid-argument",
    "message": "Invalid request"
  }
}
POST/workspaces/{workspaceId}/products/{productId}/restore

Restore a previously deleted product

Portéeproducts:write

Paramètres de chemin

workspaceIdstringobligatoire

ID of the workspace.

productIdstringobligatoire

ID of the product.

Renvoie

204

No content

curl -X POST 'https://api.business.swayapp.io/v1/workspaces/Wk7fQ2xR9bLm4tZp8sNv/products/Pr4wJ8tM1xNq6zRb3vKf/restore' \
  -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.