Skip to main content

Using Track Event API

In this page, you will find the documentation for how to send event data to our api. EventBunker currently supports HTTP POST request with write api key in the http header and JSON data in the body to track events.

You will need a write api key in the request header, if you don't have a key yet, you can create a project and create a write api key. Check out Managing Api Keys for that.


We assume you have already read previous pages in Intro to Event Tracking and Event Data Format and you know about api keys and json data format.

We are using Cloudflare Network to host tracker api, so tracking requests will be fast from all around the world, regardless of your customer's location. Typical response time of the api is around 30-40ms after first request. Also scaling up and down is not an issue since it is handled by Cloudflare system. There is no cold-start time or mini batching, your event will be ready for querying under 10 seconds.

Track Event via Post Api

Only mandatory fields are event_name and x-eventbunker-write-key header. All about Event Data Format has been described in previous page. Timestamp is optional, if not given, api will asign current UTC time for it. customer_identifier is a useful field, you can learn more here.



Example Request;

Please copy one of your write api key from web ui or management api response and replace it with placeholders in example code below. Copy and run the sample code below in your terminal window.

curl --request POST '' \
--header 'x-eventbunker-write-key: <YOUR-WRITE-API-KEY>' \
--header 'Content-Type: application/json' \
--data-raw '{
"event_name": "my_first_event_name",
"timestamp": "2021-06-26T14:48:00.000",
"customer_identifier": "your_app_customer_id",
"example_string_field": "",
"example_number_field": 123,
"example_array_field": ["cat", "dog"]
"example_bool_field": true

Example Response;

Response will be a JSON contaning unique_req_id and time_recorded (also this is timestamp field's value if set by api). Or you can get validation errors if your api key is wrong or json format is invalid. Check out errors section

"unique_req_id": "0af5d5608900000c7d813a3000000001",
"time_recorded": 1624910874832

That's it! Congratulations, you have sent your first event. You can implement this request in any language since it is just a http post request to EventBunker api endpoint.

Error Codes

For a general explanation of error codes please read here in project management

For all api methods in api key management you can possibly get the following errors with HTTP 400 error code in addition to list in linked page.

Error MessageHTTP CodeDescription
Invalid x-eventbunker-write-key401You provided wrong key value or forgotten key in header
Body JSON validation failed.400Together with json schema validation error message
Please use a write key for write requests. Invalid x-eventbunker-write-key401If you use a query key or delete key
Error...500Internal error