SalesOS

Error Handling

HTTP status codes, the error response format, and what to retry.

The full list of error codes is in Developers → Errors.

Error response format

Every error has the same body:

{
  "statusCode": 400,
  "code": "VALIDATION_RULE_FAILED",
  "message": "Close date is required once a deal reaches Negotiation",
  "timestamp": "2026-10-01T09:30:00.000Z",
  "path": "/v1/opportunities/clx…",
  "requestId": "6f1c…"
}
  • Branch on code, not on message; messages are written for people and can change.

  • message is an array when a request fails several input validations at once:

    { "statusCode": 400, "message": ["email must be an email", "property nickname should not exist"], "…": "…" }
  • Quote requestId when you contact support.

Status codes

StatusMeaningRetry?
200, 201, 202, 204Success (202 for queued jobs such as bulk and metadata deploys)—
400Malformed or invalid request, or a business rule refused itNo. Fix the request
401Missing, invalid, expired or revoked credentialsNo. Fix the credential
403Not allowed: scope, plan, Profile, IP allow-list, field-level securityNo
404Not found, or not visible to you (indistinguishable on purpose)No
409Conflict: an idempotency conflict or a state conflictDepends on the code
423The record is locked by a pending approvalAfter the approval completes
429Rate limitedYes, after Retry-After seconds
500Unexpected errorReads: yes, with backoff. Writes: only with an Idempotency-Key
503Temporarily unavailableYes, after Retry-After

Handling errors

async function apiRequest(url, options) {
  const res = await fetch(url, options);
  if (res.ok) return res.status === 204 ? null : res.json();

  const error = await res.json();
  if (res.status === 429 || res.status === 503) {
    const wait = Number(res.headers.get('Retry-After') ?? 1);
    // wait `wait` seconds, then retry (writes only with an Idempotency-Key)
  }
  switch (error.code) {
    case 'API_KEY_EXPIRED':
      // rotate the key
      break;
    case 'VALIDATION_RULE_FAILED':
      // show error.message to the user
      break;
  }
  throw error;
}

On this page