Getting started
Errors
Every error has the same shape and a stable code. Write your handling against the code, not the message.
The shape
{
"error": {
"code": "validation_failed",
"message": "Some fields are not valid.",
"fields": {
"weight_kg": ["The weight kg must be greater than 0."],
"city_id": ["The selected city id is invalid."]
}
}
}
code: a fixed word from the table below. It does not change.message: a sentence for a person. It may be reworded.- Some codes add a field of their own (
fields,module,suite,id).
The codes
| Code | HTTP | Meaning | What to do |
|---|---|---|---|
unauthenticated |
401 | No key was sent, or we do not know it. | Send Authorization: Bearer <key>. Check the key was copied whole. |
key_revoked |
401 | The key was revoked on the portal. | Create a new key and deploy it. |
partner_suspended |
403 | Wasil has suspended the partner account. | Contact Wasil. |
module_disabled |
403 | The endpoint belongs to a module you do not have. error.module names it. |
Ask Wasil to switch the module on. |
forbidden |
403 | The request is not allowed for another reason. | Read error.message. |
not_found |
404 | Nothing at this address, or it is not yours. | Check the id; make sure the account is one of yours. |
validation_failed |
422 | One or more fields are missing or wrong. error.fields lists the messages per field. |
Fix the fields and send again. |
customer_exists |
409 | The phone already belongs to a customer. If the customer is yours, error.suite holds the suite. |
Use the existing customer. |
expected_exists |
409 | This tracking number is already announced for this account. error.id is the announcement. |
Nothing: it is already there. |
not_cancellable |
409 | The announcement is already matched or cancelled. | Nothing to do. |
busy |
409 | Another of your requests is creating a customer at this moment. | Send the request again after a second. |
rate_limited |
429 | More requests than your plan allows per minute. | Wait Retry-After seconds. |
server_error |
500 | Something failed on our side. It is logged. | Try again later; if it lasts, tell Wasil the time and the address. |
invalid_step |
409 | Sandbox only: the test package cannot move to that step (it never goes back, and a delivered one is finished). | Pick a later step, or make a new test package. |
sandbox_limit |
409 | Sandbox only: your sandbox is full. error.limit is the maximum. |
Reset the sandbox. |
sandbox_unavailable |
503 | A test key was used and the sandbox is not available. Live keys are not affected. | Try again later. |
When to try again
- Try again:
rate_limited(afterRetry-After),busy(after a second),server_errorand network timeouts (with growing pauses). - Do not try again unchanged: every other code. The same request will get the same answer.