Customer Profile API
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.
Requesting an API Key
curl https://app.anyguide.com/external/api/v1/users/key -u "janedoe@example.com:SuperSecretPa$word"<br>
{ "data": { "type": "users", "id": "123", "attributes": { "key": "example-key-1234" } } } jvhjhkjhkjhkjhkljhkl
API Key Verification
curl -H 'X-API-KEY: ' https://app.anyguide.com/external/api/v1/users/profile
{ "data": { "type": "users", "id": "123", "attributes": { "first_name": "Jane", "last_name": "Doe", "email": "janedoe@example.com" } } }
Key Terminology
Customer Profile
Campaigns
- Name - a name to help easily identify the campaign
- Data model - this is used to validate the data_set that you will be passing to the UPDATE endpoint (more about this below in the JSON Structure section)
- Display label - the partner or customer facing label associated with the data
- Display key - this is the value key that will be needed to be passed in the data_set, the value of which will be displayed under the display label heading
- Approved IPs - this is a list of IP addresses that are authorized to use this API
JSON Structure
{ "type": "object", <- type of the Schema. This will always be "object" "required": [ <- list of required properties "flavor_profile" <- the only required property in this example], "properties": { <- more detail about the properties "flavor_profile": { <- this matches the property above "type": "string" <- the type of the property} }, "additionalProperties": false <- indicates that no properties other than } the ones listed above are allowed
{ "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
GET Request
- customer_profile_id (string) - uuid that uniquely identifies the customer profile.
curl -H 'X-API-KEY: ' https://app.anyguide.com/external/api/v1/customer_profile/56c934fa-03c2-46f4-b7f9-6d44bafdd5a2
GET Response
- id (string) - the unique id (uuid) of a customer profile
- data_set (JSON) - a JSON object that contains the customer profile information. The structure of this JSON is pre-defined with AnyRoad as a campaign.
- captured_at (datetime) - the date a customer_profile was captured in RFC 3339 date representation. This date will be stored in UTC time. Example: if you pass “2021-03-01 00:00:00-08” as a parameter it will be stored as "2021-03-01T08:00:00Z".
- referrer_medium (string) - string that represents where the API call originated from or where the data was collected from the customer.
- booking (collection): The properties of the booking.
- guest_email (string) - A Base64 encoded string representing the customer’s email address.
- guest_first_name (string) - A Base64 encoded string representing the customer’s first name.
- guest_last_name (string) - A Base64 encoded string representing the customer’s last name.
- booking_id (integer) - booking id that matches a customer profile.
- number_guests_booked (integer) - An integer representing the number of guests that were booked for this booking.
- tickets (string) - The tickets associated with a booking
{ "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" } }
{ "error": "Invalid API key." }
{ "error": "Forbidden." }
PATCH Request
- customer_profile_id (string) - required: uuid that uniquely identifies the customer profile
- captured_at (timestamp) - optional: timestamp in RFC 3339 format, stored in UTC time.
- referrer_medium (string) - optional: string that represents where the API call originated from or where the data was collected from the customer.
- data_set (JSON) - optional: valid JSON that represents any unique customer data desired
curl -X PATCH -H 'X-API-KEY: ' -H 'Content-Type: application/json' https://app.anyguide.com/external/api/v1/customer_profile/56c934fa-03c2-46f4-b7f9-6d44 bafdd5a2 -d '{"data_set":{"custom_attribute":"red"},"referrer_medium":"email","captured_at":"2021-03-01 00:00:00-08"}'
PATCH Response
{ "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" } }
{ "error": "Invalid API key." }
{ "error": "Forbidden." }
Customer Profile Search
POST Request
- booking_id (integer) - optional: booking id that matches a customer profile.
- last_name (string) - optional: last name of a customer that matches a customer profile. Before searching, we will remove accents, cases, apostrophes, hyphens, and spaces from names. Ex: D'Angelo -> dangelo, Van Morrison -> vanmorrison, Beyoncé -> beyonce, Newton-John -> newtonjohn
- booking_date (timestamp) - optional: The date of the guest’s experience. Timestamp in YYYY-MM-DD format.
curl -X POST -H 'X-API-KEY: ' -H 'Content-Type: application/json' https://app.anyguide.com/external/api/v1/customer_profile/search -d '{"booking_id":1234,"last_name":"Smith","booking_date":"2021-03-01"}'
POST Response
{ "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" } ] }
{[ ]}
{ "error": "Invalid API key." }
{ "error": "Forbidden." }
If you have any additional questions, you can contact our Customer Experience team at support@anyroad.com.