Zum Inhalt springen
Ressource · Billing

Products

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

products:readproducts:write
MethodePfadZusammenfassung
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

Die Pfade beginnen mit /workspaces/{workspaceId}. GET-Endpunkte brauchen products:read, die übrigen products:write.

Das Objekt Product

firestoreIdstringerforderlich

ID of the product.

workspaceIdstringerforderlich

ID of the workspace.

creationobjecterforderlich

When and by whom the resource was created.

2 untergeordnete Felder anzeigen
creationDateTimestringdate-timeerforderlich

Date and time when the resource was created.

createdBystring

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

activationobjecterforderlich

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

3 untergeordnete Felder anzeigen
enabledbooleanerforderlich

Whether the resource is enabled.

updateDateTimestringdate-timeerforderlich

Date and time when enabled was last set.

updatedBystring

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

codestringerforderlich
nameobjecterforderlich
1 untergeordnetes Feld anzeigen
defaultstringerforderlich

Text in the default language.

unitobject
1 untergeordnetes Feld anzeigen
defaultstringerforderlich

Text in the default language.

Alle 21 Felder anzeigen
purchaseNameobject
1 untergeordnetes Feld anzeigen
defaultstringerforderlich

Text in the default language.

purchaseCurrencystring

ISO 4217 currency code

purchaseMilliAmountnumber
purchaseDescriptionobject
1 untergeordnetes Feld anzeigen
defaultstringerforderlich

Text in the default language.

purchaseAccountstring

Code of an account in the chart of accounts.

purchaseTaxTypeIdstring

ID of the tax type.

saleNameobject
1 untergeordnetes Feld anzeigen
defaultstringerforderlich

Text in the default language.

saleCurrencystring

ISO 4217 currency code

saleMilliAmountnumber
saleDescriptionobject
1 untergeordnetes Feld anzeigen
defaultstringerforderlich

Text in the default language.

saleAccountstring

Code of an account in the chart of accounts.

saleTaxTypeIdstring

ID of the tax type.

supplierReferencesobject[]erforderlich
3 untergeordnete Felder anzeigen
counterpartyIdstring

ID of the counterparty.

codestring
namestring
tagsstring[]erforderlich
Das Objekt 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

Bereichproducts:read

Pfadparameter

workspaceIdstringerforderlich

ID of the workspace.

Abfrageparameter

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.

Standard20

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.

Rückgabe

200

List of items

dataProduct[]erforderlich

Items of the page, in list order.

limitintegererforderlich

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

Bereichproducts:write

Pfadparameter

workspaceIdstringerforderlich

ID of the workspace.

Abfrageparameter

fieldsstring

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

Request-Body

codestringerforderlich
nameobjecterforderlich
1 untergeordnetes Feld anzeigen
defaultstringerforderlich

Text in the default language.

unitobject
1 untergeordnetes Feld anzeigen
defaultstringerforderlich

Text in the default language.

purchaseNameobject
1 untergeordnetes Feld anzeigen
defaultstringerforderlich

Text in the default language.

purchaseCurrencystring

ISO 4217 currency code

purchaseMilliAmountnumber
purchaseDescriptionobject
1 untergeordnetes Feld anzeigen
defaultstringerforderlich

Text in the default language.

purchaseAccountstring

Code of an account in the chart of accounts.

purchaseTaxTypeIdstring

ID of the tax type.

saleNameobject
1 untergeordnetes Feld anzeigen
defaultstringerforderlich

Text in the default language.

saleCurrencystring

ISO 4217 currency code

saleMilliAmountnumber
saleDescriptionobject
1 untergeordnetes Feld anzeigen
defaultstringerforderlich

Text in the default language.

saleAccountstring

Code of an account in the chart of accounts.

saleTaxTypeIdstring

ID of the tax type.

supplierReferencesobject[]

Standard[]

3 untergeordnete Felder anzeigen
counterpartyIdstring

ID of the counterparty.

codestring
namestring
tagsstring[]

Standard[]

Rückgabe

200

Successful response

dataProducterforderlich
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

Bereichproducts:write

Pfadparameter

workspaceIdstringerforderlich

ID of the workspace.

productIdstringerforderlich

ID of the product.

Request-Body

codestring
nameobject
1 untergeordnetes Feld anzeigen
defaultstringerforderlich

Text in the default language.

unitobject | null
1 untergeordnetes Feld anzeigen
defaultstringerforderlich

Text in the default language.

purchaseNameobject | null
1 untergeordnetes Feld anzeigen
defaultstringerforderlich

Text in the default language.

purchaseCurrencystring | null

ISO 4217 currency code

purchaseMilliAmountnumber | null
purchaseDescriptionobject | null
1 untergeordnetes Feld anzeigen
defaultstringerforderlich

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
1 untergeordnetes Feld anzeigen
defaultstringerforderlich

Text in the default language.

saleCurrencystring | null

ISO 4217 currency code

saleMilliAmountnumber | null
saleDescriptionobject | null
1 untergeordnetes Feld anzeigen
defaultstringerforderlich

Text in the default language.

saleAccountstring | null

Code of an account in the chart of accounts.

saleTaxTypeIdstring | null

ID of the tax type.

supplierReferencesobject[]
3 untergeordnete Felder anzeigen
counterpartyIdstring

ID of the counterparty.

codestring
namestring
tagsstring[]

Rückgabe

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

Bereichproducts:write

Pfadparameter

workspaceIdstringerforderlich

ID of the workspace.

productIdstringerforderlich

ID of the product.

Rückgabe

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

Bereichproducts:write

Pfadparameter

workspaceIdstringerforderlich

ID of the workspace.

productIdstringerforderlich

ID of the product.

Rückgabe

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"
  }
}

Bauen Sie auf Ihren eigenen Daten.

Erstellen Sie ein Konto, öffnen Sie Profil › Entwickler und erstellen Sie einen Schlüssel, der auf die nötigen Ressourcen begrenzt ist. Fragen zu einer Integration? Das Team beantwortet sie in einem Gespräch.