Search the docs

Pages and API endpoints

Developer dashboard
Docs/Getting Started/Error Handling

Error Handling

Every error has a message for people (error), a code for your program (code) and a request_id to quote to support.

Error Response Format

404 Not Found
{
  "error": "No invoice with that ID",
  "code": "not_found",
  "request_id": "req_6f1c2a9e0b7d4c3e8a5f1b2c",
  "doc_url": "https://syncbooksapp.com/docs/getting-started/errors#not_found"
}
422 Validation failed
{
  "error": "Validation failed",
  "code": "validation_failed",
  "details": [
    { "field": "name", "message": "name is required" },
    { "field": "customerId", "message": "must be a valid ID" }
  ],
  "request_id": "req_0a9b8c7d6e5f4a3b2c1d0e9f",
  "doc_url": "https://syncbooksapp.com/docs/getting-started/errors#validation_failed"
}
ParameterTypeDescription
errorstringWhat went wrong, in words you can show people
codestringWhat went wrong, for your program to branch on (stable; the table below)
detailsarrayPer-field problems, for validation errors
request_idstringAlso in the X-Request-Id header of every response, errors or not
doc_urlstringThis page, at the code

Branch on code, not on the message: messages may be reworded, codes don't change. New codes may be added, so treat an unknown code by its HTTP status.

Retry or fix?

  • Retry network failures, 429 and 5xx, with backoff, and with the same Idempotency-Key so nothing happens twice.
  • Fix, then send again for the other 4xx: the same request will fail the same way.

Error Codes

invalid_request400

The request is missing something or has a wrong value

Read the message; it names what's wrong.

invalid_parameter400

A query parameter has the wrong type (e.g. a malformed ID)

Check the parameter named in details.

invalid_json400

The body isn't valid JSON

Send Content-Type: application/json with a valid JSON body.

invalid_idempotency_key400

The Idempotency-Key header isn't 1–255 printable characters

Use a UUID or your own record reference.

missing_api_key401

No Authorization header

Send Authorization: Bearer sk_live_…

invalid_api_key401

The key doesn't exist or was revoked

Create a new key in the developer dashboard.

authentication_required401

The credentials weren't accepted

Check the key or OAuth token.

invalid_token401

OAuth: the access token is invalid, expired or revoked (OAuth errors use error + error_description)

Refresh the token, or ask the company to connect the app again.

insufficient_scope403

The key or app lacks the scope this endpoint needs

Add the scope named in the message (e.g. bills:write) to the key.

plan_upgrade_required403

API access isn't included in the company's plan

The company upgrades to Starter or higher.

api_access_disabled403

The company turned API access off

An administrator turns it on in Settings → Company → Security.

organization_inactive403

The company is inactive or suspended

The company checks its subscription.

forbidden403

Not allowed for this key or company

Read the message.

not_found404

No record with that ID in this company

Check the ID, and that it belongs to the company the key is for.

endpoint_not_found404

No such endpoint

Check the method and path in the endpoint reference.

conflict409

The record's state doesn't allow this (e.g. already paid)

Fetch the record and check its status.

duplicate409

A record with the same unique value (email, SKU…) exists

Use the existing record or change the value named in the message.

idempotency_in_progress409

A request with this Idempotency-Key is still running

Retry after a second with the same key.

payload_too_large413

The body is too large

Send fewer records per request.

validation_failed422

Fields failed validation; details lists each field

Fix the fields in details and send again.

idempotency_key_reused422

This Idempotency-Key was used for a different request

Use a new key for each new request.

rate_limited429

Too many requests for the plan's limit

Wait for Retry-After seconds, then retry.

internal_error500

Something failed on our side

Retry with the same Idempotency-Key; if it persists, send us the request_id.

upstream_error502

A service we depend on failed

Retry shortly.

service_unavailable503

Temporarily unavailable

Retry shortly.