Getting started
Authentication
Every request carries an API key. The key says which partner is calling; there are no user sessions and no other credentials.
Sending the key
Send it as a Bearer token, over HTTPS, on every request:
Authorization: Bearer wsk_4f9c1d0a7b2e8c5d3a6f9b1e0c7d4a2b8e5f3c6d
A request without a key, or with one we do not know, answers 401:
HTTP/1.1 401 Unauthorized
{
"error": {
"code": "unauthenticated",
"message": "Send your API key as a Bearer token in the Authorization header."
}
}
Managing keys
- Keys are created on the portal under Account → API keys. Give each one a name that says where it is used ("Checkout server").
- A key starts with
wsk_followed by 40 letters and digits. It is shown once. Wasil stores only a fingerprint, so nobody, including Wasil staff, can show it to you again. - You can have up to 10 live keys. Use one per system, so you can revoke one without touching the others.
- The portal shows the first characters of each key and when it was last used.
Test keys
A key that starts with wsk_test_ is a sandbox key, created under Account → Sandbox.
It is sent the same way, to the same address, and works on test data only; see Testing in the sandbox.
Every answer says which kind of key it was answering, in the header X-Wasil-Mode.
Treat a test key with the same care as a live one.
Replacing a key
- Create a new key.
- Deploy it to your system.
- When the portal shows the old key is no longer being used, revoke it.
A revoked key stops working at once and answers 401 with the code key_revoked. If a key may have leaked, revoke it first and replace it second.
Keeping it safe
A key belongs on your server. Never put it in a mobile app, in JavaScript that runs in a browser, or in a repository. Anyone who holds it can read your customers' packages.
Suspended accounts
If Wasil suspends a partner account, every key of it answers 403 with the code partner_suspended until the account is active again.