An error is JSON with one human-readable message. When the problem is one field, the message starts with its path:
Messages are written for the person reading your logs. Branch on the status code, not on the wording, which can change.
Status codes
| Status | Meaning | Retry? |
|---|---|---|
200 201 | Done. 201 when a quote was created | |
400 | The body is invalid, or a rule refused it: an agreed price above list, both lines and a document, a quote sent without a complete service address, a file over 20 MB, and so on | No: fix the request |
401 | No key, an unknown key, or a revoked one | No |
403 | The key lacks the scope | No |
404 | No such record in this programme, or an ID of the wrong kind | No |
409 | The record is in the wrong state (sending a quote whose lines need review, or one already accepted), or an Idempotency-Key is still in flight | Only the in-flight case, shortly |
413 | The JSON body is larger than 30 MB. An uploaded file larger than 20 MB answers 400 | No |
422 | The request cannot be completed as sent: an Idempotency-Key reused with a different body, or a document that does not state what the quote needs | No |
429 | Rate limited | Yes, after the window the headers give |
500 | Something failed on our side | Yes, with the same Idempotency-Key |
502 | Your quote document could not be read | Once; then send lines |
503 | Document reading is not available for this programme | No: send lines instead |
Retrying safely
Send every POST with an Idempotency-Key and retry a timeout, a dropped connection, a 429 or a 5xx with the same key and the same body. A retry can never create a second quote or send a proposal twice. Back off between attempts: waiting 1, 2, 4 and 8 seconds is plenty, and a 429 tells you exactly when to come back.
Do not retry a 4xx other than 409 (in flight) and 429 unchanged. It will get the same answer.
Errors you will meet first
| Message includes | Cause |
|---|---|
A valid partner API key is required | The Authorization header is missing, malformed, or the key was revoked |
opportunityUrl: | The link is not an https Salesforce opportunity link, or not on the programme's Salesforce org |
customer needs an accountId or a name | customer names neither an existing account nor a new one |
Send either lines or a document | Both, or neither, were sent |
resolution and retentionDays are required | A programme that prices by configuration needs its configuration fields with lines |
lines[0].agreedUnitPrice is above the list price | An agreed price can only lower a line |
customer.accountId: account not found | The account is not in this programme |
Add the customer's service address to the account before sending | The account has no service address, and the agreement names the site it covers |
The account needs a complete service address | Where the programme charges sales tax, sending needs the street, city, state, ZIP code and country, so the tax can be worked out. In the US, the state is its two-letter code and the ZIP code has 5 or 9 digits |
This Idempotency-Key was already used with a different request | Use a new key for a new request |