# Quick start

Track an event in under a minute.

The Event Tracking API ingests event beacons from your application, validates each payload against the [event types](/reference/event/overview#event-types) reference, enriches it with server-side context, and publishes it for processing.

> **Prefer the SDK**
>
> Most applications should integrate through the [Croct SDK](/reference/sdk), which handles authentication, client IDs, context detection, and beacon delivery. Call the HTTP API directly only for custom integrations or when building a new client.

## Track an event

Make a `POST` request to `/client/web/track` with the event envelope:

**JavaScript**

```js
const response = await fetch('https://api.croct.io/client/web/track', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'X-App-Id': '<APP ID>',
    'X-Client-Id': '<CLIENT ID>',
  },
  body: JSON.stringify({
    originalTime: Date.now(),
    departureTime: Date.now(),
    context: {url: 'https://example.com/home'},
    payload: {
      type: 'pageOpened',
      url: 'https://example.com/home',
    },
  }),
});
```

**cURL**

```bash
curl -X POST 'https://api.croct.io/client/web/track' \
  -H 'Content-Type: application/json' \
  -H 'X-App-Id: <APP ID>' \
  -H 'X-Client-Id: <CLIENT ID>' \
  -d '{
    "originalTime": 1612137600000,
    "departureTime": 1612137600050,
    "context": {"url": "https://example.com/home"},
    "payload": {
      "type": "pageOpened",
      "url": "https://example.com/home"
    }
  }'
```

A successful request returns `204 No Content` with an empty body.

See the [endpoint reference](/reference/api/service/event-tracking/endpoint/track) for more details.
