// guide
Idempotency and rate limits
A network can fail after we did the work and before you heard back. Send an Idempotency-Key with every POST, and retrying is always safe.
Idempotency keys
curl https://api.marketsdk.com/v1/orders \
-H "Authorization: Bearer $MARKETSDK_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: 0192f3a4-6c1e-7b8e-9d0f-1a2b3c4d5e6f" \
-d '{"listing": "lst_...", "buyer": "buy_..."}'- Use a new random value, such as a UUID, for each thing you mean to do, and the same value when you retry it. Up to 255 characters.
- The first request runs. A repeat within 24 hours does not run again: it gets the first response back, status and body, with the header
Idempotent-Replayed: true. - The same key with a different method, path, or body gets 409
idempotency_key_reused. - A repeat that arrives while the first is still running gets 409
idempotency_key_in_use. Wait a moment and retry. - A request that failed on our side, with a 5xx, is not remembered, so the retry runs.
- Keys belong to one marketplace. The same key in test and in live are two different keys.
Rate limits
Each API key has its own limit. Every response says where you stand:
RateLimit-Limit: 1000
RateLimit-Remaining: 998
RateLimit-Reset: 7RateLimit-Limitis how many requests the key may make in the current window, andRateLimit-Resetthe seconds until the window starts again.- Past the limit, the answer is 429
rate_limitedwithRetry-Afterin seconds. Wait that long, then retry with the same Idempotency-Key. - Spread bulk work across time, or use
POST /v1/listings/bulkto create many listings in one request.