---
title: "Purchase phone number"
method: POST
path: "/v1/phone-numbers/purchase"
tags: ["Phone Numbers"]
---

# Purchase phone number

`POST /v1/phone-numbers/purchase`

Payment-first: you do not pick a specific number, the system provisions one and
auto-assigns it. With usage-based billing active and a payment method on file, the
number provisions inline and bills per month on your usage-based invoice (there is
no checkout redirect). No payment method on file returns `402 PAYMENT_REQUIRED`;
a regulated country returns `202` with `status: "kyc_required"` and a `kycUrl`.

Requires usage-based billing (the Usage plan). The maximum number of phone numbers
is determined by the user's plan.

## Request body

- object
  - `profileId` string, required — Preferred profile for the number. One number = one profile, so when the requested profile already holds a number the API assigns the next free profile instead (or creates one) and returns the actual assignment in `profileId` on the response.
  - `country` string — ISO 3166-1 alpha-2 country for the number (default US). International numbers require usage-based billing. Tier 3/4 countries return 202 { status: "kyc_required", kycUrl } — the customer must complete KYC at that URL before the number is ordered. See GET /v1/phone-numbers/countries.
  - `numberType` 'local' | 'mobile' | 'national' | 'toll_free' — Which of the country's offered number types to order (see `types[]` on GET /v1/phone-numbers/countries). Omitted = the country's default type, which is always the WhatsApp-safe choice. Capabilities, price, and KYC requirements are per (country, type): toll_free can never connect WhatsApp (400 when combined with connectWhatsapp:true), and wantsSms:true requires an SMS-capable type.
  - `areaCode` string — Area code (national destination code, e.g. 11 for Sao Paulo) the number must be in. Hard constraint: when the area has no deliverable inventory the purchase fails with 409 code AREA_CODE_UNAVAILABLE instead of assigning a number from another area, and later replacements stay in this area too. Omit for any area. Get live options from GET /v1/phone-numbers/availability (areaOptions).
  - `connectWhatsapp` boolean — A phone number is the unit; WhatsApp is one optional feature. Pass false to buy a STANDALONE number (Calls/SMS only): provisioning skips the Meta pre-verify/OTP steps and the number activates immediately. Omitted defaults to the WhatsApp provisioning path. WhatsApp can be connected to a standalone number later from the connect flow.
  - `wantsSms` boolean — SMS capability is per-number, not per-country. Pass true to provision from the SMS-capable inventory pool so the number can actually text (see also GET /v1/phone-numbers/available with sms=true, and smsAvailable on GET /v1/phone-numbers/countries).
  - `wantsWhatsapp` boolean — Declare WhatsApp intent on a STANDALONE purchase (connectWhatsapp:false). The number still activates and bills immediately, but if WhatsApp's buy-time check rejects the assigned number, it is automatically swapped for a WhatsApp-eligible one during the purchase instead of being delivered with WhatsApp unavailable. Ignored on the WhatsApp provisioning path (connectWhatsapp omitted or true), which always delivers a WhatsApp-verified number.
  - `purchaseIntentId` string — Optional idempotency key. Send the same value when retrying a purchase: if a number was already bought under this key, the API returns { status: "already_purchased", numberId, phoneNumber, profileId } instead of provisioning a second number. Generate a fresh key for each genuinely new purchase.
  - `allowMultiple` boolean — Any second purchase within 10 minutes of a previous one is rejected with 409 code PURCHASE_VELOCITY as duplicate protection. Pass true to confirm the additional purchase is intentional (e.g. bulk provisioning).

## Response `200`

Either a checkout URL (first number) or the provisioned phone number (subsequent numbers).

- union
  - object — Checkout session created (first number)
    - `message` string
    - `checkoutUrl` string, uri
  - object — Phone number provisioned inline (subsequent numbers)
    - `message` string
    - `phoneNumber` object
      - `id` string
      - `phoneNumber` string
      - `status` string
      - `country` string
      - `provisionedAt` string, date-time
      - `metaPreverifiedId` string
      - `metaVerificationStatus` string
      - `profileId` string — The profile the number was actually assigned to.
  - object — A number was already purchased under the supplied purchaseIntentId; no new number was provisioned.
    - `status` 'already_purchased'
    - `numberId` string
    - `phoneNumber` string
    - `profileId` string — The profile the number was actually assigned to.

## Other responses

- `202` — Country requires end-user KYC before the number can be ordered.
- `400` — Plan limit reached, profileId required, or country not available
- `401` — Unauthorized
- `402` — Payment method required (Metronome user with no card on file). Response body carries code: PAYMENT_REQUIRED; add a card, then retry.
- `403` — A paid plan is required
- `409` — Either duplicate-purchase protection (code PURCHASE_VELOCITY: another number was purchased within the last 10 minutes; retry with allowMultiple: true to confirm), or the requested areaCode has no deliverable inventory right now (code AREA_CODE_UNAVAILABLE: pick another area or omit areaCode).
- `422` — International numbers require usage-based billing (legacy Stripe users are US-only). Response body code: USAGE_BILLING_REQUIRED.

---

[API](https://skmtc.net/zernio/apis/zernio-api.md) · [All operations](https://skmtc.net/zernio/apis/zernio-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/zernio/zernio-api/versions/51932b099b2f/schema)
