Skip to main content

Handling Errors

Every query returns a tuple instead of throwing. On failure, the first item is undefined, the second is the Error, and the third is the HTTP Response when the request reached the API.

Rate Limits

The content API (schema, list, and get) is rate limited to prevent abuse. The limits are the same on every plan.
  • Limits are approximate, because they are counted per Cloudflare location.
  • Cached responses also count toward the limit.
  • Different secret keys do not affect each other.
When you exceed a limit, the API responds with 429, a Retry-After: 60 header, and the body { "error": "rate_limited" }. The SDK does not retry automatically. Check the status and wait before trying again:

Temporary Failures

The API responds with 503 and a Retry-After: 10 header when the failure is likely to clear up on its own:
  • The API cannot read its stored data for a moment.
  • get cannot reach Notion because Notion is temporarily unavailable, and NotCMS does not have a synchronized copy of the page yet. When a copy exists, get returns that copy instead.
Wait for the number of seconds in Retry-After, then try again. You can handle 503 the same way as 429: