NPCMotion API
Roblox animation, from your own code.
Send a prompt, get an R15 animation back. The same models, retargeting and foot locking as the app, over a small REST API, so your pipeline, tools or game backend can make motion without a person in the loop.
REST · JSON · Bearer keys · the same credits as the app
Who it is for
For anyone making a lot of motion
If you need a handful of animations, the app is quicker. The API is for when the animations are part of something bigger.
Game studios
Generate a whole cast's idles, walks and reactions from a spreadsheet of prompts, and drop the results straight into your asset pipeline.
Tool and plugin makers
Put text to motion inside your own Studio plugin, editor or web tool, billed to your account, without running a model yourself.
Game backends
Let your servers make emotes or NPC moves on demand: a request from a server Script, a run, and a KeyframeSequence back.
Agents and automation
Scripts and AI agents that build animation libraries overnight, with idempotent requests, clear errors and limits stated in every response.
Quickstart
Three calls from prompt to file
Start a run, wait for it, download it. Here is the whole loop in four languages.
Make a key
In NPCMotion, open Settings → API keys and create one. It is shown once: keep it in an environment variable on your server, never in client code.
Start a run
POST /v1/generations with a prompt and a duration. It comes back queued, with an id, and the credits for that duration are held.
Wait for it
GET /v1/generations/:id every couple of seconds until status is succeeded. A failed run refunds its credits on its own.
Download it
GET /v1/generations/:id/export/rbxmx for a link to the KeyframeSequence, ready to import into Roblox Studio.
Terminal
# 1. Start a run. Retrying with the same Idempotency-Key returns the same run.
curl https://api.npcmotion.com/v1/generations \
-H "Authorization: Bearer $NPCMOTION_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: $(uuidgen)" \
-d '{"prompt": "a confident walk, arms swinging", "duration": 3, "style": "game"}'
# 2. Check on it. Repeat every couple of seconds until "status" is "succeeded".
curl https://api.npcmotion.com/v1/generations/GENERATION_ID \
-H "Authorization: Bearer $NPCMOTION_API_KEY"
# 3. Get a download link for Roblox Studio.
curl https://api.npcmotion.com/v1/generations/GENERATION_ID/export/rbxmx \
-H "Authorization: Bearer $NPCMOTION_API_KEY"A finished run, from GET /v1/generations/:id. While it runs, poll_after_ms says when to look again
{
"generation": {
"id": "8f3c2b1e-5d4a-4c1f-9b7e-2a6d0c9e1f34",
"object": "generation",
"status": "succeeded",
"status_message": "Done. Download it from result.exports.",
"progress": 1.0,
"queue_position": null,
"poll_after_ms": null,
"typical_seconds": null,
"prompt": "a confident walk, arms swinging",
"settings": { "duration": 3, "fps": 30, "style": "game", "model": "hy-motion" },
"cost": { "credits": 3, "refunded": false },
"error": null,
"result": {
"motion_url": "https://…",
"video_url": null,
"exports": { "rbxmx": "https://api.npcmotion.com/v1/generations/8f3c2b1e-…/export/rbxmx" }
},
"licence": "Tencent HunyuanVideo Community",
"created_at": "2026-10-31T21:00:00Z",
"completed_at": "2026-10-31T21:00:41Z",
"links": {
"self": "https://api.npcmotion.com/v1/generations/8f3c2b1e-…",
"cancel": null,
"app": "https://www.npcmotion.com/generations/8f3c2b1e-…"
}
}
}Reference
Endpoints
Everything lives under https://api.npcmotion.com/v1. Send your key as Authorization: Bearer npc_… (or X-API-Key) and JSON bodies with Content-Type: application/json.
| POST | /v1/generations | Start a text-to-motion run. Returns it queued with its id, a Location header and your credits left. |
| GET | /v1/generations/:id | One run: status, a status message, when to poll again and, once it succeeds, result with download links. |
| GET | /v1/generations | Your runs, newest first. ?limit= up to 100, and has_more. |
| POST | /v1/generations/:id/cancel | Stop a run that has not finished. Its credits come back. |
| GET | /v1/generations/:id/export/:format | A short-lived download link. rbxmx for Roblox Studio; fbx where the model makes one. |
| GET | /v1/me | Your plan and the credits you have left. |
Starting a run
Every field but the prompt is optional. A value that is not allowed is refused with 422 and the field's name, rather than quietly ignored.
| Field | Type | What it does |
|---|---|---|
| prompt | string, required | The motion, in words. Up to 1,000 characters. |
| duration | number | Seconds, 1 to 10. Default 3. What the run is charged for. |
| style | string | natural, game, cinematic, combat or idle. Default natural. |
| model | string | hy-motion (most detail) or kimodo (fastest). Default hy-motion. |
| fps | number | 30 or 60. Kimodo writes 30 only. |
| pace | string | slow, normal or fast. |
| loop | boolean | Ease the end back into the start, for cycles. |
| foot_lock | boolean | Pin feet to the floor while they are planted. Default true. |
| root_motion | string | travelling (moves across the floor) or in_place. |
Errors
Every error has the same shape, so one handler covers them all: { "error": { "code": "…", "message": "…" } }.
| 401 | invalid_api_key | No key, or one that was revoked. |
| 402 | insufficient_credits | Not enough credits for that duration. Top up or upgrade. |
| 409 | idempotency_key_in_use | The same Idempotency-Key is still being processed. |
| 422 | invalid_parameter | A field is not one of its allowed values. error.param names it. |
| 429 | rate_limited | Too many requests. Wait for Retry-After seconds. |
| 429 | too_many_running | Five runs are in progress. Start another when one finishes. |
Limits
Fair limits, stated up front
Limits are per account, however many keys it uses. Every response says where you stand in X-RateLimit-Limit and X-RateLimit-Remaining, and a 429 comes with Retry-After.
- Requests
- 60 a minute per account, in bursts of up to 60
- New runs
- 10 in a burst, then one every 10 seconds
- Runs in progress
- 5 at once
- Keys
- Up to 10 per account
Need more? Tell us what you are building.
Safe retries
Retry without paying twice
Networks drop requests. Send an Idempotency-Key with each POST /v1/generations, and a retry with the same key returns the run the first request started instead of starting, and charging for, a second.
Keep keys on a server
A key spends your credits. Keep it in an environment variable or the experience secrets, revoke it in Settings if it leaks, and use one key per server so revoking one leaves the rest running.
Pricing
The same credits as the app
No separate API plan and no per-request fee. One credit is one second of animation, held when a run starts and refunded automatically if it fails. Credits never expire.
Basic
$9per month
50 credits / month · ~50 seconds a month
For your first real project.
Creator
Most popular$29per month
250 credits / month · ~4 minutes a month
For creators shipping weekly.
Studio
$99per month
1,000 credits / month · ~16 minutes a month
For teams and heavy use.
Free accounts get 5 credits to try the API. Every key on an account spends from the same balance.
Questions
Before you build
Use of the API is covered by the terms of service, including the rules on competing products and reverse engineering.