Developers

POST/v3/order/{prefix_id}

Order phone numbers from a prefix

Purchase a quantity from current prefix inventory, preserve order references, and reconcile prices, partial allocations and activation.

On this page
  1. Order from a prefix
  2. Submit the purchase
  3. Delivery and renewal settings
  4. Read the complete result
  5. Partial purchases and uncertain outcomes
  6. Registration and activation
  7. Order callbacks
  8. Failures to handle

Order from a prefix

Use this operation when the prefix catalogue directs you to order a quantity from a prefix rather than choose individual available numbers. Start with countries, areas or states, and prefixes. Keep the prefix identifier and price plan from the same fresh result. For a particular number selected from an available-number list, use Purchase a selected phone number.

This request can purchase numbers and incur charges. It is not a price quotation, reservation or dry run. Review setup and monthly charges, incoming-minute rates, included minutes, channels, registration requirements and the account’s purchase limits before submitting. A catalogue result does not reserve inventory or freeze prices. Account funding checks can happen before fulfillment; an error does not by itself prove that no purchase or account funding occurred.

Submit the purchase

Use an enabled API account over HTTPS from an allowed source IP address. Set the variables from your current catalogue selection and your approved delivery configuration. The following command purchases one number.

curl --silent --show-error --user "$API_USER:$API_PASSWORD" \
  --data-urlencode 'quantity=1' \
  --data-urlencode "price_id=$PRICE_ID" \
  --data-urlencode "channels=$CHANNELS" \
  --data-urlencode "reference=$ORDER_REFERENCE" \
  --data-urlencode "uri=$VOICE_URI" \
  "https://api.multitel.net/v3/order/$PREFIX_ID"

Form POST is shown above. The coordinator also reads a JSON object when Content-Type is application/json. JSON fields override matching form/request fields. Use one encoding consistently; do not send conflicting query and body values.

Order selection and notification parameters
ParameterMeaning
prefix identifier in the pathThe prefix UUID returned by the catalogue. A country, area, price or individual-number identifier is not a substitute.
quantitySend an integer from 1 to 100. Default 1. Values below 1 are coerced to 1; this is not a validation-only request. Values above 100 throw before this coordinator’s normal response handling, so do not depend on its usual JSON shape for that invalid input.
price_idThe selected plan’s public price identifier. priceid is a legacy alias. A non-matching identifier can silently fall back to a different plan; this field is not a strict price lock. Confirm account price caps before purchase and inspect the returned price afterward.
channelsThe channel count from the selected plan. When an exact price match is not used, a matching channel count can influence fallback selection. It does not independently guarantee that a particular plan is purchased.
referenceYour label for the purchase or batch. Use a short ASCII value, at most 255 bytes; longer values are truncated. It is retained with successful purchases and included in callbacks when supplied. Separate orders may share the same reference. It is not an idempotency key: submitting this operation again can purchase and charge for additional numbers, even with the same reference and identical fields.
webhook_urlOptional callback URL. Use an HTTPS endpoint you control. HTTP and HTTPS URLs pass the current basic validator; an invalid URL is ignored rather than rejecting the purchase. A callback is additional notification, not proof that a request is safely repeatable.

Delivery and renewal settings

Choose the same delivery settings you would use for the number in the portal. These are advanced configuration values, not instructions to create a Hosted PBX or an origination trunk. Reuse a known working account configuration and verify the saved number after purchase. An accepted purchase alone does not verify that voice or SMS delivery works.

Additional order fields
FieldUse and compatibility
uri, uri2, uri3Primary and additional voice destinations. Supply destinations appropriate for the selected forwarding and ring modes.
forward_destinationVoice forwarding mode. forwarding_destination and type are legacy aliases. Omission uses the checkout path’s default; an empty field is not a reliable way to clear an existing preference.
ring_typeVoice ring mode; ringtype is an alias. Use a supported value from your account’s number configuration.
sms_forward_destination, sms_uriSMS delivery mode and destination. Legacy aliases are smsringtype and smsuri. Some checkout paths apply the account’s default SMS destination when this is empty. SMS availability depends on the selected number and its activation/registration.
overflowRequested overflow setting. Plan availability and the checkout path affect whether it is supported.
force_codec, force_dtmfRequested codec and DTMF settings. Legacy aliases are forcecodec and forcedtmf. Verify the saved configuration for the selected inventory.
origination_trunk_idAn existing trunk configuration identifier, where applicable. This does not create a trunk. Omission uses the checkout default.
autorenewRequested renewal setting. Do not assume that 0 disables renewal: some checkout paths treat an empty-like value, including 0, as the default enabled setting. Check and, when needed, change renewal on the purchased number in the portal.

These fields are normalized and passed to checkout, but persistence differs across inventory paths. The current order route does not expose the selected-number purchase guide’s strict quote-cap fields as equivalent guards. Use the account’s purchase permissions and price limits, and inspect the resulting number configuration.

Read the complete result

Parse the JSON body and inspect status.code and status.msg even when the HTTP request succeeds. This route writes its own JSON response, and the shared response helper also does not necessarily map the application code to the HTTP status. Application codes may be JSON numbers or numeric strings. Do not require status.results; it is not present in the normal order result.

{
  "status": {"code": "200", "msg": ""},
  "response": {
    "id": "o_fictional_example",
    "numbers": ["12025550123"],
    "price": {
      "per_minute": "0.01",
      "free_minutes": 0,
      "setup_price": "1.25",
      "monthly_price": "2.50",
      "channels": 2
    },
    "features": ["voice"],
    "needs_registration": 0,
    "restrictions": "",
    "registration_requirements": null
  }
}

The identifier, number and prices above are fictional. Treat the order ID as opaque. numbers lists the numbers this response reports as purchased; compare its length with the quantity you requested. Price amounts are strings and this response rounds monetary rates to two decimal places, including per_minute; use the fresh catalogue for the original rate precision. Included minutes and channels can arrive as numeric values or numeric strings.

The price block describes the selected plan used to build the response, not a detailed invoice for every number or the order’s total. Multiple inventory candidates can have different plans. Reconcile the individual purchased numbers and account transactions rather than multiplying this block and assuming it proves the final total.

Partial purchases and uncertain outcomes

An application code of 200 can accompany a warning and fewer numbers than requested. A later failure does not undo numbers already purchased. Preserve the returned order ID, numbers and message. Reconcile those numbers in your inventory and account transactions before deciding whether to order a remaining quantity.

A timeout, disconnected request, malformed response or error after submission is not evidence that nothing happened. Do not automatically submit another purchase, even with the same reference. Preserve the original request, reference and any returned order ID, check inventory and account transactions, and contact support when the outcome remains uncertain.

An unconfirmed order can return application code 400 with wording that it is still being confirmed. Preserve its returned order ID and reconcile that purchase; this is not an instruction to submit it again. Recorded-order recovery tracks the original order internally. A new request to this operation creates a separate purchase attempt rather than resuming an order by your reference, so it can buy and charge for more numbers. Do not use repeated purchase requests to check status or search inventory.

Registration and activation

A purchased or allocated number may still need registration or activation. If needs_registration is 1, inspect restrictions and registration_requirements. The latter can identify v3/get_requirements with country and number_type values. Complete the applicable identity/address workflow and confirm the number’s status before relying on inbound calls or messaging.

features describes advertised capabilities; it does not verify live routing, campaign approval, SMS delivery or fax reception. Check the saved delivery settings and perform the appropriate service test when the number is active.

Order callbacks

Callbacks POST JSON containing the order status and response, with your reference added when supplied. They are sent for reported purchases, including partial results. A failed callback does not roll back the purchase. Delivery can be retried, so process duplicates by order ID and reconcile the numbers rather than issuing another purchase.

This route does not add a cryptographic callback signature. Treat a callback as a notification to reconcile against your authenticated inventory, not as independent authorization to charge, provision or grant access. Do not put API credentials in the callback URL. Submitting another purchase with a different callback URL does not update the original order; it creates a separate purchase attempt. Retain the original order ID when asking support to investigate its callback.

Failures to handle

Application outcomes
OutcomeWhat to do
400 and invalid-prefix wordingRe-read the prefix catalogue and use its current identifier. Distinguish this from wording that an original order is still being confirmed.
403 or an account policy/balance failureReview purchase permission, account price caps, quantity limits and funding. Other application codes can be forwarded from those checks; retain the actual message.
404 or no available inventoryRefresh availability. Do not repeatedly purchase against an exhausted prefix.
409 and purchase-confirmation, provider-rejection or cancelled-order wordingRetain the returned order ID and actual message. Reconcile the request with inventory, account transactions and support before submitting another purchase. Reusing the same reference does not make another request safe.
200 with warnings or fewer numbersSome numbers were purchased. Reconcile the returned allocation and transactions before ordering more.
Server/transport failure or unreadable responseTreat the result as potentially uncertain until inventory and transactions establish what occurred.