Orders survive a crash
Store the idempotency key before you send
Store the idempotency key before you send
{quoteId, idempotencyKey, exactBody}, then send POST /api/v1/orders; a retry sends the same key and body bytes (Retries and recovery).Recover, never reorder
Recover, never reorder
5xx or outcomeUnknown does not mean the order failed: replay with the same key, or find the order by its quote.Order again only on a new quote
Order again only on a new quote
Follow every order to the end
Follow every order to the end
statusUrl until terminal is true, every 10 to 15 seconds or when a webhook arrives (Order status).Webhooks are handled once
Verify the signature
Verify the signature
Deduplicate on webhook-id
Deduplicate on webhook-id
webhook-id: deliveries arrive at least once and out of order.Answer 2xx within 10 seconds
Answer 2xx within 10 seconds
2xx within 10 seconds, then work. Read statusUrl for the current state.Watch for a paused endpoint
Watch for a paused endpoint
Signing holds up
Sync your clock with NTP
Sync your clock with NTP
X-Timestamp must be within 300 seconds of TetraFi’s clock, and a write’s at most 10 seconds ahead.Use fresh nonces
Use fresh nonces
X-Nonce from a cryptographic random source, and sign each send, retries included, with a new nonce and timestamp (Sign requests).Keep secrets in a secret manager
Keep secrets in a secret manager
Keys can be rotated
Pick up a rotated key within one hour
Pick up a rotated key within one hour
Grant only the permissions a key uses
Grant only the permissions a key uses
Use a service account for software
Use a service account for software
Know how to revoke a leaked key
Know how to revoke a leaked key
Limits are respected
Watch markets with prices, never by polling quotes
Watch markets with prices, never by polling quotes
On any 429, wait Retry-After and retry once
On any 429, wait Retry-After and retry once
429, wait Retry-After seconds and retry once.Requote a held quote
Requote a held quote
Parsing tolerates change
Ignore response fields you do not recognise
Ignore response fields you do not recognise
Treat an unknown enum value as other
Treat an unknown enum value as other
next.kind: keep following terminal, show detail or message, and carry on.Match refusals on error, never message
Match refusals on error, never message
error, never message, and treat an unknown code by its status class (Errors and refusals).Parse amounts as decimals
Parse amounts as decimals
Read the Changelog before each release
Read the Changelog before each release