Find Contacts by an identity or an external id
POST /v1/contacts/lookup
| Property | Value |
|---|---|
| Operation | lookup_contacts |
| Group | Contacts |
| Scope | contacts:read |
| Route class | read |
| Idempotency | Idempotency-Key accepted: a retry with the same key replays the first answer |
| Audit | An audited content read contacts.contact.lookup |
| Released in | 1.61.0 |
| Phase 0 host | Served (the hosted api pins 1.65.0) |
Finds the active Contacts that hold a phone number, an email address or an external id, sent in the body, by exact keyed-hash equality (1.61.0): ids and statuses only. It reads the identity index, so it is an audited content read whose Audit event names the kind, never the value.
Request
Set VOCAL_API to the base URL of your API and VOCAL_API_KEY to an API key with the contacts:read scope (Authentication and keys). Replace each placeholder, such as agt_... or <name>, with your own value.
curl -X POST "$VOCAL_API/v1/contacts/lookup" \
-H "Authorization: Bearer $VOCAL_API_KEY" \
-H "Idempotency-Key: $(uuidgen)" \
-H "Content-Type: application/json" \
-d '{
"match": {
"kind": "phone",
"value": "+15555550100"
}
}'const response = await fetch(`${process.env.VOCAL_API}/v1/contacts/lookup`, {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.VOCAL_API_KEY}`,
'Idempotency-Key': crypto.randomUUID(),
'Content-Type': 'application/json',
},
body: JSON.stringify({
"match": {
"kind": "phone",
"value": "+15555550100"
}
}),
});
console.log(response.status, await response.text());import os
import uuid
import requests
response = requests.post(
f"{os.environ['VOCAL_API']}/v1/contacts/lookup",
headers={
"Authorization": f"Bearer {os.environ['VOCAL_API_KEY']}",
"Idempotency-Key": str(uuid.uuid4()),
},
json={
"match": {
"kind": "phone",
"value": "+15555550100",
},
},
)
print(response.status_code, response.text)Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
idempotency-key | header | string | no | A client-chosen key, kept 24 hours per Organization, environment and route. A replay returns the stored response. |
Request body
Content type application/json, required: ContactLookupRequest.
| Field | Type | Required | Description |
|---|---|---|---|
match | ContactMatchInput | yes |
Responses
| Status | Content type | Shape | Error codes |
|---|---|---|---|
200 | application/json | ContactLookup | |
400 | application/json | ErrorEnvelope | invalid_request |
401 | application/json | ErrorEnvelope | unauthenticated |
403 | application/json | ErrorEnvelope | forbidden |
429 | application/json | ErrorEnvelope | rate_limited |
500 | application/json | ErrorEnvelope | internal_error |
Fields of the 200 answer
The shape is ContactLookup.
| Field | Type | Required | Description |
|---|---|---|---|
contacts | array of ContactMatch | yes | The active Contacts that hold it, at most 10 (a target); ids and statuses only. |
object | "contact_lookup" | yes | |
resolution | one of "none", "matched", "ambiguous" | yes |