API conventions
Errors, pagination, idempotency, conditional reads, versioning, and rate limits, with endpoint-specific boundaries.
API conventions
These conventions cover the public Platform and SDK surfaces. Check the endpoint's API reference for supported headers, limits and response shapes.
Errors (RFC 7807)
Errors are application/problem+json with a stable, machine-readable
code you can branch on (the human detail may change; the code is the
contract).
{
"type": "https://curaeai.com/problems/scope-insufficient",
"title": "Scope insufficient",
"status": 403,
"detail": "This key lacks the webhook:manage scope.",
"code": "SCOPE_INSUFFICIENT"
}Common codes include SCOPE_INSUFFICIENT, SDK_AUTH_REQUIRED,
insufficient_scope, BAD_REQUEST, NOT_FOUND, and RATE_LIMITED.
Preserve code casing. With the SDK, failures throw a
PlatformApiError carrying problem and response metadata.
Pagination
Webhook endpoint lists are cursor-based. A response carries an opaque
nextCursor; pass it back to get the next page. Treat the cursor as opaque
— there is no offset pagination.
let cursor: string | undefined;
do {
const page = await client.listWebhookEndpoints({ limit: 100, cursor });
process(page.data.data);
cursor = page.data.pagination.nextCursor ?? undefined;
} while (cursor !== undefined);For this list, limit is bounded server-side (1–100); out-of-range values return
400 BAD_REQUEST rather than being silently clamped, and a malformed
cursor likewise returns 400.
Catalog searches return { brands, count } with no cursor. The three resource
searches return bounded FHIR searchset bundles (limit at most 500), without a
next-page cursor. Do not infer that a bounded response contains every matching
record; use a scoped records export when you need a materialized dataset.
Idempotency
Mutations that support Idempotency-Key replay a retained completed response
for the same key and request within 24 hours. Required headers are declared
per endpoint. Graduation handoff rejects this header because it must mint a
fresh short-lived token. Failed requests are not all cached: a thrown error
or returned 5xx can be executed again on retry.
await client.createWebhookEndpoint(body, {
idempotencyKey: 'create-endpoint-001',
});Use a stable, unique key per logical operation (a ULID/UUID, or a deterministic key derived from the operation).
A key is bound to the request it was first used for. The server fingerprints
the method, the path and query string, the CuraeAI-Version, the request
body, and the If-Match / If-None-Match preconditions. A retry must repeat all
of them byte for byte — which is what an SDK retry does. On the Platform API the
server compares the decoded JSON body value, so a retry that differs only in
whitespace or key order is not a 409; do not rely on that, repeat the bytes.
Reusing a key for anything else returns 409 CONFLICT with
code: IDEMPOTENCY_KEY_MISMATCH, and performs nothing; that is deliberate,
because replaying the first request's response for a second, different request
would be worse than refusing it. Mint a fresh key for a fresh operation.
Conditional reads (ETags)
Read endpoints that support conditional reads, such as webhook endpoint
reads, return a strong ETag. Send it back as If-None-Match to get a
304 Not Modified (and skip the body) when nothing changed.
const fresh = await client.getWebhookEndpoint(id);
if ('notModified' in fresh)
throw new Error('Expected a full endpoint response');
const again = await client.getWebhookEndpoint(id, {
ifNoneMatch: fresh.data._version,
});
if ('notModified' in again) {
// your cached copy is still authoritative
}Versioning
Send a dated version header on every request:
CuraeAI-Version: 2026-04-15The currently supported version is 2026-04-15. An unsupported header
returns 400 BAD_REQUEST. When omitted, authenticated requests use the
customer account's pinned default. Pin the version in your client.
Rate limits
Rate-limited responses carry X-RateLimit-Limit, -Remaining, -Reset, and
-Window when the relevant bucket has been evaluated. On exhaustion you get
429 with code RATE_LIMITED and Retry-After. The SDK honors Retry-After
and uses exponential backoff for eligible reads and keyed mutations;
unkeyed mutations are not automatically retried.
Next
- Webhooks — delivery, verification, retries.
- API reference — schemas, scopes, and status codes per endpoint.