Enrolls an existing voice (typically one you just created with status
draft) from a reference audio clip. Enrollment runs asynchronously: the response is 202 Accepted
with the processing voice and a job_id you poll with GET /jobs/{id}. When
the job reaches succeeded, the voice becomes ready. A clip the cloner can’t use fails the job
rather than the request - the reference needs at least 10 seconds of continuous speech.
Prefer /clone if you want to create and enroll a voice in one call. Like
cloning, enrollment is free - no character usage is charged.
Authorization
string
required
Your workspace API key (flv_…). Required scope:clone.
Path parameters
string
required
The voice id to enroll.
Body (multipart/form-data)
file
required
The reference audio clip. Maximum 20 MiB; larger uploads return 400, and a request body over 21 MiB is refused with 413.
boolean
required
Consent attestation. Send consent=true to attest that you hold the speaker’s permission to
clone their voice. Accepted truthy values: true, 1, on, yes (case-insensitive). Omitting
the field (or any other value) returns 400. The attestation - who attested, via which API key,
when, and which consent statement version - is recorded with the voice for audit. It is not
returned in API responses.
string
BCP-47 language code of the reference clip (e.g. en, hi).
string
Optional transcript of the reference clip. Improves clone quality when provided.
The clone job id. Poll GET /jobs/{id} until it reaches a terminal status.
curl -X POST \ "https://fi.production.flamapis.com/flam-voice-svc/api/v1/public/voices/665f1a2b3c4d5e6f7a8b9c0d/enroll" \ -H "X-API-Key: $FINESSE_API_KEY" \ -F "consent=true" \ -F "language=en" \ -F "ref_text=The quick brown fox jumps over the lazy dog." \ -F "file=@./sample.wav"
import { readFile } from "node:fs/promises";const id = "665f1a2b3c4d5e6f7a8b9c0d";const form = new FormData();form.set("consent", "true");form.set("language", "en");form.set("ref_text", "The quick brown fox jumps over the lazy dog.");form.set("file", new Blob([await readFile("./sample.wav")]), "sample.wav");const res = await fetch( `https://fi.production.flamapis.com/flam-voice-svc/api/v1/public/voices/${id}/enroll`, { method: "POST", headers: { "X-API-Key": process.env.FINESSE_API_KEY }, body: form },);const { data } = await res.json();console.log(data.voice.status, data.job_id);
import os, requestsvoice_id = "665f1a2b3c4d5e6f7a8b9c0d"with open("sample.wav", "rb") as f: res = requests.post( f"https://fi.production.flamapis.com/flam-voice-svc/api/v1/public/voices/{voice_id}/enroll", headers={"X-API-Key": os.environ["FINESSE_API_KEY"]}, data={"consent": "true", "language": "en", "ref_text": "The quick brown fox jumps over the lazy dog."}, files={"file": ("sample.wav", f, "audio/wav")}, )data = res.json()["data"]print(data["voice"]["status"], data["job_id"])
Copy this into your coding agent (Claude Code, Cursor, Codex…) to implement this endpoint.
You are implementing a typed client for one Finesse Voice API endpoint: "Enroll a voice".Everything you need is in this prompt. Do not invent anything that is not specified here.WHAT TO BUILD- A function enrollVoice(voiceId, input) (name it per the project's conventions) that attaches a reference clip to an existing voice (typically a "draft" voice from POST /flam-voice-svc/api/v1/public/voices) and starts cloning it, returning { voice, jobId }.- A function waitForJob(jobId, options) that polls the clone job until it reaches a terminal status (reuse an existing one if the project already has it).- Detect the stack first: look for package.json, tsconfig.json, pyproject.toml, requirements.txt, go.mod, Gemfile, composer.json and similar. Use the project's language, HTTP client, module layout, error-handling conventions and test runner. If there is no project yet or the stack is unclear, use TypeScript on Node 18+ with the built-in fetch and no new dependencies.- If the project already has a Finesse API client module, add this to it (reuse its auth, base URL, error type and retry helper) instead of creating a parallel one.- Keep the base URL (https://fi.production.flamapis.com) in one constant or config value.ENDPOINT- Method: POST- URL: https://fi.production.flamapis.com/flam-voice-svc/api/v1/public/voices/{id}/enroll- Body: multipart/form-data- Enrollment is asynchronous: the response is 202 Accepted with the voice (now "processing") and a job_id to poll. When the job reaches "succeeded", the voice becomes "ready".PARAMETERS- id (path, string, required): the voice id to enroll, a 24-character hex string. Validate it locally against /^[0-9a-f]{24}$/i and URL-encode it. The voice must belong to the key's workspace.REQUEST FIELDS (multipart/form-data)- Send multipart/form-data. Do not set the Content-Type header yourself; let the HTTP library add it with the multipart boundary.- file (file, required): the reference audio clip. Maximum 20 MiB (20 * 1024 * 1024 bytes); larger uploads return 400 (413 when the whole request body exceeds 21 MiB), so check the size locally before uploading. Send a filename.- language (text, optional): BCP-47 code of the reference clip (e.g. "en", "hi").- ref_text (text, optional): transcript of the reference clip. Improves clone quality.- Omit optional fields that the caller did not provide.Equivalent curl: curl -X POST "https://fi.production.flamapis.com/flam-voice-svc/api/v1/public/voices/665f1a2b3c4d5e6f7a8b9c0d/enroll" \ -H "X-API-Key: $FINESSE_API_KEY" \ -F "language=en" \ -F "ref_text=The quick brown fox jumps over the lazy dog." \ -F "file=@./sample.wav"AUTHENTICATION- Send the header X-API-Key: <workspace API key> on every request. Keys start with "flv_".- Required scope: clone. Keys carry one or more scopes (voices:read, voices:write, clone, tts); a key without this scope gets 403 with code "insufficient_scope". Keys created before scopes existed have all four.- Read the key from the environment variable FINESSE_API_KEY (or the project's existing secrets or config mechanism). Fail fast with a clear error if it is missing, before making any request.- Never hard-code, log or commit the key, and never ship it in browser/client-side code: call this from server-side code only. Treat it like a password.- A key is bound to one workspace. Referencing a voice or job from another workspace returns 404.- Keys can expire: an expired key returns 401 with code "key_expired". Do not retry; surface it so an operator can rotate the key.RESPONSE ENVELOPEJSON responses use one envelope. On success "error" is false and the payload is in "data": { "status": 200, "data": { "...": "endpoint payload" }, "error": false }On failure "error" is true, "data" is omitted and "message" carries the detail: { "status": 404, "error": true, "message": "Voice not found" }Billing and plan denials do NOT use the envelope. They return a flat JSON body whose "error"field is a string, not a boolean: { "error": "plan limit reached", "feature": "max_voices", "limit": 10 } { "error": "quota_exhausted", "unit": "character", "limit": 100000, "used": 100000 }The "error" string is the denial reason (for example quota_exhausted, insufficient_credits,feature_disabled, or "plan limit reached"). Tell the two shapes apart bychecking whether "error" is a boolean (envelope) or a string (flat denial), and exposefeature / unit / limit / used on your error type when present.SUCCESS RESPONSE (202, application/json) { "status": 202, "data": { "voice": { "id": "665f1a2b3c4d5e6f7a8b9c0d", "name": "Studio Narrator", "status": "processing", "primary_language": "en" }, "job_id": "665f1a2b3c4d5e6f7a8b9aa0" }, "error": false }VOICE OBJECT (define a type for it; timestamps are Unix epoch MILLISECONDS)- id: string. Unique voice id, 24-character hex. Used by the synthesize endpoints.- name: string. Display name.- description: string, optional.- status: string. Only "ready" voices can synthesize. All values: "draft" (created, no audio yet), "uploading", "queued", "verifying", "processing", "training" (in progress), "ready", "failed" (creation did not succeed), "archived" and "deleted". Type it as a string union of these values but tolerate other strings (treat them as not usable).- clone_method: "instant" | "professional" | "design" | "remix" | "guided".- visibility: "private" | "org" | "public".- primary_language: string, BCP-47 (e.g. "en"). Used when a synthesis request omits language.- labels: array of { key: string, value: string }, optional. Common keys: accent, gender, age, use_case. Example: [{ "key": "accent", "value": "american" }]- settings: object, optional, present only when configured. Synthesis defaults: stability, similarity, style, speed, pitch, volume, use_speaker_boost, emotion, engine_params.- sample_audio_url: string, optional. Public URL of a short preview clip.- base_voice_id: string, optional. Present when derived from another voice (clone_method "remix").- created_at, updated_at: integers (epoch ms).Optional fields may be absent. Responses may contain extra fields: ignore them, never fail on them.Example: { "id": "665f1a2b3c4d5e6f7a8b9c0d", "name": "Studio Narrator", "description": "Warm, neutral narration voice.", "status": "ready", "clone_method": "instant", "visibility": "public", "primary_language": "en", "labels": [ { "key": "accent", "value": "american" }, { "key": "gender", "value": "female" } ], "sample_audio_url": "https://storage.googleapis.com/.../sample.wav", "created_at": 1717939200000, "updated_at": 1717939260000 }JOB OBJECT (returned by GET https://fi.production.flamapis.com/flam-voice-svc/api/v1/public/jobs/{id} in "data")- id: string. The job id.- voice_id: string. The voice this job is enrolling.- org_id: string. The owning workspace.- job_type: string, e.g. "instant_clone", "pro_train", "verify", "localize", "design_preview", "reembed".- status: "pending" | "running" while in progress; terminal states are "succeeded", "failed", "cancelled" and "expired". When "succeeded", the voice's status is "ready".- progress: integer 0-100.- error: object, present when status is "failed"; carries the failure reason (message, status_code). { "status": 200, "data": { "id": "665f1a2b3c4d5e6f7a8b9aa0", "voice_id": "665f1a2b3c4d5e6f7a8b9c0d", "org_id": "664a0b1c2d3e4f5a6b7c8d9e", "job_type": "instant_clone", "status": "succeeded", "progress": 100 }, "error": false }POLLING THE JOB- Poll GET https://fi.production.flamapis.com/flam-voice-svc/api/v1/public/jobs/{job_id} (same X-API-Key header) every ~2 seconds until data.status is terminal: "succeeded", "failed", "cancelled" or "expired". "pending" and "running" mean keep polling.- On "succeeded" the voice is "ready" and can synthesize. On "failed" surface data.error (for example, a clip without at least 10 seconds of continuous speech fails the job, not the POST). On "cancelled" or "expired" surface a clear "clone did not complete" error.- Make the interval and an overall timeout configurable, accept an abort/cancel signal, and retry individual poll requests on 429, 502, 503 and network errors with backoff (a poll is a safe GET).- A 404 while polling means the job does not exist in this workspace: stop and surface it.BILLING- Enrollment is free: no character usage is charged.- To create and enroll in one call there is POST /flam-voice-svc/api/v1/public/voices/clone; do not build it here unless asked.ERRORS- 400: invalid request, e.g. missing file, a file over 20 MiB, ref_text over 4000 characters, or consent missing (send consent=true). Do not retry until fixed.- 401: X-API-Key missing, malformed, invalid or revoked, or code "key_expired". Do not retry.- 402: clone allowance used up, only on plans that cap clones (flat body, error "quota_exhausted", unit "voice_clone", with limit and used). Do not retry.- 403 with code "insufficient_scope": the key lacks the clone scope. Do not retry.- 404 with code "not_found" (also returned for a malformed id): the voice does not exist, belongs to another workspace, or is a public platform voice (only the owning workspace can enroll). Do not retry.- 413: request body over 21 MiB. Do not retry; send a smaller clip.- 429 with code "rate_limited" (over the plan's requests per second): wait the number of seconds in the Retry-After header, then retry with backoff. See /guides/rate-limits.- Enrollment is asynchronous, so engine failures (for example a clip that is too short) do not come back from this POST as 422 or 502: the job is marked "failed" and the detail is in the job's "error" field (see POLLING THE JOB).- Surface failures as one typed error (for example FinesseApiError) carrying: HTTP status, code (when present), message (the envelope "message" or the flat "error" string), optional feature / unit / limit / used, a retryable flag, the request id (the X-Request-Id response header; error bodies also carry it as request_id), and the raw body for debugging. Log the request id with every failure.- Parse error bodies defensively: if a body is not valid JSON, keep the raw text in the error.RETRIES- Do NOT retry the enroll POST automatically after a timeout or 5xx: the first attempt may already have started a job. Retry it only on 429, with exponential backoff plus jitter (at most 3 tries).- Poll requests are safe GETs: retry them on 429, 502, 503 and network errors.- Never retry 400, 401, 402, 403 or 404.ACCEPTANCE CRITERIA- enrollVoice validates the id, checks the 20 MiB limit before upload, and sends only the documented multipart fields.- On 202 it returns the typed voice and jobId; waitForJob resolves on "succeeded" and rejects on "failed" (with data.error), "cancelled", "expired" or timeout.- 404 is a distinct, non-retried not-found error. The key is never logged.TEST PLAN- Unit tests with mocked HTTP: 404; 202 returns voice + jobId; oversized file rejected locally; bad id rejected locally; waitForJob success and failure paths; poll retry on 502.- Smoke script: given FLAM_VOICE_ID (a draft voice you own) and ./sample.wav, call enrollVoice. Poll and print the final job status.RULES- Implement only what this spec describes. Do not invent parameters, fields, headers, endpoints or error codes. If something is ambiguous, missing, or conflicts with the existing codebase, stop and ask me before guessing.- Match the project's existing style and conventions; do not refactor unrelated code.
{"docsConfig":{"theme":"aspen","$schema":"https://mintlify.com/docs.json","name":"Finesse","description":"Finesse - realtime speech in 60 languages. Clone a voice and stream it in real time across 60 languages, 22 of them Indic.","colors":{"primary":"#2547F0","light":"#4F72FF","dark":"#1E3AD0"},"logo":{"light":"https://mintcdn.com/finesse-docs/u9NNXVA8yD6Y29Xd/logo/finesse-light.png?fit=max\u0026auto=format\u0026n=u9NNXVA8yD6Y29Xd\u0026q=85\u0026s=665b8b35d46e51f6ae805dffc09b6fc1","dark":"https://mintcdn.com/finesse-docs/u9NNXVA8yD6Y29Xd/logo/finesse-dark.png?fit=max\u0026auto=format\u0026n=u9NNXVA8yD6Y29Xd\u0026q=85\u0026s=1f28d4f2a2c26f147ce021c785c0e24a","href":"/introduction"},"favicon":{"light":"https://mintcdn.com/finesse-docs/0zFrmLlrHoW1tpnK/favicon.svg?fit=max\u0026auto=format\u0026n=0zFrmLlrHoW1tpnK\u0026q=85\u0026s=8b7f46bccba82eb14857fc9cc7baba20","dark":"https://mintcdn.com/finesse-docs/0zFrmLlrHoW1tpnK/favicon-dark.svg?fit=max\u0026auto=format\u0026n=0zFrmLlrHoW1tpnK\u0026q=85\u0026s=4d0d37da9ba0022182827b3ee360664c"},"api":{"mdx":{"auth":{"method":"key","name":"X-API-Key"},"server":"https://fi.production.flamapis.com"}},"appearance":{"default":"light","strict":true},"background":{"color":{"light":"#F5F3EE","dark":"#0E0F11"}},"navbar":{"links":[{"href":"/guides/authentication","label":"Get an API key"}],"primary":{"type":"button","label":"Dashboard","href":"https://finesse.flamapp.ai/dashboard"}},"fonts":{"heading":{"family":"Bricolage Grotesque","weight":700},"body":{"family":"Instrument Sans"}},"contextual":{"options":["copy","view"],"display":"header"},"styling":{"latex":false},"navigation":{"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"finesse-docs","hasAudioNarration":false,"actualSubdomain":"finesse-docs","customDomains":["docs.finesse.flamapp.ai"],"gitSource":{"type":"github","owner":"homingos","repo":"fe-flam-voice","deployBranch":"production","contentDirectory":"docs","isPrivate":true,"mountPath":"","label":""},"entitlements":{},"buildId":"6afaecc7213a1421d385ef81","clientVersion":"0.0.4344","searchFilterCounts":[{"language":"default","tag":"API reference","count":17},{"language":"default","tag":"SDKs","count":13},{"language":"default","tag":"Voices","count":8},{"language":"default","tag":"TypeScript SDK","count":7},{"language":"default","tag":"Reference","count":6},{"language":"default","tag":"Get started","count":5},{"language":"default","tag":"Speech","count":4},{"language":"default","tag":"Essentials","count":3},{"language":"default","tag":"Start here","count":2},{"language":"default","tag":"Integrations","count":2}]},"assistantConfig":{"enableAskAiButton":false,"enableStarterQuestions":false,"enableContextualStarterQuestions":false,"enableAskAiSearchBar":true},"basePath":"","hasChatPermissions":false,"hasWebMcpPermissions":false,"toggles":[{"name":"kill-isr","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-rbac-roles","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-mintlify-slack","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-integrations-settings","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"rbac-expansion","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-pr-grouping","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-prefix","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"analytics-v7","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"user-flows-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"no-publish-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving-live","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"stripTemperatureMiddleware","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"support-platform-pylon-zendesk","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"instant-rollback","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications-server","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-fable","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fixed-ai-action-pricing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"site-roles","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automation-resolve-merge-conflict","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"scoped-publishing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"mintql","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"page-level-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-version-history-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-page-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"full-page-search","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workspace-projects","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fork-pr-previews","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"revalidation-jwt","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"hobby-abuse-scan","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"dashboard-inbox","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-dual-write","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"approve-review-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-metadata","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-serve","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"live-agents","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"starter-pricing","enabled":true,"variant":{"name":"treatment","enabled":true,"payload":{"type":"string","value":"treatment"},"feature_enabled":true},"impressionData":false},{"name":"llms-txt-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"wildcard-email-auth","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false}],"starterQuestions":[],"googleFontsInlined":true},"customCss":[]}
{"page":{"pagePath":"voice-api/enroll-voice","slug":"/voice-api/enroll-voice","pageMetadata":{"title":"Enroll a voice","description":"Attach a reference clip to an existing voice and clone it.","api":"POST /flam-voice-svc/api/v1/public/voices/{id}/enroll","href":"/voice-api/enroll-voice"},"description":{"compiledSource":"\"use strict\";\nconst {jsx: _jsx} = arguments[0];\nconst {useMDXComponents: _provideComponents} = arguments[0];\nfunction _createMdxContent(props) {\n const _components = {\n p: \"p\",\n ..._provideComponents(),\n ...props.components\n };\n return _jsx(_components.p, {\n children: \"Attach a reference clip to an existing voice and clone it.\"\n });\n}\nfunction MDXContent(props = {}) {\n const {wrapper: MDXLayout} = {\n ..._provideComponents(),\n ...props.components\n };\n return MDXLayout ? _jsx(MDXLayout, {\n ...props,\n children: _jsx(_createMdxContent, {\n ...props\n })\n }) : _createMdxContent(props);\n}\nreturn {\n default: MDXContent\n};\n","frontmatter":{},"scope":{}},"pageType":"default","mdx":{"mdxSource":{"compiledSource":"\"use strict\";const{Fragment:_Fragment,jsx:_jsx,jsxs:_jsxs}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];function _createMdxContent(props){const _components={a:`a`,code:`code`,p:`p`,pre:`pre`,span:`span`,strong:`strong`,..._provideComponents(),...props.components},{CodeBlock,CodeGroup,Heading,Note,ParamField,ResponseField}=_components;if(!CodeBlock)_missingMdxReference(`CodeBlock`,true);if(!CodeGroup)_missingMdxReference(`CodeGroup`,true);if(!Heading)_missingMdxReference(`Heading`,true);if(!Note)_missingMdxReference(`Note`,true);if(!ParamField)_missingMdxReference(`ParamField`,true);if(!ResponseField)_missingMdxReference(`ResponseField`,true);return _jsxs(_Fragment,{children:[_jsxs(_components.p,{children:[`Enrolls an existing voice (typically one you just `,_jsx(_components.a,{href:`/voice-api/create-voice`,children:`created`}),` with status\n`,_jsx(_components.code,{children:`draft`}),`) from a reference audio clip. Enrollment runs asynchronously: the response is `,_jsx(_components.code,{children:`202 Accepted`}),`\nwith the `,_jsx(_components.code,{children:`processing`}),` voice and a `,_jsx(_components.code,{children:`job_id`}),` you poll with `,_jsx(_components.a,{href:`/voice-api/get-job`,children:_jsx(_components.code,{children:`GET /jobs/{id}`})}),`. When\nthe job reaches `,_jsx(_components.code,{children:`succeeded`}),`, the voice becomes `,_jsx(_components.code,{children:`ready`}),`. A clip the cloner can’t use fails the job\nrather than the request - the reference needs at least 10 seconds of continuous speech.`]}),`\n`,_jsx(Note,{children:_jsxs(_components.p,{children:[`Prefer `,_jsx(_components.a,{href:`/voice-api/clone-voice`,children:_jsx(_components.code,{children:`/clone`})}),` if you want to create and enroll a voice in one call. Like\ncloning, enrollment is `,_jsx(_components.strong,{children:`free`}),` - no character usage is charged.`]})}),`\n`,_jsx(Heading,{level:`4`,id:`authorization`,children:`Authorization`}),`\n`,_jsx(ParamField,{header:`X-API-Key`,type:`string`,required:true,id:`param-x-api-key`,children:_jsxs(_components.p,{children:[`Your workspace API key (`,_jsx(_components.code,{children:`flv_…`}),`). `,_jsx(_components.strong,{children:`Required scope:`}),` `,_jsx(_components.code,{children:`clone`}),`.`]})}),`\n`,_jsx(Heading,{level:`4`,id:`path-parameters`,children:`Path parameters`}),`\n`,_jsx(ParamField,{path:`id`,type:`string`,required:true,id:`param-id`,children:_jsx(_components.p,{children:`The voice id to enroll.`})}),`\n`,_jsxs(Heading,{level:`4`,id:`body-multipart/form-data`,children:[`Body (`,_jsx(_components.code,{children:`multipart/form-data`}),`)`]}),`\n`,_jsx(ParamField,{body:`file`,type:`file`,required:true,id:`param-file`,children:_jsxs(_components.p,{children:[`The reference audio clip. Maximum `,_jsx(_components.strong,{children:`20 MiB`}),`; larger uploads return `,_jsx(_components.code,{children:`400`}),`, and a request body over 21 MiB is refused with `,_jsx(_components.code,{children:`413`}),`.`]})}),`\n`,_jsx(ParamField,{body:`consent`,type:`boolean`,required:true,id:`param-consent`,children:_jsxs(_components.p,{children:[`Consent attestation. Send `,_jsx(_components.code,{children:`consent=true`}),` to attest that you hold the speaker’s permission to\nclone their voice. Accepted truthy values: `,_jsx(_components.code,{children:`true`}),`, `,_jsx(_components.code,{children:`1`}),`, `,_jsx(_components.code,{children:`on`}),`, `,_jsx(_components.code,{children:`yes`}),` (case-insensitive). Omitting\nthe field (or any other value) returns `,_jsx(_components.code,{children:`400`}),`. The attestation - who attested, via which API key,\nwhen, and which consent statement version - is recorded with the voice for audit. It is not\nreturned in API responses.`]})}),`\n`,_jsx(ParamField,{body:`language`,type:`string`,id:`param-language`,children:_jsxs(_components.p,{children:[`BCP-47 language code of the reference clip (e.g. `,_jsx(_components.code,{children:`en`}),`, `,_jsx(_components.code,{children:`hi`}),`).`]})}),`\n`,_jsx(ParamField,{body:`ref_text`,type:`string`,id:`param-ref-text`,children:_jsx(_components.p,{children:`Optional transcript of the reference clip. Improves clone quality when provided.`})}),`\n`,_jsx(Heading,{level:`4`,id:`response`,children:`Response`}),`\n`,_jsx(ResponseField,{name:`data.voice`,type:`Voice`,id:`param-data-voice`,children:_jsxs(_components.p,{children:[`The `,_jsx(_components.a,{href:`/voice-api/voice-object`,children:`Voice object`}),`, now with status `,_jsx(_components.code,{children:`processing`}),`.`]})}),`\n`,_jsx(ResponseField,{name:`data.job_id`,type:`string`,id:`param-data-job-id`,children:_jsxs(_components.p,{children:[`The clone job id. Poll `,_jsx(_components.a,{href:`/voice-api/get-job`,children:_jsx(_components.code,{children:`GET /jobs/{id}`})}),` until it reaches a terminal status.`]})}),`\n`,_jsxs(CodeGroup,{children:[_jsx(CodeBlock,{filename:`cURL`,numberOfLines:`7`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`7`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`curl`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -X`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` POST`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"https://fi.production.flamapis.com/flam-voice-svc/api/v1/public/voices/665f1a2b3c4d5e6f7a8b9c0d/enroll\"`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -H`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"X-API-Key: `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`$FINESSE_API_KEY`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -F`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"consent=true\"`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -F`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"language=en\"`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -F`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"ref_text=The quick brown fox jumps over the lazy dog.\"`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -F`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"file=@./sample.wav\"`})]}),`\n`]})})}),_jsx(CodeBlock,{filename:`JavaScript`,numberOfLines:`15`,language:`javascript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`javascript`,children:_jsxs(_components.code,{language:`javascript`,numberOfLines:`15`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` { `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`readFile`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` } `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`from`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"node:fs/promises\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` id`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"665f1a2b3c4d5e6f7a8b9c0d\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` form`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` new`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` FormData`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`();`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`form`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`set`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"consent\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"true\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`);`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`form`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`set`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"language\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"en\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`);`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`form`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`set`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"ref_text\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"The quick brown fox jumps over the lazy dog.\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`);`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`form`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`set`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"file\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`new`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` Blob`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`([`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`await`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` readFile`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"./sample.wav\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)]), `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"sample.wav\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`);`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` res`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` await`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` fetch`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:\" `https://fi.production.flamapis.com/flam-voice-svc/api/v1/public/voices/\"}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#569CD6`},children:\"${\"}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`id`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#569CD6`},children:`}`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:\"/enroll`\"}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` { `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`method:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"POST\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`headers:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` { `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"X-API-Key\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` process`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`env`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:`FINESSE_API_KEY`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`body:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` form`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` },`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`);`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` { `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:`data`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` } `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` res`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`json`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`();`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`console`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`log`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`data`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`voice`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`status`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`data`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`job_id`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`);`})]}),`\n`]})})}),_jsx(CodeBlock,{filename:`Python`,numberOfLines:`12`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`12`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` os, requests`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`voice_id `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"665f1a2b3c4d5e6f7a8b9c0d\"`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`with`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:` open`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"sample.wav\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"rb\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`as`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` f:`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` res `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` requests.post(`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` f`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"https://fi.production.flamapis.com/flam-voice-svc/api/v1/public/voices/`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`{`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`voice_id`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`}`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`/enroll\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` headers`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"X-API-Key\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: os.environ[`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"FINESSE_API_KEY\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`]},`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` data`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"consent\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"true\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"language\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"en\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"ref_text\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"The quick brown fox jumps over the lazy dog.\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`},`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` files`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"file\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: (`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"sample.wav\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, f, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"audio/wav\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)},`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` )`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`data `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` res.json()[`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"data\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`]`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`print`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(data[`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"voice\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`][`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"status\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`], data[`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"job_id\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`])`})]}),`\n`]})})})]}),`\n`,_jsx(CodeBlock,{filename:`Response`,numberOfLines:`13`,language:`json`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`json`,children:_jsxs(_components.code,{language:`json`,numberOfLines:`13`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"status\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`202`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"data\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"voice\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"id\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"665f1a2b3c4d5e6f7a8b9c0d\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"name\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Studio Narrator\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"status\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"processing\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"primary_language\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"en\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` },`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"job_id\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"665f1a2b3c4d5e6f7a8b9aa01\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` },`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"error\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:`false`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})}),`\n`,`\n`,_jsx(Heading,{level:`2`,id:`prompt`,children:`Prompt`}),`\n`,_jsx(_components.p,{children:`Copy this into your coding agent (Claude Code, Cursor, Codex…) to implement this endpoint.`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`232`,language:`text`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`text`,children:_jsxs(_components.code,{language:`text`,numberOfLines:`232`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`You are implementing a typed client for one Finesse Voice API endpoint: \"Enroll a voice\".`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`Everything you need is in this prompt. Do not invent anything that is not specified here.`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`WHAT TO BUILD`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`- A function enrollVoice(voiceId, input) (name it per the project's conventions) that attaches a`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` reference clip to an existing voice (typically a \"draft\" voice from POST /flam-voice-svc/api/v1/public/voices) and`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` starts cloning it, returning { voice, jobId }.`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`- A function waitForJob(jobId, options) that polls the clone job until it reaches a terminal`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` status (reuse an existing one if the project already has it).`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`- Detect the stack first: look for package.json, tsconfig.json, pyproject.toml,`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` requirements.txt, go.mod, Gemfile, composer.json and similar. Use the project's language, HTTP`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` client, module layout, error-handling conventions and test runner. If there is no project yet or`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` the stack is unclear, use TypeScript on Node 18+ with the built-in fetch and no new dependencies.`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`- If the project already has a Finesse API client module, add this to it (reuse its auth, base`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` URL, error type and retry helper) instead of creating a parallel one.`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`- Keep the base URL (https://fi.production.flamapis.com) in one constant or config value.`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`ENDPOINT`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`- Method: POST`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`- URL: https://fi.production.flamapis.com/flam-voice-svc/api/v1/public/voices/{id}/enroll`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`- Body: multipart/form-data`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`- Enrollment is asynchronous: the response is 202 Accepted with the voice (now \"processing\") and a`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` job_id to poll. When the job reaches \"succeeded\", the voice becomes \"ready\".`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`PARAMETERS`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`- id (path, string, required): the voice id to enroll, a 24-character hex string. Validate it`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` locally against /^[0-9a-f]{24}$/i and URL-encode it. The voice must belong to the key's`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` workspace.`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`REQUEST FIELDS (multipart/form-data)`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`- Send multipart/form-data. Do not set the Content-Type header yourself; let the HTTP library`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` add it with the multipart boundary.`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`- file (file, required): the reference audio clip. Maximum 20 MiB (20 * 1024 * 1024 bytes);`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` larger uploads return 400 (413 when the whole request body exceeds 21 MiB), so check the size`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` locally before uploading. Send a filename.`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`- language (text, optional): BCP-47 code of the reference clip (e.g. \"en\", \"hi\").`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`- ref_text (text, optional): transcript of the reference clip. Improves clone quality.`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`- Omit optional fields that the caller did not provide.`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`Equivalent curl:`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` curl -X POST \"https://fi.production.flamapis.com/flam-voice-svc/api/v1/public/voices/665f1a2b3c4d5e6f7a8b9c0d/enroll\" \\\\`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` -H \"X-API-Key: $FINESSE_API_KEY\" \\\\`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` -F \"language=en\" \\\\`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` -F \"ref_text=The quick brown fox jumps over the lazy dog.\" \\\\`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` -F \"file=@./sample.wav\"`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`AUTHENTICATION`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`- Send the header X-API-Key: \u003cworkspace API key> on every request. Keys start with \"flv_\".`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`- Required scope: clone. Keys carry one or more scopes (voices:read, voices:write, clone,`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` tts); a key without this scope gets 403 with code \"insufficient_scope\". Keys created before`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` scopes existed have all four.`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`- Read the key from the environment variable FINESSE_API_KEY (or the project's existing secrets or`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` config mechanism). Fail fast with a clear error if it is missing, before making any request.`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`- Never hard-code, log or commit the key, and never ship it in browser/client-side code: call this`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` from server-side code only. Treat it like a password.`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`- A key is bound to one workspace. Referencing a voice or job from another workspace returns 404.`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`- Keys can expire: an expired key returns 401 with code \"key_expired\". Do not retry; surface it so`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` an operator can rotate the key.`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`RESPONSE ENVELOPE`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`JSON responses use one envelope. On success \"error\" is false and the payload is in \"data\":`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` {`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` \"status\": 200,`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` \"data\": { \"...\": \"endpoint payload\" },`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` \"error\": false`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`On failure \"error\" is true, \"data\" is omitted and \"message\" carries the detail:`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` {`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` \"status\": 404,`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` \"error\": true,`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` \"message\": \"Voice not found\"`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`Billing and plan denials do NOT use the envelope. They return a flat JSON body whose \"error\"`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`field is a string, not a boolean:`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` { \"error\": \"plan limit reached\", \"feature\": \"max_voices\", \"limit\": 10 }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` { \"error\": \"quota_exhausted\", \"unit\": \"character\", \"limit\": 100000, \"used\": 100000 }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`The \"error\" string is the denial reason (for example quota_exhausted, insufficient_credits,`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`feature_disabled, or \"plan limit reached\"). Tell the two shapes apart by`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`checking whether \"error\" is a boolean (envelope) or a string (flat denial), and expose`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`feature / unit / limit / used on your error type when present.`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`SUCCESS RESPONSE (202, application/json)`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` {`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` \"status\": 202,`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` \"data\": {`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` \"voice\": {`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` \"id\": \"665f1a2b3c4d5e6f7a8b9c0d\",`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` \"name\": \"Studio Narrator\",`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` \"status\": \"processing\",`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` \"primary_language\": \"en\"`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` },`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` \"job_id\": \"665f1a2b3c4d5e6f7a8b9aa0\"`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` },`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` \"error\": false`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`VOICE OBJECT (define a type for it; timestamps are Unix epoch MILLISECONDS)`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`- id: string. Unique voice id, 24-character hex. Used by the synthesize endpoints.`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`- name: string. Display name.`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`- description: string, optional.`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`- status: string. Only \"ready\" voices can synthesize. All values: \"draft\" (created, no audio yet),`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` \"uploading\", \"queued\", \"verifying\", \"processing\", \"training\" (in progress), \"ready\", \"failed\"`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` (creation did not succeed), \"archived\" and \"deleted\".`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` Type it as a string union of these values but tolerate other strings (treat them as not usable).`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`- clone_method: \"instant\" | \"professional\" | \"design\" | \"remix\" | \"guided\".`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`- visibility: \"private\" | \"org\" | \"public\".`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`- primary_language: string, BCP-47 (e.g. \"en\"). Used when a synthesis request omits language.`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`- labels: array of { key: string, value: string }, optional. Common keys: accent, gender, age,`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` use_case. Example: [{ \"key\": \"accent\", \"value\": \"american\" }]`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`- settings: object, optional, present only when configured. Synthesis defaults: stability,`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` similarity, style, speed, pitch, volume, use_speaker_boost, emotion, engine_params.`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`- sample_audio_url: string, optional. Public URL of a short preview clip.`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`- base_voice_id: string, optional. Present when derived from another voice (clone_method \"remix\").`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`- created_at, updated_at: integers (epoch ms).`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`Optional fields may be absent. Responses may contain extra fields: ignore them, never fail on them.`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`Example:`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` {`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` \"id\": \"665f1a2b3c4d5e6f7a8b9c0d\",`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` \"name\": \"Studio Narrator\",`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` \"description\": \"Warm, neutral narration voice.\",`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` \"status\": \"ready\",`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` \"clone_method\": \"instant\",`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` \"visibility\": \"public\",`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` \"primary_language\": \"en\",`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` \"labels\": [`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` { \"key\": \"accent\", \"value\": \"american\" },`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` { \"key\": \"gender\", \"value\": \"female\" }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` ],`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` \"sample_audio_url\": \"https://storage.googleapis.com/.../sample.wav\",`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` \"created_at\": 1717939200000,`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` \"updated_at\": 1717939260000`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`JOB OBJECT (returned by GET https://fi.production.flamapis.com/flam-voice-svc/api/v1/public/jobs/{id} in \"data\")`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`- id: string. The job id.`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`- voice_id: string. The voice this job is enrolling.`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`- org_id: string. The owning workspace.`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`- job_type: string, e.g. \"instant_clone\", \"pro_train\", \"verify\", \"localize\", \"design_preview\",`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` \"reembed\".`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`- status: \"pending\" | \"running\" while in progress; terminal states are \"succeeded\", \"failed\",`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` \"cancelled\" and \"expired\". When \"succeeded\", the voice's status is \"ready\".`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`- progress: integer 0-100.`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`- error: object, present when status is \"failed\"; carries the failure reason (message, status_code).`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` {`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` \"status\": 200,`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` \"data\": {`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` \"id\": \"665f1a2b3c4d5e6f7a8b9aa0\",`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` \"voice_id\": \"665f1a2b3c4d5e6f7a8b9c0d\",`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` \"org_id\": \"664a0b1c2d3e4f5a6b7c8d9e\",`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` \"job_type\": \"instant_clone\",`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` \"status\": \"succeeded\",`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` \"progress\": 100`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` },`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` \"error\": false`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`POLLING THE JOB`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`- Poll GET https://fi.production.flamapis.com/flam-voice-svc/api/v1/public/jobs/{job_id} (same X-API-Key header) every ~2 seconds until`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` data.status is terminal: \"succeeded\", \"failed\", \"cancelled\" or \"expired\". \"pending\" and \"running\"`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` mean keep polling.`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`- On \"succeeded\" the voice is \"ready\" and can synthesize. On \"failed\" surface data.error (for`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` example, a clip without at least 10 seconds of continuous speech fails the job, not the POST). On`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` \"cancelled\" or \"expired\" surface a clear \"clone did not complete\" error.`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`- Make the interval and an overall timeout configurable, accept an abort/cancel signal, and retry`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` individual poll requests on 429, 502, 503 and network errors with backoff (a poll is a safe GET).`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`- A 404 while polling means the job does not exist in this workspace: stop and surface it.`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`BILLING`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`- Enrollment is free: no character usage is charged.`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`- To create and enroll in one call there is POST /flam-voice-svc/api/v1/public/voices/clone; do not build it here`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` unless asked.`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`ERRORS`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`- 400: invalid request, e.g. missing file, a file over 20 MiB, ref_text over 4000 characters, or`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` consent missing (send consent=true). Do not retry until fixed.`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`- 401: X-API-Key missing, malformed, invalid or revoked, or code \"key_expired\". Do not retry.`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`- 402: clone allowance used up, only on plans that cap clones (flat body, error`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` \"quota_exhausted\", unit \"voice_clone\", with limit and used). Do not retry.`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`- 403 with code \"insufficient_scope\": the key lacks the clone scope. Do not retry.`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`- 404 with code \"not_found\" (also returned for a malformed id): the voice does not exist, belongs`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` to another workspace, or is a public platform voice (only the owning workspace can enroll). Do`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` not retry.`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`- 413: request body over 21 MiB. Do not retry; send a smaller clip.`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`- 429 with code \"rate_limited\" (over the plan's requests per second): wait the number of seconds in the Retry-After header, then retry with backoff.`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` See /guides/rate-limits.`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`- Enrollment is asynchronous, so engine failures (for example a clip that is too short) do not`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` come back from this POST as 422 or 502: the job is marked \"failed\" and the detail is in the`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` job's \"error\" field (see POLLING THE JOB).`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`- Surface failures as one typed error (for example FinesseApiError) carrying: HTTP status,`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` code (when present), message`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` (the envelope \"message\" or the flat \"error\" string), optional feature / unit / limit / used, a`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` retryable flag, the request id (the X-Request-Id response header; error bodies also carry it as`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` request_id), and the raw body for debugging. Log the request id with every failure.`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`- Parse error bodies defensively: if a body is not valid JSON, keep the raw text in the error.`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`RETRIES`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`- Do NOT retry the enroll POST automatically after a timeout or 5xx: the first attempt may already`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` have started a job. Retry it only on 429, with exponential backoff plus jitter (at most 3 tries).`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`- Poll requests are safe GETs: retry them on 429, 502, 503 and network errors.`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`- Never retry 400, 401, 402, 403 or 404.`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`ACCEPTANCE CRITERIA`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`- enrollVoice validates the id, checks the 20 MiB limit before upload, and sends only the`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` documented multipart fields.`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`- On 202 it returns the typed voice and jobId; waitForJob resolves on \"succeeded\" and rejects on`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` \"failed\" (with data.error), \"cancelled\", \"expired\" or timeout.`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`- 404 is a distinct, non-retried not-found error. The key is never logged.`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`TEST PLAN`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`- Unit tests with mocked HTTP: 404; 202 returns voice + jobId; oversized file`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` rejected locally; bad id rejected locally; waitForJob success and failure paths; poll retry on`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` 502.`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`- Smoke script: given FLAM_VOICE_ID (a draft voice you own) and ./sample.wav, call enrollVoice.`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` Poll and print the final job status.`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`RULES`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`- Implement only what this spec describes. Do not invent parameters, fields, headers, endpoints or`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` error codes. If something is ambiguous, missing, or conflicts with the existing codebase, stop`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` and ask me before guessing.`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`- Match the project's existing style and conventions; do not refactor unrelated code.`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})})]})})})]})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{default:MDXContent};function _missingMdxReference(id,component){throw new Error(`Expected `+(component?`component`:`object`)+\" `\"+id+\"` to be defined: you likely forgot to import, pass, or provide it.\")}","frontmatter":{},"scope":{"config":{},"pageMetadata":{"title":"Enroll a voice","description":"Attach a reference clip to an existing voice and clone it.","api":"POST /flam-voice-svc/api/v1/public/voices/{id}/enroll","href":"/voice-api/enroll-voice"}}},"mdxSourceWithNoJs":null,"noJsSplices":[[341,345,"Example,ResponseFiel"],[625,640,"Example)_missingMdxReference(`ResponseExample`,true);if(!ResponseField)_missingM"],[31040,31299,"_jsx(ResponseExample,{children:_jsx(CodeBlock,{filename:`202`,numberOfLines:`13`,language:`json`,chi"],[31502,31583,"json`,children:_jsxs(_components.code,{language:`json`,numberOfLines:`13`,childr"],[31659,31777,"style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{`})}),`\n`,_jsxs(_com"],[31817,31955,"[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"status\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`202`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"data\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"voice\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_"],[31998,32038,"[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"id\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"665f1a2b3c4d5e6f7a8b9c0d\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_co"],[32079,32139,"[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"name\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Studio Narrator\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"status\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"processing\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs"],[32184,32327,"[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"primary_language\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"en\"`})]}),`\n`,_jsx"],[32395,32535,"style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` },`})}),`\n`,_jsxs"],[32580,32664,"[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"job_id\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"665f1a2b3c4d5e6f7a8b9aa01\"`})]"],[32743,32861,"style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` },`})}),`\n`,_jsxs(_"],[32904,33008,"[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"error\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:`false`})]}),`\n"],[33082,33195,"style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})})}),`\n`,_jsx(Heading,{level:`2`,id:`prompt`,children:`Prompt`}),`\n`,_jsx(_components.p,{children:`Copy this into your coding agent (Claude Code, Cursor, Codex…) to implement this endpoint.`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`232`,language:`text`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`text`,children:_jsxs(_components.code,{language:`text`,numberOfLines:`232`,children:[_jsx(_componen"],[33263,33370,"You are implementing a typed client for one Finesse Voice API endpoint: \"Enroll a voice\".`})}),`\n`,_"],[33451,33560,"Everything you need is in this prompt. Do not invent anything that is not specified here.`})}),`\n`,_"],[33631,33741,""],[33832,33933,"WHAT TO BUILD`})}),`"],[34018,34093,"- A function enrollVoice(voiceId, input) (name it per the project's conventions) that attaches a`})}"],[34181,34274," reference clip to an existing voice (typically a \"draft\" voice from POST /flam-voice-svc/api/v1/public/voices) and`})}"],[34352,34353,"children:` starts cloning it, returning { voice, jobId }.`}"],[34443,34459,"- A function waitForJob(jobId, options) that polls the clone job until it reaches a terminal`})}),`\n"],[34543,34574," status (reuse an existing one if the project already has it).`})}),`\n`,_jsx(_c"],[34651,34741,"Detect the stack first: look for package.json, tsconfig.json, pyproject.toml,`})"],[34830,34861," requirements.txt, go.mod, Gemfile, composer.json and similar. Use the project's language, HTTP`})}"],[34949,35049," client, module layout, error-handling conventions and test runner. If there is no project yet or`}"],[35141,35220,"the stack is unclear, use TypeScript on Node 18+ with the built-in fetch and no new dependencies.`})"],[35299,35314,"children:`- If the project already has a Finesse API client module, add this to it (reuse its auth, base`})}),`\n`,_jsx(_"],[35390,35409," URL, error type and retry helper) instead of creating a parallel one.`})}),`\n`"],[35494,35598,"Keep the base URL (https://fi.production.flamapis.com) in one constant or config value.`})}),`\n`,_js"],[35667,35767,""],[35858,35882,"ENDPOINT`})}),`\n`,_j"],[35952,35967,"children:`- Method: POST`})}),`\n`,_jsx(_"],[36043,37790,"- URL: https://fi.pr"],[37848,37892,"{id}/enroll`})}),`\n`"],[37975,38029,"- Body: multipart/form-data`})}),`\n`,_js"],[38108,38135,"- Enrollment is asynchronous: the response is 202 Accepted with the voice (now \"processing\") and a`}"],[38227,38296,"job_id to poll. When the job reaches \"succeeded\", the voice becomes \"ready\".`})}"],[38374,38414,""],[38495,38600,"children:`PARAMETERS"],[38694,38793,"id (path, string, required): the voice id to enroll, a 24-character hex string. Validate it`})}),`\n`"],[38876,38976," locally against /^[0-9a-f]{24}$/i and URL-encode it. The voice must belong to the key's`})}),`\n`,_"],[39059,51898,""],[51990,52095,""],[52186,52202,"REQUEST FIELDS (multipart/form-data)`})}"],[52292,52392,"Send multipart/form-data. Do not set the Content-Type header yourself; let the HTTP library`})}),`\n`"],[52477,52557,"add it with the multipart boundary.`})})"],[52646,52681,"file (file, required): the reference audio clip. Maximum 20 MiB (20 * 1024 * 1024 bytes);`})}),`\n`,_"],[52762,52867," larger uploads return 400 (413 when the whole request body exceeds 21 MiB), so check the size`})})"],[52944,52949,"children:` locally before uploading. Send a filename.`})}),"],[53035,55059,"- language (text, optional): BCP-47 code of the reference clip (e.g. \"en\", \"hi\")"],[55154,55261,"ref_text (text, optional): transcript of the reference clip. Improves clone quality.`})}),`\n`,_jsx(_"],[55337,55441,"- Omit optional fields that the caller did not provide.`})})"],[55518,55603,""],[55694,55795,"Equivalent curl:`})}"],[55873,55983,""],[56074,56180," curl -X POST \"https://fi.production.flamapis.com/flam-voice-svc/api/v1/public/voices/665f1a2b3c4d5e6f7a8b9c0d/enroll\" \\\\`})}),`\n`,_jsx(_"],[56246,56254,"children:` -H \"X-API-Key: $FINESSE_API_KEY\" \\\\`})}),`\n`"],[56337,56359," -F \"language=en\" \\\\`})}),`\n`,_jsx("],[56436,56501," -F \"ref_text=The quick brown fox jumps over the lazy dog.\" \\\\`})}),`\n`,_js"],[56580,56704," -F \"file=@./sample.wav\"`})}),`\n`,_"],[56775,56801,""],[56882,56897,"children:`AUTHENTICATION`})}),`\n`,_jsx(_"],[56973,56987,"- Send the header X-API-Key: \u003cworkspace API key> on every request. Keys start with \"flv_\".`})}),`\n"],[57073,57180,"Required scope: clone. Keys carry one or more scopes (voices:read, voices:write, clone,`})}),`\n`,_js"],[57261,57332,"tts); a key without this scope gets 403 with code \"insufficient_scope\". Keys created before`})}),`\n`"],[57415,57517," scopes existed have all four.`})}),`\n`"],[57602,57683,"Read the key from the environment variable FINESSE_API_KEY (or the project's existing secrets or`})}"],[57773,57855,"config mechanism). Fail fast with a clear error if it is missing, before making any request.`})}),`\n"],[57941,58025,"Never hard-code, log or commit the key, and never ship it in browser/client-side code: call this`})}"],[58113,58215," from server-side code only. Treat it like a password.`})})"],[58302,58401,"- A key is bound to one workspace. Referencing a voice or job from another workspace returns 404.`})"],[58490,58504,"- Keys can expire: an expired key returns 401 with code \"key_expired\". Do not retry; surface it so`}"],[58594,58668," an operator can rotate the key.`})}),`"],[58743,58902,""],[58993,59022,"RESPONSE ENVELOPE`})"],[59111,59215,"JSON responses use one envelope. On success \"error\" is false and the payload is in \"data\":`})}),`\n`,"],[59287,59391,""],[59484,59543," {`})}),`\n`,_jsx(_c"],[59618,59708," \"status\": 200,"],[59802,59848," \"data\": { \"...\": \"endpoint payload\" },`})}),`\n`,_jsx(_co"],[59924,60020," \"error\": false`}"],[60112,60224," }`})}),`\n`,_jsx(_c"],[60289,60385,""],[60476,60571,"On failure \"error\" is true, \"data\" is omitted and \"message\" carries the detail:`"],[60743,60765," {`})}),`\n`,_jsx("],[60842,60940," \"status\": 404,"],[61034,61133," \"error\": true,`}"],[61223,61307," \"message\": \"Voice not found\"`})}),"],[61393,61448," }`})}),`\n`,_jsx("],[61606,61633,"Billing and plan denials do NOT use the envelope. They return a flat JSON body whose \"error\"`})}),`\n"],[61717,61813,"field is a string, not a boolean:`})}),`"],[61888,61929,""],[62020,62121," { \"error\": \"plan limit reached\", \"feature\": \"max_voices\", \"limit\": 10 }`})})"],[62210,62286," { \"error\": \"quota_exhausted\", \"unit\": \"character\", \"limit\": 100000, \"used\": 100000 }`})}),`\n`,_jsx"],[62354,62439,""],[62520,62538,"children:`The \"error\" string is the denial reason (for example quota_exhausted, insufficient_credits,`})}),`\n`,_jsx(_com"],[62611,62628,"feature_disabled, or \"plan limit reached\"). Tell the two shapes apart by`})}),`\n"],[62712,62803,"checking whether \"error\" is a boolean (envelope) or a string (flat denial), and expose`})}),`\n`,_jsx"],[62881,62995,"feature / unit / limit / used on your error type when present.`})}),`\n`,_jsx(_co"],[63059,63076,""],[63167,63262,"SUCCESS RESPONSE (202, application/json)"],[63344,63393,""],[63474,63478,"children:` {`})})"],[63565,63570," \"status\": 202,"],[63662,63765," \"data\": {`})})"],[63854,63952," \"voice\": {`})}"],[64042,64088," \"id\": \"665f1a2b3c4d5e6f7a8b9c0d\",`})}),`\n`,_jsx(_com"],[64161,64250," \"name\": \"Studio Narrator\",`})}"],[64328,64767,"children:` \"status\": \"processing\",`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` \"primary_language\": \"en\"`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` },`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` \"job_id\": \"665f1a2b3c4d5e6f7a8b9aa0\"`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` },`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` \"error\": false`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`VOICE OBJECT (define a type for it; timestamps are Unix epoch MILLISECONDS)`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`- id: string. Unique voice id, 24-character hex. Used by the synthesize endpoints.`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`- name: string. Display name.`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`- description: string, optional.`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`- status: string. Only \"ready\" voices can synthesize. All values: \"draft\" (created, no audio yet),`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` \"uploading\", \"queued\", \"verifying\", \"processing\", \"training\" (in progress), \"ready\", \"failed\"`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` (creation did not succeed), \"archived\" and \"deleted\".`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` Type it as a string union of these values but tolerate other strings (treat them as not usable).`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`- clone_method: \"instant\" | \"professional\" | \"design\" | \"remix\" | \"guided\".`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`- visibility: \"private\" | \"org\" | \"public\".`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`- primary_language: string, BCP-47 (e.g. \"en\"). Used when a synthesis request omits language.`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`- labels: array of { key: string, value: string }, optional. Common keys: accent, gender, age,`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` use_case. Example: [{ \"key\": \"accent\", \"value\": \"american\" }]`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`- settings: object, optional, present only when configured. Synthesis defaults: stability,`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` similarity, style, speed, pitch, volume, use_speaker_boost, emotion, engine_params.`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`- sample_audio_url: string, optional. Public URL of a short preview clip.`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`- base_voice_id: string, optional. Present when derived from another voice (clone_method \"remix\").`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`- created_at, updated_at: integers (epoch ms).`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`Optional fields may be absent. Responses may contain extra fields: ignore them, never fail on them.`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`Example:`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` {`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` \"id\": \"665f1a2b3c4d5e6f7a8b9c0d\",`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` \"name\": \"Studio Narrator\",`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` \"description\": \"Warm, neutral narration voice.\",`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` \"status\": \"ready\",`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` \"clone_method\": \"instant\",`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` \"visibility\": \"public\",`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` \"primary_language\": \"en\",`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` \"labels\": [`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` { \"key\": \"accent\", \"value\": \"american\" },`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` { \"key\": \"gender\", \"value\": \"female\" }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` ],`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` \"sample_audio_url\": \"https://storage.googleapis.com/.../sample.wav\",`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` \"created_at\": 1717939200000,`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` \"updated_at\": 1717939260000`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`JOB OBJECT (returned by GET https://fi.production.flamapis.com/flam-voice-svc/api/v1/public/jobs/{id} in \"data\")`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`- id: string. The job id.`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`- voice_id: string. The voice this job is enrolling.`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`- org_id: string. The owning workspace.`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`- job_type: string, e.g. \"instant_clone\", \"pro_train\", \"verify\", \"localize\", \"design_preview\",`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` \"reembed\".`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`- status: \"pending\" | \"running\" while in progress; terminal states are \"succeeded\", \"failed\",`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` \"cancelled\" and \"expired\". When \"succeeded\", the voice's status is \"ready\".`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`- progress: integer 0-100.`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`- error: object, present when status is \"failed\"; carries the failure reason (message, status_code).`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` {`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` \"status\": 200,`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` \"data\": {`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` \"id\": \"665f1a2b3c4d5e6f7a8b9aa0\",`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` \"voice_id\": \"665f1a2b3c4d5e6f7a8b9c0d\",`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` \"org_id\": \"664a0b1c2d3e4f5a6b7c8d9e\",`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` \"job_type\": \"instant_clone\",`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` \"status\": \"succeeded\",`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` \"progress\": 100`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` },`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` \"error\": false`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`POLLING THE JOB`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`- Poll GET https://fi.production.flamapis.com/flam-voice-svc/api/v1/public/jobs/{job_id} (same X-API-Key header) every ~2 seconds until`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` data.status is terminal: \"succeeded\", \"failed\", \"cancelled\" or \"expired\". \"pending\" and \"running\"`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` mean keep polling.`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`- On \"succeeded\" the voice is \"ready\" and can synthesize. On \"failed\" surface data.error (for`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` example, a clip without at least 10 seconds of continuous speech fails the job, not the POST). On`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` \"cancelled\" or \"expired\" surface a clear \"clone did not complete\" error.`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`- Make the interval and an overall timeout configurable, accept an abort/cancel signal, and retry`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` individual poll requests on 429, 502, 503 and network errors with backoff (a poll is a safe GET).`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`- A 404 while polling means the job does not exist in this workspace: stop and surface it.`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`BILLING`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`- Enrollment is free: no character usage is charged.`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`- To create and enroll in one call there is POST /flam-voice-svc/api/v1/public/voices/clone; do not build it here`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` unless asked.`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`ERRORS`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`- 400: invalid request, e.g. missing file, a file over 20 MiB, ref_text over 4000 characters, or`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` consent missing (send consent=true). Do not retry until fixed.`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`- 401: X-API-Key missing, malformed, invalid or revoked, or code \"key_expired\". Do not retry.`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`- 402: clone allowance used up, only on plans that cap clones (flat body, error`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` \"quota_exhausted\", unit \"voice_clone\", with limit and used). Do not retry.`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`- 403 with code \"insufficient_scope\": the key lacks the clone scope. Do not retry.`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`- 404 with code \"not_found\" (also returned for a malformed id): the voice does not exist, belongs`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` to another workspace, or is a public platform voice (only the owning workspace can enroll). Do`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` not retry.`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`- 413: request body over 21 MiB. Do not retry; send a smaller clip.`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`- 429 with code \"rate_limited\" (over the plan's requests per second): wait the number of seconds in the Retry-After header, then retry with backoff.`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` See /guides/rate-limits.`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`- Enrollment is asynchronous, so engine failures (for example a clip that is too short) do not`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` come back from this POST as 422 or 502: the job is marked \"failed\" and the detail is in the`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` job's \"error\" field (see POLLING THE JOB).`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`- Surface failures as one typed error (for example FinesseApiError) carrying: HTTP status,`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` code (when present), message`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` (the envelope \"message\" or the flat \"error\" string), optional feature / unit / limit / used, a`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` retryable flag, the request id (the X-Request-Id response header; error bodies also carry it as`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` request_id), and the raw body for debugging. Log the request id with every failure.`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`- Parse error bodies defensively: if a body is not valid JSON, keep the raw text in the error.`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`RETRIES`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`- Do NOT retry the enroll POST automatically after a timeout or 5xx: the first attempt may already`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` have started a job. Retry it only on 429, with exponential backoff plus jitter (at most 3 tries).`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`- Poll requests are safe GETs: retry them on 429, 502, 503 and network errors.`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`- Never retry 400, 401, 402, 403 or 404.`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`ACCEPTANCE CRITERIA`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`- enrollVoice validates the id, checks the 20 MiB limit before upload, and sends only the`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` documented multipart fields.`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`- On 202 it returns the typed voice and jobId; waitForJob resolves on \"succeeded\" and rejects on`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` \"failed\" (with data.error), \"cancelled\", \"expired\" or timeout.`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`- 404 is a distinct, non-retried not-found error. The key is never logged.`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`TEST PLAN`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`- Unit tests with mocked HTTP: 404; 202 returns voice + jobId; oversized file`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` rejected locally; bad id rejected locally; waitForJob success and failure paths; poll retry on`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` 502.`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`- Smoke script: given FLAM_VOICE_ID (a draft voice you own) and ./sample.wav, call enrollVoice.`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` Poll and print the final job status.`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`RULES`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`- Implement only what this spec describes. Do not invent parameters, fields, headers, endpoints or`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` error codes. If something is ambiguous, missing, or conflicts with the existing codebase, stop`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` and ask me before guessing.`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`- Match the project's existing style and conventions; do not refactor unrelated code.`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})})]})})})]})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{default:MDXContent};function _missingMdxReference(id,component){throw new Error(`Expected `+(component?`component`:`object`)+\" `\"+id+\"` to be defined: you likely forgot to import, pass, or provide it.\")}"]]},"mdxExtracts":{"tableOfContents":[{"title":"Authorization","slug":"authorization","depth":4,"children":[]},{"title":"Path parameters","slug":"path-parameters","depth":4,"children":[]},{"title":"Body (multipart/form-data)","slug":"body-multipart/form-data","depth":4,"children":[]},{"title":"Response","slug":"response","depth":4,"children":[]},{"title":"Prompt","slug":"prompt","depth":2,"children":[]}],"codeExamples":{"response":{"type":"ResponseExample","children":[{"filename":"202","html":"\u003cpre class=\"shiki shiki-themes github-light-default dark-plus\" style=\"background-color:#ffffff;--shiki-dark-bg:#0B0C0E;color:#1f2328;--shiki-dark:#D4D4D4\" language=\"json\">\u003ccode language=\"json\" numberOfLines=\"13\">\u003cspan class=\"line\">\u003cspan style=\"color:#1F2328;--shiki-dark:#D4D4D4\">{\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#116329;--shiki-dark:#9CDCFE\"> \"status\"\u003c/span>\u003cspan style=\"color:#1F2328;--shiki-dark:#D4D4D4\">: \u003c/span>\u003cspan style=\"color:#0550AE;--shiki-dark:#B5CEA8\">202\u003c/span>\u003cspan style=\"color:#1F2328;--shiki-dark:#D4D4D4\">,\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#116329;--shiki-dark:#9CDCFE\"> \"data\"\u003c/span>\u003cspan style=\"color:#1F2328;--shiki-dark:#D4D4D4\">: {\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#116329;--shiki-dark:#9CDCFE\"> \"voice\"\u003c/span>\u003cspan style=\"color:#1F2328;--shiki-dark:#D4D4D4\">: {\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#116329;--shiki-dark:#9CDCFE\"> \"id\"\u003c/span>\u003cspan style=\"color:#1F2328;--shiki-dark:#D4D4D4\">: \u003c/span>\u003cspan style=\"color:#0A3069;--shiki-dark:#CE9178\">\"665f1a2b3c4d5e6f7a8b9c0d\"\u003c/span>\u003cspan style=\"color:#1F2328;--shiki-dark:#D4D4D4\">,\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#116329;--shiki-dark:#9CDCFE\"> \"name\"\u003c/span>\u003cspan style=\"color:#1F2328;--shiki-dark:#D4D4D4\">: \u003c/span>\u003cspan style=\"color:#0A3069;--shiki-dark:#CE9178\">\"Studio Narrator\"\u003c/span>\u003cspan style=\"color:#1F2328;--shiki-dark:#D4D4D4\">,\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#116329;--shiki-dark:#9CDCFE\"> \"status\"\u003c/span>\u003cspan style=\"color:#1F2328;--shiki-dark:#D4D4D4\">: \u003c/span>\u003cspan style=\"color:#0A3069;--shiki-dark:#CE9178\">\"processing\"\u003c/span>\u003cspan style=\"color:#1F2328;--shiki-dark:#D4D4D4\">,\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#116329;--shiki-dark:#9CDCFE\"> \"primary_language\"\u003c/span>\u003cspan style=\"color:#1F2328;--shiki-dark:#D4D4D4\">: \u003c/span>\u003cspan style=\"color:#0A3069;--shiki-dark:#CE9178\">\"en\"\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#1F2328;--shiki-dark:#D4D4D4\"> },\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#116329;--shiki-dark:#9CDCFE\"> \"job_id\"\u003c/span>\u003cspan style=\"color:#1F2328;--shiki-dark:#D4D4D4\">: \u003c/span>\u003cspan style=\"color:#0A3069;--shiki-dark:#CE9178\">\"665f1a2b3c4d5e6f7a8b9aa01\"\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#1F2328;--shiki-dark:#D4D4D4\"> },\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#116329;--shiki-dark:#9CDCFE\"> \"error\"\u003c/span>\u003cspan style=\"color:#1F2328;--shiki-dark:#D4D4D4\">: \u003c/span>\u003cspan style=\"color:#0550AE;--shiki-dark:#569CD6\">false\u003c/span>\u003c/span>\n\u003cspan class=\"line\">\u003cspan style=\"color:#1F2328;--shiki-dark:#D4D4D4\">}\u003c/span>\u003c/span>\n\u003c/code>\u003c/pre>"}],"attributes":[]}},"endpoint":{"title":"Enroll a voice","path":"/flam-voice-svc/api/v1/public/voices/{id}/enroll","servers":[{"url":"https://fi.production.flamapis.com"}],"method":"post","request":{"security":[{"title":"API Key Auth","parameters":{"header":{"X-API-Key":{"type":"apiKey"}},"query":{},"cookie":{}}}],"parameters":{"query":{},"header":{"X-API-Key":{"schema":[{"type":"string","description":"Your workspace API key ( `flv_…` ). Required scope: `clone` .","required":true}]}},"cookie":{},"path":{"id":{"schema":[{"type":"string","description":"The voice id to enroll.","required":true}]}}},"body":{"application/json":{"schemaArray":[{"type":"object","properties":{"file":[{"type":"file","description":"The reference audio clip. Maximum 20 MiB ; larger uploads return `400` , and a request body over 21 MiB is refused with `413` .","required":true}],"consent":[{"type":"boolean","description":"Consent attestation. Send `consent=true` to attest that you hold the speaker’s permission to clone their voice. Accepted truthy values: `true` , `1` , `on` , `yes` (case-insensitive). Omitting the field (or any other value) returns `400` . The attestation - who attested, via which API key, when, and which consent statement version - is recorded with the voice for audit. It is not returned in API responses.","required":true}],"language":[{"type":"string","description":"BCP-47 language code of the reference clip (e.g. `en` , `hi` )."}],"ref_text":[{"type":"string","description":"Optional transcript of the reference clip. Improves clone quality when provided."}]}}],"examples":{"example":{"value":{"consent":true,"language":"\u003cstring>","ref_text":"\u003cstring>"}}}}}},"response":{"200":{"application/json":{"schemaArray":[{"type":"object","properties":{"data.voice":[{"type":"object","properties":{},"description":"The Voice object , now with status `processing` ."}],"data.job_id":[{"type":"string","description":"The clone job id. Poll `GET /jobs/{id}` until it reaches a terminal status."}]}}],"examples":{"example":{"value":{"data.voice":{},"data.job_id":"\u003cstring>"}}}}}},"deprecated":false}},"jsLinks":[],"subdomain":"finesse-docs","siteName":"Finesse","title":"Enroll a voice - Finesse","contextualStarterQuestions":[],"navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"lastModified":"2026-10-23T20:30:45.419Z","originalFileLocation":"voice-api/enroll-voice.mdx"},"headHtml":"\u003cscript data-mint-head>(function(){var d=document.documentElement,p=\"light\";if(!p){try{p=localStorage.getItem(\"isDarkMode\")}catch(e){}if(p==='true')p='dark';else if(p==='false')p='light';if(p!=='light'\u0026\u0026p!=='dark'\u0026\u0026p!=='system')p=\"light\"}var r=p==='system'?(matchMedia(\"(prefers-color-scheme: dark)\").matches?'dark':'light'):p;d.classList.remove(r==='dark'?'light':'dark');d.classList.add(r);d.setAttribute(\"data-theme-preference\",p)})();\u003c/script>\u003cmeta data-mint-head name=\"description\" content=\"Attach a reference clip to an existing voice and clone it.\">\u003cmeta data-mint-head name=\"application-name\" content=\"Finesse\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/finesse-docs/9nsqrG5QOUT6LAm6/_generated/favicon/android-chrome-192x192.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"apple-touch-icon\" type=\"image/png\" sizes=\"180x180\" href=\"/mintlify-assets/_mintlify/favicons/finesse-docs/9nsqrG5QOUT6LAm6/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/finesse-docs/9nsqrG5QOUT6LAm6/_generated/favicon/favicon-16x16.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/finesse-docs/9nsqrG5QOUT6LAm6/_generated/favicon/favicon-32x32.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/finesse-docs/9nsqrG5QOUT6LAm6/_generated/favicon/favicon.ico\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/finesse-docs/9nsqrG5QOUT6LAm6/_generated/favicon-dark/android-chrome-192x192.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/finesse-docs/9nsqrG5QOUT6LAm6/_generated/favicon-dark/favicon-16x16.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/finesse-docs/9nsqrG5QOUT6LAm6/_generated/favicon-dark/favicon-32x32.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/finesse-docs/9nsqrG5QOUT6LAm6/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"Enroll a voice - Finesse\">\u003cmeta data-mint-head property=\"og:description\" content=\"Attach a reference clip to an existing voice and clone it.\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"Finesse\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://docs.finesse.flamapp.ai/voice-api/enroll-voice\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://finesse-docs.mintlify.site/_mintlify/api/og/v2?division=Voices\u0026amp;title=Enroll+a+voice\u0026amp;description=Attach+a+reference+clip+to+an+existing+voice+and+clone+it.\u0026amp;theme=b900d03be7b2e5a1a2310fa6\u0026amp;signature=88e64565b616f35ecdbed7c01133354f9553f496c10afecf57b88ec6422bbd3d\">\u003cmeta data-mint-head property=\"og:image:width\" content=\"1200\">\u003cmeta data-mint-head property=\"og:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"twitter:card\" content=\"summary_large_image\">\u003cmeta data-mint-head name=\"twitter:title\" content=\"Enroll a voice - Finesse\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"Attach a reference clip to an existing voice and clone it.\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://finesse-docs.mintlify.site/_mintlify/api/og/v2?division=Voices\u0026amp;title=Enroll+a+voice\u0026amp;description=Attach+a+reference+clip+to+an+existing+voice+and+clone+it.\u0026amp;theme=b900d03be7b2e5a1a2310fa6\u0026amp;signature=88e64565b616f35ecdbed7c01133354f9553f496c10afecf57b88ec6422bbd3d\">\u003cmeta data-mint-head name=\"twitter:image:width\" content=\"1200\">\u003cmeta data-mint-head name=\"twitter:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"msapplication-config\" content=\"/mintlify-assets/_mintlify/favicons/finesse-docs/9nsqrG5QOUT6LAm6/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"Finesse\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#2547F0\">\u003clink data-mint-head rel=\"canonical\" href=\"https://docs.finesse.flamapp.ai/voice-api/enroll-voice\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/voice-api/enroll-voice.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://docs.finesse.flamapp.ai/#organization\",\"name\":\"Finesse\",\"url\":\"https://docs.finesse.flamapp.ai\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/finesse-docs/u9NNXVA8yD6Y29Xd/logo/finesse-light.png?fit=max\u0026auto=format\u0026n=u9NNXVA8yD6Y29Xd\u0026q=85\u0026s=665b8b35d46e51f6ae805dffc09b6fc1\"}},{\"@type\":\"WebSite\",\"@id\":\"https://docs.finesse.flamapp.ai#website\",\"name\":\"Finesse\",\"url\":\"https://docs.finesse.flamapp.ai\",\"publisher\":{\"@id\":\"https://docs.finesse.flamapp.ai/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://docs.finesse.flamapp.ai/voice-api/enroll-voice#webpage\",\"url\":\"https://docs.finesse.flamapp.ai/voice-api/enroll-voice\",\"name\":\"Enroll a voice\",\"description\":\"Attach a reference clip to an existing voice and clone it.\",\"dateModified\":\"2026-10-23T20:30:45.419Z\",\"isPartOf\":{\"@id\":\"https://docs.finesse.flamapp.ai#website\"},\"breadcrumb\":{\"@id\":\"https://docs.finesse.flamapp.ai/voice-api/enroll-voice#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://docs.finesse.flamapp.ai/voice-api/enroll-voice#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Voices\",\"item\":\"https://docs.finesse.flamapp.ai/voice-api/list-voices\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Enroll a voice\",\"item\":\"https://docs.finesse.flamapp.ai/voice-api/enroll-voice\"}]},{\"@type\":[\"TechArticle\",\"APIReference\"],\"@id\":\"https://docs.finesse.flamapp.ai/voice-api/enroll-voice#apireference\",\"headline\":\"Enroll a voice\",\"name\":\"Enroll a voice\",\"description\":\"Attach a reference clip to an existing voice and clone it.\",\"url\":\"https://docs.finesse.flamapp.ai/voice-api/enroll-voice\",\"mainEntityOfPage\":{\"@id\":\"https://docs.finesse.flamapp.ai/voice-api/enroll-voice#webpage\"},\"dateModified\":\"2026-10-23T20:30:45.419Z\",\"publisher\":{\"@id\":\"https://docs.finesse.flamapp.ai/#organization\"},\"isPartOf\":{\"@id\":\"https://docs.finesse.flamapp.ai#website\"}}]}\u003c/script>\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"Finesse\",\"publisher\":{\"@type\":\"Organization\",\"name\":\"Finesse\"},\"provider\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","agentPointerHref":"/voice-api/enroll-voice.md","siteName":"Finesse","nav":{"global":null,"tabs":[{"tab":"Get started","pages":[{"title":"Get started","href":"/introduction"}]},{"tab":"SDKs","pages":[{"title":"SDKs","href":"/sdks/overview"}]},{"tab":"API reference","groups":[{"group":"Authentication","icon":"lock","pages":[{"title":"Create an access token","api":"POST /flam-voice-svc/api/v1/public/tokens","tag":"START HERE","href":"/voice-api/create-token"}]},{"group":"Voices","icon":"microphone","pages":[{"title":"List voices","api":"GET /flam-voice-svc/api/v1/public/voices","href":"/voice-api/list-voices"},{"title":"Get a voice","api":"GET /flam-voice-svc/api/v1/public/voices/{id}","href":"/voice-api/get-voice"},{"title":"Create a voice","api":"POST /flam-voice-svc/api/v1/public/voices","href":"/voice-api/create-voice"},{"title":"Clone a voice","description":"Create a voice and enroll it from a reference clip in a single call.","api":"POST /flam-voice-svc/api/v1/public/voices/clone","href":"/voice-api/clone-voice"},{"title":"Enroll a voice","api":"POST /flam-voice-svc/api/v1/public/voices/{id}/enroll","href":"/voice-api/enroll-voice"},{"title":"Get a job","description":"Poll the status of an async clone/enroll job.","api":"GET /flam-voice-svc/api/v1/public/jobs/{id}","href":"/voice-api/get-job"},{"title":"Update a voice","api":"PATCH /flam-voice-svc/api/v1/public/voices/{id}","href":"/voice-api/update-voice"},{"title":"Delete a voice","api":"DELETE /flam-voice-svc/api/v1/public/voices/{id}","href":"/voice-api/delete-voice"}]},{"group":"Speech","icon":"waveform","pages":[{"title":"Synthesize speech","api":"POST /flam-voice-svc/api/v1/public/voices/{id}/speak","href":"/voice-api/synthesize-speech"},{"title":"Stream speech (SSE)","api":"POST /flam-voice-svc/api/v1/public/voices/{id}/stream","href":"/voice-api/stream-speech"},{"title":"Realtime (WebSocket)","href":"/voice-api/realtime-websocket"},{"title":"Create a direct realtime session","api":"POST /flam-voice-svc/api/v1/public/realtime/sessions","href":"/voice-api/realtime-sessions"}]},{"group":"Compatibility","icon":"plug","pages":[{"title":"OpenAI-compatible API","href":"/voice-api/openai-compatible"}]},{"group":"Reference","icon":"book","pages":[{"title":"The Voice object","href":"/voice-api/voice-object"},{"title":"Synthesize parameters","href":"/voice-api/synthesize-parameters"},{"title":"Errors \u0026 response envelope","href":"/voice-api/errors"}]}]},{"tab":"Changelog","pages":[{"title":"Changelog","href":"/changelog/api"}]}]},"basePath":"","title":"Enroll a voice - Finesse","deploymentId":"dpl_EwfxjeKENdVkfzdag8rM6mKzcTUJ","buildId":"dpl_EwfxjeKENdVkfzdag8rM6mKzcTUJ","dynamics":["c2aa737661","2b790eda92","b0f84f53ff"],"chunks":["OpenApiReferenceProvider-B8kPdtB2.js","snippetPresets-C-p1aFQ1.js","utils-B9NnUZSZ.js","style-to-object-BY3JEAdk.js","utils-DFxl7cW2.js","v4-DIgz8zy6.js","addTypeLabelsToSchema-bSr9h7OB.js","conditional-requirements-CFM0id0Q.js","cloneDeep-Bw4Gcy_r.js","_Uint8Array-C68x8Gny.js","isObject-FP1Yky1u.js","ApiExamples-BXsp8PHs.js","usePlaygroundInputsStore-BlAOLmIF.js","shallow-C2F02mqa.js","isEqual-C8iG4q2G.js","CodeSnippets-45lHR04X.js","CodeSnippet-6Cemznl-.js","use-playground-group-access-Cyy8SXp5.js","Page-CeZ_ZB5X.js","api-description-markdown-DiOdv5rp.js","DynamicMarkdown-B_9ywLDq.js","SectionHeading-Cc2r-uqU.js","MethodPill-Df3Tcu4c.js","getPastedJson-B3vrV0wE.js","Check2Icon-YQhSFafd.js","axios-CsQoIw0U.js"]}