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!
The Freshpaint HTTP API will return a 200 as soon as the event has been received. Validation of the event will be performed after the event is received. If you want to confirm Freshpaint has received your event, you should check the Freshpaint Live View.

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.
Freshpaint APIs are fast, and we're committed to 99.9% uptime (see our SLA https://www.freshpaint.io/sla). That said, we recommend communicating with Freshpaint APIs in a "fire and forget" manner, for example by making the request from a separate thread or by using an async-await pattern if your language supports it. We recommend this so that your server processing is not blocked waiting for the Freshpaint API to respond.