API errors
Owner, AdminLast checked 24 November 20264 min readArticle ID:
developers-errorsOn this page
Every error code the Skeduler API returns, what it means, its likely cause and how to fix it, plus the token endpoint's OAuth errors.
A failed call returns an HTTP status and one JSON envelope:
{ "error": { "code": "validation_failed", "message": "The title field is required.", "fields": { "title": ["The title field is required."] } } }
- Branch on
error.code. It's stable. Themessageis for people and can change. error.fieldsappears only forvalidation_failed, with the messages for each field.- The token endpoint is the one exception. It answers in the OAuth format, for example
{ "error": "invalid_client" }.
Codes
| Status | error.code | What it means, and the likely cause | How to fix it |
|---|---|---|---|
| 401 | unauthenticated | No token, or a malformed, expired or revoked one. Suspending or revoking an app deletes its tokens, so its calls get this too. | Get a new token and retry once. If it fails again, check the app hasn't been suspended or revoked, and that you're using its current secret. |
| 403 | insufficient_scope | The token lacks the scope the call needs (the message names it). On webhook subscribe, the app lacks the read scope of the event's records. | Give the app that scope, then get a new token. See Who can grant which scopes. |
| 403 | app_inactive | The business's account is no longer active. | Nothing in your request. The business needs its Skeduler account active again. |
| 403 | billing_restricted | The business's subscription restricts API access. | Nothing in your request. The business's Owner or an Admin sorts out the subscription in Skeduler, and calls work again once access is back. |
| 404 | not_found | No such record in this business. Archived records and other businesses' ids look the same, and so does an unknown path. | Check the id and the path. The record may be archived, or belong to another business. |
| 405 | method_not_allowed | The path exists, but not for that method. | Use the method the endpoint list gives for that path. |
| 409 | idempotency_in_progress | A request with the same Idempotency-Key is still being processed. | Wait a moment, then retry with the same key. You'll get the first request's answer. |
| 409 | idempotency_replay_unavailable | The first answer for this Idempotency-Key can no longer be replayed. | Check whether the first request took effect (for example, read the record), then retry with a new key. |
| 422 | validation_failed | A field is missing or wrong, a filter value isn't valid, or a name you referenced doesn't exist (for example a job status). | Read error.fields, fix those fields and send it again. |
| 422 | invalid_event | Webhook subscribe: unknown event. | Use an event from Webhook events and their payloads. |
| 422 | invalid_target_url | Webhook subscribe: target_url isn't an https:// URL of up to 2048 characters with a public address. | Use a public https:// address of up to 2048 characters. |
| 422 | subscription_limit_reached | Webhook subscribe: 50 active subscriptions for the app, or 200 for the business. | Delete subscriptions you no longer use, then subscribe again. |
| 422 | invalid_idempotency_key | The Idempotency-Key isn't 1 to 255 printable ASCII characters, or it's missing on POST /invoices/{id}/payments, where it's required. | Send a key of 1 to 255 printable ASCII characters, such as a UUID. Always send one when recording a payment. |
| 422 | idempotency_key_reused | The key was already used for a different request. | Use a new key for each new request. Reuse a key only to retry the exact same request. See My request fails with idempotency_key_reused. |
| 429 | rate_limited | Over a rate limit. | Wait Retry-After seconds, then retry. Spread your calls out. See Staying under the rate limits. |
| 500 | server_error | Something went wrong on Skeduler's side. | Retry with backoff. If it keeps happening, contact Skeduler support with the time and the call you made. |
| 503 | api_disabled | The API is switched off for a while. | Try again later, with backoff. |
Token endpoint errors
POST /api/v1/oauth/token answers in the OAuth format, { "error": "<code>" }, with no message.
| Status | error | What it means, and the likely cause | How to fix it |
|---|---|---|---|
| 401 | invalid_client | The client ID or secret is wrong, or the app can't get tokens any more. | Check both values. If the secret is lost, rotate it. See Token request fails with invalid_client. |
| 400 | invalid_request | You sent the client ID and secret both in the Authorization header and in the body. | Send them one way only: the header (HTTP Basic) or the body. |
| 400 | unsupported_grant_type | grant_type isn't client_credentials. | Send grant_type=client_credentials. |
Handling them
- 401: get a new token and retry once. If it still fails, the app was suspended or revoked, or its secret changed.
- 403: don't retry. Fix the scope, or the app or billing problem.
- 409, 429, 500, 503: retry with exponential backoff and a little random delay. Honour
Retry-Afteron a 429. If you sent anIdempotency-Key, retrying a write is safe. - 404, 422: the request itself is wrong. Sending it again won't help.