Skip to main content
User Data API
Updated over a week ago

Description

This endpoint retrieves data for a specific user based on the provided user ID. The data returned includes user properties, calculated properties, tags, and a list of segments the user is part of.

Base URLs

  • EU region: https://app.coho.ai

  • US region: https://app.us.coho.ai

Endpoint

GET /api/data/user/:id

Headers

  • Authorization: Bearer <API KEY>

The authorization header must include a valid API key to access the endpoint.

Path Parameters

  • id: The unique identifier of the user whose data is being requested.

Response

Successful Response

  • Status Code: 200 OK

  • Response Body:

The response body contains the following JSON structure:

{
"userProperties": {
"userId": "string",
"name": "string",
"email": "string",
"firstVisitTime": "string (ISO 8601 format)",
"signupTime": "string (ISO 8601 format)",
"appVersion": "string",
"platform": "string",
"os": "string",
"browser": "string",
"browserVersion": "string",
"continent": "string",
"city": "string",
"initialAppVersion": "string",
"initialPlatform": "string",
"initialOs": "string",
"initialBrowser": "string",
"initialBrowserVersion": "string",
"initialContinent": "string",
"initialCountry": "string",
"initialCity": "string",
"createdTime": "string (ISO 8601 format)",
"updateTime": "string (ISO 8601 format)",
"country": "string",
"properties": {
// Additional key-value pairs as needed
}
},
"calculatedProperties": [
{
"id": "string",
"name": "string",
"timeframe": "number (days)",
"value": "number"
},
// Additional calculated properties as needed
],
"tags": [
{
"key": "string",
"value": "string"
},
// Additional tags as needed
],
"segments": [
{
"segmentId": "string",
"segmentName": "string"
},
// Additional segments as needed
]
}

Error Responses

  • Status Code: 401 Unauthorized

  • Description: The API key is missing or invalid.

{
"error": "Unauthorized",
"message": "Invalid API key"
}

  • Status Code: 404 Not Found

  • Description: The specified user ID does not exist.

{
"error": "Not Found",
"message": "User not found"
}

Notes

  • Ensure the API key is kept secure and not exposed in client-side code.

  • The DateTime fields in userProperties are in ISO 8601 format.

Did this answer your question?