アニメーション API

利用可能なアニメーションを検索し、リグ済みのキャラクターに適用するためのエンドポイント。


POST/openapi/v1/animations

アニメーションタスクを作成する

このエンドポイントを使用すると、既にrigging(骨格)が設定されたキャラクターにアニメーションを適用する新しいタスクを作成できます。アニメーションライブラリのプリセットアクション(action_id)か、Text to Motion APIで生成したモーションクリップ(motion_task_id)のいずれかを使用します。後処理オプションも利用できます。

パラメータ

  • Name
    rig_task_id
    Type
    string
    必須
    Description

    正常に完了したriggingタスク(POST /openapi/v1/rigging)のidです。このタスクのキャラクターにアニメーションが適用されます。

  • Name
    action_id
    Type
    integer
    Description

    適用するプリセットアニメーションアクションの識別子です。利用可能なアニメーションの一覧はアニメーションライブラリのリファレンスをご覧ください。action_idまたはmotion_task_idのいずれか一方のみを指定してください。

  • Name
    motion_task_id
    Type
    string
    Description

    プリセットアクションの代わりに適用する、正常に完了したText to Motionタスクのidです。生成されたクリップはriggingされたキャラクターにリターゲットされ、作成時点でクリップのスナップショットが保存されるため、後で元のタスクが失効または削除されても、このタスクには影響しません。元のタスクのアセットは3日間保持されるため、失効する前にクリップを適用してください。二足歩行のrigが必要です。action_idまたはmotion_task_idのいずれか一方のみを指定してください。

  • Name
    post_process
    Type
    object
    Description

    アニメーション出力に対するオプションの後処理です。指定しない場合、標準のアニメーションファイルが返されます。

次の場合のみ適用 post_process is set
  • Name
    operation_type
    Type
    string
    必須
    Description

    実行する操作の種類です。利用可能な値: change_fpsfbx2usdzextract_armature

  • Name
    fps
    Type
    integer
    デフォルト 30
    Description

    目標フレームレートです。operation_typechange_fpsの場合にのみ適用されます。指定可能な値: 24253060

戻り値

レスポンスのresultプロパティには、新しく作成されたアニメーションタスクのタスクidが含まれます。

失敗モード

  • Name
    400 - Bad Request
    Description

    リクエストが受理されませんでした。よくある原因:

    • パラメータの欠落: rig_task_idが欠落している、またはaction_idmotion_task_idのどちらも指定されていない。
    • パラメータの競合: action_idmotion_task_idの両方が指定されている(これらは互いに排他的です)。
    • 無効なrigタスク: rig_task_idが無効であるか、失敗した、または存在しないタスクを参照している。
    • 無効なaction ID: action_idが有効なアニメーションに対応していない。
    • motionタスクが未完了: motion_task_idのタスクがまだSUCCEEDEDになっていない。
    • サポートされていないrig: motion_task_idには二足歩行のrigが必要であり、四足歩行のrigは拒否されます。
  • Name
    401 - Unauthorized
    Description

    認証に失敗しました。APIキーをご確認ください。

  • Name
    402 - Payment Required
    Description

    このタスクを実行するためのクレジットが不足しています。

  • Name
    404 - Not Found
    Description

    rig_task_idで指定されたriggingタスクが見つからない、motion_task_idで指定されたmotionタスクが見つからない、またはモーションクリップが失効している(元のタスクのアセットは3日間保持されます)場合です。

  • Name
    429 - Too Many Requests
    Description

    レート制限を超過しました。

Request

POST
/openapi/v1/animations
# Animate a rigged model with required params only
curl https://api.meshy.ai/openapi/v1/animations \
  -X POST \
  -H "Authorization: Bearer ${YOUR_API_KEY}" \
  -H 'Content-Type: application/json' \
  -d '{
    "rig_task_id": "018b314a-a1b5-716d-c222-2f1776f7f579",
    "action_id": 92
  }'

# Apply a generated Text to Motion clip instead of a preset action
curl https://api.meshy.ai/openapi/v1/animations \
  -X POST \
  -H "Authorization: Bearer ${YOUR_API_KEY}" \
  -H 'Content-Type: application/json' \
  -d '{
    "rig_task_id": "018b314a-a1b5-716d-c222-2f1776f7f579",
    "motion_task_id": "018c425b-b2c6-727e-d333-3c1887i9h791"
  }'

# With post-processing to change FPS
curl https://api.meshy.ai/openapi/v1/animations \
  -X POST \
  -H "Authorization: Bearer ${YOUR_API_KEY}" \
  -H 'Content-Type: application/json' \
  -d '{
    "rig_task_id": "018b314a-a1b5-716d-c222-2f1776f7f579",
    "action_id": 92,
    "post_process": {
      "operation_type": "change_fps",
      "fps": 24
    }
  }'

Response

{
  "result": "018c425b-b2c6-727e-d333-3c1887i9h791"
}

GET/openapi/v1/animations/:id

アニメーションタスクを取得する

このエンドポイントでは、有効なタスクidを指定してアニメーションタスクを取得できます。含まれるプロパティについてはThe Animation Task Objectを参照してください。

パラメータ

  • Name
    id
    Type
    path
    Description

    取得するアニメーションタスクの一意の識別子。

戻り値

レスポンスにはAnimation Taskオブジェクトが含まれます。詳細はThe Animation Task Objectセクションを確認してください。

Request

GET
/openapi/v1/animations/018c425b-b2c6-727e-d333-3c1887i9h791
curl https://api.meshy.ai/openapi/v1/animations/018c425b-b2c6-727e-d333-3c1887i9h791 
  -H "Authorization: Bearer ${YOUR_API_KEY}"

Response

{
  "id": "018c425b-b2c6-727e-d333-3c1887i9h791",
  "type": "animate",
  "status": "SUCCEEDED",
  "created_at": 1747032440896,
  "progress": 100,
  "started_at": 1747032441210,
  "finished_at": 1747032457530,
  "expires_at": 1747291657530,
  "task_error": {

    "message": ""

  },

  "consumed_credits": 3,
  "result": {
    "animation_glb_url": "https://assets.meshy.ai/0630d47c-84b8-4d37-bc02-69e45d9272c1/tasks/018c425b-b2c6-727e-d333-3c1887i9h791/output/Animation_Reaping_Swing_withSkin.glb?Expires=...",
    "animation_fbx_url": "https://assets.meshy.ai/0630d47c-84b8-4d37-bc02-69e45d9272c1/tasks/018c425b-b2c6-727e-d333-3c1887i9h791/output/Animation_Reaping_Swing_withSkin.fbx?Expires=...",
    "processed_usdz_url": "https://assets.meshy.ai/0630d47c-84b8-4d37-bc02-69e45d9272c1/tasks/018c425b-b2c6-727e-d333-3c1887i9h791/output/processed.usdz?Expires=...",
    "processed_armature_fbx_url": "https://assets.meshy.ai/0630d47c-84b8-4d37-bc02-69e45d9272c1/tasks/018c425b-b2c6-727e-d333-3c1887i9h791/output/processed_armature.fbx?Expires=...",
    "processed_animation_fps_fbx_url": "https://assets.meshy.ai/0630d47c-84b8-4d37-bc02-69e45d9272c1/tasks/018c425b-b2c6-727e-d333-3c1887i9h791/output/processed_60fps.fbx?Expires=..."
  },
  "preceding_tasks": 0
}

DELETE/openapi/v1/animations/:id

アニメーションタスクを削除

このエンドポイントは、関連するすべてのモデルとデータを含め、アニメーションタスクを完全に削除します。この操作は取り消せません。

パスパラメータ

  • Name
    id
    Type
    path
    Description

    削除するアニメーションタスクのID。

戻り値

成功時は 200 OK を返します。

Request

DELETE
/openapi/v1/animations/018b314a-a1b5-716d-c222-2f1776f7f579
curl --request DELETE \
  --url https://api.meshy.ai/openapi/v1/animations/018b314a-a1b5-716d-c222-2f1776f7f579 \
  -H "Authorization: Bearer ${YOUR_API_KEY}"

Response

// Returns 200 Ok on success.

GET/openapi/v1/animations

アニメーションタスク一覧の取得

呼び出し元のアニメーションタスクのページネーションされた一覧を、新しい順に返します。page_numpage_size による標準的なページネーションが利用できます。

APIを通じて作成されたタスクはAPIを通じて管理される点にご注意ください。これらはウェブアプリのMy Assetsには表示されません。IDを紛失したタスクを探す際にはこのエンドポイントを使用してください。

Request

GET
/openapi/v1/animations
curl "https://api.meshy.ai/openapi/v1/animations?page_num=1&page_size=20" \
-H "Authorization: Bearer ${YOUR_API_KEY}"

GET/openapi/v1/animations/:id/stream

Animationタスクをストリーミングする

このエンドポイントは、Server-Sent Events (SSE) を使用してAnimationタスクのリアルタイム更新をストリーミングします。

パラメータ

  • Name
    id
    Type
    path
    Description

    ストリーミングするAnimationタスクの一意の識別子です。

戻り値

The Animation Task Objects のストリームをServer-Sent Eventsとして返します。

PENDING または IN_PROGRESS のタスクの場合、レスポンスストリームには必要な progress および status フィールドのみが含まれます。

Request

GET
/openapi/v1/animations/018c425b-b2c6-727e-d333-3c1887i9h791/stream
curl -N https://api.meshy.ai/openapi/v1/animations/018c425b-b2c6-727e-d333-3c1887i9h791/stream 
-H "Authorization: Bearer ${YOUR_API_KEY}"

Response Stream

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

// Message event examples illustrate task progress.
// For PENDING or IN_PROGRESS tasks, the response stream will not include all fields.
event: message
data: {
  "id": "018c425b-b2c6-727e-d333-3c1887i9h791",
  "progress": 0,
  "status": "PENDING"
}

event: message
data: {
  "id": "018c425b-b2c6-727e-d333-3c1887i9h791",
  "progress": 50,
  "status": "IN_PROGRESS"
}

event: message
data: { // Example of a SUCCEEDED task stream item, mirroring The Animation Task Object structure
  "id": "018c425b-b2c6-727e-d333-3c1887i9h791",
  "type": "animate",
  "status": "SUCCEEDED",
  "created_at": 1747032440896,
  "progress": 100,
  "started_at": 1747032441210,
  "finished_at": 1747032457530,
  "expires_at": 1747291657530,
  "task_error": {

    "message": ""

  },

  "consumed_credits": 3,
  "result": {
    "animation_glb_url": "https://assets.meshy.ai/.../Animation_Reaping_Swing_withSkin.glb?...",
    "animation_fbx_url": "https://assets.meshy.ai/.../Animation_Reaping_Swing_withSkin.fbx?...",
    "processed_usdz_url": "https://assets.meshy.ai/.../processed.usdz?...",
    "processed_armature_fbx_url": "https://assets.meshy.ai/.../processed_armature.fbx?...",
    "processed_animation_fps_fbx_url": "https://assets.meshy.ai/.../processed_60fps.fbx?..."
  },
  "preceding_tasks": 0
}

Animation タスクオブジェクト

Animation タスクオブジェクトは、リグ済みキャラクターにアニメーションを適用する作業単位を表します。

プロパティ

  • Name
    id
    Type
    string
    Description

    タスクの一意の識別子です。

  • Name
    type
    Type
    string
    Description

    Animation タスクのタイプです。値は animate です。

  • Name
    status
    Type
    string
    Description

    タスクのステータスです。可能な値: PENDINGIN_PROGRESSSUCCEEDEDFAILEDCANCELED

  • Name
    progress
    Type
    integer
    Description

    タスクの progress です(0~100)。

  • Name
    created_at
    Type
    timestamp
    Description

    タスクが作成されたときのタイムスタンプ(エポックからのミリ秒)です。

  • Name
    started_at
    Type
    timestamp
    Description

    タスクが処理を開始したときのタイムスタンプ(エポックからのミリ秒)です。開始していない場合は 0 です。

  • Name
    finished_at
    Type
    timestamp
    Description

    タスクが終了したときのタイムスタンプ(エポックからのミリ秒)です。終了していない場合は 0 です。

  • Name
    expires_at
    Type
    timestamp
    Description

    タスクの結果アセットが期限切れになるときのタイムスタンプ(エポックからのミリ秒)です。

  • Name
    task_error
    Type
    object
    Description

    失敗したタスクのエラー詳細です。task_error オブジェクトの完全なリファレンスについては、エラー を参照してください。

  • Name
    consumed_credits
    Type
    integer
    Description

    このタスクで消費されたクレジットの数です。タスクのステータスが PENDINGIN_PROGRESS、または SUCCEEDED の場合に存在します。FAILED タスクの場合は 0 を返します(失敗時にはクレジットが返還されます)。

  • Name
    result
    Type
    object
    Description

    タスクが SUCCEEDED の場合、出力アニメーションの URL を含みます。

    • Name
      animation_glb_url
      Type
      string
      Description
      GLB 形式のアニメーションのダウンロード可能な URL です。
    • Name
      animation_fbx_url
      Type
      string
      Description
      FBX 形式のアニメーションのダウンロード可能な URL です。
    • Name
      processed_usdz_url
      Type
      string
      Description
      USDZ 形式の処理済みアニメーションのダウンロード可能な URL です。
    • Name
      processed_armature_fbx_url
      Type
      string
      Description
      FBX 形式の処理済みアーマチュアのダウンロード可能な URL です。
    • Name
      processed_animation_fps_fbx_url
      Type
      string
      Description
      FPS を変更したアニメーションの FBX 形式のダウンロード可能な URL です(例: change_fps 操作が使用された場合)。
  • Name
    preceding_tasks
    Type
    integer
    Description

    キュー内の先行タスクの数です。ステータスが PENDING の場合のみ意味を持ちます。

Example Animation Task Object

{
  "id": "018c425b-b2c6-727e-d333-3c1887i9h791",
  "type": "animate",
  "status": "SUCCEEDED",
  "created_at": 1747032440896,
  "progress": 100,
  "started_at": 1747032441210,
  "finished_at": 1747032457530,
  "expires_at": 1747291657530,
  "task_error": {

    "message": ""

  },

  "consumed_credits": 3,
  "result": {
    "animation_glb_url": "https://assets.meshy.ai/.../Animation_Reaping_Swing_withSkin.glb?...",
    "animation_fbx_url": "https://assets.meshy.ai/.../Animation_Reaping_Swing_withSkin.fbx?...",
    "processed_usdz_url": "https://assets.meshy.ai/.../processed.usdz?...",
    "processed_armature_fbx_url": "https://assets.meshy.ai/.../processed_armature.fbx?...",
    "processed_animation_fps_fbx_url": "https://assets.meshy.ai/.../processed_60fps.fbx?..."
  },
  "preceding_tasks": 0
}