Skip to content

Sandbox

Testing in the sandbox

The sandbox is the same API on test data. Build and test your whole integration there: nothing you do reaches a real customer, the warehouse, or your live account, and it costs nothing.

Get a test key

On the partner portal open Account → Sandbox and create a test key. Test keys start with wsk_test_. Every partner has a sandbox; there is nothing to request.

The address is the same as live, https://api.wasil-iq.com/v1. The key decides which data you are working on:

Request
curl -i https://api.wasil-iq.com/v1/me \
  -H "Authorization: Bearer $WASIL_TEST_KEY"
Answer
HTTP/1.1 200 OK
X-Wasil-Mode: sandbox

{
  "data": {
    "name": "Example Store",
    "code": "EX",
    "mode": "sandbox",
    "plan": "Sandbox",
    "modules": { "tracking": true, "rates": true, "webhooks": true, "write": true },
    "requests_per_minute": 60
  }
}

Every answer carries the header X-Wasil-Mode (sandbox or live), and GET /v1/me has the same in mode. If you ever see sandbox in production, a test key was left in your configuration.

What is the same as live

  • Every endpoint, every field, every error code.
  • Webhooks: the same events, the same signature, the same retries.
  • Shipping quotes: the real prices, refreshed from live once a day.
  • Your requests-per-minute limit (counted separately from live).

What is different

LiveSandbox
API keywsk_…wsk_test_…
ModulesThe ones Wasil switched on for youAll four, always
Customer suiteUM1EX042UT1EX042
Package idWP…WT…
Webhook secretwhsec_…whsec_test_…
Event idevt_…evt_test_…
Creating a customerOpens a real Wasil account and US addressNothing real; shows as ready a few seconds later
PackagesLogged by the warehouseLogged by you, with the sandbox controls
Shipments and photosFilled as the package travelsAlways empty

A test suite (UT1…) is not an address. Never show one to a real customer or ship a real parcel to it: the warehouse has no customer for it.

A complete test run

From customer to delivered
# 1. a test customer (no real account, no cost)
curl -X POST https://api.wasil-iq.com/v1/customers \
  -H "Authorization: Bearer $WASIL_TEST_KEY" -H "Content-Type: application/json" \
  -d '{"name": "Sara Ahmed", "phone": "+9647701234567", "city_id": 1}'
#    -> "suite": "UT1EX042"

# 2. announce the package your customer ordered
curl -X POST https://api.wasil-iq.com/v1/packages \
  -H "Authorization: Bearer $WASIL_TEST_KEY" -H "Content-Type: application/json" \
  -d '{"account": "UT1EX042", "origin": "ger", "tracking_number": "1Z999AA10123456784", "partner_reference": "ORDER-4471"}'

# 3. play the warehouse: the package arrives ...
curl -X POST https://api.wasil-iq.com/v1/sandbox/packages \
  -H "Authorization: Bearer $WASIL_TEST_KEY" -H "Content-Type: application/json" \
  -d '{"account": "UT1EX042", "origin": "ger", "tracking_number": "1Z999AA10123456784"}'
#    -> "id": "WTgerT17CS1", "partner_reference": "ORDER-4471"

# 4. ... and is shipped, arrives in Iraq, is delivered
curl -X POST https://api.wasil-iq.com/v1/sandbox/packages/WTgerT17CS1/advance \
  -H "Authorization: Bearer $WASIL_TEST_KEY"

Each step fires the same webhooks as on live, within seconds. The portal's Sandbox page has buttons for steps 1, 3 and 4 if you prefer to click.

Test webhooks

  • The sandbox has its own webhook address and its own signing secret, set on the same Sandbox page. Point it at your development server; your live address is untouched.
  • The body carries "mode": "sandbox", so one receiver can tell test events from live ones.
  • The address must be public HTTPS, as on live. For a machine on your desk, use a tunnel (ngrok, Cloudflare Tunnel or similar).

Limits

One partner's sandbox holds at most 200 test customers and 1,000 test packages. Past that you get 409 sandbox_limit. POST /v1/sandbox/reset, or the Reset button on the portal, empties it; your test keys and webhook address stay.

If the sandbox itself is down you get 503 sandbox_unavailable. Live keys are never affected by that.

Going live

  1. Your code reads the API key and the webhook secret from configuration, one set per environment. Nothing is hard-coded.
  2. Your webhook receiver checks X-Wasil-Signature and ignores an event id it has already handled.
  3. Your error handling goes by error.code, and retries only what the errors page says to retry.
  4. You have run the whole journey above at least once, from customer to delivered.
  5. Tell your Wasil contact which modules you need on live. They look at what you exercised in the sandbox and switch them on.
  6. Create a live key (Account → API keys) and set your live webhook address (Account → Webhooks).
  7. Swap the key. GET /v1/me should now say "mode": "live".