> ## Documentation Index
> Fetch the complete documentation index at: https://docs.viggle.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Quick Start: Motion

> Create a reusable Motion from a driving video.

Create a reusable **Motion** from a driving video once, then reference its ID from any number of [Video Remix](/v1/guides/quickstart-mix) renders without re-uploading the video. This is the `type=render` path of `POST /v1/motions` — see the [Motion 3D Quickstart](/v1/guides/quickstart-mocap) for the `glb` extraction instead, or the [Text-to-Motion Quickstart](/v1/guides/quickstart-text-to-motion) to generate a Motion from a text prompt with no source video at all.

Set `VIGGLE_API_KEY` and run the example below as-is — it uses a Viggle-hosted sample video, so you don't need to prepare your own motion video first.

## What you need

* An API key from the [Viggle Dashboard](https://portal.viggle.ai/keys), exported as `VIGGLE_API_KEY`

<Note>
  The examples below reference a placeholder sample asset URL (`https://assets.viggle.ai/samples/motion.mp4`). Swap in your own `motion_video`/`motion_video_url`, or Viggle's published sample asset once available.
</Note>

## Complete example

<CodeGroup>
  ```bash cURL theme={null}
  #!/usr/bin/env bash
  set -euo pipefail

  response=$(curl -s -X POST "https://apis.viggle.ai/v1/motions" \
    -H "Authorization: Bearer $VIGGLE_API_KEY" \
    -F "motion_video_url=https://assets.viggle.ai/samples/motion.mp4" \
    -F "name=Quickstart motion")
  motion_id=$(echo "$response" | jq -r '.id')

  for _ in $(seq 1 60); do
    motion=$(curl -s "https://apis.viggle.ai/v1/motions/$motion_id" \
      -H "Authorization: Bearer $VIGGLE_API_KEY")
    status=$(echo "$motion" | jq -r '.status')

    case "$status" in
      ready)
        echo "$motion_id"
        exit 0
        ;;
      failed)
        echo "Motion failed: $(echo "$motion" | jq -c '.error')" >&2
        exit 1
        ;;
    esac
    sleep 3
  done

  echo "Timed out waiting for motion $motion_id" >&2
  exit 1
  ```

  ```javascript Node theme={null}
  const baseUrl = "https://apis.viggle.ai/v1";
  const headers = { Authorization: `Bearer ${process.env.VIGGLE_API_KEY}` };

  async function createMotion() {
    const form = new FormData();
    form.append("motion_video_url", "https://assets.viggle.ai/samples/motion.mp4");
    form.append("name", "Quickstart motion");

    const response = await fetch(`${baseUrl}/motions`, {
      method: "POST",
      headers,
      body: form,
    });
    if (!response.ok) {
      const body = await response.json().catch(() => ({}));
      throw new Error(`HTTP ${response.status}: ${JSON.stringify(body.error ?? body)}`);
    }
    return response.json();
  }

  async function waitForMotion(id) {
    for (let attempt = 0; attempt < 60; attempt++) {
      const response = await fetch(`${baseUrl}/motions/${id}`, { headers });
      if (!response.ok) {
        const body = await response.json().catch(() => ({}));
        throw new Error(`HTTP ${response.status}: ${JSON.stringify(body.error ?? body)}`);
      }
      const motion = await response.json();
      if (["ready", "failed"].includes(motion.status)) return motion;
      await new Promise((resolve) => setTimeout(resolve, 3000));
    }
    throw new Error(`Timed out waiting for motion ${id}`);
  }

  const created = await createMotion();
  const motion = await waitForMotion(created.id);

  if (motion.status !== "ready") {
    throw new Error(`Motion failed: ${JSON.stringify(motion.error)}`);
  }
  console.log(motion.id);
  ```

  ```python Python theme={null}
  import os
  import time
  import requests

  base_url = "https://apis.viggle.ai/v1"
  headers = {"Authorization": f"Bearer {os.environ['VIGGLE_API_KEY']}"}

  response = requests.post(
      f"{base_url}/motions",
      headers=headers,
      files={"motion_video_url": (None, "https://assets.viggle.ai/samples/motion.mp4")},
      data={"name": "Quickstart motion"},
  )
  response.raise_for_status()
  motion = response.json()

  for _ in range(60):
      if motion["status"] in {"ready", "failed"}:
          break
      time.sleep(3)
      response = requests.get(f"{base_url}/motions/{motion['id']}", headers=headers)
      response.raise_for_status()
      motion = response.json()
  else:
      raise TimeoutError(f"Timed out waiting for motion {motion['id']}")

  if motion["status"] != "ready":
      error = motion.get("error") or {}
      raise RuntimeError(f"failed: {error.get('code')} {error.get('message')}")

  print(motion["id"])
  ```
</CodeGroup>

## Response

```json theme={null}
{
  "id": "mot_550e8400-e29b-41d4-a716-446655440000",
  "status": "queued",
  "name": "Quickstart motion",
  "progress": 0,
  "capabilities": [],
  "created_at": "2026-07-21T10:00:00+00:00",
  "completed_at": null,
  "error": null,
  "type": "render",
  "vsplat": null,
  "glb": null
}
```

Poll `GET /v1/motions/{motion_id}` every 3 seconds until `status` is `ready` or `failed`. Once ready, `id` is a **reusable Motion ID** — pass it as `motion_id` to [Render Video](/v1/api-reference/renders/create) (or the [Video Remix Quickstart](/v1/guides/quickstart-mix)) any number of times, without re-uploading the source video.

See [Pricing and retention](/v1/pricing#motion) for how Motion creation is billed — a `type=render` Motion has no separate preprocessing charge.

<Card title="Create Motion (from Video)" icon="film" href="/v1/api-reference/motions/create">
  See every request and response field, including the `glb`/`all` extraction options.
</Card>
