chrts icon
chrts icon

API documentation

Getting started

This guide explains all you need to know to get started sending product data to chrts.

To get started with the API, you will need to create an account and generate an API key for the source you want to send product data to.

Would you like to create a token?

You can create a token by going to your list of sources.

Authentication

You can authenticate with the API by providing your API key in the Authorization header. The API key is a Bearer token that you can generate from the sources page.

Example

1 2 3 curl --request GET \ --url https://api.chrts.co/ \ --header 'Authorization: Bearer api_chrts_21ifmQkfBytOOg8XqhZeUaR2a2wtMkoMNH2qL6JZsRXjTV90wKSFn8DeGzHxTTp'

Would you like to create a token?

You can create a token by going to your list of sources.

Identify a customer

The Identify call lets you tie a user to their actions and record attributes about them.

It includes a unique User ID (UID) and any optional attributes you know about the user, like their email, name, location and more.

Request body params

ParamTypeDescription
uidstringRequired. The unique identifier for the user. Optional if you use userId or  anonymousId to identify the customer
userIdstringRequired. The unique identifier for the user. Optional if you use uid or  anonymousId to identify the customer
anonymousIdstringRequired. The unique identifier for the user. Optional if you use uid or  userId to identify the customer
attributesobjectOptional. A dictionary of traits you know about the user. You can include any custom attributes you like. Do not use attributes if using traits
traitsobjectOptional. A dictionary of traits you know about the user. You can include any custom attributes you like. Do not use traits if using attributes

Example

1 2 3 4 5 6 7 8 9 10 11 12 curl --request POST \ --url https://api.chrts.co/customer/identify \ --header 'Authorization: Bearer api_chrts_3bxip2lXCUctEWLBFIEjgcu5fsrjRKNjCIgYiRPQXhMKo6GE1asMXX6sjZobcPU' \ --header 'Content-Type: application/json' \ --data '{ "uid":"cus_sample_ciaVhuuE", "attributes":{ "email":"[email protected]", "country":"CA", "city":"Vancouver" } }'

200 Response

1 2 3 4 5 { "status": true, "code": 200, "message": "Customer identified successfully" }

400 Response

1 2 3 4 5 { "status": false, "code": 400, "message": "Customer UID is required. You can use `uid`, `userId` or `anonymousId` to identify the customer" }

Do you use Segment?

we are fully compatible with Segment API. Check for more information.

Alias a customer

The Alias call lets you associate one identity with another.

This is most often used to connect anonymous activity on your site with a known user.

Request body params

ParamTypeDescription
uidstringRequired. The unique identifier for the user. Optional if you use userId to identify the customer
userIdstringRequired. The unique identifier for the user. Optional if you use uid to identify the customer
knownUidstringRequired. The unique identifier for the known user. Optional if you use  previousId or  anonymousId to identify the customer
previousIdstringRequired. The unique identifier for the known user. Optional if you use  knownUid or  anonymousId to identify the customer
anonymousIdstringRequired. The unique identifier for the known user. Optional if you use  knownUid or  previousId to identify the customer

Example

1 2 3 4 5 6 7 8 curl --request POST \ --url https://api.chrts.co/customer/alias \ --header 'Authorization: Bearer api_chrts_3bxip2lXCUctEWLBFIEjgcu5fsrjRKNjCIgYiRPQXhMKo6GE1asMXX6sjZobcPU' \ --header 'Content-Type: application/json' \ --data '{ "knownUid":"cus_sample_ciaVhuuE", "uid":"663fb97043f840a6dae87125" }'

200 Response

1 2 3 4 5 { "status": true, "code": 200, "message": "Customer alias set successfully" }

400 Response

1 2 3 4 5 { "status": false, "code": 400, "message": "Known UID is required. You can use `knownUid`, `previousId` or `anonymousId` to identify the known customer UID" }

Do you use Segment?

we are fully compatible with Segment API. Check for more information.

Track an event

The Track call lets you record the actions your users perform.

Every action triggers an event, which can also have associated properties.

Request body params

ParamTypeDescription
uidstringRequired. The unique identifier for the user. Optional if you use userId or  anonymousId to identify the customer
userIdstringRequired. The unique identifier for the user. Optional if you use uid or  anonymousId to identify the customer
anonymousIdstringRequired. The unique identifier for the known user. Optional if you use uid or  userId to identify the customer
namestringRequired. The name of the event you're tracking
propertiesobjectOptional. A dictionary of properties for the event. You can also send the event properties outside of this object

Example

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 curl --request POST \ --url https://api.chrts.co/event/track \ --header 'Authorization: Bearer api_chrts_3bxip2lXCUctEWLBFIEjgcu5fsrjRKNjCIgYiRPQXhMKo6GE1asMXX6sjZobcPU' \ --header 'Content-Type: application/json' \ --data '{ "uid": "663fb97043f840a6dae87125", "name": "account-signup", "platform": "desktop" }' //The following request is equivalent to the previous one curl --request POST \ --url https://api.chrts.co/event/track \ --header 'Authorization: Bearer api_chrts_3bxip2lXCUctEWLBFIEjgcu5fsrjRKNjCIgYiRPQXhMKo6GE1asMXX6sjZobcPU' \ --header 'Content-Type: application/json' \ --data '{ "uid": "663fb97043f840a6dae87125", "name": "account-signup", "properties":{ "platform": "desktop" } }'

200 Response

1 2 3 4 5 { "status": true, "code": 200, "message": "Event tracked successfully" }

400 Response

1 2 3 4 5 { "status": false, "code": 400, "message": "Customer UID is required. You can use `uid`, `userId` or `anonymousId` to identify the customer" }

Do you use Segment?

we are fully compatible with Segment API. Check for more information.

Rotate your phone ;)