API reference
Server-side events
Report purchases and other events from your backend, where they cannot be tampered with.
Send events
POST/eventsevents:write
Records up to 50 events for a device and sends them to your webhooks and postbacks.
| Parameter | Type | Description |
|---|---|---|
app_idRequired |
integer | The app this belongs to, from GET /apps. |
device_idRequired |
string | The UUID your app uses for this install with the SDK. |
platformRequired |
string | ios or android. |
eventsRequired |
array | Up to 50 objects with event_id, name, and optional time_ms, revenue, currency and properties. |
curl -X POST "https://baiocodesolutions.com/api/v1/events" \
-H "Authorization: Bearer $DEEPBERTH_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"app_id": 12,
"device_id": "6f2b9a52-3c84-4b1e-9f10-2a7c1d4e8b90",
"platform": "ios",
"events": [
{
"event_id": "0c7f3a10-8d2e-4f6b-b1a4-93e5c2d7f810",
"name": "purchase",
"revenue": 19.99,
"currency": "USD",
"properties": {
"sku": "A-100"
}
}
]
}'const response = await fetch("https://baiocodesolutions.com/api/v1/events", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.DEEPBERTH_TOKEN}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
"app_id": 12,
"device_id": "6f2b9a52-3c84-4b1e-9f10-2a7c1d4e8b90",
"platform": "ios",
"events": [
{
"event_id": "0c7f3a10-8d2e-4f6b-b1a4-93e5c2d7f810",
"name": "purchase",
"revenue": 19.99,
"currency": "USD",
"properties": {
"sku": "A-100"
}
}
]
}),
});
console.log(await response.json());import os, requests
response = requests.post(
"https://baiocodesolutions.com/api/v1/events",
headers={"Authorization": f"Bearer {os.environ['DEEPBERTH_TOKEN']}"},
json={
"app_id": 12,
"device_id": "6f2b9a52-3c84-4b1e-9f10-2a7c1d4e8b90",
"platform": "ios",
"events": [
{
"event_id": "0c7f3a10-8d2e-4f6b-b1a4-93e5c2d7f810",
"name": "purchase",
"revenue": 19.99,
"currency": "USD",
"properties": {
"sku": "A-100"
}
}
]
},
)
print(response.status_code, response.json())$response = Http::withToken(env('DEEPBERTH_TOKEN'))
->post('https://baiocodesolutions.com/api/v1/events',
[
'app_id' => 12,
'device_id' => '6f2b9a52-3c84-4b1e-9f10-2a7c1d4e8b90',
'platform' => 'ios',
'events' => [
[
'event_id' => '0c7f3a10-8d2e-4f6b-b1a4-93e5c2d7f810',
'name' => 'purchase',
'revenue' => 19.99,
'currency' => 'USD',
'properties' => [
'sku' => 'A-100',
],
],
],
]);
dump($response->status(), $response->json());202 Accepted
{
"data": {
"accepted": 1,
"duplicates": 0
}
}Erase a device
DELETE/devices/{id}devices:write
Deletes a device and its install and event records, so you can honor an end user’s erasure request.
| Parameter | Type | Description |
|---|---|---|
app_idRequired |
integer | The app this belongs to, from GET /apps. |
curl -X DELETE "https://baiocodesolutions.com/api/v1/devices/6f2b9a52-3c84-4b1e-9f10-2a7c1d4e8b90?app_id=12" \
-H "Authorization: Bearer $DEEPBERTH_TOKEN"const response = await fetch("https://baiocodesolutions.com/api/v1/devices/6f2b9a52-3c84-4b1e-9f10-2a7c1d4e8b90?app_id=12", {
method: "DELETE",
headers: {
Authorization: `Bearer ${process.env.DEEPBERTH_TOKEN}`,
},
});
console.log(await response.json());import os, requests
response = requests.delete(
"https://baiocodesolutions.com/api/v1/devices/6f2b9a52-3c84-4b1e-9f10-2a7c1d4e8b90?app_id=12",
headers={"Authorization": f"Bearer {os.environ['DEEPBERTH_TOKEN']}"},
)
print(response.status_code, response.json())$response = Http::withToken(env('DEEPBERTH_TOKEN'))
->delete('https://baiocodesolutions.com/api/v1/devices/6f2b9a52-3c84-4b1e-9f10-2a7c1d4e8b90?app_id=12');
dump($response->status(), $response->json());202 Accepted
{
"data": {
"status": "erasure_scheduled"
}
}