API reference
Orders
An order is one number for one service. Create it, put the number into the app you're verifying, and read the code when it arrives. Unused orders are refunded automatically.
Endpoints
- PendingPaid; assigning a number
- WaitingNumber ready, no SMS yet
- ReceivedA code arrived
- CompletedFinished, or past expires_at
Refunded in fullRefunded
- from waitingCancelledYou cancelled it before any SMS arrived.
- from waitingExpiredNo SMS before
expires_at. - from pendingFailedNo number could be assigned.
- Waiting window
- Each order waits 20 minutes for an SMS (
expires_at). No SMS by then:expiredand refunded. - More than one SMS
- Resends land on the same order until it ends.
codeis always the latest;messageskeeps them all. - Refunds
- Exactly once, to your balance, the moment an order is cancelled, expires or fails. See
refunded_at.
Simulator inventory carries demo: true — fictional numbers, simulated SMS. The web app labels it wherever prices or stock are shown.
Invite-only for now
not_available for now. Everything else on this page is how the API behaves at launch.The Order object
A one-time number bought for one service. The order waits for an SMS until expires_at; if none arrives it is refunded automatically.
Attributes
idstringUnique identifier, prefixed
ord_.statusstringpending(assigning a number) →waiting(number assigned, no SMS yet) →received(a code arrived) →completed. Refunded end states:cancelled,expired,failed.serviceobjectThe service the number is for.
Show child attributesHide child attributes
slugstringThe service's stable identifier, e.g.
whatsapp.namestringDisplay name.
countryCountry objectThe number's country.
phone_numberstring· nullableThe number in E.164 format.
nulluntil one is assigned.pricestringAmount charged in US dollars, as a decimal string.
price_microsintegerAmount charged in micro-dollars (1 USD = 1,000,000).
codestring· nullableThe latest verification code received, or
null.messagesarray of Message objectsEvery SMS received for this order, newest first.
strategystringThe strategy used to pick the offer.
One of:
bestcheapestfastestsourcestringWhere the order was placed.
One of:
webapicreated_attimestampWhen the order was created.
expires_attimestamp· nullableWhen the order stops waiting. Unused orders are refunded at this time.
received_attimestamp· nullableWhen the first SMS arrived.
completed_attimestamp· nullableWhen the order was completed.
cancelled_attimestamp· nullableWhen the order was cancelled.
refunded_attimestamp· nullableWhen the price was returned to your balance.
can_cancelbooleanWhether Cancel an order would succeed now (waiting, no SMS yet).
can_finishbooleanWhether Finish an order would succeed now (an SMS arrived).
demobooleantruefor simulator inventory: fictional numbers and simulated SMS.
{
"id": "ord_7Hq2LmX9vB3kR8tN4cYp",
"status": "received",
"service": {
"slug": "whatsapp",
"name": "WhatsApp"
},
"country": {
"iso2": "US",
"name": "United States",
"dial_code": "+1"
},
"phone_number": "+12025550147",
"price": "0.895",
"price_micros": 895000,
"code": "482913",
"messages": [
{
"id": "msg_4mQ8rXc2LpV7nZ1kT9bW",
"from": "32665",
"body": "Your WhatsApp code: 482-913\nDon't share this code with others",
"code": "482913",
"received_at": "2026-10-06T14:02:19.000Z"
}
],
"strategy": "best",
"source": "api",
"created_at": "2026-10-06T14:02:03.000Z",
"expires_at": "2026-10-06T14:22:03.000Z",
"received_at": "2026-10-06T14:02:19.000Z",
"completed_at": null,
"cancelled_at": null,
"refunded_at": null,
"can_cancel": false,
"can_finish": true,
"demo": true
}The Message object
An SMS received on an order's or rental's number.
Attributes
idstringUnique identifier, prefixed
msg_.fromstringSender: a short code, phone number or alphanumeric sender ID.
bodystringFull message text.
codestring· nullableThe verification code we extracted from
body, ornullwhen unsure.received_attimestampWhen the SMS arrived.
{
"id": "msg_4mQ8rXc2LpV7nZ1kT9bW",
"from": "32665",
"body": "Your WhatsApp code: 482-913\nDon't share this code with others",
"code": "482913",
"received_at": "2026-10-06T14:02:19.000Z"
}Create an order
Buys a number for service and returns the order in waiting, with phone_number set. Enter that number in the app you're verifying, then poll Retrieve an order (or listen for the order.code_received webhook) until code is set.
Without offer_id we buy the top quote for strategy in country (or anywhere). Set max_price to refuse anything pricier. The price is charged when the order is created; if no SMS arrives before expires_at, it is refunded in full automatically.
Send an Idempotency-Key so a retried request can never buy twice. See Idempotency.
Headers
Idempotency-Keystring· optionalA unique string (e.g. a UUID), up to 255 characters. Retrying the same request with the same key returns the original order; a different request with it fails with
idempotency_conflict.
Body · application/json
servicestringRequiredService slug (or
svc_id), e.g.whatsapp.countrystring· optionalISO2 country code, or
any(the default) to let the strategy pick.strategystring· optionalHow to pick the offer when
offer_idis not given.One of:
bestcheapestfastestDefaults to
best.max_pricestring | number· optionalHighest price you accept, in USD (
"0.50"or0.5). Fails withprice_above_maxotherwise.max_price_microsinteger· optionalThe same limit in micro-dollars. Send
max_priceor this, not both.offer_idstring· optionalBuy exactly this offer from Get quotes (
ofr_…).
Returns
Returns an Order object.
- 201The new order. Its URL is in the
Locationheader.Location· Path of the order, e.g./api/v1/orders/ord_…. - 200The
Idempotency-Keywas used before: the original order in its current state, withIdempotent-Replayed: true. Nothing is charged.Idempotent-Replayed· Alwaystrueon a replay.Location· Path of the original order.
Errors
- 400invalid_request
- 402insufficient_balance
- 403not_available
- 404service_not_found
- 404country_not_found
- 409no_inventory
- 409price_above_max
- 409idempotency_conflict
- 413payload_too_large
Any endpoint can also return unauthorized, account_disabled, rate_limited and internal_error, and method_not_allowed when called with another method.
curl https://passcode.sh/api/v1/orders \
-H "Authorization: Bearer $PASSCODE_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: $(uuidgen)" \
-d '{
"service": "whatsapp",
"country": "US",
"max_price": "1.00"
}'{
"id": "ord_7Hq2LmX9vB3kR8tN4cYp",
"status": "waiting",
"service": {
"slug": "whatsapp",
"name": "WhatsApp"
},
"country": {
"iso2": "US",
"name": "United States",
"dial_code": "+1"
},
"phone_number": "+12025550147",
"price": "0.895",
"price_micros": 895000,
"code": null,
"messages": [],
"strategy": "best",
"source": "api",
"created_at": "2026-10-06T14:02:03.000Z",
"expires_at": "2026-10-06T14:22:03.000Z",
"received_at": null,
"completed_at": null,
"cancelled_at": null,
"refunded_at": null,
"can_cancel": true,
"can_finish": false,
"demo": true
}List orders
Returns your orders newest first. Active orders are brought up to date first, so statuses are current. Page with limit and the next_cursor of the previous page (Pagination).
Query parameters
statusstring· optionalOnly these statuses. One status, or several separated by commas:
waiting,received.limitinteger· optionalPage size, 1–100.
Defaults to
25.Between 1 and 100.
cursorstring· optionalnext_cursorfrom the previous page.
Returns
- 200A page of orders.
dataarray of Order objectsOrders on this page.
has_morebooleanWhether another page follows.
next_cursorstring· nullablePass as
cursorto fetch the next page;nullon the last page.
Errors
Any endpoint can also return unauthorized, account_disabled, rate_limited and internal_error, and method_not_allowed when called with another method.
curl -G https://passcode.sh/api/v1/orders \
-H "Authorization: Bearer $PASSCODE_API_KEY" \
-d status=received \
-d limit=10{
"data": [
{
"id": "ord_7Hq2LmX9vB3kR8tN4cYp",
"status": "completed",
"service": {
"slug": "whatsapp",
"name": "WhatsApp"
},
"country": {
"iso2": "US",
"name": "United States",
"dial_code": "+1"
},
"phone_number": "+12025550147",
"price": "0.895",
"price_micros": 895000,
"code": "482913",
"messages": [
{
"id": "msg_4mQ8rXc2LpV7nZ1kT9bW",
"from": "32665",
"body": "Your WhatsApp code: 482-913\nDon't share this code with others",
"code": "482913",
"received_at": "2026-10-06T14:02:19.000Z"
}
],
"strategy": "best",
"source": "api",
"created_at": "2026-10-06T14:02:03.000Z",
"expires_at": "2026-10-06T14:22:03.000Z",
"received_at": "2026-10-06T14:02:19.000Z",
"completed_at": "2026-10-06T14:03:40.000Z",
"cancelled_at": null,
"refunded_at": null,
"can_cancel": false,
"can_finish": false,
"demo": true
}
],
"has_more": true,
"next_cursor": "MjAyNi0xMC0wNlQxNDowMjowMy4wMDBafG9yZF83SHEy"
}Retrieve an order
Returns the order, settled first: a due SMS is attached and an overdue order is expired and refunded before we respond. Poll this every 2–5 seconds while status is waiting, or use webhooks.
Path parameters
idstringRequiredThe order id (
ord_…).
Errors
Any endpoint can also return unauthorized, account_disabled, rate_limited and internal_error, and method_not_allowed when called with another method.
curl https://passcode.sh/api/v1/orders/ord_7Hq2LmX9vB3kR8tN4cYp \
-H "Authorization: Bearer $PASSCODE_API_KEY"{
"id": "ord_7Hq2LmX9vB3kR8tN4cYp",
"status": "received",
"service": {
"slug": "whatsapp",
"name": "WhatsApp"
},
"country": {
"iso2": "US",
"name": "United States",
"dial_code": "+1"
},
"phone_number": "+12025550147",
"price": "0.895",
"price_micros": 895000,
"code": "482913",
"messages": [
{
"id": "msg_4mQ8rXc2LpV7nZ1kT9bW",
"from": "32665",
"body": "Your WhatsApp code: 482-913\nDon't share this code with others",
"code": "482913",
"received_at": "2026-10-06T14:02:19.000Z"
}
],
"strategy": "best",
"source": "api",
"created_at": "2026-10-06T14:02:03.000Z",
"expires_at": "2026-10-06T14:22:03.000Z",
"received_at": "2026-10-06T14:02:19.000Z",
"completed_at": null,
"cancelled_at": null,
"refunded_at": null,
"can_cancel": false,
"can_finish": true,
"demo": true
}Cancel an order
Cancels a waiting order with no messages and refunds it in full, exactly once. Cancelling an already-cancelled order returns it unchanged.
Once an SMS has arrived the order can't be cancelled (invalid_state); finish it instead.
Path parameters
idstringRequiredThe order id (
ord_…).
Body
No body. Send an empty POST.
Errors
Any endpoint can also return unauthorized, account_disabled, rate_limited and internal_error, and method_not_allowed when called with another method.
curl -X POST https://passcode.sh/api/v1/orders/ord_7Hq2LmX9vB3kR8tN4cYp/cancel \
-H "Authorization: Bearer $PASSCODE_API_KEY"{
"id": "ord_7Hq2LmX9vB3kR8tN4cYp",
"status": "cancelled",
"service": {
"slug": "whatsapp",
"name": "WhatsApp"
},
"country": {
"iso2": "US",
"name": "United States",
"dial_code": "+1"
},
"phone_number": "+12025550147",
"price": "0.895",
"price_micros": 895000,
"code": null,
"messages": [],
"strategy": "best",
"source": "api",
"created_at": "2026-10-06T14:02:03.000Z",
"expires_at": "2026-10-06T14:22:03.000Z",
"received_at": null,
"completed_at": null,
"cancelled_at": "2026-10-06T14:04:12.000Z",
"refunded_at": "2026-10-06T14:04:12.000Z",
"can_cancel": false,
"can_finish": false,
"demo": true
}Finish an order
Completes a received order once you've used the code. Orders with a code also complete on their own at expires_at; finishing early just releases the number sooner. Finishing a completed order returns it unchanged.
Path parameters
idstringRequiredThe order id (
ord_…).
Body
No body. Send an empty POST.
Errors
Any endpoint can also return unauthorized, account_disabled, rate_limited and internal_error, and method_not_allowed when called with another method.
curl -X POST https://passcode.sh/api/v1/orders/ord_7Hq2LmX9vB3kR8tN4cYp/finish \
-H "Authorization: Bearer $PASSCODE_API_KEY"{
"id": "ord_7Hq2LmX9vB3kR8tN4cYp",
"status": "completed",
"service": {
"slug": "whatsapp",
"name": "WhatsApp"
},
"country": {
"iso2": "US",
"name": "United States",
"dial_code": "+1"
},
"phone_number": "+12025550147",
"price": "0.895",
"price_micros": 895000,
"code": "482913",
"messages": [
{
"id": "msg_4mQ8rXc2LpV7nZ1kT9bW",
"from": "32665",
"body": "Your WhatsApp code: 482-913\nDon't share this code with others",
"code": "482913",
"received_at": "2026-10-06T14:02:19.000Z"
}
],
"strategy": "best",
"source": "api",
"created_at": "2026-10-06T14:02:03.000Z",
"expires_at": "2026-10-06T14:22:03.000Z",
"received_at": "2026-10-06T14:02:19.000Z",
"completed_at": "2026-10-06T14:03:40.000Z",
"cancelled_at": null,
"refunded_at": null,
"can_cancel": false,
"can_finish": false,
"demo": true
}