Phone Number Lookup

Retrieve phone-number formatting, carrier information, and caller-name data, and handle incomplete lookup results.

Look up a phone number

Use Lookup to retrieve information about a phone number, including its formatted representation and requested carrier or caller-name data.

Lookup uses a separate API host:

https://lookups.textgrid.com/v1

Authenticate using your TextGrid Account SID and Auth Token. See Getting Started.

For the complete request and response schema, see Look up a phone number.

Choose the information to request

Use the type query parameter to select the information you need:

ValueRequested information
carrierCarrier name, line type, and mobile network identifiers when available.
caller-nameCaller-name information based on CNAM when available.
carrier,caller-nameBoth carrier and caller-name information.

Use a comma-separated value to request both types.

Supply the phone number in E.164 format, including the leading +. The optional countryCode parameter provides country context.

Example using HTTP Basic Auth:

curl --get "https://lookups.textgrid.com/v1/PhoneNumbers/+12025550100" \
  --user "YOUR_ACCOUNT_SID:YOUR_AUTH_TOKEN" \
  --data-urlencode "type=carrier,caller-name"

The example number is fictitious. Replace it with the number you intend to look up.

Read the response

The response can include:

FieldMeaning
phone_numberPhone number in E.164 format.
national_formatPhone number in national format.
country_codeISO country code.
carrierRequested carrier information, when available.
caller_nameRequested caller-name information, when available.
urlURL of the lookup resource.
add_onsReserved; currently null.

Carrier information

The carrier object can contain:

  • name: Carrier name.
  • type: Line type, such as mobile, landline, or VoIP.
  • mobile_country_code: Mobile country code.
  • mobile_network_code: Mobile network code.
  • error_code: Error information when available; null in the documented successful example.

Keep network codes as strings so leading zeros are preserved.

Caller-name information

The caller_name object can contain:

  • caller_name: Reported caller name.
  • caller_type: Reported caller classification.
  • error_code: Error information when available; null in the documented successful example.

Caller-name data is informational. It does not establish the identity of the person currently using the number.

Handle missing information

Carrier and caller-name information may be absent or null. A successful HTTP response does not guarantee that every requested detail is available.

Check that an object exists before reading its nested fields. Treat missing information as unavailable rather than assuming the number is invalid.

Do not use a lookup result as proof of recipient consent or as a guarantee that an SMS, MMS, or call will succeed.

Handle errors and access limits

Check the HTTP status before interpreting the body as a successful lookup.

Account restrictions can produce messages such as:

  • Account has reached Lookups limit.
  • Balance is below 0. Please Add Funds and try again

If you reach a lookup limit, pause the affected workflow and contact support to review your allowance. The messaging allowance shown on the dashboard does not reflect your lookup allowance.

Error bodies can vary. Allow for an empty body and do not require every error to contain the same fields.

Build a tolerant integration

Read fields by name rather than relying on their order. Handle missing and null values, and allow additional response fields without failing.

Use Look up a phone number as the contract for your integration rather than assuming that fields from another lookup API are supported.


Did this page help you?