Customer Profile API | AnyRoad Help Center

Customer Profile API

October 18, 2024

The Customer Profile API provides information about the custom campaigns set up for any of your experiences. This means it helps collect more information about your guests from an external form, outside AnyRoad.

To make requests for our API, you will need an API key. Your AnyRoad user id and password are your normal AnyRoad account login credentials. Once you receive your API key, you will be able to make requests to all endpoints. Please keep your API key secure. If you believe your key has been compromised, please contact us for a new one.

All responses adhere to the JSON:API formatting guidelines found here: JSON API — A specification for building APIs in JSON.

Requesting an API Key

Please reach out to your AnyRoad Account Manager to activate your API key. Once activated, send the below request to receive your API key. You will need the AnyRoad account registered email and password associated with the owner of the account.

Request:

curl https://app.anyroad.com/external/api/v1/users/key -u
"janedoe@example.com:SuperSecretPa$word"

Response:

Status: 200

{
 "data": {
   "type": "users",
   "id": "123",
   "attributes": {
     "key": "example-key-1234"
   }
 }
}

API Key Verification

To verify that your API key is active, send the following request, where is your API key:

Request:

curl -H 'X-API-KEY: '<API_KEY>
https://app.anyroad.com/external/api/v1/users/profile

Response:

Status: 200

{
"data": {
"type": "users",
"id": "123",
"attributes": {
"first_name": "Jane",
"last_name": "Doe",
"email": "janedoe@example.com"
}
}
}

Key Terminology

Customer Profile

The Customer Profile API allows partners to append additional data to a customer’s AnyRoad profile. Its flexible structure can absorb just about any data type - customer preferences, demographics, psychographics, segmentation - that can then be viewed on a customer profile within AnyRoad, and used for analytics.

Campaigns

Campaigns define the data structure for a Customer Profile update. Each Customer Profile update is connected to a single campaign. A campaign has the following important information:

JSON Structure

When sending a JSON object to update the data set, the structure of the JSON must match the predefined structure contained in the data model attribute of the campaign. AnyRoad will help to create this structure when the campaign is created. For this API, we conform to JSON Schema Draft 4.

The JSON schema description is quite extensive (see: Understanding JSON Schema — Understanding JSON Schema 7.0 documentation) but the following small example may help to get started:

{
"type": "object",

Here are few valid & invalid JSON objects following the above schema:

{ "flavor_profile": "red" } VALID
{ "flavor_profile": 6 } INVALID - wrong type
{ "flavour_profile": "red" } INVALID - mismatched property name
{ "flavor_profile": "red", "hacky": "hack" } INVALID - extra property

Endpoints

Customer Profile

The customer profile endpoint can be used to update and retrieve customer information with AnyRoad.

GET Request

Query Params:

Example Request:

curl -H 'X-API-KEY: '<API_KEY>
https://app.anyroad.com/external/api/v1/customer_profile/56c934fa-03c2-46f4-b7f9-6d44bafdd5a2

GET Response

Attributes:

Example Responses:

Status: 200 - OK

{
"data": {
"attributes": {
"booking": {
"guest_email": "Ym9iQGxhd2Jsb2cuY29t",
"guest_first_name": "Qm9i",
"guest_last_name": "TG9ibGF3",
"id": 1234,
"number_guests_booked": 2,
"tickets": {
"adult": 1,
"child": 1
}
},
"captured_at": null,
"data_set": null,
"experience": {
"date": "2021-03-31",
"name": "Monster Mash",
"time": "15:00"
},
"id": "56c934fa-03c2-46f4-b7f9-6d44bafdd5a2",
"referrer_medium": null
},
"id": "56c934fa-03c2-46f4-b7f9-6d44bafdd5a2",
"type": "customer_profile"
}
}

Status: 401 - unauthorized

{ "error": "Invalid API key." }

Status: 403 - forbidden

{ "error": "Forbidden." }

PATCH Request

Query Params:

Example Request:

curl -X PATCH -H 'X-API-KEY: '<API_KEY>' -H 'Content-Type: application/json'
https://app.anyroad.com/external/api/v1/customer_profile/56c934fa-03c2-46f4-b7f9-6d44bafdd5a2 -d
'{"data_set":{"custom_attribute":"red"},"referrer_medium":"email","captured_at":"2021-03-01 00:00:00-08"}'

PATCH Response

Example Responses:

Status: 200 - OK

{
"data": {
"attributes": {
"booking": {
"guest_email": "Ym9iQGxhd2Jsb2cuY29t",
"guest_first_name": "Qm9i",
"guest_last_name": "TG9ibGF3",
"id": 1234,
"number_guests_booked": 2,
"tickets": {
"adult": 1,
"child": 1
}
},
"captured_at": "2021-03-01T08:00:00Z",
"data_set": {
"custom_attribute":"red"
},
"experience": {
"date": "2021-03-31",
"name": "Monster Mash",
"time": "15:00"
},
"id": "56c934fa-03c2-46f4-b7f9-6d44bafdd5a2",
"referrer_medium": "email"
},
"id": "56c934fa-03c2-46f4-b7f9-6d44bafdd5a2",
"type": "customer_profile"
}
}

Status: 401 - unauthorized

{ "error": "Invalid API key." }

Status: 403 - forbidden

{ "error": "Forbidden." }

Customer Profile Search

POST Request

Query Params:

Example Request:

curl -X POST -H 'X-API-KEY: <API_KEY>' -H 'Content-Type: application/json'
https://app.anyroad.com/external/api/v1/customer_profile/search -d
'{"booking_id":1234,"last_name":"Smith","experience_date":"2021-03-01"}'

POST Response

Example Responses:

Responses will be an array of results that match the search query.

Status: 200 - OK

{
"data": [
{
"attributes": {
"booking": {
"guest_email": "Ym9iQGxhd2Jsb2cuY29t",
"guest_first_name": "Qm9i",
"guest_last_name": "TG9ibGF3",
"id": 1234,
"number_guests_booked": 2,
"tickets": {
"adult": 1,
"child": 1
}
},
"captured_at": "2021-03-01T08:00:00Z",
"data_set": {
"custom_attribute":"red"
},
"experience": {
"date": "2021-03-31",
"name": "Monster Mash",
"time": "15:00"
},
"id": "56c934fa-03c2-46f4-b7f9-6d44bafdd5a2",
"referrer_medium": "email"
},
"id": "56c934fa-03c2-46f4-b7f9-6d44bafdd5a2",
"type": "customer_profile"
}
]
}

Status: 204 - no content

{[ ]}

Status: 401 - unauthorized

{ "error": "Invalid API key." }

Status: 403 - forbidden

{ "error": "Forbidden." }

If you have any additional questions, you can contact our Customer Experience team via chat or at support@anyroad.com.