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.

Jump to examples ↓

GET /api/contacts/lookup/channel/{channel_id}

Security:

Path parameters:

  • channel_id stringREQUIRED
    The Channel ID for which to retrieve the associated Contact ID.

Responses

  • 200

    The request was accepted.

    • Content-Type: application/json
      OBJECT PROPERTIES
      • contact_id stringREQUIRED

        The resolved Contact ID.

      • is_anonymous booleanREQUIRED

        Specifies whether the Contact is anonymous or not.

      • ok booleanREQUIRED

        Set to true when status code is 200.

  • 400

    There was a parsing or validation error in the request. Bad Request errors typically include path and location in the response to help you find the cause of the error.

    • Content-Type: application/json

      Errors 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.

    • Content-Type: text/plain

      Errors 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.

    • Content-Type: application/json

      Errors 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.

    • Content-Type: application/vnd.urbanairship+json

      Errors 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.

    • Content-Type: application/json

      Errors 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.

Jump to examples ↓

GET /api/contacts/lookup/named_user/{named_user_id}

Security:

Path parameters:

  • named_user_id stringREQUIRED
    The URL-encoded Named User ID for which to retrieve the associated Contact ID.

Responses

  • 200

    The request was accepted.

    • Content-Type: application/json

      The 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

      OBJECT PROPERTIES
      • contact_id stringREQUIRED

        The resolved Contact ID.

      • ok booleanREQUIRED

        Set to true when status code is 200.

  • 400

    There was a parsing or validation error in the request. Bad Request errors typically include path and location in the response to help you find the cause of the error.

    • Content-Type: application/json

      Errors 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.

    • Content-Type: text/plain

      Errors 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.

    • Content-Type: application/json

      Errors 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.

    • Content-Type: application/vnd.urbanairship+json

      Errors 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.

    • Content-Type: application/json

      Errors 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"
}