# Datumwell API integration guide for AI agents

For public datasets, [browse the catalog](https://datumwell.io/en/datasets), open the Hugging Face repository linked from each entry and check its license. For a quote, use the contact form on the dataset page.

For API integration, Datumwell offers [RoboRouter](https://datumwell.io/en/roborouter) for Robot MaaS integration and [Annotation](https://datumwell.io/en/video-annotation) for fine-grained video segments and sub-second action annotations. The production API base is `https://datumwell.io/api/v1`. Use the [OpenAPI 3.1 schema](https://datumwell.io/openapi.json) for machine-readable request and response contracts and the [pricing page](https://datumwell.io/en/pricing) for usage rates and settlement.

## 1. Authenticate and discover capabilities

Read `ROBOROUTER_TOKEN` from the user's secret store or environment. Send it as `Authorization: Bearer <token>` to `https://datumwell.io/api/v1`. A standard account token covers both capabilities. If the user has no token yet, they can create one by name in [API Tokens](https://datumwell.io/en/tokens) ([中文](https://datumwell.io/zh/tokens), [日本語](https://datumwell.io/ja/tokens), [한국어](https://datumwell.io/ko/tokens)). The full token is shown once. Keep it out of chat, code, and logs. For the homepage free check, stop after `GET /models` and summarize the returned capabilities in the user’s language. If the token is missing, give the localized API Tokens link and ask the user to set `ROBOROUTER_TOKEN` locally. Uploads and paid requests require separate user authorization. Use the same shell for the examples below or set `RR_API` in each shell.

```sh
: "${ROBOROUTER_TOKEN:?Set ROBOROUTER_TOKEN in the agent environment}"
RR_API=https://datumwell.io/api/v1
curl -fsS "$RR_API/models" -H "Authorization: Bearer $ROBOROUTER_TOKEN"
```

`GET /models` is free. Use its `data[].id` to select an available prediction model for the user's hardware. The top-level `annotation` entry identifies video annotation when the token has upload access. The `hand_pose` entry identifies standalone 3D Hand Pose for single videos and batches, priced at $3 per original video hour on success. Use the [Hand Pose guide](https://datumwell.io/en/docs/hand-pose) and the OpenAPI schema served by your deployment. Read `pricing` and any applicable `max_charge_microusd` before submitting a job the user has authorized. Amounts in `microusd` are USD millionths. Prediction is metered by returned action steps, and video annotation by measured video duration at $6 per video hour on success. New duration-v3 jobs that fail after provider processing charge 50% ($3 per video hour) on the full original duration; failures before provider processing and idle cancellations release the hold. Older uncertain outcomes retain the hold for review; automatic jobs use the bounded recovery described below. Token usage is reported separately, and existing jobs keep the reserved rate version. Both spend the user's Datumwell USD credits.

## 2. Predict robot actions

Send JSON to `POST /inference` with `request_key` (a UUID), `model`, and `observation`. The observation has `instruction`, `state`, `images`, and model-specific `eef`. A standard account token can omit both hardware-profile fields to select the model's built-in contract. With a restricted token, supply both `hardware_profile_id` and `hardware_profile_revision` from an allowed compatible profile. Use `GET /hardware-profiles` to list profiles the token can read.

Each image entry is `{"role":"wrist","frames":["data:image/jpeg;base64,..."]}`, with the exact camera role for the model. Base64-encode the bytes of a correctly sized RGB JPEG. Each data URL is limited to 400,000 characters and the JSON body to 2 MiB. Capture frames and state together.

| Model | Hardware and camera roles | State and extra fields |
| --- | --- | --- |
| `rr/poke-aurora` | UR5e. `wrist` with one 640×360 frame. | `[x,y,z,qx,qy,qz,qw,gripper]`. Position in metres, normalized quaternion, gripper in [0,1]. Omit `eef`. |
| `rr/dream-1` | I²RT YAM. `overhead`, `wrist_l`, `wrist_r` with 320×176 frames and the same number of frames per role (1–9). | Six right joints, right gripper, six left joints, left gripper. Joints in radians, grippers in [0,1]. Include `eef.right` and `eef.left`. Each has `position` (three values in metres) and `rotation_6d` (the first two rotation matrix columns, concatenated). Compute poses in each arm's base frame. |
| [`rr/wall-oss-1.0`](https://datumwell.io/en/docs?topic=wall-oss-1.0) | Franka single arm. One synchronized 480×360 RGB JPEG for each of `front` and `right_wrist`. | `[x,y,z,qx,qy,qz,qw,gripper]`, position in metres in the robot base frame, unit quaternion, gripper 0 open to 1 closed. Omit `eef`. Result: 32 absolute targets at 15 Hz. |
| `rr/dm05` | Dexmal Mirror (DOS-W1). `cam_high`, `cam_left_wrist`, `cam_right_wrist` with one 448×448 frame each. | Six left joints, left gripper, six right joints, right gripper, in DexOS native units. Omit `eef`. |

The integrated Dream-1 configuration is I²RT YAM. [Dream Labs’ cross-embodiment research](https://dreamlabs.ai/research/dream-1/) also covers other simulated and physical robots. Use the integrated hardware contract above when calling RoboRouter.

Use `observation.json` for the user's captured data. For an authorized test call without hardware, download the [synthetic DM0.5 observation](https://datumwell.io/downloads/dm05-mirror-observation.json) as `observation.json`. The sample call uses credits.

The example uses `rr/dm05`. Set `RR_MODEL` to the matching catalog ID when using another model. In a new job directory, create the request once. Keep the resulting file for retries.

```sh
RR_MODEL="${RR_MODEL:-rr/dm05}" python3 - <<'PY'
import json
import os
import uuid

with open("observation.json", encoding="utf-8") as source:
    observation = json.load(source)
with open("inference-request.json", "x", encoding="utf-8") as output:
    json.dump({
        "request_key": str(uuid.uuid4()),
        "model": os.environ["RR_MODEL"],
        "observation": observation,
    }, output)
PY

curl -sS --fail-with-body "$RR_API/inference" \
  -H "Authorization: Bearer $ROBOROUTER_TOKEN" \
  -H 'Content-Type: application/json' \
  --data-binary @inference-request.json -o inference-receipt.json
```

Read `status` and save `id` from the receipt. Poll `GET /inference/{id}` while `reserved` or `sending`. On `succeeded`, fetch the saved result:

```sh
RR_ID=$(python3 -c 'import json; print(json.load(open("inference-receipt.json"))["id"])')
curl -fsS "$RR_API/inference/$RR_ID/result" -H "Authorization: Bearer $ROBOROUTER_TOKEN"
```

Inside `actions`, read `values`, `channel_order`, `frame`, `units` and `dt_ms` (nullable) to interpret the sequence. Treat saved results with `do_not_auto_execute` as predictions for review, and validate timing and calibration in the robot integration before actuation.

## 3. Annotate a video

Upload the original MP4, MOV or WebM, including 29.97 fps and variable frame rate video. The limit is 50,000,000 bytes, 4096 pixels per side and 8,294,400 total pixels. The worker converts the input to an internal 30 fps grid. Result seconds start at the first displayed frame of the original video track, and billing uses its measured duration.

If upload creation returns `429 annotation_upload_limit`, complete or cancel an idle upload before creating another. For processing limits and retries, see [Capacity and high-volume access](#capacity-and-high-volume-access).

Read `GET /models` before uploading and follow the [Annotation API guide](https://datumwell.io/en/docs?topic=annotations). Save the job UUID in `annotation-request.key` and call `POST /annotations/{id}/upload-session` with file name, size and SHA-256. POST all returned form fields and the video file to the signed TOS URL, without forwarding the API token. Confirm with `POST /annotations/{id}/upload-complete` and the returned generation, then submit one `POST /annotations/{id}/process`. Upload confirmation stores the file and does not start annotation. Submit once before polling even if the newly created job already reports `processing_mode: automatic`. If the response includes `processing_mode: automatic`, poll with `GET /annotations/{id}` while the server finishes the job. Reuse the original job UUID as `{id}` for every read and retry. After an interruption, check the original job with `GET /annotations/{id}` before retrying.

Read the original job with the same UUID. Production returns `result.hands` (`version: hands_actions_v2`): `segments[]` contains independent anatomical `left[]` and `right[]` arrays. Each event has `start_s`, `end_s` in episode seconds, English `action`, and Chinese `action_zh`. Resumable jobs complete once both languages are ready. Older synchronous results may have English only or use `result.v4`. Fetch the individual job for detailed timelines. When `result_paged` is true, fetch `GET /annotations/{id}/result?offset=0` and follow `next_offset` until null. Preserve nulls and raw boundaries and consult `audit`. Review estimated timestamps before use.

Optional 3D hand Pose requires `pose3d: true` and
`pose3d_scope: "egocentric_single_wearer"` in the upload-session request. Declare
this scope only for first-person videos of one camera wearer's two hands, up to
120 seconds / 50,000,000 bytes. The service does not automatically verify the
scene and does not support multi-person or third-person hand tracking. The
success rate with Pose is $9/video-hour; omission preserves $6/video-hour.
Both branches finish before the original task is settled once.

For a complete runnable upload, processing and result-reading example, use the
[hand 3D Pose Python example](https://datumwell.io/en/docs?topic=annotations#pose3d-example)
([中文](https://datumwell.io/zh/docs?topic=annotations#pose3d-example) ·
[日本語](https://datumwell.io/ja/docs?topic=annotations#pose3d-example) ·
[한국어](https://datumwell.io/ko/docs?topic=annotations#pose3d-example)).
It explicitly enables Pose, saves the UUID in `clip.mp4.pose3d.request-id`, reads
all action and Pose result pages, and writes `clip.mp4.annotation.json` and
`clip.mp4.pose3d.json`. Keep that UUID file and the same input for retries;
do not reuse an ordinary non-Pose task's UUID.

On completion, follow `result.pose3d.result_endpoint` and every `next_offset`.
The `datumwell-hand-pose-v2` pages preserve source `frame_id` / `timestamp` and
return `track_id`, `detected_is_right` (original prediction) and `is_right`
(track-stabilized anatomical side). Tracks are computed on the complete ordered
artifact before paging. IDs are stable within one job across pages/retries/seeks,
but are not comparable across jobs. Missing observations may leave `hands` empty;
a new confirmed track after a long absence has a new ID. Association and duplicate
suppression do not correct joint geometry or establish measurement accuracy.
Video is processed by GPU services in Canada over HTTPS; results remain private
and project-authorized. Raw predictions and processing provenance remain internal.

```sh
RR_ANNOTATION_ID=$(cat annotation-request.key)
curl -fsS "$RR_API/annotations/$RR_ANNOTATION_ID" -H "Authorization: Bearer $ROBOROUTER_TOKEN"
```

### Automatic recovery

New accepted automatic jobs expose `recovery.automatic: true`. An interrupted call or crashed Worker is recovered under the original job UUID for at most two rounds after the initial execution. No new cumulative processing-duration cutoff is added. Keep polling GET with that UUID while `status: processing` and `recovery.retrying: true`; `retries_used`, `max_retries` and `next_retry_at` report recovery progress. The server reuses successful checkpoints and the original hold. A stage whose response was lost may be sent again, but the customer receives one settlement at the original reserved rate. Exhausted recovery ends as `failed` with `annotation_retry_exhausted`, applying the existing failure billing rules. Do not call `/recover`, create a replacement UUID or re-upload for automatic recovery.

### Explicit recovery of an older uncertain task

For older tasks without `recovery.automatic: true`, ordinary GET and POST /process never resend uncertain upstream work. Uncertain jobs retain media, attempts and their credit hold; idle cleanup does not refund them. After a 10-minute safety window, inactive uncertain jobs leave upload admission.

For a staged task without 3D Pose, only after the user authorizes recovery and acknowledges possible upstream duplication, save a recovery UUID and POST `{"recovery_key":"<saved recovery UUID>","acknowledge_possible_duplicate_upstream":true}` to `/annotations/{original-job-UUID}/recover`. The job and unresolved attempts must be at least 10 minutes old and not running. Then POST `/process` once and poll the original job. Retry this recovery with the same recovery_key. Successful checkpoints and the original credit reservation are reused, with one final customer settlement. At most two recoveries per job are accepted. Pose, missing media, exhausted recoveries or settled credits require support review. Never generate a replacement job UUID merely because the original result is uncertain.

### Submit a batch of videos

Create and confirm the upload for each video as above, keeping its original UUID. Include `pose3d: true` and the matching scope on each upload session when 3D hand Pose is required. Submit up to 10 confirmed uploads with one request. This submission starts processing for accepted items in place of the single-video `/process` call.

```sh
curl -fsS "$RR_API/annotation-batches" \
  -H "Authorization: Bearer $ROBOROUTER_TOKEN" \
  -H "Idempotency-Key: $RR_BATCH_REQUEST_UUID" \
  -H 'Content-Type: application/json' \
  --data-binary @annotation-batch.json
```

Set `RR_BATCH_REQUEST_UUID` to a new UUID and save it alongside the input JSON. The request body is `{"items":[{"job_id":"<first-original-job-UUID>"},{"job_id":"<second-original-job-UUID>"}]}`. HTTP 202 returns a `batch_id` and an admission decision for each item. Reuse the original request UUID and body after an ambiguous response. Use a new request UUID to submit previously unaccepted items.

Poll an accepted item's `status_url` with the same token and follow `poll_after_seconds`, or get the batch summary at `GET /annotation-batches/{batch_id}`. Accepted jobs can report `queued` or `waiting_for_gpu` until resources are available. Retrieve result and Pose pages through the original single-video endpoints. A completed item frees an account slot. Add more with `POST /annotation-batches/{batch_id}/items`, using a new request UUID. Credits settle per video at the same rates as single-video submission. `POST /annotation-batches/{batch_id}/cancel` closes the batch and cancels unstarted items. See the [Batch walkthrough](https://datumwell.io/en/docs?topic=annotations#annotation-batch) for the complete flow.

### Read standalone 3D Hand Pose results

For a completed standalone job or batch item, read `GET /hand-pose/jobs/{id}/result?offset=0` and follow `next_offset` until null. Check the result `version` before interpreting the frames.

- `datumwell-hand-pose-v3` returns one row per displayed source frame. Use `frame_id` and `timestamp` (seconds from the first displayed frame) to align keypoints with the original video, including variable-frame-rate recordings. If a frame has no available hand keypoints, `hands` is empty.
- A track ID is local to one video. On v3 receipts, `pose3d.frames` counts source frames and `pose3d.hands` sums the hands across all returned frames. For older results, use the frame IDs and timestamps included on each page.

## 4. Resume safely and report the result

- A `200` or `201` may contain a failed job. Check `status` and `error_code` in the body. During rollout, a `202` without `processing_mode: automatic` still requires subsequent `POST /process` calls with the original job UUID. Use the original job lookup for synchronous requests and to reconcile interruptions. Stop on terminal status or `uncertain`, and report uncertainty with the original identifier for follow-up.
- If an inference POST response is lost, replay the saved JSON with the same `request_key` to recover the receipt.
- If an Annotation upload or processing response is lost, check the original job status. If it still needs that step, retry using the original job UUID and the same input for that step. Changed input with the same identifier can return `409`. Generate a new UUID only for a new authorized job.
- For `401`, check the token. For `403`, check its permissions and profile access. For `402`, ask the user to add credits. For `413`, `415` or `422`, inspect file limits, content type, and `error.issues` when present. For `429`, back off and preserve the original inference `request_key` or Annotation job UUID. On `503` or a network timeout, check the original job before retrying.
- Return the result or job identifier and actual charge when available. Read prediction `charged_microusd` or annotation `billing.charged_microusd`. A pending job may show a credit hold. Status and result GETs incur no usage charge.

## Capacity and high-volume access

By default, each user can submit up to 10 jobs concurrently. This limit applies across all API tokens on your account for model inference, Annotation and standalone 3D Hand Pose. Individual submissions use immediate capacity admission. Each accepted video in a batch uses one account slot, even while waiting for service capacity. `429 account_concurrency_exceeded`, `503 service_capacity_exceeded` and `503 capacity_busy` reject that attempt before it starts processing, calls an upstream service, or places a new credit hold. Respect `Retry-After` (currently 5 seconds) with jitter and a bounded retry count. Keep the same inference `request_key` and payload or the original Annotation or standalone 3D Hand Pose job UUID. Other errors/timeouts may be ambiguous: look up the original request first. Reading results and listing models do not consume execution slots. For higher concurrency or faster processing, [contact the team](https://datumwell.io/en/docs#contact-api).
