Skip to content

Number Ordering

Note: The API key provided in the Authorization header must have the apik_ prefix.

Numbers can be ordered and added, or removed from your account. This is done by:

  1. (Optional) Search our number inventory with the coverage endpoint to view counts of available numbers according to your filters
  2. Create a cart
  3. Add one or more requests to the cart (using NEW_NUMBERS or REMOVE_NUMBERS requests)
  4. Checkout the cart to order the numbers

See examples below for complete and individual examples.

Schemas

Swift Inventory Coverage

Request

Provided via query string.

NameTypeDescription
number_typeStringThe type of number to search for. Always tendlc.
group_by[]StringThe fields to group the results by. Valid values are npa, nxx, lata, state, rate_center, country_code.
npaStringOptional. The NPA (area code) to search for.
nxxStringOptional. The NXX (exchange code) to search for.
lataStringOptional. The LATA (local access and transport area) to search for.
stateStringOptional. The state/province to search for.
rate_centerStringOptional. The rate center to search for.
country_codeStringOptional. The country code to search for.

Response

Inventory Coverage Response Object
NameTypeDescription
associationsObjectAssociations to other entities in the system related to the account.
dataObject(Inventory Coverage Data Object)Contains details about the coverage results.
typeStringObject type identifier. Always "inventory_coverage".
Inventory Coverage Data Object
NameTypeDescription
entriesArray:Object(Inventory Coverage Entry Object)List of grouped inventory entries. Each object is described below.
quantityIntegerTotal number of numbers available that match the request filters.
Inventory Coverage Entry Object
NameTypeDescription
keyArray:StringList of fields used for grouping the inventory (e.g. npa, nxx, etc).
quantityIntegerNumber of phone numbers available for the specified group.
valueObjectKey-value map containing field(s) and value(s) for this group (e.g. { "npa": "555" }).

Cart

NameTypeDescription
idStringThe unique identifier of the record.
inserted_atString(datetime)When the record was created, in ISO 8601 format.
updated_atString(datetime)When the record was last updated, in ISO 8601 format.
nameStringThe name of the cart.
notesString or nullOptional. Notes about the cart.
reference_idString or nullOptional. An identifier for the cart for your own reference.

Cart Request

Requests are added to carts to alter the numbers on your account.

Cart Request Object
NameTypeDescription
notesString or nullOptional notes related to this cart request.
typeStringThe type of the object. For cart request objects, this value is always cart_request.
dataObject(Cart Request Data Object)The data payload for the cart request.
Cart Request Data Object
NameTypeDescription
nameStringThe name for this request in the cart.
typeStringThe type of number order request. For new numbers, this value can be NEW_NUMBERS or REMOVE_NUMBERS.
dataObject(Number Request Data Object)Additional parameters for the request.
Number Request Data Objects

Note: numbers are considered “tainted” after being ordered, and cannot be removed from the account for 30 minutes.

NEW_NUMBERS:

NameTypeDescription
quantityIntegerNumber of new numbers to request.
number_typeStringThe type of number to order. Always tendlc.
country_codeStringOptional. Country code for the new numbers (e.g., "1" for North America).
npaStringOptional. The NPA (area code) for the new numbers.
nxxStringOptional. The NXX (exchange code) for the new numbers.
lataStringOptional. The LATA (local access and transport area) for the new numbers.
stateStringOptional. The state/province for the new numbers.
rate_centerStringOptional. The rate center for the new numbers.
country_codeStringOptional. The country code for the new numbers.

REMOVE_NUMBERS:

NameTypeDescription
numbersArray:String(format:e164)Array of numbers to remove from the account, in E.164 format excluding the + prefix (eg 17055551234).

Order

Carts are converted to orders when they are checked out, and can no longer be modified outside of the name and notes.

Order Object
NameTypeDescription
idStringThe unique identifier of the order.
nameStringThe name of the order (from the cart name).
notesString or nullOptional notes about the order.
reference_idString or nullOptional reference identifier for the order.
statusStringThe processing status of the order. Possible values include NEW, PROCESSING, COMPLETED, ERROR, COMPLETED_WITH_ERRORS.
error_codeStringA code indicating if an error occurred. Typically OK if successful.
inserted_atString(datetime)When the order was created, in ISO 8601 format.
updated_atString(datetime)When the order was last updated, in ISO 8601 format.
completed_atString(datetime) or nullWhen the order was completed, in ISO 8601 format, or null if not completed yet.
status_historyArray:Object(Status History Object)The history of status changes for the order.
Status History Object
NameTypeDescription
statusStringThe status at this point in time.
detailStringAdditional detail about the status change.
error_codeStringError code for this status update.
inserted_atString(datetime)When this status update was recorded.

Examples

Note: Requests, carts, and orders can be performed for a sub account as well, by adding /accounts/:account_id to the URL:

  • /api/v1/accounts/{account_id}/carts
  • /api/v1/accounts/{account_id}/orders
  • /api/v1/accounts/{account_id}/requests

Complete number order process

A complete example of ordering numbers for an account:

  1. Search coverage of Swift number inventory by filter:

Request:

GET /api/v1/inventory/coverage?number_type=tendlc&group_by[]=npa HTTP/1.1
Accept: application/json, text/plain
Authorization: Bearer apik_ABC123

Response:

HTTP/1.1 200
Content-Type: application/json
Content-Length: 402
{
"associations": {},
"data": {
"entries": [
{
"key": [
"npa"
],
"quantity": 1,
"value": {
"npa": "555"
}
}
],
"quantity": 1
},
"type": "inventory_coverage"
}
  1. Create a cart:

Request:

POST /api/v1/carts HTTP/1.1
Accept: application/json, text/plain
Authorization: Bearer apik_ABC123
{
"data": {
"name": "cart name",
"notes": "cart note"
},
"type": "cart"
}

Response:

HTTP/1.1 201
Content-Type: application/json
Content-Length: 365
{
"associations": {
"account": {
"data": {
"id": "01K3S620PA5JPWPR10F0000000"
},
"type": "account"
},
"author": {
"data": {
"id": "01KBB59RM02N21V7K0V0000000"
},
"type": "user"
}
},
"data": {
"id": "01KBC4VZE1CFMG5MAB089000000",
"inserted_at": "2025-12-01T05:06:21.249813Z",
"name": "cart name",
"notes": "cart note",
"reference_id": null,
"updated_at": "2025-12-01T05:06:21.249813Z"
},
"type": "cart"
}
  1. Add a request to the cart:

Request:

POST /api/v1/carts/{cart_id}/requests HTTP/1.1
Accept: application/json, text/plain
Authorization: Bearer apik_ABC123
{
"notes": "request note",
"type": "cart_request",
"data": {
"name": "request name",
"type": "NEW_NUMBERS",
"data": {
"quantity": 5,
"country_code": "1",
"number_type": "tendlc"
}
}
}

Response:

HTTP/1.1 201
Content-Type: application/json
Content-Length: 464
{
"associations": {
"account": {
"data": {
"id": "01K3S620PA5JPWPR10F0000000"
},
"type": "account"
},
"author": {
"data": {
"id": "01KBB59RM02N21V7K0V0000000"
},
"type": "user"
},
"cart": {
"data": {
"id": "01KBC4VZE1CFMG5MAB089000000"
},
"type": "cart"
}
},
"data": {
"data": {},
"id": "01KBC4VZE1CFMG5MAB089000000",
"inserted_at": "2025-12-01T04:27:50.055391Z",
"name": "request name",
"notes": null,
"reference_id": null,
"type": "NONE",
"updated_at": "2025-12-01T04:27:50.055391Z"
},
"type": "cart_request"
}
  1. Checkout the cart:

Request:

POST /api/v1/carts/{cart_id}/checkout HTTP/1.1
Accept: application/json, text/plain
Authorization: Bearer apik_ABC123

Response:

HTTP/1.1 200
Content-Type: application/json
Content-Length: 540
{
"associations": {
"account": {
"data": {
"id": "01K3S620PA5JPWPR10F0000000"
},
"type": "account"
},
"author": {
"data": {
"id": "01KBB59RM02N21V7K0V0000000"
},
"type": "user"
}
},
"data": {
"completed_at": null,
"error_code": "OK",
"id": "01KBC4VZE1CFMG5MAB089000000",
"inserted_at": "2025-11-30T20:45:39.807030Z",
"name": "cart name",
"notes": null,
"reference_id": null,
"status": "NEW",
"status_history": [
{
"detail": "checkout cart",
"error_code": "OK",
"inserted_at": "2025-12-01T04:37:39.098864Z",
"status": "NEW"
}
],
"updated_at": "2025-12-01T04:37:39.099025Z"
},
"type": "order"
}

Search Swift inventory by coverage filter

Request:

GET /api/v1/inventory/coverage?number_type=tendlc&group_by[]=npa HTTP/1.1
Accept: application/json, text/plain
Authorization: Bearer apik_ABC123

Response:

HTTP/1.1 200
Content-Type: application/json
Content-Length: 402
{
"associations": {},
"data": {
"entries": [
{
"key": [
"npa"
],
"quantity": 1,
"value": {
"npa": "555"
},
"value": {
"npa": "555"
}
}
],
"quantity": 1
},
"type": "inventory_coverage"
}

Add remove_numbers request to cart

This assumes a cart has already been created. Request:

POST /api/v1/carts/{cart_id}/requests HTTP/1.1
Accept: application/json, text/plain
Authorization: Bearer apik_ABC123
{
"notes": "request note",
"type": "cart_request",
"data": {
"name": "request name",
"type": "REMOVE_NUMBERS",
"data": {
"numbers": [
"17055551234",
"17055551235",
"17055551236"
]
}
}
}

Response:

HTTP/1.1 201
Content-Type: application/json
Content-Length: 464
{
"associations": {
"account": {
"data": {
"id": "01K3S620PA5JPWPR10F0000000"
},
"type": "account"
},
"author": {
"data": {
"id": "01KBB59RM02N21V7K0V0000000"
},
"type": "user"
},
"cart": {
"data": {
"id": "01KBC4VZE1CFMG5MAB089000000"
},
"type": "cart"
}
},
"data": {
"data": {},
"id": "01KBC4VZE1CFMG5MAB089000000",
"inserted_at": "2025-12-01T04:27:50.055391Z",
"name": "request name",
"notes": null,
"reference_id": null,
"type": "REMOVE_NUMBERS",
"updated_at": "2025-12-01T04:27:50.055391Z"
},
"type": "cart_request"
}

Checkout cart

Request:

POST /api/v1/carts/{cart_id}/checkout HTTP/1.1
Accept: application/json, text/plain
Authorization: Bearer apik_ABC123

Response:

HTTP/1.1 200
Content-Type: application/json
Content-Length: 540
{
"associations": {
"account": {
"data": {
"id": "01K3S620PA5JPWPR10F0000000"
},
"type": "account"
},
"author": {
"data": {
"id": "01KBB59RM02N21V7K0V0000000"
},
"type": "user"
}
},
"data": {
"completed_at": null,
"error_code": "OK",
"id": "01KBC4VZE1CFMG5MAB089000000",
"inserted_at": "2025-12-01T05:06:21.249813Z",
"name": "cart name",
"notes": null,
"reference_id": null,
"status": "NEW",
"status_history": [
{
"detail": "checkout cart",
"error_code": "OK",
"inserted_at": "2025-12-01T14:36:58.137795Z",
"status": "NEW"
}
],
"updated_at": "2025-12-01T14:36:58.138004Z"
},
"type": "order"
}