Get Data into Candu via the REST API

Candu's REST API can be used to make data available for content targeting and customization. See our guide on how to use this data in segmentation.

Authentication

Candu uses Token Bearer authentication via the HTTP Authentication header. To authenticate with Candu's API, you need to access your API KEY from your workspace settings.

You can then access the API using a Authorization: Bearer token.

curl -X GET \
 https://api.candu.ai/api/contentMetadata \
  -H 'content-type: application/json' \
  -H 'Authorization: Bearer [ADD_YOUR_API_KEY_HERE]

For example if your API key is TestAPIKey:

curl -X GET \
  https://api.candu.ai/api/contentMetadata \
  -H 'content-type: application/json' \
  -H 'Authorization: Bearer TestApiKey'

/api/eventWebhook

User traits and events can be sent into candu via our inbound webhook.

Identify

To send attributes for a given user. Typically, things like name, email, organization, role in company.

curl -X POST \
  https://api.candu.ai/api/eventWebhook \
  -H 'content-type: application/json' \
  -H 'Authorization: Bearer [YOUR_API_KEY]' \
  --data '
    {
      "type": "identify",
      "userId": "[USER_ID]",
      "traits": {
        "email": "[email protected]",
        "location": "New York",
        "isAdmin": true
      },
      "timestamp": "2021-11-01T15:58:02Z"
    }
  '
FieldRequired?Description
typeyesThe type of tracking event. In this case, "identify"
userIDyesThe user ID we wish to update
traitsyesA dictionary map of user properties. Strings, numbers and boolean values are supported. For dates, we recommend using unix timestamps.'
timestampnoDefaults to the current time

Track

To track a custom event for a given user. These can be used in content targeting.

curl -X POST \
  https://api.candu.ai/api/eventWebhook \
  -H 'content-type: application/json' \
  -H 'Authorization: Bearer [YOUR_API_KEY]' \
  --data '
    {
      "type": "track",
      "userId": "[USER_ID]",
      "event": "Upgraded plan",
      "properties": {
        "amountPaidInUSD": 30,
        "newPlan": "Business+"
      },
      "timestamp": "2022-01-20T11:21:02Z"
    }
  '
FieldRequired?Description
typeyesThe type of tracking event. In this case, "track"
userIDyesThe ID of the user the event belongs to
traitsyesThe name of the event
timestampnoTimestamp the event occurred. Defaults to the current time