Freshpaint
Search…
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:
1
{
2
"event": "<name of the event>",
3
"properties": {
4
"distinct_id": "<unique user identifier>",
5
"token": "<your environment id>",
6
"time": <the epoch time when the event occurred>,
7
<additional properties>
8
}
9
}
Copied!

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:

1
curl -X POST -H "Content-Type: application/json" -d '{
2
"event": "Purchase",
3
"properties": {
4
"distinct_id": "13793",
5
"token": "2ce2b45b-af44-4426-a3ef-a314abce9c85",
6
"time": 1577836800,
7
"price": 500
8
}
9
}' https://api.perfalytics.com/track
Copied!

Server-side Identify

You can also pass identify events server-side to attach user properties to users from the server. To do so, you pass a server-side event to the HTTP API with the following format:
1
{
2
"event": "$identify",
3
"properties": {
4
"distinct_id": "<user identifier>",
5
"token": "<your freshpaint environment id>",
6
"time": <epoch time in seconds>,
7
"$user_props": {
8
<any properties you want to attach to the user>
9
}
10
}
11
}
Copied!
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.
Last modified 3mo ago