Skip to Content
Athanor

Being a good citizen

What a well-behaved integration does, and why each one keeps your budget, your data and our desk in good shape.

Hear, don't poll

Register a webhook for the events you act on and read the record by id when one arrives. Polling the feed to find out what changed costs a page of records per poll and still arrives later than the notice would have.

If you must poll, poll the feed with a small first, stop at the first record you have already seen, and keep the interval in minutes, not seconds.

Say first

Every connection takes first. Without it the budget assumes 50, and the answer may carry more than you render. A nested connection multiplies: orders(first: 50) { edges { node { lines } } } is fifty records and their lines.

Read errors even on a 200

A GraphQL answer can carry data and errors at once. A field the token may not read is null with an error at its path; a step out of turn is an error with the steps that were legal. Treat a 200 with errors as a refusal of that part, not a success. The SDK does this for you and throws the typed error.

Use idempotency keys you can find again

Every mutation takes one. Use the reference you already keep, a purchase order number say, plus the step. A retry after a timeout then answers with the first run's order instead of making a second.

State what you expect

lockPrices takes expectedAllIn, issueDirection takes authorizedMaximum, sendDirection takes recipientEmail. Pass what you showed your user; a mismatch is refused with a reason instead of committing to something they did not see.

Register your documents, then lock the mode

Run the publish step from your build, check the Documents page, and set the client trusted_only on live. A compromised integration can then run only what your build registered.

Back off on a 429

Wait as Retry-After says. The SDK does; if you are not on it, never retry a 429 sooner. Spread scheduled work across the hour rather than at the top of it.

Hold the least scope

A client that only reads orders should hold dealer:orders:read alone. Scopes are set at minting; mint a second client for a second job rather than widening the first.

Keep nothing that can mint a token

Prefer where the workload runs over a private key; prefer a private key over anything copied into an env file. Never log a token; it is an hour of access to your organization's book.

Answer webhooks fast and twice-safe

Store the message, answer 2xx, act after. The same webhook-id may arrive again after a retry; make the second arrival a no-op.

On this page