# API reference: motion

Learning a motion from a video. A clip of one person becomes a preview of the robot doing the move. After a person confirms, it becomes a trained policy checked in MuJoCo.

## GET /v1/motion-jobs

`listMotionJobs` · scope `key:read` · List motion jobs

The motion jobs of the accounts the caller acts for: their own and those of the organizations they belong to. Newest first.

Parameters:

- `robot` (query): Only jobs for this robot, as `owner/slug`.
- `status` (query): Only jobs in this state.
- `limit` (query): Page size.
- `cursor` (query): Opaque cursor from the previous page's `next_cursor`.

Responses:

- `200`: A page of motion jobs.
- `401`: Missing or invalid credentials.
- `422`: Request failed validation.
- `503`: A service this endpoint needs is not configured in this deployment. The API boots with zero secrets. An endpoint that needs one says so instead of returning a stack trace.

## POST /v1/motion-jobs

`createMotionJob` · scope `key:write` · Start learning a motion from a video

A motion job turns a clip of one person into a motion a robot can learn. The hub recovers the person's motion in 3D, retargets it onto `robot`, and renders a preview. Nothing trains until a person confirms with `trainMotionJob`.

**The clip.** `source.kind: upload` answers with `upload`, a presigned PUT for the file. Send the bytes, then call `completeMotionUpload`. This answer is the only one that carries the PUT, and it lives 1 h. A clip not sent in time needs a new job. `source.kind: link` names an https URL that answers with the video's bytes, and the preview is queued at once. A web page that shows a video is not a video file, and the preview fails saying so. `clip.start_s` and `clip.end_s` trim the move to 2 to 15 seconds. One person should be in frame. With several, `person` picks one by size, largest first.

**The robot.** What a robot can express is read from its card's `interface.parts` and `interface.base`, not from its name. Two legs and two arms on a floating base express the whole body. Two legs on a floating base express the legs. One or two arms on a fixed base express the arms. Any other robot is `422`, with the reason in `errors[]`. `robot.cannot_express` and `notes` say what the robot drops, such as the arms of a robot that has none.

**Cost.** The preview is the hub's own cost: recovering and retargeting are not billed. An account may start `MOTION_PREVIEWS_PER_DAY` previews in 24 hours (default 20). Past that the answer is `429` with `Retry-After`. The owner must be one the deployment hosts (`HOSTED_OWNERS`), else `403` with `errors[].type: forbidden.hosted_owner`. A key with `write` may create a job, because nothing here spends the caller's money.

**Where it runs.** `executor: modal` (the default) runs each stage on the hub's Modal app for motion (`MOTION_MODAL_APP_NAME`). The hub dispatches it after the commit. `executor: worker` waits for `lucen motion worker` to claim it.

**Off by default.** Every motion operation is `503` unless the deployment sets `VIDEO_MOTION_ENABLED`. Audited as `motion.create`.

Request body: `application/json`, required.

Responses:

- `201`: Created. Upload the clip with `upload`, or wait for the preview of a link.
- `401`: Missing or invalid credentials.
- `403`: Authenticated but not allowed (visibility, membership or scope).
- `404`: Resource not found (or hidden from the caller).
- `409`: State conflict (duplicate handle/slug, wrong repo kind, terminal job, ...).
- `422`: Request failed validation.
- `429`: The account started its day's previews. `Retry-After` counts the seconds until the oldest of them leaves the 24-hour window.
- `503`: A service this endpoint needs is not configured in this deployment. The API boots with zero secrets. An endpoint that needs one says so instead of returning a stack trace.

## GET /v1/motion-jobs/{motion_job_id}

`getMotionJob` · scope `key:read` · Read a motion job

The job as it stands: its stage, the preview and its notes, the training plan with its price, and every training with its checks. Presigned URLs in the answer live 1 h, and all of them are downloads: `upload` is always `null` here. A job of an account the caller does not act for is `404`.

Parameters:

- `motion_job_id` (path, required): Motion job id (`motion_...`).

Responses:

- `200`: The motion job.
- `401`: Missing or invalid credentials.
- `404`: Resource not found (or hidden from the caller).
- `503`: A service this endpoint needs is not configured in this deployment. The API boots with zero secrets. An endpoint that needs one says so instead of returning a stack trace.

## POST /v1/motion-jobs/{motion_job_id}/uploaded

`completeMotionUpload` · scope `key:write` · Say the clip is uploaded and queue the preview

Call this after the PUT to `upload.url`. The hub checks that the object is there and no larger than `upload.max_bytes`. The job then becomes `queued` and the preview is dispatched. Only a job in `awaiting_upload` may complete (`409` otherwise). An object that is missing or too large is `422`.

Parameters:

- `motion_job_id` (path, required): Motion job id (`motion_...`).

Responses:

- `202`: The preview is queued.
- `401`: Missing or invalid credentials.
- `403`: Authenticated but not allowed (visibility, membership or scope).
- `404`: Resource not found (or hidden from the caller).
- `409`: State conflict (duplicate handle/slug, wrong repo kind, terminal job, ...).
- `422`: Request failed validation.
- `503`: A service this endpoint needs is not configured in this deployment. The API boots with zero secrets. An endpoint that needs one says so instead of returning a stack trace.

## POST /v1/motion-jobs/{motion_job_id}/retime

`retimeMotionJob` · scope `key:write` · Slow the motion down and remake the robot's preview

Plays the motion at `speed` times the clip's own pace and remakes the robot half of the preview. The recovered human motion is kept, so this stage runs on a CPU and is not billed. `speed: 1` undoes a slowdown. `suggested_speed` on the job is the fastest pace the robot card's joint speed limits allow. Allowed in `ready`, `done` and `failed` once a preview exists (`409` otherwise). A job whose training waits for a person to approve it is `409` until that hold is decided. The job returns to `queued` with stage `retime`. Audited as `motion.retime`.

Parameters:

- `motion_job_id` (path, required): Motion job id (`motion_...`).

Request body: `application/json`, required.

Responses:

- `202`: The robot preview is being remade.
- `401`: Missing or invalid credentials.
- `403`: Authenticated but not allowed (visibility, membership or scope).
- `404`: Resource not found (or hidden from the caller).
- `409`: State conflict (duplicate handle/slug, wrong repo kind, terminal job, ...).
- `422`: Request failed validation.
- `503`: A service this endpoint needs is not configured in this deployment. The API boots with zero secrets. An endpoint that needs one says so instead of returning a stack trace.

## POST /v1/motion-jobs/{motion_job_id}/train

`trainMotionJob` · scope `key:write` · Train the robot to do the previewed motion, then check it

Trains a policy that tracks the previewed motion at the job's `speed`, then checks it in MuJoCo. Allowed in `ready`, and in `done` or `failed` to try again (`409` otherwise). A job whose notes carry a `blocking` note is `409` naming it. So is a job whose last slowdown failed, until a preview at its `speed` is in. A deployment that has not switched training on (`MOTION_TRAINING_ENABLED`) answers `503`, and its plans say so in `why_not`.

**Who starts it.** A signed-in person starts training now. So does a key with `train` that is not marked as an AI agent's. The answer is `201`, with the job `training` and the run in `trainings[0]`. Any other key files a spend hold for a person, and the answer is `202` with the hold (`SpendHeld`). A person approves it from the Inbox, and training starts then. The hub's own agent starts it only after the person approves the step in the session.

**The run.** Training is a run (`motion_tracking_isaac` or `motion_tracking_mjlab`), with the run's logs, cost, budget and cancel. The spend cap and the hosted allowance apply as they do for `createRun`. The job's `plan` says where it trains. NVIDIA's licence lets the hub host Isaac Lab only for its own robots (`ISAAC_OPERATOR_OWNERS`), so those train in Isaac Lab when the robot repo has a URDF. Everyone else trains in mjlab. Such a result is marked as trained and checked in one simulator family.

**Arms on a fixed base** train nothing (`plan.method: servo_playback`). Their position servos play the motion in MuJoCo, and the check runs at once. That check is not billed, so any key that may write starts it.

**A priced dry run.** `dry_run: true` records nothing and answers `200` with the plan for exactly these `iterations`, `max_minutes` and `budget_usd`. Its `cost_usd_max` is what the run would reserve, capped by the budget. Any key that may write may ask.

**The check.** When the run succeeds, the hub queues the policy's check in MuJoCo. The job is `verifying`, then `done` with `trainings[0].checks` and `trainings[0].gate`. A run that fails or is canceled leaves the job `failed` with the run's reason. Audited as `motion.train`.

Parameters:

- `motion_job_id` (path, required): Motion job id (`motion_...`).

Request body: `application/json`.

Responses:

- `200`: A dry run; the plan for these arguments, nothing recorded.
- `201`: Training started (or the servo check queued).
- `202`: Held for a person's confirmation. The key is marked as an AI agent's, and the work would spend beyond the free hosted allowance. Nothing started, and nothing is reserved yet. A person approves or denies the hold from the Inbox. Poll `getSpendHold` with the hold's id.
- `401`: Missing or invalid credentials.
- `403`: Authenticated but not allowed (visibility, membership or scope).
- `404`: Resource not found (or hidden from the caller).
- `409`: State conflict (duplicate handle/slug, wrong repo kind, terminal job, ...).
- `422`: Request failed validation.
- `429`: The account's spend cap is in `stop` mode, and this job would carry the month past it. The month counts recorded Lucen cloud spend, what queued and running cloud work could still cost, and this job's own most possible cost. `errors[].type` is `quota.spend_cap`. `Retry-After` counts the seconds until the month ends. Nothing was recorded, and work already running keeps running.
- `503`: A service this endpoint needs is not configured in this deployment. The API boots with zero secrets. An endpoint that needs one says so instead of returning a stack trace.

## POST /v1/motion-jobs/{motion_job_id}/cancel

`cancelMotionJob` · scope `key:write` · Cancel a motion job

Stops the job. A queued or running stage ends now, and its Modal call is terminated. A job that is training cancels its run, which is billed to the second as `cancelRun` bills it. Canceling only lowers spend, so a key that may write may cancel. A job that is `done`, `failed` or `canceled` is `409`. Audited as `motion.cancel`.

Parameters:

- `motion_job_id` (path, required): Motion job id (`motion_...`).

Responses:

- `200`: Canceled; the job as it now stands.
- `401`: Missing or invalid credentials.
- `403`: Authenticated but not allowed (visibility, membership or scope).
- `404`: Resource not found (or hidden from the caller).
- `409`: State conflict (duplicate handle/slug, wrong repo kind, terminal job, ...).
- `502`: Modal refused to terminate the stage's call; nothing changed.
- `503`: A service this endpoint needs is not configured in this deployment. The API boots with zero secrets. An endpoint that needs one says so instead of returning a stack trace.

## POST /v1/motion-jobs/{motion_job_id}/claim

`claimMotionJob` · scope `key:train` · Claim a motion job's queued stage (motion worker protocol)

Compare-and-set of the queued stage to running, like `claimRollout`. One caller wins, and everyone else gets `409` naming the holder. The answer carries the stage and its inputs as presigned GET URLs. A `preview` gets the clip or its link. A `retime` gets the recovered human motion. A `verify` gets the robot motion and the run whose policy it checks. `presignMotionArtifacts` and `reportMotionJob` are `409` from any other credential. A Modal stage claims with a key minted for that one job. `key:train`: a worker spends compute on the owner's behalf.

Parameters:

- `motion_job_id` (path, required): Motion job id (`motion_...`).

Request body: `application/json`, required.

Responses:

- `200`: Claimed; the stage and its inputs.
- `401`: Missing or invalid credentials.
- `403`: Authenticated but not allowed (visibility, membership or scope).
- `404`: Resource not found (or hidden from the caller).
- `409`: State conflict (duplicate handle/slug, wrong repo kind, terminal job, ...).
- `422`: Request failed validation.
- `503`: A service this endpoint needs is not configured in this deployment. The API boots with zero secrets. An endpoint that needs one says so instead of returning a stack trace.

## POST /v1/motion-jobs/{motion_job_id}/artifacts

`presignMotionArtifacts` · scope `key:train` · Presign uploads for a running stage's artifacts

Presigned PUT URLs under `motion/{motion_job_id}/`, one object per artifact. Names are relative paths such as `preview/robot.mp4`. Only the credential that claimed the running stage may presign (`409` otherwise). URLs live 1 h. The declared sizes count toward the owner's storage quota, and a request over it is `413`.

**Each URL signs its declared `size`.** Object storage refuses a body of any other size. The hub keeps the declared size, and `reportMotionJob` checks every reported object against it.

Parameters:

- `motion_job_id` (path, required): Motion job id (`motion_...`).

Request body: `application/json`, required.

Responses:

- `200`: One presigned PUT per requested artifact.
- `401`: Missing or invalid credentials.
- `403`: Authenticated but not allowed (visibility, membership or scope).
- `404`: Resource not found (or hidden from the caller).
- `409`: State conflict (duplicate handle/slug, wrong repo kind, terminal job, ...).
- `413`: The owner's storage quota would be exceeded.
- `422`: Request failed validation.
- `503`: A service this endpoint needs is not configured in this deployment. The API boots with zero secrets. An endpoint that needs one says so instead of returning a stack trace.

## POST /v1/motion-jobs/{motion_job_id}/report

`reportMotionJob` · scope `key:train` · Report progress or the result of a claimed stage

The worker's one write path after `claimMotionJob`. `status` may move only `running → succeeded | failed`. A succeeded `preview` or `retime` carries `observed`, `retarget` and its artifact keys. A succeeded `verify` carries `verification` and its videos.

**The hub writes the words and the verdict.** The worker sends measurements only. The hub turns them into `notes` against the robot card, and into `checks` and `gate` against the pass rule. An artifact key outside this job's prefix, or one with no object, is `422`. So is a key `presignMotionArtifacts` never signed. An object whose size is not the size it was signed for is deleted, and the report is `422` naming it. The stage keeps running, so the worker may upload it again. A failed stage leaves the job `failed` with `error` and `error_stage`.

Parameters:

- `motion_job_id` (path, required): Motion job id (`motion_...`).

Request body: `application/json`, required.

Responses:

- `200`: Recorded; the job as it now stands.
- `401`: Missing or invalid credentials.
- `403`: Authenticated but not allowed (visibility, membership or scope).
- `404`: Resource not found (or hidden from the caller).
- `409`: State conflict (duplicate handle/slug, wrong repo kind, terminal job, ...).
- `413`: A log chunk or the report body is over its size limit.
- `422`: Request failed validation.
- `503`: A service this endpoint needs is not configured in this deployment. The API boots with zero secrets. An endpoint that needs one says so instead of returning a stack trace.
