> **API v1 is deprecated and stops working on March 15, 2027.** For new integrations, use API v2.
>
> - This page on v2: https://docs.meshy.ai/api/v2/video-to-motion.md
> - Migrate to API v2: https://docs.meshy.ai/api/migrate-to-v2

> **Reading as an AI agent?** This is the Markdown version of https://docs.meshy.ai/api/video-to-motion.
>
> - Full docs index: https://docs.meshy.ai/api/v1/llms.txt
> - Single-fetch full content: https://docs.meshy.ai/api/v1/llms-full.txt
> - Tool-calling access via MCP server: https://docs.meshy.ai/api/ai
> - Command-line access via the Meshy CLI: https://docs.meshy.ai/api/cli

---
# Video to Motion API

Turn a video of a person moving into a motion clip. Send the video, and get a GLB clip of the same movement, as long as the video.

The output is a standalone motion clip. It doesn't need a character model, and it isn't attached to one. To rig a character first, see the [Rigging API](/api/rigging). To apply a clip to your rigged character, send the task `id` as `motion_task_id` to the [Animation API](/api/animation#create-an-animation-task).

---

## POST /openapi/v1/video-to-motion -- Create a Video to Motion task

Creates a Video to Motion task, which reads the motion of the person in a video into a motion clip.

Meshy downloads and checks the video while it handles your request, so a video it can't use returns `400` before Meshy creates a task. The task then runs in the background, as described in [Task lifecycle](/api/task-lifecycle#how-a-task-runs).

The video must meet all of these requirements:
* **File**: an MP4, MOV, or AVI file of at most 200 MB (200,000,000 bytes)
* **Video codec**: H.264, HEVC, MPEG-4, or Motion JPEG
* **Length**: 2 to 60 seconds
* **Frame rate**: 24 to 120 frames per second
* **Resolution**: each side 300 to 4,096 pixels

For the best clip, film one person whose whole body stays in the frame.

A task costs 5 credits for each second of video, rounded to the nearest credit. For example, a 2.5-second video costs 13 credits. Meshy charges the credits when it creates the task, and refunds them if the task fails. See [Pricing](/api/pricing).

When the task succeeds or fails, Meshy deletes your video. The motion clip stays with the task, like other task files. See [Asset retention](/api/asset-retention).

### Parameters

  - `video_url` · *string* · **required**

  The video, as a public `http` or `https` URL or a base64 data URI, such as `data:video/mp4;base64,...`. A data URI's media type must be `video/*` or `application/octet-stream`. Either way, the file can be at most 200 MB. A video that Meshy can't download, or that's outside the preceding requirements, returns `400`.

### Returns

`202 Accepted`. The `result` field of the response holds the ID of the new Video to Motion task.

### Failure modes

  - `400 - Bad Request`

  The request can't run. The error message says which problem it found. For example:
  * **Missing video**: `video_url` is missing or empty. The message is `video_url is required`.
  * **Download failed**: Meshy couldn't download `video_url`. The message is `Could not download video_url`. Make the URL publicly readable, or send the file as a data URI.
  * **Invalid data URI**: `video_url` isn't a valid base64 data URI, or its media type isn't `video/*` or `application/octet-stream`.
  * **Unsupported file**: The file isn't an MP4, MOV, or AVI file, or Meshy can't read its video. For example, the message is `Unsupported video; send an MP4, MOV or AVI file`.
  * **File too large**: The file is larger than 200 MB. The message is `The video is too large; a video is at most 200 MB`.
  * **Video outside the limits**: The video's codec, length, frame rate, or resolution is outside the requirements. The message names the limit, for example `The video runs 1.5 s; it must run 2 to 60 s`.

  Fix the request, then send it again. See [Errors](/api/errors#request-errors).

  - `401 - Unauthorized`

  The API key is missing or invalid. Check the `Authorization` header.

  - `402 - Payment Required`

  For example:
  * **Insufficient credits**: The account doesn't have enough credits for this video, or the account reached a credit limit. Check your credit balance, then retry.
  * **Free plan**: Creating a task requires a paid plan. Upgrade your plan in your [subscription settings](https://www.meshy.ai/settings/subscription), then retry.

  - `403 - Forbidden`

  Content moderation blocked the video. The message is `explicit content`. Send a different video.

  - `429 - Too Many Requests`

  For example:
  * **Video processing is busy**: Meshy is checking too many videos. The message is `Video processing is busy; try again shortly`. Wait a few seconds, then retry.
  * **Rate limit**: You exceeded your rate limit, or you have too many pending tasks. Wait, then retry. See [Rate limits](/api/rate-limits).

Meshy charges nothing for a request that returns an error. A task that Meshy created can still fail. For the reasons, see `task_error` in the [Video to Motion task object](#the-video-to-motion-task-object).

**cURL**

```bash
# Read the motion from a video at a public URL
curl https://api.meshy.ai/openapi/v1/video-to-motion \
  -X POST \
  -H "Authorization: Bearer ${YOUR_API_KEY}" \
  -H 'Content-Type: application/json' \
  -d '{
    "video_url": "https://example.com/videos/dance.mp4"
  }'

# Send a local MP4 file as a data URI
{ printf '{"video_url": "data:video/mp4;base64,'; base64 < dance.mp4 | tr -d '\n'; printf '"}'; } |
  curl https://api.meshy.ai/openapi/v1/video-to-motion \
    -X POST \
    -H "Authorization: Bearer ${YOUR_API_KEY}" \
    -H 'Content-Type: application/json' \
    --data-binary @-
```

```javascript
import axios from 'axios'
import { readFile } from 'node:fs/promises'

const headers = { Authorization: `Bearer ${YOUR_API_KEY}` };

// Read the motion from a video at a public URL
const payload = {
  video_url: "https://example.com/videos/dance.mp4"
};

try {
  const response = await axios.post(
    'https://api.meshy.ai/openapi/v1/video-to-motion',
    payload,
    { headers }
  );
  console.log(response.data);
} catch (error) {
  console.error(error);
}

// Send a local MP4 file as a data URI
const video = await readFile("dance.mp4");
const filePayload = {
  video_url: `data:video/mp4;base64,${video.toString("base64")}`
};

try {
  const response = await axios.post(
    'https://api.meshy.ai/openapi/v1/video-to-motion',
    filePayload,
    { headers }
  );
  console.log(response.data);
} catch (error) {
  console.error(error);
}
```

```python
import base64
import requests

headers = {
    "Authorization": f"Bearer {YOUR_API_KEY}"
}

# Read the motion from a video at a public URL
payload = {
    "video_url": "https://example.com/videos/dance.mp4"
}

response = requests.post(
    "https://api.meshy.ai/openapi/v1/video-to-motion",
    headers=headers,
    json=payload,
)
response.raise_for_status()
print(response.json())

# Send a local MP4 file as a data URI
with open("dance.mp4", "rb") as f:
    video = base64.b64encode(f.read()).decode()

file_payload = {
    "video_url": f"data:video/mp4;base64,{video}"
}

response = requests.post(
    "https://api.meshy.ai/openapi/v1/video-to-motion",
    headers=headers,
    json=file_payload,
)
response.raise_for_status()
print(response.json())
```

**Response**

```json
{
  "result": "019ad6a1-4c2e-7f38-b5d0-8e3f1a6c9b24"
}
```

---

## GET /openapi/v1/video-to-motion/:id -- Get a Video to Motion task

Returns a Video to Motion task by its ID.

### Parameters

  - `id` · *path*

  The task ID from the create response.

### Returns
The [Video to Motion task object](#the-video-to-motion-task-object).

**cURL**

```bash
curl https://api.meshy.ai/openapi/v1/video-to-motion/019ad6a1-4c2e-7f38-b5d0-8e3f1a6c9b24 \
  -H "Authorization: Bearer ${YOUR_API_KEY}"
```

```javascript
import axios from 'axios'

const taskId = '019ad6a1-4c2e-7f38-b5d0-8e3f1a6c9b24';
const headers = { Authorization: `Bearer ${YOUR_API_KEY}` };

try {
  const response = await axios.get(
    `https://api.meshy.ai/openapi/v1/video-to-motion/${taskId}`,
    { headers }
  );
  console.log(response.data);
} catch (error) {
  console.error(error);
}
```

```python
import requests

task_id = "019ad6a1-4c2e-7f38-b5d0-8e3f1a6c9b24"
headers = {
    "Authorization": f"Bearer {YOUR_API_KEY}"
}

response = requests.get(
    f"https://api.meshy.ai/openapi/v1/video-to-motion/{task_id}",
    headers=headers,
)
response.raise_for_status()
print(response.json())
```

**Response**

```json
{
  "id": "019ad6a1-4c2e-7f38-b5d0-8e3f1a6c9b24",
  "type": "video-to-motion",
  "name": "",
  "status": "SUCCEEDED",
  "progress": 100,
  "created_at": 1796083214512,
  "started_at": 1796083216813,
  "finished_at": 1796083288293,
  "expires_at": 1796342488293,
  "task_error": null,
  "result": {
    "motion_url": "https://assets.meshy.ai/0630d47c-84b8-4d37-bc02-69e45d9272c1/tasks/019ad6a1-4c2e-7f38-b5d0-8e3f1a6c9b24/output/clip.glb?Expires=...",
    "motion_format": "glb",
    "duration_ms": 4200
  },
  "consumed_credits": 21
}
```

---

## GET /openapi/v1/video-to-motion -- List Video to Motion tasks

Returns a list of your Video to Motion tasks, newest first unless you set `sort_by`.

Tasks you create with the API stay in the API and don't appear in **My Assets** in the web app. To find a task whose ID you no longer have, use this endpoint.

### Parameters

  - `page_num` · *integer* · default: `1`

  The page number to return, starting at `1`.

  - `page_size` · *integer* · default: `10`

  The number of tasks per page, up to `100`.

  - `sort_by` · *string*

  The sort order.

  Available values:
  * `+created_at`: oldest first
  * `-created_at`: newest first

### Returns

A list of [Video to Motion task objects](#the-video-to-motion-task-object). An empty page is an empty array.

**cURL**

```bash
curl https://api.meshy.ai/openapi/v1/video-to-motion?page_size=10 \
  -H "Authorization: Bearer ${YOUR_API_KEY}"
```

```javascript
import axios from 'axios'

const headers = { Authorization: `Bearer ${YOUR_API_KEY}` };

try {
  const response = await axios.get(
    `https://api.meshy.ai/openapi/v1/video-to-motion?page_size=10`,
    { headers }
  );
  console.log(response.data);
} catch (error) {
  console.error(error);
}
```

```python
import requests

headers = {
    "Authorization": f"Bearer {YOUR_API_KEY}"
}

response = requests.get(
    "https://api.meshy.ai/openapi/v1/video-to-motion",
    headers=headers,
    params={"page_size": 10}
)
response.raise_for_status()
print(response.json())
```

**Response**

```json
[
  {
    "id": "019ad6a1-4c2e-7f38-b5d0-8e3f1a6c9b24",
    "type": "video-to-motion",
    "name": "",
    "status": "SUCCEEDED",
    "progress": 100,
    "created_at": 1796083214512,
    "started_at": 1796083216813,
    "finished_at": 1796083288293,
    "expires_at": 1796342488293,
    "task_error": null,
    "result": {
      "motion_url": "https://assets.meshy.ai/.../output/clip.glb?Expires=...",
      "motion_format": "glb",
      "duration_ms": 4200
    },
    "consumed_credits": 21
  }
]
```

---

## GET /openapi/v1/video-to-motion/:id/stream -- Stream a Video to Motion task

Streams a Video to Motion task's updates as Server-Sent Events (SSE).

### Parameters

  - `id` · *path*

  The task ID from the create response.

### Returns

A stream of [Video to Motion task objects](#the-video-to-motion-task-object) as Server-Sent Events.

Every `message` event carries the full task object. While the task is `PENDING` or `IN_PROGRESS`, the `result` fields are empty (`""` or `0`), and `finished_at` and `expires_at` are `0`. To follow the task, watch `status` and `progress`.

  **cURL**

  ```bash
  curl -N https://api.meshy.ai/openapi/v1/video-to-motion/019ad6a1-4c2e-7f38-b5d0-8e3f1a6c9b24/stream \
  -H "Authorization: Bearer ${YOUR_API_KEY}"
  ```

  ```javascript
  const response = await fetch(
    'https://api.meshy.ai/openapi/v1/video-to-motion/019ad6a1-4c2e-7f38-b5d0-8e3f1a6c9b24/stream',
    {
      headers: { Authorization: `Bearer ${YOUR_API_KEY}` }
    }
  );

  const reader = response.body.getReader();
  const decoder = new TextDecoder();
  let buffer = '';
  let event = 'message';

  while (true) {
    const { done, value } = await reader.read();
    if (done) break;

    buffer += decoder.decode(value, { stream: true });
    const lines = buffer.split('\n');
    buffer = lines.pop();

    for (const line of lines) {
      if (line.startsWith('event:')) {
        event = line.slice(6).trim();
      } else if (line.startsWith('data:')) {
        const data = JSON.parse(line.slice(5));
        console.log(event, data);

        if (event === 'error') {
          reader.cancel(); // {"status_code": ..., "message": ...}
        } else if (['SUCCEEDED', 'FAILED', 'CANCELED'].includes(data.status)) {
          reader.cancel();
        }
      }
    }
  }
  ```

  ```python
  import requests
  import json

  headers = {
      "Authorization": f"Bearer {YOUR_API_KEY}",
      "Accept": "text/event-stream"
  }
  task_id = "019ad6a1-4c2e-7f38-b5d0-8e3f1a6c9b24"

  response = requests.get(
      f'https://api.meshy.ai/openapi/v1/video-to-motion/{task_id}/stream',
      headers=headers,
      stream=True
  )

  event = 'message'
  for line in response.iter_lines():
      if not line:
          continue
      if line.startswith(b'event:'):
          event = line.decode('utf-8')[6:].strip()
      elif line.startswith(b'data:'):
          data = json.loads(line.decode('utf-8')[5:])
          print(event, data)

          if event == 'error':
              break  # {"status_code": ..., "message": ...}
          if data['status'] in ['SUCCEEDED', 'FAILED', 'CANCELED']:
              break

  response.close()
  ```

  **Response Stream**

  ```javascript
  // Error event example
  event: error
  data: {
    "status_code": 404,
    "message": "Task not found"
  }

  // Message events carry the full task object at every stage; the result
  // fields stay empty until the task succeeds.
  event: message
  data: {
    "id": "019ad6a1-4c2e-7f38-b5d0-8e3f1a6c9b24",
    "type": "video-to-motion",
    "name": "",
    "status": "IN_PROGRESS",
    "progress": 50,
    "created_at": 1796083214512,
    "started_at": 1796083216813,
    "finished_at": 0,
    "expires_at": 0,
    "task_error": null,
    "result": {
      "motion_url": "",
      "motion_format": "",
      "duration_ms": 0
    },
    "consumed_credits": 21
  }

  event: message
  data: { // Example of a SUCCEEDED task event, with the same fields as the Video to Motion task object
    "id": "019ad6a1-4c2e-7f38-b5d0-8e3f1a6c9b24",
    "type": "video-to-motion",
    "name": "",
    "status": "SUCCEEDED",
    "progress": 100,
    "created_at": 1796083214512,
    "started_at": 1796083216813,
    "finished_at": 1796083288293,
    "expires_at": 1796342488293,
    "task_error": null,
    "result": {
      "motion_url": "https://assets.meshy.ai/.../output/clip.glb?Expires=...",
      "motion_format": "glb",
      "duration_ms": 4200
    },
    "consumed_credits": 21
  }
```

---

## DELETE /openapi/v1/video-to-motion/:id -- Delete a Video to Motion task

Permanently deletes a Video to Motion task, including its motion clip. You can't undo a delete.

### Path parameters

  - `id` · *path*

  The ID of the task to delete.

### Task status
Deleting a `PENDING` task refunds the credits it used when you created it.

An `IN_PROGRESS` task can't be deleted. The request returns `409 Conflict`,
and the task keeps running. Meshy doesn't refund a task that has started,
so deleting it would cost you both the credits and the result. Wait for it
to reach `SUCCEEDED`, `FAILED`, or `CANCELED`, then delete it.

Deleting a task in a final status (`SUCCEEDED`, `FAILED`, or `CANCELED`)
doesn't refund its credits.

### Returns
`200 OK` when the task is deleted, or `409 Conflict` when the task is
`IN_PROGRESS`.

  **cURL**

  ```bash
  curl --request DELETE \
    --url https://api.meshy.ai/openapi/v1/video-to-motion/019ad6a1-4c2e-7f38-b5d0-8e3f1a6c9b24 \
    -H "Authorization: Bearer ${YOUR_API_KEY}"
  ```

  ```javascript
  import axios from 'axios'

  const taskId = '019ad6a1-4c2e-7f38-b5d0-8e3f1a6c9b24'
  const headers = { Authorization: `Bearer ${YOUR_API_KEY}` }

  try {
    await axios.delete(
      `https://api.meshy.ai/openapi/v1/video-to-motion/${taskId}`,
      { headers }
    )
  } catch (error) {
    console.error(error)
  }
  ```

  ```python
  import requests

  task_id = "019ad6a1-4c2e-7f38-b5d0-8e3f1a6c9b24"
  headers = {
      "Authorization": f"Bearer {YOUR_API_KEY}"
  }

  response = requests.delete(
      f"https://api.meshy.ai/openapi/v1/video-to-motion/{task_id}",
      headers=headers,
  )
  response.raise_for_status()
  ```

**Response**

```json
// 200 OK on success, with an empty body.
//
// 409 Conflict when the task is IN_PROGRESS. The task keeps running:
{
  "message": "Task is IN_PROGRESS and cannot be deleted. Credits for a task the worker has already started are not refundable; wait for it to reach SUCCEEDED, FAILED or CANCELED, then delete it."
}
```

---

## The Video to Motion task object
A Video to Motion task object describes the reading of one video into a motion clip. It holds the status, the progress, and the clip when the task succeeds.

### Properties

  - `id` · *string*

  The task ID. Treat it as an opaque string, and don't rely on its format.

  - `type` · *string*

  The task type, always `video-to-motion`.

  - `name` · *string*

  Always an empty string. A Video to Motion task has no name.

  - `status` · *string*

  The task status, one of `PENDING`, `IN_PROGRESS`, `SUCCEEDED`, `FAILED`, or `CANCELED`.

  - `progress` · *integer*

  How much of the task is done, as a percentage from `0` to `100`.

  - `created_at` · *timestamp*

  Time the task was created, in Unix milliseconds.

  - `started_at` · *timestamp*

  Time the task started, in Unix milliseconds. It's `0` until the task starts.

  - `finished_at` · *timestamp*

  Time the task finished, in Unix milliseconds. It's `0` until the task finishes.

  - `expires_at` · *timestamp*

  Time the task's result files expire, in Unix milliseconds. It's `0` until the task finishes. Meshy keeps the clip for 3 days after the task finishes, so download it before then.

  - `preceding_tasks` · *integer*

  The number of tasks ahead of this one in the queue. The value is meaningful only while the task is `PENDING`. The field is left out when the value is `0`.

  - `consumed_credits` · *integer*

  The number of credits the task used, 5 for each second of video, rounded. It's `0` for a `FAILED` task, because Meshy refunds the credits when a task fails.

  - `task_error` · *object*

  The error details when the task fails, and `null` otherwise. See [Errors](/api/errors#task-errors).

  - `result` · *object*

  The motion clip when the task succeeds. Until then, the fields are present but empty (`""` or `0`).

- `motion_url` · *string*

  Download URL for the motion clip, a GLB file at 30 frames per second. Meshy signs the URL again on every read, and it expires with the task's retention window.

- `motion_format` · *string*

  The clip's file format, always `glb`.

- `duration_ms` · *integer*

  The clip length, in milliseconds. It's the length of the video, as Meshy measured it when you created the task.

  <span id="example-video-to-motion-task-object" />

  **Example Video to Motion Task Object**

  ```json
  {
    "id": "019ad6a1-4c2e-7f38-b5d0-8e3f1a6c9b24",
    "type": "video-to-motion",
    "name": "",
    "status": "SUCCEEDED",
    "progress": 100,
    "created_at": 1796083214512,
    "started_at": 1796083216813,
    "finished_at": 1796083288293,
    "expires_at": 1796342488293,
    "task_error": null,
    "result": {
      "motion_url": "https://assets.meshy.ai/.../output/clip.glb?Expires=...",
      "motion_format": "glb",
      "duration_ms": 4200
    },
    "consumed_credits": 21
  }
  ```
