Buy a phone number
acquire_numberBuys a real phone number using a valid quote, charges setup and first-month fees, and returns details needed to route it to an agent.
Instructions
Buys a real phone number. It charges the setup fee and the first month now and renews monthly. Call quote_numbers first. Pass the offer's quote_id, country_code, number_type, and confirm_total_cents = monthly_cents + setup_cents from that offer. If the quote expired or the price changed (409) you get an error: quote again. Only buy when your user asked for this number. After buying, call route_number to point it at an agent.
A quote buys at most one number. After a timeout, retry with the same
quote_id and idempotency_key, or check list_numbers. Never request a
new quote after a timeout.
``idempotency_key`` is optional; to retry after a timeout or a
5xx, pass the ``idempotency_key`` that result returned, so the number
is bought once. A 4xx error returns no key: the API remembers that
failure under it, so drop it and quote again.
``verification_id`` picks which approved verification buys a number
that needs one: the ``id`` of an approved entry in the offer's
``verifications``. Pass it when more than one is approved: show the
user each ``subject_name`` (the person's or company's name) and ask
which. With one approved, it is used. ``subject_type`` (``person`` or
``business``) is optional: it keeps only that kind. A 422 on
``verification_id`` means several are approved and none was picked,
or the id is not an approved verification for this number.
Returns the number (``id``, ``e164``, ``provisioning_state``,
``verification_id``, ``subject_name``, ...)
plus ``idempotency_key``, or ``{"error": "<message>",
"idempotency_key": ...}``.Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| quote_id | Yes | ||
| number_type | Yes | ||
| country_code | Yes | ||
| subject_type | No | ||
| idempotency_key | No | ||
| verification_id | No | ||
| confirm_total_cents | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||