Skip to main content
← All documentationContents ↓

Error Handling

Standard error envelope, error codes, HTTP status codes, and how to handle errors with the TypeScript SDK.

Error Response Format

All Simply360 API errors follow a consistent envelope. When a request fails, the response body contains an error object with a machine-readable code and a human-readable message, plus a meta object that includes a unique request identifier.

{
  "error": {
    "code": "VALIDATION_ERROR",
    "message": "The field 'email' is required.",
    "details": { "field": "email" }
  },
  "meta": {
    "requestId": "req_abc123def456"
  }
}

Envelope Fields

FieldTypeDescription
error.code string Stable, machine-readable error code. Use this for programmatic handling.
error.message string Human-readable description. May change over time — do not match against this string in code.
error.details object Optional, error-specific structured details (e.g., the offending field name).
meta.requestId string Unique identifier for the request. Include this when contacting support.

Common Error Codes

Error CodeHTTP StatusDescription
VALIDATION_ERROR 400 The request body or query parameters failed validation. Inspect error.details and error.message for which fields are invalid.
AUTHENTICATION_REQUIRED 401 No valid credential was provided. Ensure your Authorization header includes a valid bearer token.
INVALID_API_KEY 401 The API key was not found, is inactive, or failed verification. Related codes: API_KEY_EXPIRED and INVALID_SESSION_TOKEN (expired or revoked session token).
PERMISSION_DENIED 403 The credential is valid but lacks access to this resource or operation. Related code: FEATURE_PERMISSION_DENIED (a required feature permission is missing).
NOT_FOUND 404 The requested resource does not exist or is not accessible to your team.
CONFLICT 409 The request conflicts with the current state of the resource (e.g., a duplicate of an existing item).
RATE_LIMIT_EXCEEDED 429 You've exceeded a request quota and nothing was carried out. Wait the number of seconds in the Retry-After header (the window resets at X-RateLimit-Reset), then send the same request again. See Rate Limiting.
INTERNAL_ERROR 500 An unexpected server error occurred. If it persists, contact support with the requestId.
NOT_ATTEMPTED 503 Nothing was written, so the same request can be sent again unchanged, with the same Idempotency-Key if it had one. A record update answers this when a concurrent write to the same records keeps interrupting it even after the server's own retries; a record create (including MCP and Ask Simply) or parent-with-children write answers it after one interruption, without a server replay. The rolled-back create leaves no record, Automation occurrence, or idempotency outcome. Batch writes report it per entry, also for entries the request time budget did not reach.
TIMEOUT 408 Returned by the SDK (not the server) when the configured request timeout elapses (default 30 seconds).
UNKNOWN — SDK fallback when a non-2xx response has no parseable error code (e.g., a gateway error page).

HTTP Status Codes

Simply360 follows standard HTTP semantics:

StatusMeaning
200Success.
201Created — a new resource was successfully created.
204No Content — success with no response body. Rare; most delete endpoints return 200 with a confirmation body.
400Bad Request — malformed input or failed validation.
401Unauthorized — missing or invalid credentials.
403Forbidden — authenticated but lacking permission.
404Not Found.
409Conflict — the request conflicts with existing state.
429Too Many Requests — you've hit a rate limit.
500Internal Server Error.
503Service Unavailable — the request was not carried out. The error code says whether it can be sent again; NOT_ATTEMPTED always can.

Idempotency-Key retries

Send the same Idempotency-Key with the same request when retrying after an uncertain response, and use a new key for each new operation. How the key is honored depends on the endpoint: record creates and updates have their own durable, body-checked fence; other write endpoints use a short-lived response cache.

Record creates and updates

POST /v1/data-records, POST /v1/data-records/batch (per-record idempotencyKey), and PUT/PATCH /v1/data-records/{dataRecordSimplyId} claim the key in the same database transaction as the write:

  • Key format: 1 to 64 visible ASCII characters with no spaces. Use a canonical lowercase UUIDv4 (for example crypto.randomUUID()) to also get the X-Mutation-Operation-Handle and Operation-Location headers, which let you look up the exact outcome later. Batch per-record keys must be UUIDv4.
  • Updates: an update sent with an Idempotency-Key must also name the record's dataCollectionSimplyId in its body, or it is refused with 400 VALIDATION_ERROR.
  • Body compared: a retry with the same key and the same request replays the original outcome and writes nothing new. The same key with a different method, target, Collection, or body returns 409 IDEMPOTENCY_CONFLICT (in a batch, only that entry fails).
  • Concurrent retries: a retry that arrives while the first attempt is still running waits for it, then replays or conflicts; it never writes a second time.
  • Failures: a refused or rolled-back write (a validation error, 409 DUPLICATE_ENTRY, 503 NOT_ATTEMPTED) leaves the key unused, so the same request with the same key can run again.
  • Scope and lifetime: keys are scoped to the Team and the authenticated principal, and kept for 90 days. Rotating an API key's secret keeps the same key, so its keys still replay; a different API key, user, or session token is a different principal and runs its own request.

Other write endpoints

Most other POST, PUT, PATCH, and DELETE requests use a response cache: a successful response may be replayed for up to 24 hours within the same Team, authenticated principal, HTTP method, and route. A replay does not run the route handler again and carries X-Idempotency-Replayed: true. Keys are up to 255 visible ASCII characters with no spaces. Some endpoints keep their own retry rules instead, such as Bookings, conversation messages, the MCP endpoint, batch File writes, and configuration changes; their reference articles describe them.

  • Caller: The authenticated principal is the signed-in user (for an OAuth app, the same user through that app), the API key or the session token. The Team applies only to Team requests; requests without a Team are told apart by principal alone. Another Team member or credential sending the same key runs its own request.
  • What is stored: Only successful JSON responses are stored. Errors and empty successes such as 204 are not, so those requests run again on retry.
  • No lock: A retry that arrives while the first attempt is still running is not held back, so it runs again.
  • Body not compared: A reused key replays the first response even when the body changed. Generate a fresh random key, such as crypto.randomUUID(), for each operation.
  • Endpoint rules: Secret and one-use capability responses are never saved in or replayed from the broad idempotency cache, and carry Cache-Control: no-store. This includes API and integration keys, session tokens, webhook secrets, action credentials, MFA and action step-up material, website sign-in exchange codes, share-link and Bookings map tokens, Simply Spaces webhook and share-link secrets, Data View public-access and Bookings record-grant tokens, Wizard run-session credentials, provider account-link state, Style Kit preview permits and private-asset URLs, media file-request tokens, custom-domain and widget billing activation tokens, and signed File or AI graph upload/download URLs. Retrying one of these endpoints runs its current permission and state checks again; a second request may be rejected or may create or rotate a new resource. File uploads with a supported uploadRequestKey use their own actor-bound recovery flow.

Handling Errors in the TypeScript SDK

The SDK throws ApiError for any non-2xx response. ApiError extends Error and exposes:

  • statusCode — HTTP status (e.g., 404).
  • code — Machine-readable error code (e.g., "NOT_FOUND").
  • message — Human-readable message.
  • details — Optional Record<string, unknown> with structured context.
import { Simply360, ApiError } from '@simply360/sdk';

const s360 = new Simply360({ apiKey: process.env.S360_API_KEY! });

async function getRecord(recordId: string) {
  try {
    const response = await s360.dataRecords.get(recordId);
    return response.data;
  } catch (error) {
    if (error instanceof ApiError) {
      switch (error.code) {
        case 'AUTHENTICATION_REQUIRED':
        case 'INVALID_API_KEY':
          console.error('Invalid credentials. Check your API key.');
          break;

        case 'NOT_FOUND':
          console.warn(`Record ${recordId} not found.`);
          return null;

        case 'RATE_LIMIT_EXCEEDED': {
          // Rate-limit headers are on the HTTP response, not on ApiError.
          // Apply your own backoff before retrying.
          await new Promise((resolve) => setTimeout(resolve, 5000));
          return getRecord(recordId);
        }

        case 'VALIDATION_ERROR':
          console.error('Validation failed:', error.message, error.details);
          break;

        default:
          console.error(`API error [${error.statusCode}/${error.code}]: ${error.message}`);
      }
    }
    throw error;
  }
}

Managed production configuration

A production configuration managed through Environment Promotion returns HTTP 409 with code MANAGED_ENVIRONMENT_WRITE_DENIED. Use the SDK guard to validate its bounded public guidance. Do not retry the same mutation: direct the Team Admin to the named authoring environment and preserve the suggested route when your application can offer an environment link.

import { isManagedEnvironmentWriteDeniedError } from '@simply360/sdk';

try {
  await updateConfiguration();
} catch (error) {
  if (isManagedEnvironmentWriteDeniedError(error)) {
    const { authoringEnvironment, authoringPath, deniedArtifacts } = error.details;
    showManagedConfigurationNotice({ authoringEnvironment, authoringPath, deniedArtifacts });
    return;
  }
  throw error;
}

The details contain public Simply IDs only. Policy changes are not exposed as an agent or API-key mutation flow; they remain an interactive Team Admin review in the web application.

Hosted MCP write tools preserve the same public code, message, and optional details inside an MCP error result. The in-process chat assistant MCP surface is read-only and exposes no Data View, Wizard, or artifact-policy mutation tool. Simply Anywhere exposes the decoded envelope as APITransportError.apiErrorResponse; Ask Simply approval failures display the server guidance and do not retry the denied mutation.

The requestId Field

Every API response includes a requestId in the meta object, and the same value is sent in the X-Request-Id response header. When contacting Simply360 support about an API issue, always include the requestId from the failed response — it lets the team locate the exact request in server logs and diagnose quickly.

If you are making raw HTTP requests without the SDK, parse the response body (or read the X-Request-Id header) to extract the requestId. Store it alongside any error report or log entry your application produces.

const response = await fetch('https://api.simply360.app/v1/data-records/WXYZ-5678-IJKL', {
  headers: { Authorization: `Bearer ${apiKey}` },
});

const body = await response.json();

if (!response.ok) {
  console.error(`Request failed: ${body.error.message} (requestId: ${body.meta.requestId})`);
}

Timeouts

The SDK has a default request timeout of 30 seconds. When the timeout fires, the SDK throws an ApiError with statusCode: 408 and code: "TIMEOUT". You can configure the timeout per client:

const s360 = new Simply360({
  apiKey: process.env.S360_API_KEY!,
  timeout: 60000, // 60 seconds
});
↑