> **Reading as an AI agent?** This is the Markdown version of https://docs.meshy.ai/api/v2/animation, part of the Meshy API v2 docs.
>
> - v2 docs index: https://docs.meshy.ai/api/v2/llms.txt
> - All v2 pages in one file: https://docs.meshy.ai/api/v2/llms-full.txt
> - OpenAPI spec for v2: https://docs.meshy.ai/api/v2/openapi.yaml

---

# Animation API

Make a rigged character move. Apply one animation from the Meshy library, join several library animations into one file, or play a clip from Text to Motion.

> **Note:** Moving from v1? The main changes for Animation:
>   * The request is the same.
>   * Results are in `output` instead of `result`.
>   * A file that wasn't produced is `null` instead of `""`.
>   * The animation library is at `GET /openapi/v2/animations/library`, and returns the same list.
>
>   See [what changed for the other endpoints](/api/migrate-to-v2/reference#other-endpoints).

---

## POST /openapi/v2/animations -- Create an Animation task

Creates an Animation task and returns the [task object](https://docs.meshy.ai/api/v2/tasks.md#the-task-object). The task runs in the background. To read its result, see [Get the result](#get-the-result). For how long a task usually takes, see [Processing times](/api/task-lifecycle#processing-times).

Meshy charges for each animation in a task, so a task with `action_ids` costs more than one with `action_id` or `motion_task_id`. See [Pricing](/api/pricing).

### Parameters

  - `rig_task_id` · *string* · **required**

  The ID of the [Rigging](https://docs.meshy.ai/api/v2/rigging.md) task whose character to animate. The task must be one of yours and have the status `SUCCEEDED`.

  A Rigging task that hasn't succeeded returns `400` with the code `input_task_not_ready`, and the message gives its status. A task of another type returns `400` with the code `input_task_unsupported`.

Send exactly one of `action_id`, `action_ids`, and `motion_task_id`. Sending more than one returns `400`. Sending none returns `400` with the message `action_id is required`.

  - `action_id` · *integer* · **required**

  Required unless you send `action_ids` or `motion_task_id`. The `action_id` of one library animation to apply. To find IDs, use [List animations](#list-animations) or the [Animation Library](/api/animation-library) page.

  The animation's `rig_type` must match the rig, or the request returns `400`. Any `quadruped` animation works on any quadruped rig, whatever animal its `category` names.

  Meshy names the clip in the file by the animation's `key`, for example `Big_Wave_Hello`, as in a download from the Meshy web app. In a clip name, each character other than a letter, a digit, or `_` becomes `_`. A key that starts with a digit gets a `_` in front, for example `_360_Power_Spin_Jump`.

  A few library animations don't work with some two-legged rigs. They return `400` with the message `This animation is no longer available`.

  - `action_ids` · *integer[]* · **required**

  Required unless you send `action_id` or `motion_task_id`. The `action_id` values of up to 10 library animations to join into one file, with no repeats. More than 10 IDs, or a repeated ID, returns `400`. A list with one ID works like `action_id`.

  Meshy joins the animations in the order you send them. It names each clip in the file by the animation's `key`, the same way as for `action_id`.

  An animation whose `rig_type` doesn't match the rig returns `400`.

  - `motion_task_id` · *string* · **required**

  Required unless you send `action_id` or `action_ids`. The ID of the [Text to Motion](https://docs.meshy.ai/api/v2/text-to-motion.md) task whose clip to play on the character. The task must be one of yours and have the status `SUCCEEDED`, and the rig must be a `biped`.

  Use the Text to Motion task within 3 days after it finishes. After that, Meshy deletes its clip, like other task files, and this parameter returns `404`. Enterprise accounts keep their files.

  Meshy names the clip in the file by the Text to Motion task's `id`, as in a download from the Meshy web app. Each `-` becomes `_`, and an ID that starts with a digit gets a `_` in front. For example, the clip of task `018a210d-1c22-7e0f-9d3a-4a5b6c7d8e9f` is named `_018a210d_1c22_7e0f_9d3a_4a5b6c7d8e9f`.

  - `post_process` · *object*

  One extra file to make from the animation's FBX file, returned in the matching `output` field. Leave it out for no extra file.

  It has these fields:
  * `operation_type`: the file to make. Without it, Meshy makes no extra file.
* `change_fps`: an FBX file at another frame rate
* `fbx2usdz`: a USDZ file
* `extract_armature`: an FBX file with the skeleton only
  * `fps`: the frame rate for `change_fps`, one of `24`, `25`, `30`, or `60`. The default is `30`.

  Any other `operation_type` or `fps` value returns `400`.

  With `motion_task_id`, the clip can come back as a GLB file only. In that case, a `post_process` operation fails the task, and Meshy refunds its credits.

### Returns

`202 Accepted` with the [task object](https://docs.meshy.ai/api/v2/tasks.md#the-task-object). The task starts as `PENDING`, with your request in `input` and `output` set to `null`.

Two response headers help you read the task:
* `Location`: the task's URL on [Tasks](https://docs.meshy.ai/api/v2/tasks.md#how-a-task-runs)
* `Retry-After`: how many seconds to wait before you first read it

### Failure modes

  - `400 - Bad Request`

  The request can't run. For example:
  * More than one of `action_id`, `action_ids`, and `motion_task_id` was sent
  * An `action_id` isn't in the library
  * `action_ids` has a repeat or more than 10 IDs
  * The Rigging task hasn't succeeded
  * The Text to Motion task hasn't succeeded (`Motion task has not succeeded`)
  * `motion_task_id` was sent with a rig that isn't a `biped`
  * An animation's `rig_type` doesn't match the rig

  The error message says which problem it found. See [Errors](https://docs.meshy.ai/api/v2/errors.md#request-errors).

  - `401 - Unauthorized`

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

  - `402 - Payment Required`

  One of these applies:
  * The account doesn't have enough credits.
  * The account reached a credit limit.
  * The account is on the free plan.

  Check your credits and plan, then retry.

  - `403 - Forbidden`

  The `rig_task_id` task is a bas-relief model, which this endpoint can't animate. The message is `This model type does not support this operation`. Rig a different model.

  - `404 - Not Found`

  Meshy can't find a task or file the request needs. One of these applies:
  * `rig_task_id` doesn't match any of your tasks (`rig_task_id does not match any of your tasks`). Check the ID.
  * `motion_task_id` doesn't match any of your Text to Motion tasks (`Motion task not found`). Check the ID.
  * Meshy deleted the Text to Motion clip (the message starts with `Motion clip has expired`). Create another Text to Motion task.
  * The Rigging task's files were deleted after its `expires_at` (code `input_task_expired`). Rig the character again.

  - `429 - Too Many Requests`

  One of these limits was reached:
  * You sent too many requests. Wait the number of seconds in `Retry-After`, then retry.
  * Too many of your tasks are queued or running. Wait for some to finish, then retry.
  * On an unlimited plan with no credits left, you reached the number of tasks that can run without credits. Wait for a task to finish, or add credits.

**cURL**

```bash
# Apply one library animation (28: Big Wave Hello)
curl https://api.meshy.ai/openapi/v2/animations \
  -X POST \
  -H "Authorization: Bearer ${MESHY_API_KEY}" \
  -H 'Content-Type: application/json' \
  -d '{
    "rig_task_id": "018a210d-8ba4-705c-b111-1f1776f7f578",
    "action_id": 28
  }'

# Join two animations into one file, plus a 60 fps FBX
curl https://api.meshy.ai/openapi/v2/animations \
  -X POST \
  -H "Authorization: Bearer ${MESHY_API_KEY}" \
  -H 'Content-Type: application/json' \
  -d '{
    "rig_task_id": "018a210d-8ba4-705c-b111-1f1776f7f578",
    "action_ids": [0, 28],
    "post_process": { "operation_type": "change_fps", "fps": 60 }
  }'

# Play a Text to Motion clip on the character
curl https://api.meshy.ai/openapi/v2/animations \
  -X POST \
  -H "Authorization: Bearer ${MESHY_API_KEY}" \
  -H 'Content-Type: application/json' \
  -d '{
    "rig_task_id": "018a210d-8ba4-705c-b111-1f1776f7f578",
    "motion_task_id": "018a210d-1c22-7e0f-9d3a-4a5b6c7d8e9f"
  }'
```

```javascript
// Apply one library animation (28: Big Wave Hello)
const response = await fetch("https://api.meshy.ai/openapi/v2/animations", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.MESHY_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    rig_task_id: "018a210d-8ba4-705c-b111-1f1776f7f578",
    action_id: 28,
  }),
});
if (!response.ok) throw new Error(await response.text());
const task = await response.json();
console.log(task.id, task.status);
```

```python
import os
import requests

# Apply one library animation (28: Big Wave Hello)
response = requests.post(
    "https://api.meshy.ai/openapi/v2/animations",
    headers={"Authorization": f"Bearer {os.environ['MESHY_API_KEY']}"},
    json={
        "rig_task_id": "018a210d-8ba4-705c-b111-1f1776f7f578",
        "action_id": 28,
    },
)
response.raise_for_status()
task = response.json()
print(task["id"], task["status"])
```

**Response**

```json
{
  "id": "0199a8f6-3d27-7c2e-9b41-6e0c5d2f8a13",
  "type": "animate",
  "status": "PENDING",
  "progress": 0,
  "created_at": 1790640079880,
  "started_at": null,
  "finished_at": null,
  "expires_at": null,
  "preceding_tasks": 1,
  "consumed_credits": 3,
  "task_error": null,
  "input": {
    "rig_task_id": "018a210d-8ba4-705c-b111-1f1776f7f578",
    "action_id": 28
  },
  "output": null
}
```

---

## GET /openapi/v2/animations/library -- List animations

Returns the animations in the library, with the `action_id` to send when you create a task. This request costs no credits.

The following filters combine. Leave them all out to get the whole library.

### Parameters

  - `search` · *string*

  Text to search for. Meshy returns the animations whose `name` or `key` contains this text, ignoring case.

  - `category` · *string*

  The category to list. For example:
  * `DailyActions`
  * `WalkAndRun`
  * `Fighting`
  * `BodyMovements`
  * `Dancing`

  A `quadruped` animation's category is an animal, for example `dog` or `horse`. An unknown category returns an empty list.

  - `sub_category` · *string*

  The subcategory to list, for example `Walking` or `Interacting`. You can send it without `category`.

  - `action_ids` · *string*

  The animations to list, as up to 200 comma-separated IDs, for example `28,92`. More than 200 IDs returns `400`.

### Returns

An array of animations, ordered by `action_id`. The response has the whole list, with no pages.

  - `action_id` · *integer*

  The ID to send as `action_id` or in `action_ids`.

  - `name` · *string*

  The animation's display name.

  - `key` · *string*

  The animation's key.

  - `category` · *string*

  The animation's category. For a `quadruped` animation, it's an animal, for example `dog` or `horse`.

  - `sub_category` · *string*

  The animation's subcategory.

  - `preview_url` · *string*

  URL to an animated GIF preview of the animation.

  - `rig_type` · *string*

  The kind of rig the animation plays on, `biped` or `quadruped`. It matches the `animation_type` of the [Rigging](https://docs.meshy.ai/api/v2/rigging.md#create-a-rigging-task) task. A rig takes only animations of its own type.

### Failure modes

  - `400 - Bad Request`

  `action_ids` has more than 200 IDs, or an item that isn't an integer. The error message says which problem it found. Fix the list, then send the request again. See [Errors](https://docs.meshy.ai/api/v2/errors.md#request-errors).

  - `401 - Unauthorized`

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

  - `429 - Too Many Requests`

  You sent too many requests. Wait the number of seconds in `Retry-After`, then retry.

**cURL**

```bash
# Find waving animations
curl "https://api.meshy.ai/openapi/v2/animations/library?search=wave" \
  -H "Authorization: Bearer ${MESHY_API_KEY}"
```

```javascript
// Find waving animations
const response = await fetch(
  "https://api.meshy.ai/openapi/v2/animations/library?search=wave",
  { headers: { Authorization: `Bearer ${process.env.MESHY_API_KEY}` } },
);
if (!response.ok) throw new Error(await response.text());
const animations = await response.json();
console.log(animations.map((a) => `${a.action_id} ${a.name}`));
```

```python
import os
import requests

# Find waving animations
response = requests.get(
    "https://api.meshy.ai/openapi/v2/animations/library",
    headers={"Authorization": f"Bearer {os.environ['MESHY_API_KEY']}"},
    params={"search": "wave"},
)
response.raise_for_status()
for animation in response.json():
    print(animation["action_id"], animation["name"])
```

**Response (shortened)**

```json
[
  {
    "action_id": 28,
    "name": "Big Wave Hello",
    "key": "Big_Wave_Hello",
    "category": "DailyActions",
    "sub_category": "Interacting",
    "preview_url": "https://cdn.meshy.ai/webapp-assets/feature-demo/animation/preview/biped/Big_Wave_Hello.gif",
    "rig_type": "biped"
  },
  {
    "action_id": 290,
    "name": "Wave One Hand",
    "key": "Wave_One_Hand",
    "category": "DailyActions",
    "sub_category": "Interacting",
    "preview_url": "https://cdn.meshy.ai/webapp-assets/feature-demo/animation/preview/biped/Wave_One_Hand.gif",
    "rig_type": "biped"
  }
]
```

---

## Get the result
Read Animation tasks the same way as every other v2 task, through the [Tasks](https://docs.meshy.ai/api/v2/tasks.md) routes. To list only Animation tasks, filter by `type=animate`.

| To | Call |
| --- | --- |
| Get one task | [`GET /openapi/v2/tasks/{id}`](https://docs.meshy.ai/api/v2/tasks.md#get-a-task) |
| Wait for updates | [`GET /openapi/v2/tasks/{id}/stream`](https://docs.meshy.ai/api/v2/tasks.md#stream-a-task) or a [webhook](https://docs.meshy.ai/api/v2/webhooks.md) |
| List your tasks | [`GET /openapi/v2/tasks?type=animate`](https://docs.meshy.ai/api/v2/tasks.md#list-tasks) |
| Delete a task | [`DELETE /openapi/v2/tasks/{id}`](https://docs.meshy.ai/api/v2/tasks.md#delete-a-task) |

---

## Animation output
When the task succeeds, `output` holds these fields. The rest of the [task object](https://docs.meshy.ai/api/v2/tasks.md#the-task-object) is the same for every task type. The URLs in `output` stop working at `expires_at`.

  - `animation_glb_url` · *string | null*

  Signed URL to the animated character as a GLB file. With `action_ids`, the file has every clip.

  - `animation_fbx_url` · *string | null*

  Signed URL to the animated character as an FBX file. It can be `null` for a `motion_task_id` clip that came back as a GLB file only.

  - `processed_animation_fps_fbx_url` · *string | null*

  Signed URL to the FBX file at the frame rate you asked for. `null` unless you sent `"operation_type": "change_fps"`.

  - `processed_usdz_url` · *string | null*

  Signed URL to the animation as a USDZ file. `null` unless you sent `"operation_type": "fbx2usdz"`.

  - `processed_armature_fbx_url` · *string | null*

  Signed URL to the skeleton and its animation without the mesh, as an FBX file. `null` unless you sent `"operation_type": "extract_armature"`.

**Succeeded Animation task**

```json
{
  "id": "0199a8f6-3d27-7c2e-9b41-6e0c5d2f8a13",
  "type": "animate",
  "status": "SUCCEEDED",
  "progress": 100,
  "created_at": 1790640079880,
  "started_at": 1790640079888,
  "finished_at": 1790640084741,
  "expires_at": 1790899284741,
  "preceding_tasks": 0,
  "consumed_credits": 3,
  "task_error": null,
  "input": {
    "rig_task_id": "018a210d-8ba4-705c-b111-1f1776f7f578",
    "action_id": 28
  },
  "output": {
    "animation_glb_url": "https://assets.meshy.ai/***/output/Animation_Big_Wave_Hello_withSkin.glb?Expires=***",
    "animation_fbx_url": "https://assets.meshy.ai/***/output/Animation_Big_Wave_Hello_withSkin.fbx?Expires=***",
    "processed_usdz_url": null,
    "processed_armature_fbx_url": null,
    "processed_animation_fps_fbx_url": null
  }
}
```
