# Estimate hand pose

> Find hands in an image and get 21 keypoints for each.

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

## 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 hand pose model to run. The models for this endpoint are listed below.
- `image` (string, required): The image, base64 JPEG or PNG (a `data:` URL works too). Under 4 MB of base64.

## Response

- `id` (string): Unique id of this call, e.g. `hnd_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.
- `hands` (object[]): One per hand found.
  - `side` (string): `"left"` or `"right"`.
  - `score` (number): Confidence, 0–1.
  - `box` (number[4]): `[x0, y0, x1, y1]` in pixels.
  - `keypoints` (number[][]): 21 `[x, y]` pixel positions: the wrist, then 4 joints for each finger.
- `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/hands",
  headers={"Authorization": f"Bearer {os.environ['OPENROBOTICS_API_KEY']}"},
  json={
    "model": "<hand pose model id>",
    "image": "<base64 JPEG or PNG>",
  },
).json()
res["hands"]           # side, score, box, 21 keypoints
```

TypeScript:

```typescript
const res = await fetch("https://api.openrobotics.dev/v1/hands", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.OPENROBOTICS_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    model: "<hand pose model id>",
    image: "<base64 JPEG or PNG>",
  }),
}).then((r) => r.json());
```

cURL:

```bash
curl https://api.openrobotics.dev/v1/hands \
  -H "Authorization: Bearer $OPENROBOTICS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"<hand pose model id>","image":"<base64 JPEG or PNG>"}'
```

## Example response

```json
{
  "id": "hnd_48213",
  "model": "<hand pose model id>",
  "backend": "http",
  "hands": [
    {
      "side": "right",
      "score": 0.95,
      "box": [300.2, 180.4, 420.9, 330],
      "keypoints": [
        [360.5, 330],
        [348.1, 309.6],
        …
      ]
    }
  ],
  "usage": { "cost_usd": 0.0001, "latency_ms": 120 }
}
```

## Models

No model is live for this endpoint yet.
