Skip to main content

Envelope

Every error is JSON with a stable code, a human message and, when useful, details with the numbers the message quotes:
Match on code, never on message. The SDK surfaces the same fields on GainsApiError.

Codes

Rejections that happen after a transaction is sent are not HTTP errors: the order is created and moves to rejected with a reason, see Orders.

Retry guidance

Rate limits

Every response carries RateLimit-Limit, RateLimit-Remaining and RateLimit-Reset (seconds) for the tightest bucket that applied. Exceeding one answers 429 RATE_LIMITED with Retry-After and details.scope (ip, agent or agent-writes). Windows are fixed one-minute windows. These are the launch values on testnet; production limits are published with the mainnet release.