curl --request POST \
--url https://{cluster}.voucherify.io/client/v1/events \
--header 'Content-Type: application/json' \
--header 'X-Client-Application-Id: <api-key>' \
--header 'X-Client-Token: <api-key>' \
--header 'origin: <origin>' \
--data '
{
"event": "user_subscribed",
"customer": {
"source_id": "source_customer_event"
},
"referral": {
"code": "46jL0kYI",
"referrer_id": "cust_Vzck5i8U3OhcEUFY6MKhN9Rv"
},
"metadata": {
"login": "bob",
"pricing_plan": "PP1",
"volume_number": 4
}
}
'{
"object": "event",
"type": "cart_abandoned",
"customer": {
"id": "cust_ypePCF6IU6fnUvec6RMXZuH4",
"name": "John Doe",
"email": "john@voucherify.io",
"source_id": "source_customer_event",
"metadata": {
"prop": "value"
},
"object": "customer"
},
"referral": null,
"loyalty": null
}{
"code": 400,
"key": "invalid_payload",
"message": "Invalid payload",
"details": "Property .referral should have required property 'code'",
"request_id": "v-0c15694e0e022146dd"
}Track Custom Event (client-side)
To track a custom event, you create an event object.
The event object must be linked to the customer who performs the action. If a customer doesn’t exist in Voucherify, the customer will be created.
curl --request POST \
--url https://{cluster}.voucherify.io/client/v1/events \
--header 'Content-Type: application/json' \
--header 'X-Client-Application-Id: <api-key>' \
--header 'X-Client-Token: <api-key>' \
--header 'origin: <origin>' \
--data '
{
"event": "user_subscribed",
"customer": {
"source_id": "source_customer_event"
},
"referral": {
"code": "46jL0kYI",
"referrer_id": "cust_Vzck5i8U3OhcEUFY6MKhN9Rv"
},
"metadata": {
"login": "bob",
"pricing_plan": "PP1",
"volume_number": 4
}
}
'{
"object": "event",
"type": "cart_abandoned",
"customer": {
"id": "cust_ypePCF6IU6fnUvec6RMXZuH4",
"name": "John Doe",
"email": "john@voucherify.io",
"source_id": "source_customer_event",
"metadata": {
"prop": "value"
},
"object": "customer"
},
"referral": null,
"loyalty": null
}{
"code": 400,
"key": "invalid_payload",
"message": "Invalid payload",
"details": "Property .referral should have required property 'code'",
"request_id": "v-0c15694e0e022146dd"
}Authorizations
Scopes
Body
Specify the details of the custom event.
Request body schema for POST v1/events.
The metadata object stores all custom attributes assigned to the event. A set of key/value pairs that you can attach to an event object. It can be useful for storing additional information about the event in a structured format. Event metadata schema is defined in the Dashboard > Project Settings > Event Schema > Edit particular event > Metadata property definition.
Response
Returns the event type if the event was received by the application.
Response body schema for POST v1/events.

