API reference
Lookup
How these fit together: the Lookup guide.
Lookup phone number
get
Looks a phone number up: validity, formats, country, type and India’s do-not-call status.
Answered from the numbering metadata this deployment carries and the NCPR (India do-not-call) extract the platform operator loaded — no vendor is contacted, so a lookup is free (it counts against the key’s per-minute request budget). The carrier name is never known (carrier.available: false). The number is in the path, so it is never logged or kept: the request log records the route template, error envelopes read /v1/lookup/[redacted]. A number that parses but is not one its country assigns is 200 with valid: false.
Access: an organization key with the lookup:read scope.
Path parameters
phonestringRequiredThe number in E.164 (
+919876543210; URL-encode+as%2Bif your client rewrites it), or written nationally with?country=(09876543210?country=IN). Spaces, dots, dashes and brackets are ignored.
Query parameters
countrystringISO 3166 alpha-2 country to read a number written WITHOUT
+and a country calling code in (09876543210withcountry=IN). Ignored for a number in E.164 (+…). Case-insensitive.
Response 200PublicPhoneNumberLookup
Show the 10 fieldsHide the fields
carrierPublicLookupCarrierRequired2 fields of
carrieravailablebooleanRequiredWhether this deployment can name carriers: false. Read
nameonly when it is true.namestring | nullRequiredAlways null: a carrier (operator) name needs a vendor lookup, and this deployment makes none. India’s mobile numbers are portable, so the range a number was issued from would not name its operator either.
countrystring | nullRequiredISO 3166 alpha-2 country (or territory) the number belongs to. Null for a non-geographic code (
+800,+882, …) or a number that is not valid.countryCallingCodestringRequiredThe country calling code, without
+.dndPublicLookupDndRequired2 fields of
dndregistrystring | nullRequiredThe national do-not-call registry consulted:
ncpr(India’s National Customer Preference Register) for a valid +91 number; null elsewhere.One of
ncprstatusstringRequiredregisteredornot_registeredon the NCPR extract the platform operator loaded into this deployment (not a live scrub with a registry vendor — a number registered since the last load readsnot_registered);not_applicablefor a number outside India or one that is not valid;not_checkedfor a TEST key, whose lookups never read the registry (it is real data about real people — use a live key). A promotional call to aregisterednumber is refused (422 NCPR_REGISTERED).One of
registerednot_registerednot_applicablenot_checked
e164stringRequiredThe number in E.164 (
+, the country calling code, the national number) — the form every other endpoint takes.invalidReasonstring | nullRequiredWhy
validis false:too_short,too_long,invalid_length(a length the country never uses) ornot_in_numbering_plan(the right length, in a range not allocated). Null for a valid number.One of
too_shorttoo_longinvalid_lengthnot_in_numbering_plannationalFormatstring | nullRequiredHow the number is written inside its country. Null when it is not valid.
objectstringRequiredOne of
phone_number_lookuptypestringRequiredThe kind of number its range is allocated to.
fixed_line_or_mobilewhere the plan does not tell them apart (the US and Canada);unknownfor a number that is not valid. A ported number keeps the type of its range.One of
mobilefixed_linefixed_line_or_mobiletoll_freepremium_rateshared_costvoippersonal_numberpageruanvoicemailunknownvalidbooleanRequiredWhether the number is one its country’s numbering plan assigns (right length, an allocated range). Not whether it is in service.
Errors
400PHONE_NUMBER_MALFORMED — the path is not a phone number this API can read (letters, no country calling code and nocountry, a code no country uses); the message never repeats it. VALIDATION_FAILED —countryis not an ISO 3166 alpha-2 code this API knows.401API_KEY_INVALID — missing, unknown, revoked or expired key.403API_KEY_SCOPE_MISSING or API_KEY_KIND_MISMATCH — the key may not call this endpoint.404NOT_FOUND — no such resource for this key (another organization’s id is answered the same way).429RATE_LIMITED — retry afterRetry-Afterseconds.500INTERNAL_ERROR — our fault; retry with backoff (with the same Idempotency-Key on a write).
curl 'https://api.trovacast.com/v1/lookup/%2B919876543210' \
-H "Authorization: Bearer $TROVACAST_API_KEY"{
"carrier": {
"available": false,
"name": null
},
"country": "IN",
"countryCallingCode": "91",
"dnd": {
"registry": "ncpr",
"status": "not_registered"
},
"e164": "+919876543210",
"invalidReason": null,
"nationalFormat": "098765 43210",
"object": "phone_number_lookup",
"type": "mobile",
"valid": true
}