Errors and retries
Error format
A failed request returns a status code and a body like this:
The message is written for a person. Use the status code in your software, not the message text.
Responsejson
{
"code": 400,
"message": "Set the stock quantity before publishing"
}Status codes
| Status | Meaning | What to do |
|---|---|---|
400 | The request is not valid: a field is missing or a rule is not met | Fix the request, do not retry as is |
401 | The key is missing, wrong or revoked | Check the key |
403 | The account cannot do this, for example it is limited | Contact support |
404 | The listing, stock item or order does not exist or is not yours | Check the id |
422 | The Idempotency-Key was already used with a different request | Use a new key |
409 | The action does not fit the current state, or the same request is still running | Read the current state and try again |
429 | A request or listing limit is full | Wait for Retry-After, then retry |
500 | Something failed on our side | Retry after a short wait |
Retrying safely
If a request times out, you cannot know whether it reached us. To retry without creating a second listing, send an Idempotency-Key header with a unique value of your own, for example a UUID:
- If the first request succeeded, a repeat with the same key returns the first answer and adds the header
Idempotent-Replayed: true. Nothing is created twice. - The same key with a different body is rejected with
422. Use a new key for a new request. - If the first request is still running, the repeat returns
409. - If the first request failed, the key is free again and you can retry with a corrected body.
- A key is remembered for 24 hours and can be at most 100 characters.
The header works on creating a listing, bulk creating listings and adding stock.
Requestbash
curl -X POST https://api.gamerarea.gg/v1/seller-api/listings \
-H "Authorization: Bearer ga_live_your_key" \
-H "Idempotency-Key: 7c1f0a52-0f3c-4e0e-9d2b-5b8c1c1a9e10" \
-H "Content-Type: application/json" \
-d '{ }'Bulk requests
Bulk requests return 200 even when some items fail. Each item has its own result, in the order you sent them:
Responsejson
{
"message": "Bulk create finished",
"data": [
{ "index": 0, "ok": true, "listing": { } },
{ "index": 1, "ok": false, "error": "Price can have at most 4 decimals" }
]
}