# Track points

> Follow points through a video: give their positions in the first frame and get their positions in every frame.

`POST https://api.openrobotics.dev/v1/track`

## Authorization

`Authorization: Bearer sk-orb-v1-…`, your [API key](https://www.openrobotics.dev/docs/authentication), or a free [test key](https://www.openrobotics.dev/docs/authentication#test-keys) (`sk-orb-test-…`; no account? get one with [`POST /sandbox/keys`](https://www.openrobotics.dev/docs/api/create-sandbox-key)).

## Request body

JSON, with `Content-Type: application/json`.

- `model` (string, required): The tracking model to run, e.g. `google-deepmind/tapnext`. The live models for this endpoint are listed below.
- `frames` (string[], required): The video, 2–64 frames, oldest first. Each a base64 JPEG or PNG under 4 MB of base64.
- `points` (number[][], required): 1–256 `[x, y]` pixel positions in the first frame.
- `depths` (string[]): RGB-D trackers (TAPIP3D) require it: one depth map per frame, the same size, as a base64 16-bit grayscale PNG in millimetres (0 = no measurement). 2-D trackers refuse it.
- `intrinsics` (number[]): RGB-D trackers: the camera's `[fx, fy, cx, cy]` in pixels, shared by all frames. Required with `depths`.
- `poses` (number[][]): RGB-D trackers, optional: one camera-to-world pose per frame (16 numbers, row-major 4×4, meters) for a moving camera. Without them the camera is taken as static.

## Response

- `id` (string): Unique id of this call, e.g. `trk_48213`. It matches the call in your Activity dashboard.
- `model` (string): The model that answered.
- `backend` (string): `"http"`: the real model ran on a GPU. `"simulated"`: stand-in output of the same shape, as test keys get.
- `sandbox` (boolean): `true` when the call was made with a [test key](https://www.openrobotics.dev/docs/authentication#test-keys): the output is simulated, nothing ran on a GPU and nothing was charged. Absent otherwise.
- `tracks` (object[][]): One list per point, in the order you sent them, with one entry per frame: `{ x, y, visible }`, where `visible` is false while the point is hidden. RGB-D trackers add `point: [x, y, z]` in meters, in the world frame of `poses` (without poses, the camera's: x right, y down, z forward).
- `usage` (object): What the call cost.
  - `cost_usd` (number): Charged to your credits, in US dollars.
  - `latency_ms` (integer): Time the model took, in milliseconds.

## Errors

Plus the errors every endpoint shares: see [Errors](https://www.openrobotics.dev/docs/errors).

## Example request

Python:

```python
import os, requests

res = requests.post(
  "https://api.openrobotics.dev/v1/track",
  headers={"Authorization": f"Bearer {os.environ['OPENROBOTICS_API_KEY']}"},
  json={
    "model": "google-deepmind/tapnext",
    "frames": ["<base64 JPEG or PNG>", "<base64 JPEG or PNG>", "…"],
    "points": [[320, 240]],
  },
).json()
res["tracks"]          # per point, per frame { x, y, visible }
```

TypeScript:

```typescript
const res = await fetch("https://api.openrobotics.dev/v1/track", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.OPENROBOTICS_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    model: "google-deepmind/tapnext",
    frames: ["<base64 JPEG or PNG>", "<base64 JPEG or PNG>", "…"],
    points: [[320, 240]],
  }),
}).then((r) => r.json());
```

cURL:

```bash
curl https://api.openrobotics.dev/v1/track \
  -H "Authorization: Bearer $OPENROBOTICS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"google-deepmind/tapnext","frames":["<base64 JPEG or PNG>","<base64 JPEG or PNG>","…"],"points":[[320,240]]}'
```

## Example response

```json
{
  "id": "trk_48213",
  "model": "google-deepmind/tapnext",
  "backend": "http",
  "tracks": [
    [
      { "x": 320, "y": 240, "visible": true },
      { "x": 324.6, "y": 238.1, "visible": true },
      …
    ]
  ],
  "usage": { "cost_usd": 0.0002, "latency_ms": 410 }
}
```

## Models

5 live for `/track`:

- [TAPNext](https://www.openrobotics.dev/models/google-deepmind/tapnext.md): `google-deepmind/tapnext`, $0.10 per 1,000 calls
- [TAPIR / BootsTAP](https://www.openrobotics.dev/models/google-deepmind/tapir.md): `google-deepmind/tapir`, $0.10 per 1,000 calls
- [TAPIP3D](https://www.openrobotics.dev/models/cmu/tapip3d.md): `cmu/tapip3d`, $0.10 per 1,000 calls
- [Track-On2](https://www.openrobotics.dev/models/kuis-ai/track-on2.md): `kuis-ai/track-on2`, $0.10 per 1,000 calls
- [AllTracker](https://www.openrobotics.dev/models/stanford/alltracker.md): `stanford/alltracker`, $0.10 per 1,000 calls
