Public developer API
POST /v1/virtual-numbers/purchase
Purchases a currently available number from the organization USD wallet.
Access
A project-specific API key (Authorization: Bearer dapi_live_...) and its Business ID (X-Business-Id). Rate limited per business (120 calls a minute by default).
Requires an Idempotency-Key header.
Send an Idempotency-Key header and reuse it only when retrying the same purchase.
Quote the service first and pass its totalUsd as quotedTotalUsd. Purchases are unavailable unless enabled for the deployment.
Body
| Field | Type | Required | Description |
|---|---|---|---|
product | string | yes | Virtual-number service slug. |
country | string | yes | Country slug. |
operator | string | no | Operator returned by the quote endpoint. |
quotedTotalUsd | number | yes | Current USD total returned by the quote endpoint. |
Example request
curl --request POST \
--url 'https://production.dutchapi.co/v1/virtual-numbers/purchase' \
--header 'X-Business-Id: YOUR_BUSINESS_ID' \
--header 'Authorization: Bearer bsk_live_YOUR_BUSINESS_SECRET' \
--header 'Idempotency-Key: virtual-numbers-0001' \
--header 'Content-Type: application/json' \
--data '{"product":"whatsapp","country":"united_states","operator":"Carrier A","quotedTotalUsd":2}'
Response 201
{
"data": {
"transactionId": "vnm_8f2c1a",
"status": "active",
"service": "whatsapp",
"country": "United States",
"operator": "Carrier A",
"phoneNumber": "+12025550123",
"providerOrderReady": true,
"providerStatus": "RECEIVED",
"expiresAt": null,
"totalUsd": 2,
"currency": "USD",
"smsCode": null
}
}
Errors
| Status | error | Meaning |
|---|---|---|
| 403 | insufficient_scope | This project key is not allowed to do that. |
| 400 | idempotency_key_required | Send an Idempotency-Key header. |
| 402 | insufficient_funds | The wallet balance is too low. |
| 409 | virtual_number_price_changed | The current number price changed; request a new quote. |
| 422 | virtual_number_order_rejected | The provider rejected the order and the USD wallet was refunded. |
| 503 | virtual_number_purchases_disabled | Virtual number purchases are not enabled for this business. |