Skip to content
Support
← Back to ErrorsUse Print, then choose Save as PDF to keep a copy.

Skeduler Support · For developers

Errors

What error responses mean.

3 pages

Handling API errors well

Branch on error.code, retry only what is worth retrying, and reuse the idempotency key when you do.

Owner, Admin · Last checked 25 November 2026 · 2 min read

Every failed call returns the same envelope, so one small wrapper can handle all of them. See API errors for every code.

The rules

  1. Branch on error.code. It's stable. error.message is for people and can change.
  2. Retry only what can succeed later: 409, 429, 500 and 503, with exponential backoff and a little randomness (jitter). On 429, wait the Retry-After seconds first.
  3. On 401, get a fresh token and retry once. If it still fails, the app was revoked or its secret changed.
  4. Don't retry 403, 404 or 422. The request is wrong, or the app lacks a scope. Fix it instead.
  5. Retry writes with the same Idempotency-Key, so a retry never does the work twice. A new key is for a new write. See Safe retries with idempotency keys.
  6. Never log the secret or the token. Log error.code, the status and the path.

A small wrapper

In the example, SKEDULER_API is your Skeduler API address. Contact Skeduler support if you don't have it.

async function call(path, { method = "GET", body, key } = {}) {
  const idempotencyKey = method === "GET" ? undefined : key ?? crypto.randomUUID(); // chosen once per write
  let refreshed = false;
  for (let attempt = 0; attempt < 5; attempt++) {
    const res = await fetch(`${process.env.SKEDULER_API}/api/v1${path}`, {
      method,
      headers: {
        Authorization: `Bearer ${await getToken()}`,
        "Content-Type": "application/json",
        ...(idempotencyKey && { "Idempotency-Key": idempotencyKey }),
      },
      body: body && JSON.stringify(body),
    });
    if (res.ok) return res.json();

    const { error } = await res.json().catch(() => ({ error: { code: "server_error" } }));
    if (res.status === 401 && !refreshed) { refreshed = true; await getToken({ force: true }); continue; }
    if ([409, 429, 500, 503].includes(res.status)) {
      const wait = Number(res.headers.get("Retry-After")) * 1000 || Math.min(30000, 500 * 2 ** attempt) * (0.5 + Math.random());
      await new Promise((r) => setTimeout(r, wait));
      continue;
    }
    throw Object.assign(new Error(error.message), { status: res.status, code: error.code, fields: error.fields });
  }
  throw new Error("Gave up after 5 attempts");
}

getToken() returns a cached token and asks for a new one shortly before it expires. See How long does an access token last?.

Showing a problem to a person

For 422 validation_failed, error.fields has a message for each field you can show next to the right box. See My request fails with validation_failed. A 500 is always server_error: tell the person something went wrong on Skeduler's side and that you'll try again, rather than showing a raw response.

API errors

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.

Owner, Admin · Last checked 24 November 2026 · 4 min read

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. The message is for people and can change.
  • error.fields appears only for validation_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

Statuserror.codeWhat it means, and the likely causeHow to fix it
401unauthenticatedNo 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.
403insufficient_scopeThe 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.
403app_inactiveThe business's account is no longer active.Nothing in your request. The business needs its Skeduler account active again.
403billing_restrictedThe 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.
404not_foundNo 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.
405method_not_allowedThe path exists, but not for that method.Use the method the endpoint list gives for that path.
409idempotency_in_progressA 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.
409idempotency_replay_unavailableThe 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.
422validation_failedA 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.
422invalid_eventWebhook subscribe: unknown event.Use an event from Webhook events and their payloads.
422invalid_target_urlWebhook 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.
422subscription_limit_reachedWebhook subscribe: 50 active subscriptions for the app, or 200 for the business.Delete subscriptions you no longer use, then subscribe again.
422invalid_idempotency_keyThe 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.
422idempotency_key_reusedThe 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.
429rate_limitedOver a rate limit.Wait Retry-After seconds, then retry. Spread your calls out. See Staying under the rate limits.
500server_errorSomething went wrong on Skeduler's side.Retry with backoff. If it keeps happening, contact Skeduler support with the time and the call you made.
503api_disabledThe 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.

StatuserrorWhat it means, and the likely causeHow to fix it
401invalid_clientThe 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.
400invalid_requestYou 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.
400unsupported_grant_typegrant_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-After on a 429. If you sent an Idempotency-Key, retrying a write is safe.
  • 404, 422: the request itself is wrong. Sending it again won't help.

My request fails with validation_failed

A field is missing or wrong. The error says which one in error.fields.

Owner, Admin · Last checked 25 November 2026 · 1 min read

What you see

422 with error.code of validation_failed:

{ "error": { "code": "validation_failed", "message": "The title field is required.", "fields": { "title": ["The title field is required."] } } }

error.fields lists the messages for each field. message is the first of them.

Why it happens

  1. A required field is missing.
  2. A filter value isn't valid.
  3. updated_since isn't a real date, such as 2026-02-30.
  4. cursor isn't one the API issued.
  5. A name you referenced doesn't exist.
  6. A visit time has no UTC offset.
  7. end_at isn't after start_at.
  8. A payment is more than what's due, or the invoice is a draft, void or cancelled.

How to fix it

  1. Add the missing field. For example, a job needs a title.
  2. Use an allowed status, and ids that are ULIDs.
  3. Send a valid ISO 8601 date or timestamp.
  4. Pass back meta.next_cursor exactly. Don't build one.
  5. A job status name must match one of the business's active statuses. See Change a job's status.
  6. Send 2026-12-01T09:00:00+11:00 or …Z.
  7. Fix the times.
  8. See Record a payment on an invoice.

Retrying the same request won't help. Fix the request. If you sent an Idempotency-Key, the refusal is stored, so send the corrected request with a new key. See What happens if I reuse an idempotency key with a different body?.

See API errors for every code.