Skip to contentSkip to navigationSkip to topbar
On this page

Eligibility Resource (Public Beta)


(warning)

Public Beta

The Eligibility APIs are currently available as a Public Beta product and the information contained in this document is subject to change.

Public Beta products are not covered by a Twilio SLA.

Twilio's Eligibility API allows you to determine if the non-Twilio phone numbers already in your possession can be hosted with Twilio. It's often possible to use your existing phone numbers with Twilio's Messaging Services without changing the voice provider by hosting the messaging capability of those numbers with Twilio.

Determining a number's eligibility is the first step of the hosting process. Using the API, you can check the eligibility of a number or group of numbers before starting the hosting process. If a number cannot be hosted by Twilio, the API will provide a reason and suggest potential next steps.


Base URL

base-url page anchor

All URLs referenced in the API documentation have the following base:

https://numbers.twilio.com/v1/HostedNumber/Eligibility

The API is served over HTTPS. To ensure data privacy, unencrypted HTTP is not supported.


HTTP requests to the API are protected with HTTP Basic authentication(link takes you to an external page). To learn more about how Twilio handles authentication, please refer to our security documentation.

In short, you will use your Twilio Account SID as the username and your Auth Token as the password for HTTP Basic authentication with Twilio.

You can find your Account SID and Auth Token in the Console(link takes you to an external page).

Twilio console showing auth token and SID.

To learn more about authentication and interaction with the Twilio REST API, check out our documentation for requests to the API and Twilio's response.


Create a single eligibility check request

create-a-single-eligibility-check-request page anchor

Resource URL: https://numbers.twilio.com/v1/HostedNumber/Eligibility

To check a single phone number's eligibility, make a POST request to this resource.

See the following code sample for a complete curl request. See the request properties table for all the properties available on this resource.

1
curl --location --request POST 'https://numbers.twilio.com/v1/HostedNumber/Eligibility' \
2
-u "Account_SID:Auth_Token" \
3
--header 'Content-Type: application/json' \
4
--data-raw '{
5
"friendly_name": "My first eligibility check",
6
"phone_numbers": [
7
{"phone_number": "+13175787XXX", "hosting_account_sid": "AC264f0af1e323b9a38e513c433828dXXX"}
8
]
9
}'
10

Request properties

request-properties page anchor

The resource accepts an array of one object called phone_numbers. The object must contain a phone_number in E.164 format to check for eligibility. A phone_numbers object may also contain a Twilio Account SID (hosting_account_sid) belonging to the Twilio Account where you want to host the phone number. If a SID is not provided, the account used to make the request will be used as the hosting Twilio Account. This resource also accepts an optional friendly_name property, which allows you to assign a human-readable reference to the eligibility request.

ParameterRequiredField TypeValidationDescription
phone_numbersYes.ArraySize must equal 1.An array of one object containing fields:
  • phone_number, the number (E.164 format) to check for hosting eligibility.
  • hosting_account_sid (optional), the Twilio Account or Subaccount SID where the number will be hosted. If this field is not provided, the authentication Account SID used when making the request will be used as the hosting account.
friendly_nameNo.StringName of the eligibility check.

The following table provides all the properties that may be returned by the resource.

ParameterDescriptionPossible return values
phone_numberPhone number that was checked for hosting eligibility.
hosting_account_sidTwilio's Account or Subaccount SID where the number would be hosted.
eligibility_statusThe number's eligibility to be hosted with Twilio.
  • "eligible"
  • "ineligible"
  • eligibility_sub_statusAdditional information about why a number cannot be hosted with Twilio.
  • country-ineligible
  • number-format-ineligible
  • number-type-ineligible
  • carrier-ineligible
  • already-in-twilio
  • internal-processing-error
  • invalid-phone-number
  • invalid-hosting-account-sid
  • eligible-by-manual-process
  • may-be-eligible-by-manual-process
  • eligible
  • ineligibility_reasonThe primary reason the number cannot be hosted with Twilio.
  • eligible-for-hosting
  • country-not-supported
  • number-format-ineligible
  • number-type-ineligible
  • numbers-provider-does-not-allow-twilio-to-host-it
  • already-in-twilio-but-not-in-use
  • already-in-twilio-and-in-hosting-process
  • already-in-twilio-for-both-capabilities
  • already-in-twilio-without-messaging-capability
  • already-in-twilio-owned-by-other-account
  • internal-processing-error
  • invalid-phone-number
  • hosting-account-sid-does-not-belong-to-your-account
  • hosting-account-sid-does-not-exist
  • eligible-for-hosting-by-manual-process
  • missing-provider-data
  • already-hosted-in-twilio
  • support-validation-required-number-without-an-approved-nnid
  • next_stepAction that customers can take based on the eligibility result.
  • none
  • create-hosted-number-order
  • edit-ineligible-number-and-run-eligibility-check-again
  • manage-hosting-order
  • recover-messaging-capability
  • contact-support-ineligible-carrier
  • contact-support-internal-transfer
  • contact-support-ineligible-inventory-status
  • number-type-cannot-be-hosted
  • retry-the-eligibility-check
  • update-hosting-account-sid
  • contact-support-to-manually-host-the-number
  • contact-support-missing-provider-data
  • contact-support-for-manual-process
  • contact-support-to-retire-previous-orders
  • phone_number_typeThe phone number's type.
  • toll-free
  • local
  • mobile
  • unknown
  • iso_country_codeThe country to which the number belongs.

    The following example responses are provided for your reference.

    Eligible number

    eligible-number page anchor
    1
    "results": [
    2
    {
    3
    "phone_number": "+1XXXXXXXXXX",
    4
    "next_step": "CREATE_HOSTED_NUMBER_ORDER",
    5
    "phone_number_type": "TOLLFREE",
    6
    "eligibility_sub_status": "ELIGIBLE",
    7
    "eligibility_status": "ELIGIBLE",
    8
    "hosting_account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
    9
    "ineligibility_reason": "None",
    10
    "iso_country_code": "USA"
    11
    }
    12
    ]

    Ineligible number (wrong number format)

    ineligible-number-wrong-number-format page anchor
    1
    "results": [
    2
    {
    3
    "phone_number": "+493333344444544XXX",
    4
    "next_step": "EDIT_INELIGIBLE_NUMBER_AND_RUN_ELIGIBILITY_CHECK_AGAIN",
    5
    "phone_number_type": "UNKNOWN",
    6
    "eligibility_sub_status": "NUMBER_FORMAT_INELIGIBLE",
    7
    "eligibility_status": "INELIGIBLE",
    8
    "hosting_account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
    9
    "ineligibility_reason": "NUMBER_FORMAT_INELIGIBLE",
    10
    "iso_country_code": null
    11
    }
    12
    ]
    13

    Ineligible number (number type ineligible)

    ineligible-number-number-type-ineligible page anchor
    1
    "results": [
    2
    {
    3
    "phone_number": "+1XXXXXXXXXX",
    4
    "next_step": "NUMBER_TYPE_CANNOT_BE_HOSTED",
    5
    "phone_number_type": "MOBILE",
    6
    "eligibility_sub_status": "NUMBER_TYPE_INELIGIBLE",
    7
    "eligibility_status": "INELIGIBLE",
    8
    "hosting_account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
    9
    "ineligibility_reason": "NUMBER_TYPE_INELIGIBLE",
    10
    "iso_country_code": "US"
    11
    }
    12
    ]
    13

    The following table enumerates and describes all the possible error codes within the response body of an HTTP 400: Bad Request.

    Status CodeError MessageDescription
    21470Account SID is requiredAccount SID is missing or invalid
    21470Invalid Account SIDInvalid Account SID
    21471Account not foundValid Account SID, but account not found
    22102Phone Number is requiredThe phone_number field is missing
    22102Invalid Phone NumberPhone number is invalid
    22116Invalid Friendly NameFriendly name is empty or exceeds 128 characters
    22124Phone number(s) are requiredThe phone_numbers field is missing
    22125Phone number(s) cannot exceed the maximum limit allowedNumber of phone numbers cannot exceed one

    Create a bulk eligibility check request

    create-a-bulk-eligibility-check-request page anchor

    Resource URL: https://numbers.twilio.com/v1/HostedNumber/Eligibility/Bulk

    To check a set of up to 1,000 phone numbers' eligibility, make a POST request to this resource. After the bulk eligibility check is created, the next step is to get the results for the bulk request.

    See the following code sample for a complete curl request. See the request properties table for all the properties available on this resource.

    1
    curl --location --request POST 'https://numbers.twilio.com/v1/HostedNumber/Eligibility/Bulk' \
    2
    -u "Account_SID:Auth_Token" \
    3
    --header 'Content-Type: application/json' \
    4
    --data-raw '{
    5
    "friendly_name": "My first eligibility check",
    6
    "phone_numbers": [
    7
    {
    8
    "phone_number": "+13175787XXX",
    9
    "hosting_account_sid": "AC264f0af1e323b9a38e513c433828dXXX"
    10
    },
    11
    {
    12
    "phone_number": "+15017122XXX",
    13
    "hosting_account_sid": "AC264f0af1e323b9a38e513c433828dXXX"
    14
    },
    15
    {
    16
    "phone_number": "+18003482XXX"
    17
    }
    18
    ]
    19
    }'
    20

    The resource accepts an array of objects called phone_numbers. Each object must contain a phone_number in E.164 format to check for eligibility. A phone_numbers object may also contain a Twilio Account SID (hosting_account_sid) belonging to the Twilio Account where you want to host the phone numbers. If a SID is not provided, the account used to make the request will be used as the hosting Twilio Account. This resource also accepts an optional friendly_name property, which allows you to assign a human-readable reference to the eligibility request.

    ParameterRequiredField TypeValidationDescription
    phone_numbersYes.Array1 ≤ size ≤ 1000An array of one to 1,000 objects containing fields:
    • phone_number, the number (E.164 format) to check for hosting eligibility.
    • hosting_account_sid (optional), the Twilio Account or Subaccount SID where the number will be hosted. If this field is not provided, the authentication Account SID used when making the request will be used as the hosting account.
    friendly_nameYes.StringName of the eligibility check.

    A POST request to the above resource will return a status and request_id, among other properties. Processing a bulk request may require some time depending on the quantity of numbers to be checked. Once the status of your request is "SUCCESSFUL", you can use the request_id to retrieve the eligibility results for the numbers sent in your bulk request as described in the Get results for a bulk request section of this page.

    NameTypeDescription
    statusStringThis is the status of the bulk eligibility check request. Return values include: SUCCESSFUL, QUEUED, PROCESSING).
    date_completeddate_time<ISO8601>Date the request was completed. It will be null until the eligibility check is completed.
    urlURLThis is the URL that you can use to GET the results of the request.
    friendly_nameStringThis is the string that you assigned as a friendly name for describing the eligibility check request.
    resultsObject[]The result set that contains the eligibility check response for each requested number. It will be empty until the eligibility check is completed.
    request_idSID<EC>The SID of the bulk eligibility check.
    date_createddate_time<ISO8601>Date the request was created.
    1
    {
    2
    "status": "QUEUED",
    3
    "date_completed": null,
    4
    "url": "https://numbers.twilio.com/v1/HostedNumber/Eligibility/Bulk/Request_ID",
    5
    "friendly_name": "friendly_name",
    6
    "results": [],
    7
    "request_id": "Request_ID",
    8
    "date_created": "2024-03-21T22:06:24Z"
    9
    }
    10

    The following table enumerates and describes all the possible error codes within the response body of an HTTP 400: Bad Request.

    Status CodeError MessageDescription
    21470Account SID is requiredAccount SID is missing or invalid
    21470Invalid Account SIDInvalid Account SID
    21471Account not foundValid Account SID, but account not found
    22102Phone Number is requiredThe phone_number field is missing
    22102Invalid Phone NumberPhone number is invalid
    22116Invalid Friendly NameFriendly name is empty or exceeds 128 characters
    22124Phone number(s) are requiredThe phone_numbers field is missing
    22125Phone number(s) cannot exceed the maximum limit allowedNumber of phone numbers cannot exceed 1000
    22127Friendly Name is requiredFriendly name is missing

    Get results for a bulk request

    get-results-for-a-bulk-request page anchor

    Resource URL: https://numbers.twilio.com/v1/HostedNumber/Eligibility/Bulk/{request_id}

    To retrieve the eligibility results for the phone numbers passed to the Bulk Eligibility resource, make a GET request to this resource with the request_id returned by your initial POST request to the Bulk Eligibility resource. Once the status of your initial POST request is "SUCCESSFUL", you will see the eligibility status for each phone number in the response from this resource. Descriptions for each eligibility response property are provided in the below response properties table.

    1
    curl --location --request GET 'https://numbers.twilio.com/v1/HostedNumber/Eligibility/Bulk/ECXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX' \
    2
    -u "Account_SID:Auth_Token" \
    3
    --header 'Content-Type: application/json' \
    4

    The following table provides all the properties that may be returned by the resource.

    ParameterDescriptionPossible return values
    phone_numberPhone number that was checked for hosting eligibility.
    hosting_account_sidTwilio's Account or Subaccount SID where the number would be hosted.
    eligibility_statusThe number's eligibility to be hosted with Twilio.
  • "eligible"
  • "ineligible"
  • eligibility_sub_statusAdditional information about why a number cannot be hosted with Twilio.
  • country-ineligible
  • number-format-ineligible
  • number-type-ineligible
  • carrier-ineligible
  • already-in-twilio
  • internal-processing-error
  • invalid-phone-number
  • invalid-hosting-account-sid
  • eligible-by-manual-process
  • may-be-eligible-by-manual-process
  • eligible
  • ineligibility_reasonThe primary reason the number cannot be hosted with Twilio.
  • eligible-for-hosting
  • country-not-supported
  • number-format-ineligible
  • number-type-ineligible
  • numbers-provider-does-not-allow-twilio-to-host-it
  • already-in-twilio-but-not-in-use
  • already-in-twilio-and-in-hosting-process
  • already-in-twilio-for-both-capabilities
  • already-in-twilio-without-messaging-capability
  • already-in-twilio-owned-by-other-account
  • internal-processing-error
  • invalid-phone-number
  • hosting-account-sid-does-not-belong-to-your-account
  • hosting-account-sid-does-not-exist
  • eligible-for-hosting-by-manual-process
  • missing-provider-data
  • already-hosted-in-twilio
  • support-validation-required-number-without-an-approved-nnid
  • next_stepAction that customers can take based on the eligibility result.
  • none
  • create-hosted-number-order
  • edit-ineligible-number-and-run-eligibility-check-again
  • manage-hosting-order
  • recover-messaging-capability
  • contact-support-ineligible-carrier
  • contact-support-internal-transfer
  • contact-support-ineligible-inventory-status
  • number-type-cannot-be-hosted
  • retry-the-eligibility-check
  • update-hosting-account-sid
  • contact-support-to-manually-host-the-number
  • contact-support-missing-provider-data
  • contact-support-for-manual-process
  • contact-support-to-retire-previous-orders
  • phone_number_typeThe phone number's type.
  • toll-free
  • local
  • mobile
  • unknown
  • iso_country_codeThe country to which the number belongs.

    The following example responses are provided for your reference.

    1
    {
    2
    "status": "SUCCESSFUL",
    3
    "date_completed": "2024-03-21T22:07:20Z",
    4
    "url": "https://numbers.twilio.com/v1/HostedNumber/Eligibility/Bulk/Request_ID",
    5
    "friendly_name": "friendly_name",
    6
    "results": [
    7
    {
    8
    "phone_number": "+1XXXXXXXXXX",
    9
    "next_step": "NUMBER_TYPE_CANNOT_BE_HOSTED",
    10
    "phone_number_type": "MOBILE",
    11
    "eligibility_sub_status": "NUMBER_TYPE_INELIGIBLE",
    12
    "eligibility_status": "INELIGIBLE",
    13
    "hosting_account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
    14
    "ineligibility_reason": "NUMBER_TYPE_INELIGIBLE",
    15
    "iso_country_code": "US"
    16
    },
    17
    {
    18
    "phone_number": "+493333344444544XXX",
    19
    "next_step": "EDIT_INELIGIBLE_NUMBER_AND_RUN_ELIGIBILITY_CHECK_AGAIN",
    20
    "phone_number_type": "UNKNOWN",
    21
    "eligibility_sub_status": "NUMBER_FORMAT_INELIGIBLE",
    22
    "eligibility_status": "INELIGIBLE",
    23
    "hosting_account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
    24
    "ineligibility_reason": "NUMBER_FORMAT_INELIGIBLE",
    25
    "iso_country_code": null
    26
    }
    27
    ],
    28
    "request_id": "Request_ID",
    29
    "date_created": "2024-03-21T22:06:24Z"
    30
    }

    Processing (not completed yet)

    processing-not-completed-yet page anchor
    1
    {
    2
    "status": "PROCESSING",
    3
    "date_completed": null,
    4
    "url": "https://numbers.twilio.com/v1/HostedNumber/Eligibility/Bulk/Request_ID",
    5
    "friendly_name": "friendly_name",
    6
    "results": [
    7
    {
    8
    "phone_number": "+1XXXXXXXXXX",
    9
    "next_step": "NUMBER_TYPE_CANNOT_BE_HOSTED",
    10
    "phone_number_type": "MOBILE",
    11
    "eligibility_sub_status": "NUMBER_TYPE_INELIGIBLE",
    12
    "eligibility_status": "INELIGIBLE",
    13
    "hosting_account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
    14
    "ineligibility_reason": "NUMBER_TYPE_INELIGIBLE",
    15
    "iso_country_code": "US"
    16
    },
    17
    {
    18
    "phone_number": "+493333344444544XXX",
    19
    "next_step": "EDIT_INELIGIBLE_NUMBER_AND_RUN_ELIGIBILITY_CHECK_AGAIN",
    20
    "phone_number_type": "UNKNOWN",
    21
    "eligibility_sub_status": "NUMBER_FORMAT_INELIGIBLE",
    22
    "eligibility_status": "INELIGIBLE",
    23
    "hosting_account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
    24
    "ineligibility_reason": "NUMBER_FORMAT_INELIGIBLE",
    25
    "iso_country_code": null
    26
    }
    27
    ],
    28
    "request_id": "Request_ID",
    29
    "date_created": "2024-03-21T22:06:24Z"
    30
    }
    31

    Need some help?

    Terms of service

    Copyright © 2024 Twilio Inc.