Contacts
Manage Contacts and query for subscription lists, channels, named users, and attributes associated with a Contact.
Look up Contact ID by Channel ID
Looks up a Contact ID for the given Channel ID.
GET /api/contacts/lookup/channel/{channel_id}
Security:
Path parameters:
- channel_id stringREQUIREDThe Channel ID for which to retrieve the associated Contact ID.
Responses
200
The request was accepted.
Response body:
- Content-Type:OBJECT PROPERTIES
application/json- contact_id stringREQUIRED
The resolved Contact ID.
- is_anonymous booleanREQUIRED
Specifies whether the Contact is anonymous or not.
- ok booleanREQUIRED
Set to
truewhen status code is200.
400
There was a parsing or validation error in the request. Bad Request errors typically include
pathandlocationin the response to help you find the cause of the error.Response body:
- Content-Type:
application/jsonErrors returned with 4xx responses. Errors include as much information as possible to help you understand the reason for the failure.
401
Authentication information (the app key and secret or bearer token) was either incorrect or missing.
Response body:
- Content-Type:
text/plainErrors returned with 4xx responses. Errors include as much information as possible to help you understand the reason for the failure.
403
Authentication was correct, but the user does not have permission to access the requested API, e.g., if the feature in question is not included in your pricing plan.
Response body:
- Content-Type:
application/jsonErrors returned with 4xx responses. Errors include as much information as possible to help you understand the reason for the failure.
404
The requested resource doesn’t exist.
Response body:
- Content-Type:
application/vnd.urbanairship+jsonErrors returned with 4xx responses. Errors include as much information as possible to help you understand the reason for the failure.
406
Return when the client requests a version of the API that cannot be satisfied, because no compatible version is currently deployed.
Response body:
- Content-Type:
application/jsonErrors returned with 4xx responses. Errors include as much information as possible to help you understand the reason for the failure.
Examples
Example get Contact ID from a Channel ID
GET /api/contacts/lookup/channel/164c3a13-9c75-4ea9-be2c-1bed2c97f9c3 HTTP/1.1
Authorization: Basic <application or master authorization string>
Accept: application/vnd.urbanairship+json; version=3
HTTP/1.1 200 OK
Content-Type: application/vnd.urbanairship+json; version=3
{
"ok": true,
"contact_id": "7c24ebdd-ec06-47d4-9a56-ced8611f5b52",
"is_anonymous": false
}
Look up Contact ID by Named User ID
Looks up a Contact ID for the given Named User ID.
GET /api/contacts/lookup/named_user/{named_user_id}
Security:
Path parameters:
- named_user_id stringREQUIREDThe URL-encoded Named User ID for which to retrieve the associated Contact ID.
Responses
200
The request was accepted.
Response body:
- Content-Type:
application/jsonThe Contact ID in the response will be based on these precedence rules:
- From the Named User if it exists
- From the channel if it is associated to an Anonymous Contact
- From the payload if provided
- Randomly generated
- contact_id stringREQUIRED
The resolved Contact ID.
- ok booleanREQUIRED
Set to
truewhen status code is200.
400
There was a parsing or validation error in the request. Bad Request errors typically include
pathandlocationin the response to help you find the cause of the error.Response body:
- Content-Type:
application/jsonErrors returned with 4xx responses. Errors include as much information as possible to help you understand the reason for the failure.
401
Authentication information (the app key and secret or bearer token) was either incorrect or missing.
Response body:
- Content-Type:
text/plainErrors returned with 4xx responses. Errors include as much information as possible to help you understand the reason for the failure.
403
Authentication was correct, but the user does not have permission to access the requested API, e.g., if the feature in question is not included in your pricing plan.
Response body:
- Content-Type:
application/jsonErrors returned with 4xx responses. Errors include as much information as possible to help you understand the reason for the failure.
404
The requested resource doesn’t exist.
Response body:
- Content-Type:
application/vnd.urbanairship+jsonErrors returned with 4xx responses. Errors include as much information as possible to help you understand the reason for the failure.
406
Return when the client requests a version of the API that cannot be satisfied, because no compatible version is currently deployed.
Response body:
- Content-Type:
application/jsonErrors returned with 4xx responses. Errors include as much information as possible to help you understand the reason for the failure.
Examples
Example get Contact ID from a Named User ID
GET /api/contacts/lookup/named_user/90ae282f-f56e-4037-8174-482ef7e3e5f4 HTTP/1.1
Authorization: Basic <application or master authorization string>
Accept: application/vnd.urbanairship+json; version=3
HTTP/1.1 200 OK
Content-Type: application/vnd.urbanairship+json; version=3
{
"ok": true,
"contact_id": "7c24ebdd-ec06-47d4-9a56-ced8611f5b52"
}