Replace {subdomain}
in the endpoint below with your Vitally subdomain.
You can find your subdomain in the URL used to log into Vitally (i.e., https://yoursubdomain.vitally.io
Create/update a user
POST
https://{subdomain}.api.vitally.io/analytics/v1/user
This endpoint will create or update a user in Vitally based on the userId
parameter.
Headers
Name | Type | Description |
Content-Type* | string | Set to |
Authorization* | string | Set to |
Request Body
Name | Type | Description |
userId* | string | The unique ID of this user in your system |
accountId | string | Required if
This should match the |
traits* | object | Required, but can be passed as an empty object
A JSON object containing the traits of this user. Some traits, called "reserved" traits, have special meaning to Vitally. A list of "reserved" traits can be found below. |
timestamp | string | Required if |
messageId | string | Required if |
organizationId | string | Required if
If you have organizations enabled, you may associate the user with an organization by setting |
200 When your user is created/updated, you'll receive
{"message":"Success."}
Example
An example curl request describing a Vitally user would look like:
curl -X POST https://{subdomain}.api.vitally.io/analytics/v1/user \
-H "Authorization: Basic [your token]" \
-H "Content-Type: application/json" \
-d '{
"userId": "32",
"accountId": "123456",
"traits": {
"name": "Lionel Messi",
"position": "Forward",
"email": "messi@barcelona.sp"
},
"messageId": "7ac1c682-a54b-4d0d-9f56-d6d3618f4915",
"timestamp": "2018-05-15T12:31:12.123Z"
}'
Special traits
Vitally has special logic to handle the following User traits:
name
: defines the user's name in Vitallyavatar
: defines the user's avatar in Vitallyemail
: defines the user's email in VitallycreatedAt
: defines the user's 'join date' in Vitally