Skip to main content
POST
Purchase number
Buy one of the numbers search returned. Required scope: phone_numbers:purchase. This call charges the workspace’s card and starts a monthly subscription for the number, so it is the one step of the number journey that is not free to repeat. A saved payment method is required — add one with Set up payment first.

Retrying safely

Send an Idempotency-Key header — 16 to 128 letters, digits, underscores or hyphens — and a retry of the same purchase charges once and orders one number. Make a new random key, such as a UUID, for each number you decide to buy, and reuse it only to retry that purchase. A retry with the same key and the same number answers what the first request did: the same success body once the purchase went through, 409 PURCHASE_IN_PROGRESS while it is still going through, or 409 PURCHASE_FAILED when it did not go through. After PURCHASE_FAILED or any other error, send a new key. Retry within 24 hours: after that a key may be forgotten, and the request is then a new purchase. A key belongs to one number. The same key sent with a different number is a separate purchase: that number is bought and charged too. Without the header, every request is a new purchase.
Do not build the key from the number or the date. A key made that way repeats when you buy the same number again later, and the new purchase answers with the old one instead of buying anything. The first charge and every monthly charge come with an invoice, emailed to the workspace’s billing email; list them with GET /billing/invoices.

Response

A new Israeli number is never active at purchase time. It starts at pending_requirements while the regulator’s paperwork clears — usually one to three business days — and a background job promotes it when it does. Until then it appears in the list with that status, and an attempt to bind an agent to it is refused. Poll the list, or check the dashboard, rather than waiting on this response. monthlyPrice is in cents and matches the finalPriceCents the search showed. message is free text for a person to read — do not branch on it.

What happens if it fails

The subscription is created before the number is reserved, and is cancelled again if the reservation does not go through — a failed purchase does not leave you paying for a number you do not have.

Errors

Authorizations

Authorization
string
header
required

Your Yappr API key (e.g. ypr_live_...). Generate one in the dashboard under Settings → API Keys. No key is 401 MISSING_KEY; a key that is not one of ours, or is revoked, is 401 INVALID_KEY; an expired one is 401 EXPIRED_KEY. A valid key without the scope an operation needs is 403 INSUFFICIENT_SCOPE on every operation, and the message names the scope. Every response, a 401 included, carries X-RateLimit-Limit, X-RateLimit-Remaining and X-RateLimit-Reset: the budget is 60 requests a minute per API key. Every 429, whatever its code, carries Retry-After (whole seconds, never zero): the per-key budget's RATE_LIMIT asks for what is left of the minute, a route's daily cap (RATE_LIMITED) for the time until that cap resets. All four headers are listed in Access-Control-Expose-Headers, so a browser can read them. A path the API does not serve (an unknown sub-path, an id left empty) is 404 ROUTE_NOT_FOUND, and a method a served path does not take is 405 METHOD_NOT_ALLOWED with an Allow header; both are answered before any scope check, and nothing is read or changed. A trailing slash is ignored where it cannot be an id left empty (POST /calls/ is POST /calls) and refused where it can (GET /calls/). A doubled slash inside a path is merged into one before the request reaches the API (GET //calls is GET /calls).

Headers

Idempotency-Key
string

Makes the purchase safe to retry. A repeat with the same key, for the same number, charges once and orders one number: it answers the finished purchase with 200, 409 PURCHASE_IN_PROGRESS while the first request is still completing it, or 409 PURCHASE_FAILED when the first request's purchase did not go through. After PURCHASE_FAILED or any other error, send a new key. Without the header every request is a new purchase.

Pattern: ^[A-Za-z0-9_-]{16,128}$

Body

application/json
phone_number
string
required
Example:

"+972551234567"

Response

Purchase result. Israeli numbers always start as pending_requirements — they are never active at purchase time. Activation happens later, once regulatory requirements clear (usually 1–3 business days), promoted by a background job.

success
boolean
phoneNumber
string
monthlyPrice
integer

Monthly cost in cents

currency
string
status
enum<string>

Always pending_requirements at purchase time for Israeli numbers.

Available options:
pending_requirements
message
string

Human-readable status note (e.g. regulatory-review notice).