Errors#
Format#
An error has a JSON body with one field, error. The field tells you the cause in English.
{"error": "Expiry must be between 1 and 168 hours"}
Do not compare the text of error in your code. The text can change. Use the status code.
Status codes#
| Status | Meaning | What to do |
|---|---|---|
200 |
The operation is complete. | — |
201 |
Rokh made a new item, for example a request or a key. | — |
400 |
The request is not correct. Examples: a field with a wrong value, an unknown field, a body that is not a JSON object. | Read error. Correct the request. Do not send it again without a change. |
401 |
No key, a wrong key, a revoked key, or no panel session | Examine the key. See Authentication. |
403 |
The operation needs the panel session, not an API key. | Sign in to the panel. |
404 |
The item does not exist, or it belongs to a different vendor. The report is not ready. | Examine the identifier. For a report, wait for the status submitted. |
405 |
The method is not correct for this address. | Use the method in the API reference. |
409 |
The item is not in the correct state. Examples: revoke a completed request, or an Idempotency-Key with a different body. |
Read the item again. Then decide what to do. |
410 |
A customer link after a revoke or after its expiry | Reissue the request. |
413 |
A file is too large. | Send a smaller file. |
429 |
Too many sign-in attempts from one address | Wait one minute. Then try again. |
500 |
An error in Rokh | Send the request again after a short time. If the error stays, tell the Rokh operations team. |
503 |
Rokh is not available for a short time. | Send the request again after a short time. |
Send a request again#
- Send a request again only after
429,500,503or a network error. - Wait before each new attempt. Make the wait longer after each attempt, for example 1, 2, 4 and 8 seconds.
- For
POST /api/vendor/requests, always send anIdempotency-Key. Then a second attempt cannot make a second request. See Requests.
Errors of the customer pages#
The customer pages use their own endpoints under /api/r/{token}. These endpoints also give {"error": "…"} and, in some errors, a code. Your server does not call these endpoints. The customer page shows the errors to the customer in Persian.