curl --request POST \
--url https://{cluster}.voucherify.io/v1/events \
--header 'Content-Type: application/json' \
--header 'X-App-Id: <api-key>' \
--header 'X-App-Token: <api-key>' \
--data '
{
"event": "event-name",
"customer": {
"source_id": "referee-source_id"
},
"referral": {
"code": "voucher-code",
"referrer_id": "referrer-source_id"
}
}
'{
"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": 404,
"key": "not_found",
"message": "Resource not found",
"details": "Cannot find customer with id registered_10055",
"request_id": "v-0dc6ead2680056a15a",
"resource_id": "registered_10055",
"resource_type": "customer"
}Track Custom Event
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/v1/events \
--header 'Content-Type: application/json' \
--header 'X-App-Id: <api-key>' \
--header 'X-App-Token: <api-key>' \
--data '
{
"event": "event-name",
"customer": {
"source_id": "referee-source_id"
},
"referral": {
"code": "voucher-code",
"referrer_id": "referrer-source_id"
}
}
'{
"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": 404,
"key": "not_found",
"message": "Resource not found",
"details": "Cannot find customer with id registered_10055",
"request_id": "v-0dc6ead2680056a15a",
"resource_id": "registered_10055",
"resource_type": "customer"
}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.

