# Estimate 6D pose

> Locate named objects in 3D: get each one's position and orientation in the camera frame.

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

## 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 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.
- `object` (string): The object to locate, by name or mesh id. Send `object` or `objects`.
- `objects` (string[]): Several objects, up to 16.
- `depth` (string): A depth image of the same view.
- `intrinsics` (number[4]): `[fx, fy, cx, cy]` in pixels of the image (fx, fy > 0).
- `meshes` (object): CAD models by object name, for model-based estimators: `{ "mug": { format, data, units? } }` with `format` `"ply"` or `"obj"`, `data` the file as base64, and `units` `"m"` (default) or `"mm"`. Under 2 MB of base64 together.
- `boxes` (object): Where each object is in the image, by object name (e.g. from [detect](https://www.openrobotics.dev/docs/api/detect)): `[x0, y0, x1, y1]` in pixels.

## Response

- `id` (string): Unique id of this call, e.g. `pos_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.
- `poses` (object[]): One per object found, in the camera frame.
  - `object` (string): Which object.
  - `score` (number): Confidence, 0–1.
  - `translation` (number[3]): `[x, y, z]` in meters.
  - `rotation` (number[4]): Quaternion `[qx, qy, qz, qw]`.
- `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/pose",
  headers={"Authorization": f"Bearer {os.environ['OPENROBOTICS_API_KEY']}"},
  json={
    "model": "<pose model id>",
    "image": "<base64 JPEG or PNG>",
    "object": "mug",
  },
).json()
res["poses"]           # translation (m) + rotation quaternion
```

TypeScript:

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

cURL:

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

## Example response

```json
{
  "id": "pos_48213",
  "model": "<pose model id>",
  "backend": "http",
  "poses": [
    {
      "object": "mug",
      "score": 0.91,
      "translation": [0.08, -0.03, 0.62],
      "rotation": [0.02, 0.71, -0.01, 0.7]
    }
  ],
  "usage": { "cost_usd": 0.0002, "latency_ms": 350 }
}
```

## Models

1 live for `/pose`:

- [FoundationPose](https://www.openrobotics.dev/models/nvidia/foundationpose.md): `nvidia/foundationpose`, $0.10 per 1,000 calls
