HTTP API

You can use the Freshpaint HTTP API to send server side events into Freshpaint. See the server side source docs for information on how you can use server side events.

Using the HTTP API

The Freshpaint server-side API can be used to send data from your backend to Freshpaint. To send a server-side event, you make a POST request to api.perfalytics.com/track with the event you want to send. Events have the following format:

{
"event": "<name of the event>",
"properties": {
"distinct_id": "<unique user identifier>",
"token": "<your environment id>",
"time": <the epoch time when the event occurred>,
<additional properties>
}
}

Properties

The following properties are required:

Argument

Type

Description

distinct_id

String

An identifier that uniquely identifies the user that performed the event (usually email address).

token

String

Your environment ID. You can get it from the Server Side API section on the sources page of the Freshpaint app.

time

Number

The epoch time the event occurred. The epoch time is the number of seconds since January 1st 1970.

In addition to the above required properties, you can send any properties you want.

Example curl request:

curl -X POST -H "Content-Type: application/json" -d '{
"event": "Purchase",
"properties": {
"distinct_id": "13793",
"token": "2ce2b45b-af44-4426-a3ef-a314abce9c85",
"time": 1577836800,
"price": 500
}
}' https://api.perfalytics.com/track