Skip to main content

Sandbox

Sandbox (Test Mode)​

Sandbox lets you integrate the Courier API risk-free: use your Test Key, and the endpoints & base URL are exactly the same as live, but every courier call runs against a mock and the balance uses a fake wallet. No real shipments, no real charges.

How to Use​

  1. Get your Test Key from the dashboard (the "Sandbox (Test) Key" card).
  2. Send that key in the x-api-co-id header — exactly like live.
  3. Run the normal flow: create address → check shipping cost → order. Everything is isolated from live data.

What's Different in Sandbox​

  • Free shipping rate checks — no Rp 5 fee.
  • Seeded wallet — the sandbox balance starts at around Rp 1.000.000 and decreases with each order; endpoints return 402 when the balance runs out.
  • Auto-advance — sandbox orders automatically move waiting → shipping → delivered within a few seconds, so you see the full webhook sequence without doing anything.
  • Manual trigger — force any event (problem/returned/failed/cancelled) via the trigger endpoint.
  • Flagged webhooks — every sandbox webhook payload carries "sandbox": true (similar to Stripe's livemode:false) so your handler can tell them apart.
  • Same reference data — the courier & location lists are shared (not sandbox-specific data).
info

Test Keys and Live Keys are fully separate: it's impossible to create a real order with a Test Key, and sandbox data never appears in your live order list.

Sandbox: Trigger Event​

Sandbox mode only. Force a single lifecycle event on a sandbox order so the matching webhook is sent — to test your handler without waiting.

POST /courier/v1/sandbox/orders/{id}/trigger

Request Body​

ParameterTypeRequiredDescription
eventstringyesOne of: shipping, delivered, problem, returned, cancelled, failed.

Example Request​

curl -X POST 'https://use.api.co.id/courier/v1/sandbox/orders/{id}/trigger' \
-H 'x-api-co-id: YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"event": "delivered"
}'

Example Response​

{
"is_success": true,
"message": "OK",
"data": { "id": "ord_3a9f", "status": "completed", "event": "delivered" }
}
  • Only applies to is_sandbox orders; live orders → 404.
  • Orders already in a final status (delivered/cancelled/returned) can no longer be changed.

Try it out​

tip

Use your sandbox Test Key to try these endpoints without creating real shipments or charges. See Sandbox.

  • POST/courier/v1/sandbox/orders/{id}/triggerSandbox: Trigger Event
Was this page helpful?