Exporting accounting data

Get your purchase and bank journals out of Spendesk, and tell Spendesk what you exported so nothing is exported twice.

Once payables have been prepared in Spendesk, their accounting entries need to reach your accounting software or ERP. There are two ways to do it through the API:

  • Option A — export journals: Spendesk generates your purchase and bank journals as CSV files, using your journal templates;
  • Option B — build your own export: you read the prepared payables and write them to your system yourself.

In both cases, you then tell Spendesk what was exported, so that the same entries are not exported twice.

📘

Experimental

These endpoints use experimental:* scopes. Request access to experimental features from your CSM or by email at [email protected].

Prerequisites

To…Scope
Export journals (option A)experimental:accounting-export:read
Read prepared payables (option B)payable:read (snapshots) or experimental:payable-search:read
Mark payables and settlements exportedexperimental:accounting:update

Only prepared payables are exported: payables still waiting to be prepared by an accountant are left out.

Option A — export journals

1. List the journal templates

GET /v1/experimental/journals/templates returns the templates available to the company, each with an id, a name and a type (purchase or bank). Templates are created and edited in the Spendesk app by a Controller, in Settings → Accounting → Export.

curl --request GET \
     --url https://public-api.spendesk.com/v1/experimental/journals/templates \
     --header 'accept: application/json' \
     --header 'authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.masked'

2. Start the export

POST /v1/experimental/journals starts generating the journals for a period and returns a key right away — the files are generated asynchronously.

curl --request POST \
     --url https://public-api.spendesk.com/v1/experimental/journals \
     --header 'accept: application/json' \
     --header 'authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.masked' \
     --header 'content-type: application/json' \
     --data '{
  "from": "2026-09-01",
  "to": "2026-09-30",
  "templates": {
    "purchaseJournalTemplateId": "<purchase template id>",
    "bankJournalTemplateId": "<bank template id>"
  },
  "userLanguage": "en-GB",
  "includeAlreadyExportedPayables": false,
  "markEntriesAsExported": false
}'
  • from and to (yyyy-MM-dd, required) - the period, 31 days at most;
  • templates - the purchase and bank journal templates to use. When omitted, Spendesk uses its default template for the company's accounting software (e.g. Sage 100, Cegid, Datev);
  • userLanguage - en-GB (default), fr or de;
  • includeAlreadyExportedPayables - also include payables already exported (default false);
  • markEntriesAsExported - mark the exported entries as exported in Spendesk (default false). With false, the export is a preview: you get the files and nothing changes in Spendesk. With true, the entries are marked when the export is created, before you download the files.
{
  "query": { "from": "2026-09-01", "to": "2026-09-30", "…": "…" },
  "key": "3fa85f64-5717-4562-b3fc-2c963f66afa6"
}

3. Download each journal

Both journals — purchase and bank — are generated for each export. Download them with GET /v1/experimental/journals/{key} and journalType=purchase or journalType=bank; the response is the CSV file.

curl --request GET \
     --url 'https://public-api.spendesk.com/v1/experimental/journals/3fa85f64-5717-4562-b3fc-2c963f66afa6?journalType=purchase' \
     --header 'accept: text/csv' \
     --header 'authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.masked'
ResponseMeaning
200The CSV file.
409The journal export is still in progress — retry a little later.
404No export matches this key.

Generated journals are cached for 24 hours.

4. Mark what you exported

If you did not set markEntriesAsExported: true, tell Spendesk what you imported once your accounting software has accepted the files — see Tell Spendesk what you exported. Exporting with markEntriesAsExported: true does it for you in one step, but also marks entries that your system may later reject.

🚧

Companies with a native accounting integration

Journal export works whether or not the company also uses a native accounting integration (e.g. NetSuite): the two flows are independent but share the same bookkeeping status. With includeAlreadyExportedPayables: false, the files only contain entries the native integration has not exported yet. Conversely, entries marked as exported through the API are excluded from later native exports — if the company relies on its native integration to manage its exports, keep markEntriesAsExported: false.

Option B — build your own export

  1. Retrieve the prepared payables with a snapshot of payables filtered on "bookkeepingStatus": ["prepared"] — see Retrieving Spend Data — or with Search payables.
  2. Write them to your accounting software, using the accounting information prepared on each payable (accounts, tax codes, analytical fields…).
  3. Tell Spendesk what you exported, as below.

Tell Spendesk what you exported

Each item needs its current version (returned with the payable or settlement), and each call takes up to 50 items.

curl --request PUT \
     --url https://public-api.spendesk.com/v1/payables/bookkeeping-status \
     --header 'accept: application/json' \
     --header 'authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.masked' \
     --header 'content-type: application/json' \
     --data '{
  "payables": [
    { "id": "bc9cef35-401d-4ea4-b384-ed725e6685cf", "version": 3, "status": "exportedManually" },
    { "id": "5d1f0a2e-7b6c-4e3d-9f8a-2b1c0d9e8f7a", "version": 2, "status": "failedExport", "message": "Unknown account 6064 in the ERP" }
  ]
}'

When only some items could be updated, the response is 207 Multi-Status: check the outcome of each item — see Error Handling.

Check what has been exported

GET /v1/experimental/integrations/export-status returns the IDs of the entities that are exported or notExported over a period of up to one year, for one entityType: payable, settlementAllocation, walletLoad or bankFee.

curl --request GET \
     --url 'https://public-api.spendesk.com/v1/experimental/integrations/export-status?entityType=payable&status=notExported&from=2026-09-01T00:00:00Z&to=2026-09-30T23:59:59Z' \
     --header 'accept: application/json' \
     --header 'authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.masked'

Use it to reconcile your system with Spendesk, or to find entries still to export. Export status data is cached for 24 hours.

Going further

The chart of accounts (experimental:chart-of-accounts:*) and external references (experimental:external-reference:*) let an integration keep Spendesk's accounting setup in sync with your ERP — see Scopes and the Accounting and Accounts sections of the API reference.