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

# Purchase phone number

`POST /v1/messaging/phone-numbers/purchase`

## Request

- Base URL: `https://apihub.co.il`
- URL: `https://apihub.co.il/v1/messaging/phone-numbers/purchase`
- Auth: HTTP bearer

Payment-first: the system provisions a number and auto-assigns it, unless you pass
`phoneNumber` to buy one exact number from `GET /v1/phone-numbers/available`. 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`.

The monthly price is the one `GET /v1/phone-numbers/countries` quotes for that
country and `numberType` at the time of purchase, and it is stamped on the number:
later rate-card changes never move a number you already own.

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


**Billing:** Request; paid actions are priced in credits (see GET /v1/messaging/prices) · **Rate limit:** 60/min

## Headers

- `Idempotency-Key` string
- `X-Tag` string

## Request body

- object
  - `claimId` string: Keyless calls only: a `claimId` from a keyless GET /v1/phone-numbers/available. The 401 then carries a `claimUrl` for that exact number. Ignored when an API key is sent.
  - `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.
  - `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).
  - `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).
  - `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.
  - `phoneNumber` string: One exact number to buy, in E.164, taken from GET /v1/phone-numbers/available. Hard constraint: when it is no longer available (bought by someone else, or WhatsApp's buy-time check rejects it) the purchase fails with 409 code PHONE_NUMBER_UNAVAILABLE instead of assigning another number; search again and pick another. Only for countries and types that activate instantly: a regulated one (202 kyc_required) returns 400 when phoneNumber is set.
  - `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).
  - `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.
  - `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.
  - `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.

## Response `200`

Completed

- object
  - `id` string: Execution id — stable across internal retries; use it with GET /v1/executions/{id}
  - `status` 'pending' | 'processing' | 'completed' | 'partial' | 'failed' | 'cancelled' | 'timeout'
  - `operation` string
  - `tag` string, nullable: Your X-Tag, if sent
  - `created_at` string, date-time
  - `completed_at` string, date-time, nullable
  - `output` 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
        - `status` string
        - `country` string
        - `profileId` string: The profile the number was actually assigned to.
        - `phoneNumber` string
        - `provisionedAt` string, date-time
        - `metaPreverifiedId` string
        - `metaVerificationStatus` string
    - object: A number was already purchased under the supplied purchaseIntentId; no new number was provisioned.
      - `status` 'already_purchased'
      - `numberId` string
      - `profileId` string: The profile the number was actually assigned to.
      - `phoneNumber` string
  - `error` string, nullable
  - `usage` object
    - `credits_charged` number, nullable
    - `credits_reserved` number
    - `estimated_credits` number
    - `cost_source` 'provider_reported' | 'calculated' | 'estimated' | 'null', nullable
    - `provider_usage` object, nullable: Normalised consumption, e.g. { VIDEO_SECOND: 22.4 }
  - `balance` object
    - `available` number
    - `reserved` number

## Other responses

- `400`: Invalid input
- `402`: Insufficient credits / project budget
- `404`: Resource not found (or not yours)
- `429`: Rate limited
- `503`: Service temporarily paused

---

[API](https://skmtc.dev/apihub/apis/apihub-one-api-for-chat-image-video-ai.md) · [All operations](https://skmtc.dev/apihub/apis/apihub-one-api-for-chat-image-video-ai/llms.txt) · [OpenAPI document](https://skmtc.dev/apihub/apis/apihub-one-api-for-chat-image-video-ai/revisions/a8caa42835ce?raw)
