Skip to Content
Grail Network

Errors

The error body, the statuses, and the partner's codes with what to do next.

The error body

An error answer has the content type application/problem+json (RFC 9457, "Problem Details for HTTP APIs"):

{
  "status": 409,
  "code": "PULL_BALANCE_TOO_LOW",
  "detail": "The shop's balance is lower than the amount of the pull.",
  "traceId": "4bf92f3577b34da6a3ce929d0e0e4736"
}
  • code is the error's name. It never changes. Your code branches on code, never on detail.
  • detail is a text for a developer. It can change. Never show it to a buyer.
  • traceId names the request in Grail Network's logs. Send it to Grail Network when you report a problem.

The statuses

StatusMeaningWhat to do
400 VALIDATION_FAILEDA field of the request does not fit its schema. errors lists each field with field and messageCorrect the request. Do not send it again as it is
401The API key is missing or not validCheck the header and the key
403 FORBIDDENThe key may not call this routeUse the routes of your own section
404The record does not exist, or it is not yoursCheck the id
409The state of the data refuses the request, such as a balance that is too lowRead code. Each route's page lists its codes
503Another part of Grail Network gave no answerSend the request again later
500A mistake of Grail NetworkReport it with the traceId

A business error is always 404 or 409. Grail Network never answers 422.

An example of 400:

{
  "status": 400,
  "code": "VALIDATION_FAILED",
  "detail": "The request does not fit its schema.",
  "traceId": "4bf92f3577b34da6a3ce929d0e0e4736",
  "errors": [{ "field": "packCount", "message": "Too big: expected a number of at most 5" }]
}

The partner's codes

CodeStatusRoutesWhat your system does
PARTNER_ITEM_NOT_FOUND404A card by its idCheck the id. Another partner's card gives this code too
PARTNER_ITEM_SOLD409The price adjustment, a take-backStop: the card is sold and can no longer change. Read its state
PARTNER_ITEM_TAKEN_BACK409The price adjustmentStop: you asked to take the card back
PARTNER_WEBHOOK_URL_INVALID409Set the webhookUse an address with a public host
PARTNER_WEBHOOK_NOT_SET409A new webhook secretSet a webhook address first. It makes a secret
PARTNER_STATEMENT_DAY_NOT_CLOSED409StatementsWait: a day closes at 00:01 UTC of the next day
SERVICE_UNAVAILABLE503The cards, the price adjustment, a take-back, the intakesSend the request again after the seconds of the header Retry-After
ROUTE_NOT_FOUND404Any path that does not existCheck the path

The routes of your record, your webhook, the report lines and the statements never answer 503 for another part of Grail Network.

On this page