---
title: "Track"
method: POST
path: "/api/track"
---

# Track

`POST /api/track`

Use this API to send custom events to Heap server-side. We recommend using this for events that need to exactly match your backend, such as completed order transaction info, or events that are not available for Heap to capture on the client-side.<br><br>**NOTE: It is required that you use either the `identity` or `user_id` param, but not both.**

## Request body

- object
  - `app_id` string, required — The environment ID corresponding to one of your environments.
  - `event` string, required — The name of the server-side event. Limited to 1024 characters.
  - `identity` string — An identity, typically corresponding to an existing user. If no such identity exists, then a new user will be created with that identity. Case-sensitive string, limited to 255 characters.
  - `user_id` string — The user_id from the Heap SDK. The user_id must be the string representation of a number between zero and 2^53 - 1. user_id may be specified instead of identity, but both cannot be provided at the same time.
  - `session_id` string — An identifier corresponding to a user's session
  - `properties` object — An object with key-value properties you want associated with the event. Each key and property must either be a number or string with fewer than 1024 characters.
    - `example_name` string
  - `timestamp` string — ISO8601 e.g. "2017-03-10T22:21:56+00:00". Defaults to the current time if not provided.
  - `idempotency_key` string — A unique ID that will be hashed to Heap's event ID keyspace, to prevent duplication of events. Subsequent calls with the same idempotency key will not update data.

## Response `200`

200

- object

## Other responses

- `400` — 400

---

[API](https://skmtc.dev/heap/apis/server-side-api.md) · [All operations](https://skmtc.dev/heap/apis/server-side-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/heap/server-side-api/revisions/6cb04521d6fa/schema)
