A supplier created in Spendesk is not in your ERP yet: create it there under the same name, refresh the accounting settings, and the native integration links the two — automatically, through the API.
When a supplier is created in Spendesk — at invoice review, or through the API — your ERP does not know it yet. On the native integrations that bring suppliers from the ERP into Spendesk, its invoices then cannot be exported: the export stops with "supplier not mapped", and asks you to create a supplier with the same name in the ERP, then to refresh the settings.
Through the API, an integration can do that for you, without anyone clicking in Spendesk:
| Step | Where | Endpoint |
|---|---|---|
| 1. Find the suppliers your ERP does not have yet | Spendesk | Get Suppliers |
| 2. Create each one in the ERP, under exactly the same name | Your ERP | Your ERP's own API |
| 3. Ask Spendesk to pull the ERP's suppliers again | Spendesk | Refresh accounting integration settings |
| 4. Check that the supplier is now linked to its ERP vendor | Spendesk | Get Supplier By Id |
The native integration stays in charge: it is its own supplier pull that links the two, and its own export that sends the invoice afterwards. Your integration only creates the vendor on the ERP side and triggers the pull.
Which integrations this applies toThe native integrations that pull suppliers from the ERP: NetSuite, Microsoft Dynamics 365 Business Central, Sage Intacct, Odoo, Exact Online and DATEV Rechnungswesen. Xero and QuickBooks work differently — their export creates the contact itself — so this page does not apply to them. For a company without a native integration, see Building an accounting integration.
Experimental
POST /v1/experimental/integrations/refresh-settingsis experimental: it may still change. Request access from your CSM or at [email protected] — see Getting access.
Before you start
Scopes
| To… | Scope |
|---|---|
| Read suppliers and their ERP IDs | supplier:read |
| Create suppliers in Spendesk (optional — only if your integration also creates them) | experimental:supplier:manage |
| Refresh the accounting settings | experimental:chart-of-accounts:write |
Who can refresh. The refresh is reserved to a Controller or an Account Owner of the company.
Several entities. With an organisation-level key, send the X-Company-Id header on every call to say which entity you act on — see Organisation-level access. Each entity has its own native integration and its own refresh.
1. Find the suppliers your ERP does not have yet
List the suppliers with their ERP IDs, by adding include=externalIds. A supplier the native integration has linked carries an entry in externalIds; one it has not linked has none.
curl --request GET \
--url 'https://public-api.spendesk.com/v1/suppliers?include=externalIds&isArchived=false&page=1&pageSize=30' \
--header 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.masked' \
--header 'accept: application/json'{
"data": [
{
"id": "04805c8v_6gqtm",
"name": "Atelier Boreal",
"legalName": "Atelier Boreal SAS",
"vatNo": "FR11123456782",
"isArchived": false,
"externalIds": []
},
{
"id": "dr4m07s9pfz3px",
"name": "Sterling Couriers",
"isArchived": false,
"externalIds": [
{
"externalId": "43c3fecf-f4c7-f111-a056-7ced8d6daac0",
"provider": "MicrosoftDynamics",
"source": "native_integration"
}
]
}
]
}Here Atelier Boreal is not in the ERP yet. Use its name — and, to fill the ERP record, its legalName, vatNo, address and bank details — in the next step. Results are paginated: see Pagination.
If your integration creates the supplier in Spendesk as well, use Create Supplier(s); it works on a company with a native integration.
2. Create the vendor in your ERP, under the same name
Create the vendor through your ERP's own API, with exactly the supplier's Spendesk name as its name (the vendor's display name, or company name, depending on the ERP). Fill the rest from what Spendesk holds: legal name, VAT number, address, bank details.
Also set whatever your ERP requires before a vendor can receive an invoice — for example posting groups in Business Central, or the subsidiary and currency in NetSuite. Spendesk does not set them.
3. Refresh the accounting settings
Ask Spendesk to pull the ERP's settings again — accounts, tax accounts, analytical fields, suppliers, employees and currencies:
curl --request POST \
--url https://public-api.spendesk.com/v1/experimental/integrations/refresh-settings \
--header 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.masked' \
--header 'accept: application/json'{
"outcome": "refreshTriggered"
}The answer is 202: the refresh was accepted, and runs in the background. It is not finished yet.
| Answer | Meaning | What to do |
|---|---|---|
202 | Refresh accepted | Wait, then check (step 4) |
429 | A refresh ran shortly before; refreshes are throttled per company | Wait for the delay in the Retry-After header, then retry |
409 | This company's accounting integration has no settings synchronisation | This page does not apply to this company |
403 | The key's owner is not a Controller or an Account Owner, or lacks the scope | Use a key with the right role and scope |
Create all the vendors first, then refresh once: one refresh pulls every supplier.
4. Check the link
Read the supplier back with its ERP IDs:
curl --request GET \
--url 'https://public-api.spendesk.com/v1/suppliers/04805c8v_6gqtm?include=externalIds' \
--header 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.masked' \
--header 'accept: application/json'{
"id": "04805c8v_6gqtm",
"name": "Atelier Boreal",
"externalIds": [
{
"externalId": "148f0888-b1e1-f111-84e5-6045bd1a4e02",
"provider": "MicrosoftDynamics",
"source": "native_integration"
}
]
}The supplier now carries its ERP vendor's ID, recorded by the native integration (source: native_integration). Its invoices can be exported as usual. The link is usually made within seconds of the refresh. Read the supplier by its ID, as above: the supplier list can take a few minutes longer to show it. If the link is not there yet, check again later rather than refreshing again.
How suppliers are matched
The native integration matches each ERP vendor that is not linked yet with a Spendesk supplier that is not linked yet, by name:
- Case, accents and extra spaces do not matter. Café Nordé in Spendesk matches cafe norde in the ERP.
- Any other difference does. Dupont in Spendesk and Dupont SAS in the ERP do not match: the pull then creates a second supplier, Dupont SAS, in Spendesk, linked to the vendor — and Dupont stays unlinked. Copy the Spendesk
nameas it is. - To force the match, use
<name> - <ERP vendor ID>. A Spendesk supplier named Atelier Boreal - 148f0888-b1e1-f111-84e5-6045bd1a4e02 is matched with that vendor before any match on the name alone. - Keep supplier names unique. When two Spendesk suppliers share the same name, do not rely on which one gets linked: merge or rename them first.
- A link, once made, is kept. A supplier already linked to a vendor is never re-matched to another one by a later refresh.
Check the name before you create the vendorA name that does not match is not an error: nothing fails, but you get a duplicate supplier in Spendesk and the original one still cannot be exported. Read the supplier's
namefrom Spendesk right before you create the vendor, and check step 4 after the refresh.
Next steps
- Run steps 1 to 4 on a schedule, or when your ERP tells you a vendor was created.
- Errors and retries: see Error handling and Rate limiting.
- Building an integration for a company without a native integration: see Building an accounting integration.