Pixel and events
List of available Pixel Tag events
GET /api/pixel_events/?account_id={account_id}
Description
Returns Pixel Tag events associated with the specified account.
Example request
http
GET https://clientapi.adstat.pro/api/pixel_events/?account_id={account_id}Request parameters
| Field | Type | Description | Required |
|---|---|---|---|
account_id | String | Account identifier | Yes |
Example response
json
{
"items": [
{
"id": "test_event_some_property",
"pixel_id": "test_event_some_property",
"tg_event_id": "test_event_some_property",
"title": "test_event_some_property",
"type": "custom",
"status": "inactive",
"ads_count": 1,
"created_at": "2025-06-04T14:36:45+00:00",
"last_triggered_at": null,
"code_snippet": "<script>\ntgp('event', 'test_event_some_property');\n</script>"
}
]
}Response fields
| Field | Type | Description |
|---|---|---|
id | String | Event identifier |
pixel_id | String | Pixel identifier |
tg_event_id | String | Telegram event identifier |
title | String | Event name |
type | String | Event type (e.g. custom, page_view) |
status | String | Event status (active, inactive) |
ads_count | Number | Number of linked ads |
created_at | String | Event creation date and time (ISO 8601) |
last_triggered_at | String | Last trigger date and time (may be null) |
code_snippet | String | Code snippet to embed the event on a site |
Create an event
POST /api/pixel_events/
Description
Creates a new Pixel Tag event for the specified account.
Example request
http
POST https://clientapi.adstat.pro/api/pixel_events/Request body
| Field | Type | Description | Required |
|---|---|---|---|
account_id | String | Account identifier | Yes |
title | String | Event name | Yes |
type | String | Event type (from the types list) | Yes |
Example request body
json
{
"account_id": "12345",
"title": "Purchase",
"type": "page_view"
}Possible errors
- 400 Bad Request: Invalid data format or missing required fields.
- 403 Forbidden: Insufficient permissions to create an event.
- 422 Unprocessable Entity: Unsupported event type.
Get base Pixel Tag code
GET /api/pixel_events/{account_id}/code_snippet
Description
Returns the base Pixel Tag code for the specified account.
Example request
http
GET https://clientapi.adstat.pro/api/pixel_events/{account_id}/code_snippetRequest parameters
| Field | Type | Description | Required |
|---|---|---|---|
account_id | String | Account identifier | Yes |
Example response
json
{
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"tg_pixel_id": "pixel_12345",
"code_snippet": "<script>\n(function(w,d,s,l,i){...})(window,document,'script','dataLayer','pixel_12345');\n</script>"
}Response fields
| Field | Type | Description |
|---|---|---|
id | String | Pixel identifier |
tg_pixel_id | String | Telegram pixel identifier |
code_snippet | String | Code snippet to embed the pixel |
List of event types
GET /api/pixel_events/types
Description
Returns available Pixel Tag event types.
Example request
http
GET https://clientapi.adstat.pro/api/pixel_events/typesExample response
json
{
"items": [
{
"type": "page_view",
"label": "Page View"
},
{
"type": "purchase",
"label": "Purchase"
},
{
"type": "custom",
"label": "Custom Event"
}
]
}Response fields
| Field | Type | Description |
|---|---|---|
type | String | Event type identifier |
label | String | Display name of the type |
Edit Pixel Tag event name
PATCH /api/pixel_events/{event_id}
Description
Updates the name of an existing Pixel Tag event.
Example request
http
PATCH https://clientapi.adstat.pro/api/pixel_events/{event_id}Request parameters
| Field | Type | Description | Required |
|---|---|---|---|
event_id | String | Event identifier | Yes |
Request body
| Field | Type | Description | Required |
|---|---|---|---|
account_id | String | Account identifier | Yes |
title | String | New event name | Yes |
Example request body
json
{
"account_id": "12345",
"title": "Updated Purchase Event"
}Possible errors
- 400 Bad Request: Invalid data format or missing required fields.
- 403 Forbidden: Insufficient permissions to edit the event.
- 404 Not Found: Event with the given
event_idnot found.
Delete a Pixel Tag event
DELETE /api/pixel_events/{account_id}/events/{event_id}
Description
Deletes a Pixel Tag event for the specified account.
Example request
http
DELETE https://clientapi.adstat.pro/api/pixel_events/{account_id}/events/{event_id}Request parameters
| Field | Type | Description | Required |
|---|---|---|---|
account_id | String | Account identifier | Yes |
event_id | String | Event identifier | Yes |
Possible errors
- 403 Forbidden: Insufficient permissions to delete the event.
- 404 Not Found: Event or account not found.