The mechanics
- Errors. Every failed request returns one uniform envelope with a machine-readable
typeand arequestIdfor support. Branch on the type, log the id. - Retries. A timeout does not tell you whether the server processed your request. Most create operations accept an
Idempotency-Keyheader, so a retry can never create a duplicate. - Pagination. Collections return a uniform envelope with
offset/limitfor shallow access and an opaque cursor for walking large result sets. - Concurrency. Document reads return the current version as an
ETag; writes acceptIf-Matchto refuse overwriting a change someone else made in the meantime. - Webhooks. Instead of polling, Circularo calls your endpoint when documents change — registered by an organization administrator, and — when you configure a secret — signed so you can trust what arrives.
Worth knowing across the chapter
- One error envelope is the common vocabulary. Every mechanic here reports its failures through it: a
412from a conditional write, a422from an idempotency key reused with a different payload and a400from a stale cursor all arrive in the same shape. - The mechanics are opt-in, and per endpoint. An
Idempotency-Keymatters on creates,If-Matchon document writes, a cursor on the collections that support one. Which endpoint accepts what is documented with that endpoint in the API reference. - Rate limiting applies to everything. Any endpoint can answer
429with aRetry-Afterheader, so the retry logic you build for timeouts is worth reusing for that. - The pages stand on their own. Apart from the error envelope, nothing here builds on the page before it, so reading by need costs you nothing.
Where to start
Read Handle errors first — every other page builds on the error envelope. Then pick by need: Retry requests safely before you add retry logic, Page through collections before you list or search at scale, Guard concurrent writes when several actors may modify the same document, and React to events with webhooks when you would rather be told than keep asking.Pages in this chapter
Handle errors
Every failed request returns the same JSON envelope, whatever went wrong. This guide reads that envelope on two common failures — two requests in total — and turns it into something your code can branch on.
Retry requests safely
A timeout does not tell you whether the server processed your request — retrying blindly can create the same document or folder twice. Most create operations accept an
Idempotency-Key header that makes retries safe. This guide demonstrates it with two requests.Page through collections
Every collection endpoint answers with the same envelope. This guide walks a collection of documents from the first page to the last — two requests in total.
Guard concurrent writes
When your system and people in the Circularo web app may touch the same document, an unconditional write can silently overwrite their change. Document reads return the current version as an
ETag, and writes accept it back in If-Match — three requests in total.React to events with webhooks
Polling tells you what changed only as often as you ask. A webhook has Circularo call you instead, the moment a document event happens in your organization. Registering one takes a single call; securing the deliveries, and receiving them safely, is the rest of this guide.