curl --fail-with-body --request POST \
--url "$XPILOT_API_BASE_URL/v1/avatars/%3Cavatar_id%3E/videos" \
--header "Authorization: Bearer $XPILOT_API_KEY" \
--header 'Content-Type: application/json' \
--header 'Idempotency-Key: lesson-request-001' \
--data '{"text":"Welcome to our lesson.","voice_id":"<voice_id>","voice_version":1}'const response = await fetch(process.env.XPILOT_API_BASE_URL + "/v1/avatars/%3Cavatar_id%3E/videos", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.XPILOT_API_KEY}`,
"Content-Type": "application/json",
"Idempotency-Key": "lesson-request-001",
},
body: JSON.stringify({
"text": "Welcome to our lesson.",
"voice_id": "<voice_id>",
"voice_version": 1
}),
});
const result = await response.json();
if (!response.ok) throw new Error(JSON.stringify(result));
console.log(result);import os, json, requests
response = requests.request(
"POST",
os.environ["XPILOT_API_BASE_URL"] + "/v1/avatars/%3Cavatar_id%3E/videos",
headers={
"Authorization": "Bearer " + os.environ["XPILOT_API_KEY"],
"Content-Type": "application/json",
"Idempotency-Key": "lesson-request-001",
},
json=json.loads("{\"text\":\"Welcome to our lesson.\",\"voice_id\":\"<voice_id>\",\"voice_version\":1}"),
timeout=70,
)
print(response.status_code, response.text)
response.raise_for_status(){
"data": {
"id": "<video_id>",
"avatar_id": "<avatar_id>",
"status": "queued",
"source": "text",
"video_url": null,
"format": "webm",
"has_alpha": true,
"duration_seconds": null,
"width": null,
"height": null,
"cost_credits": null,
"error": null,
"created_at": 1791849600,
"updated_at": 1791849600
}
}{
"error": {
"code": "invalid_parameter",
"message": "Check parameter types, required fields and idempotency key."
},
"request_id": "<request_id>"
}{
"error": {
"code": "invalid_token",
"message": "Use an active scoped API Key. MCP OAuth tokens cannot call REST."
},
"request_id": "<request_id>"
}{
"error": {
"code": "insufficient_credits",
"message": "The balance cannot cover the platform reserve, or the credential monthly budget is used up."
},
"request_id": "<request_id>"
}{
"error": {
"code": "insufficient_scope",
"message": "Check the credential scope and resource ownership."
},
"request_id": "<request_id>"
}{
"error": {
"code": "not_found",
"message": "Use an existing owned conversation, message, brand kit or render ID."
},
"request_id": "<request_id>"
}{
"error": {
"code": "idempotency_conflict",
"message": "The same idempotency key must use the exact same input. A conversation may already be busy."
},
"request_id": "<request_id>"
}{
"error": {
"code": "rate_limited",
"message": "Credential/workspace rate or concurrency limit reached. Respect Retry-After before retrying.",
"retry_after": 60
},
"request_id": "<request_id>"
}create avatar video
Synthesize a talking-presenter video with an owned avatar whose training_status is ready. Drive it with text + voice_id (platform TTS, Voice I or Voice II) or with your own speech audio (asset_id or a public http(s) audio_url) — exactly one source, up to 5 minutes of speech. Output is a transparent-background WebM (VP9 with alpha) for compositing. Billed per rendered second at the digital-human video rate; the balance must cover the estimate before dispatch. Poll get_avatar_video, or receive avatar-video.completed / avatar-video.failed through callback_url or a webhook subscription. Reuse Idempotency-Key on retry; never resubmit automatically.
curl --fail-with-body --request POST \
--url "$XPILOT_API_BASE_URL/v1/avatars/%3Cavatar_id%3E/videos" \
--header "Authorization: Bearer $XPILOT_API_KEY" \
--header 'Content-Type: application/json' \
--header 'Idempotency-Key: lesson-request-001' \
--data '{"text":"Welcome to our lesson.","voice_id":"<voice_id>","voice_version":1}'const response = await fetch(process.env.XPILOT_API_BASE_URL + "/v1/avatars/%3Cavatar_id%3E/videos", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.XPILOT_API_KEY}`,
"Content-Type": "application/json",
"Idempotency-Key": "lesson-request-001",
},
body: JSON.stringify({
"text": "Welcome to our lesson.",
"voice_id": "<voice_id>",
"voice_version": 1
}),
});
const result = await response.json();
if (!response.ok) throw new Error(JSON.stringify(result));
console.log(result);import os, json, requests
response = requests.request(
"POST",
os.environ["XPILOT_API_BASE_URL"] + "/v1/avatars/%3Cavatar_id%3E/videos",
headers={
"Authorization": "Bearer " + os.environ["XPILOT_API_KEY"],
"Content-Type": "application/json",
"Idempotency-Key": "lesson-request-001",
},
json=json.loads("{\"text\":\"Welcome to our lesson.\",\"voice_id\":\"<voice_id>\",\"voice_version\":1}"),
timeout=70,
)
print(response.status_code, response.text)
response.raise_for_status(){
"data": {
"id": "<video_id>",
"avatar_id": "<avatar_id>",
"status": "queued",
"source": "text",
"video_url": null,
"format": "webm",
"has_alpha": true,
"duration_seconds": null,
"width": null,
"height": null,
"cost_credits": null,
"error": null,
"created_at": 1791849600,
"updated_at": 1791849600
}
}{
"error": {
"code": "invalid_parameter",
"message": "Check parameter types, required fields and idempotency key."
},
"request_id": "<request_id>"
}{
"error": {
"code": "invalid_token",
"message": "Use an active scoped API Key. MCP OAuth tokens cannot call REST."
},
"request_id": "<request_id>"
}{
"error": {
"code": "insufficient_credits",
"message": "The balance cannot cover the platform reserve, or the credential monthly budget is used up."
},
"request_id": "<request_id>"
}{
"error": {
"code": "insufficient_scope",
"message": "Check the credential scope and resource ownership."
},
"request_id": "<request_id>"
}{
"error": {
"code": "not_found",
"message": "Use an existing owned conversation, message, brand kit or render ID."
},
"request_id": "<request_id>"
}{
"error": {
"code": "idempotency_conflict",
"message": "The same idempotency key must use the exact same input. A conversation may already be busy."
},
"request_id": "<request_id>"
}{
"error": {
"code": "rate_limited",
"message": "Credential/workspace rate or concurrency limit reached. Respect Retry-After before retrying.",
"retry_after": 60
},
"request_id": "<request_id>"
}Documentation by X-Pilot
avatars:write. A stable Idempotency-Key is required for exact retries.
Manage API keys · Authentication and recovery

Authorizations
Scoped X-Pilot API key
Headers
Stable key for exact retries only. Use a different key for a different operation or input.
8 - 128Path Parameters
Owned avatar ID with training_status ready.
Body
Spoken text for platform TTS. Use with voice_id; omit when sending audio.
5000"Welcome to our lesson."
Catalog voice ID or owned ready clone ID from list_voices. Required with text.
Voice version of voice_id: Voice I (1, default) or Voice II (2).
1, 2 Optional native locale for the voice.
TTS playback speed.
0.5 <= x <= 2Public http(s) speech audio URL (≤20 MB). The backend archives third-party audio to your owned storage first. Use this or asset_id instead of text.
Owned audio asset ID returned by POST /v1/assets. Use this or audio_url instead of text.
Optional public HTTPS URL notified once with avatar-video.completed or avatar-video.failed. Signed with the workspace callback secret (X-XPilot-Signature). Only set it when you run a receiving service.
2048Optional reference echoed back as data.callback_id. Requires callback_url.
128Response
Success
