Skip to content

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

FieldTypeDescriptionRequired
account_idStringAccount identifierYes

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

FieldTypeDescription
idStringEvent identifier
pixel_idStringPixel identifier
tg_event_idStringTelegram event identifier
titleStringEvent name
typeStringEvent type (e.g. custom, page_view)
statusStringEvent status (active, inactive)
ads_countNumberNumber of linked ads
created_atStringEvent creation date and time (ISO 8601)
last_triggered_atStringLast trigger date and time (may be null)
code_snippetStringCode 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

FieldTypeDescriptionRequired
account_idStringAccount identifierYes
titleStringEvent nameYes
typeStringEvent 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_snippet

Request parameters

FieldTypeDescriptionRequired
account_idStringAccount identifierYes

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

FieldTypeDescription
idStringPixel identifier
tg_pixel_idStringTelegram pixel identifier
code_snippetStringCode 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/types

Example response

json
{
	"items": [
		{
			"type": "page_view",
			"label": "Page View"
		},
		{
			"type": "purchase",
			"label": "Purchase"
		},
		{
			"type": "custom",
			"label": "Custom Event"
		}
	]
}

Response fields

FieldTypeDescription
typeStringEvent type identifier
labelStringDisplay 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

FieldTypeDescriptionRequired
event_idStringEvent identifierYes

Request body

FieldTypeDescriptionRequired
account_idStringAccount identifierYes
titleStringNew event nameYes

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_id not 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

FieldTypeDescriptionRequired
account_idStringAccount identifierYes
event_idStringEvent identifierYes

Possible errors

  • 403 Forbidden: Insufficient permissions to delete the event.
  • 404 Not Found: Event or account not found.