Skip to Content
Grail Network

Errors

The error body, the statuses, and where each route lists its codes.

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 codes of each route

AreaWhere its codes are
A pullPurchases of packs
A proofPULL_PROOF_NOT_FOUND (404): the pull is not completed. See Check a pull
A packPACK_NOT_FOUND (404). See Packs
A sale backHoldings
A quote and an orderShipping

A request that fails stays failed: a pull, a market purchase and an order answer their first error to each repeat of the same request. To try again, send a new request id (and a new commitment for a pull, a new quote for an order).

On this page