Use error.code and the HTTP status for broad control flow. Use message for
diagnostics and derive a safe user-facing summary in your application. Keep
raw_message in restricted server logs; it may contain untranslated or
provider-specific details.
Do not build application logic around exact provider error sentences. Wording
can change without changing the failure class.
When the HTTP response is not successful, the request did not enter the normal
asynchronous lifecycle. Read the response body before deciding what to do.
For 400–403, change the input, credentials, account state, or balance.
For 429, wait for existing work to finish.
For a transient 5xx, use a bounded retry policy.
If a response already contains a job_id, persist it and query that task rather
than creating a replacement.
the same request fails repeatedly without an actionable validation message;
credits appear inconsistent after the task reaches a terminal state; or
a task remains non-terminal beyond your operational timeout.
Include the job_id, endpoint, UTC timestamp, HTTP status, and sanitized error
object. Never send the API key.
{"docsConfig":{"theme":"aspen","$schema":"https://mintlify.com/docs.json","name":"Legnext AI API","colors":{"primary":"#9333EA","light":"#A855F7","dark":"#7E22CE"},"logo":{"light":"https://mintcdn.com/leggie/YWSsPTgoYu8cYOsa/logo/light.svg?fit=max\u0026auto=format\u0026n=YWSsPTgoYu8cYOsa\u0026q=85\u0026s=3476ba306e8316af3dc44ed04638f199","dark":"https://mintcdn.com/leggie/YWSsPTgoYu8cYOsa/logo/dark.svg?fit=max\u0026auto=format\u0026n=YWSsPTgoYu8cYOsa\u0026q=85\u0026s=8518dbe9f82f2419cb8cba1541d42329","href":"/getting-started/ai-agents"},"favicon":"https://mintcdn.com/leggie/JEGHtJMnjFBhtevc/icon/favicon.png?fit=max\u0026auto=format\u0026n=JEGHtJMnjFBhtevc\u0026q=85\u0026s=40e499b145eb3341eb9d85c46f83d782","navbar":{"links":[{"href":"mailto:support@legnext.ai","label":"Support"}],"primary":{"type":"button","label":"Get API key","href":"https://legnext.ai/app/api-keys"}},"seo":{"metatags":{"og:type":"website","og:site_name":"Legnext AI API Documentation","og:image":"https://legnext.ai/og-image.png","twitter:card":"summary_large_image","twitter:title":"Legnext AI API - Midjourney Image \u0026 Video Generation","twitter:description":"Professional API for AI-powered image and video generation using Midjourney models"},"indexing":"all"},"contextual":{"options":["copy","chatgpt","claude","cursor","vscode","mcp","add-mcp"],"display":"header"},"styling":{"latex":true},"navigation":{"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"leggie","hasAudioNarration":false,"actualSubdomain":"leggie","customDomains":["docs.legnext.ai"],"gitSource":{"type":"github","owner":"legnext-ai","repo":"legnext_docs","deployBranch":"main","contentDirectory":"","isPrivate":true,"mountPath":"","label":""},"chroma":{"liveDeploymentHistoryId":"6add0bc59a241c7512af75f1","collectionId":"167d734c-00e3-4b41-9fa1-ed9621a7c701","schemaVersion":"v3","latestBuiltDeploymentHistoryId":"6add0bc59a241c7512af75f1"},"entitlements":{},"buildId":"6add0bc59a241c7512af75f1","clientVersion":"0.0.4021","searchFilterCounts":[{"language":"default","tag":"API reference","count":21},{"language":"default","tag":"Image Generation","count":16},{"language":"default","tag":"Start here","count":5},{"language":"default","tag":"API basics","count":4},{"language":"default","tag":"Reference","count":4},{"language":"default","tag":"Video Generation","count":3},{"language":"default","tag":"Platform integrations","count":3},{"language":"default","tag":"Account Management","count":1},{"language":"default","tag":"Task Management","count":1},{"language":"default","tag":"Updates","count":1}]},"assistantConfig":{},"basePath":"","hasChatPermissions":false,"hasWebMcpPermissions":false,"toggles":[{"name":"kill-isr","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":"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":"workos-onboarding","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"llms-txt-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"pause-universal-search-reconcile","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":"per-site-search-delta","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":"editor-private-page-search","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":"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":"workspace-projects","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"assistant-v5","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"byok-sep-25","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":"vite-origin","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-updated-9-15","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-sso-scim","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":"workos-signup","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-enabled","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false}],"googleFontsInlined":false},"customCss":[{"filePath":"style.css","content":"@media (min-width:1024px){#sidebar-content{width:16rem}}"}],"page":{"pagePath":"api-reference/errors","slug":"/api-reference/errors","pageMetadata":{"title":"Errors \u0026 recovery","description":"Decide whether to fix, wait, retry, or escalate a Legnext API failure.","href":"/api-reference/errors"},"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: \"Decide whether to fix, wait, retry, or escalate a Legnext API failure.\"\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`,li:`li`,ol:`ol`,p:`p`,pre:`pre`,span:`span`,tbody:`tbody`,td:`td`,th:`th`,thead:`thead`,tr:`tr`,ul:`ul`,..._provideComponents(),...props.components},{CodeBlock,Heading,Table,Warning}=_components;if(!CodeBlock)_missingMdxReference(`CodeBlock`,true);if(!Heading)_missingMdxReference(`Heading`,true);if(!Table)_missingMdxReference(`Table`,true);if(!Warning)_missingMdxReference(`Warning`,true);return _jsxs(_Fragment,{children:[_jsx(_components.p,{children:`Legnext failures occur either while a request is submitted or after an\nasynchronous task has been accepted. Handle those stages differently.`}),`\n`,_jsx(Heading,{level:`2`,id:`read-the-failure`,children:`Read the failure`}),`\n`,_jsxs(_components.p,{children:[`Task endpoints return the `,_jsx(_components.code,{children:`TaskResponse`}),` shape for both accepted and rejected\nrequests. A failure includes:`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`10`,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:`10`,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:` \"job_id\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"4de9c4db-31e1-43df-a2bd-d54285ce4f39\"`}),_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:`\"failed\"`}),_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:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"code\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`400`}),_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:` \"message\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Human-readable failure\"`}),_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:` \"raw_message\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Optional provider detail\"`}),_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:` \"detail\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:`null`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_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`]})})}),`\n`,_jsxs(_components.p,{children:[`Use `,_jsx(_components.code,{children:`error.code`}),` and the HTTP status for broad control flow. Use `,_jsx(_components.code,{children:`message`}),` for\ndiagnostics and derive a safe user-facing summary in your application. Keep\n`,_jsx(_components.code,{children:`raw_message`}),` in restricted server logs; it may contain untranslated or\nprovider-specific details.`]}),`\n`,_jsx(Warning,{children:_jsx(_components.p,{children:`Do not build application logic around exact provider error sentences. Wording\ncan change without changing the failure class.`})}),`\n`,_jsx(Heading,{level:`2`,id:`recovery-matrix`,children:`Recovery matrix`}),`\n`,_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{children:`Signal`}),_jsx(_components.th,{children:`Meaning`}),_jsx(_components.th,{children:`Client action`})]})}),_jsxs(_components.tbody,{children:[_jsxs(_components.tr,{children:[_jsx(_components.td,{\"data-numeric\":`true`,children:_jsx(_components.code,{children:`400`})}),_jsx(_components.td,{children:`Invalid field, unsupported parameter, incompatible model/action, or moderated input`}),_jsx(_components.td,{children:`Fix the request or source image; do not retry unchanged`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{\"data-numeric\":`true`,children:_jsx(_components.code,{children:`401`})}),_jsx(_components.td,{children:`Missing, invalid, or revoked API key`}),_jsx(_components.td,{children:`Correct or replace the key`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{\"data-numeric\":`true`,children:_jsx(_components.code,{children:`402`})}),_jsx(_components.td,{children:`Insufficient quota`}),_jsx(_components.td,{children:`Ask the user to top up, then submit a new task`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{\"data-numeric\":`true`,children:_jsx(_components.code,{children:`403`})}),_jsx(_components.td,{children:`Disabled/restricted account, moderation rejection, or daily error limit`}),_jsx(_components.td,{children:`Correct the cause or contact support; do not retry unchanged`})]}),_jsxs(_components.tr,{children:[_jsxs(_components.td,{children:[_jsx(_components.code,{children:`404`}),` from Get Task`]}),_jsx(_components.td,{children:`Unknown or expired capability URL`}),_jsxs(_components.td,{children:[`Check the `,_jsx(_components.code,{children:`job_id`}),`; the task lookup window may have expired`]})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{\"data-numeric\":`true`,children:_jsx(_components.code,{children:`429`})}),_jsx(_components.td,{children:`Concurrency or staged-queue limit reached`}),_jsx(_components.td,{children:`Wait for running tasks to finish, then retry with backoff`})]}),_jsxs(_components.tr,{children:[_jsxs(_components.td,{children:[`transient `,_jsx(_components.code,{children:`5xx`}),` or network failure`]}),_jsx(_components.td,{children:`Temporary Legnext or provider failure`}),_jsx(_components.td,{children:`Retry with capped exponential backoff and jitter`})]}),_jsxs(_components.tr,{children:[_jsxs(_components.td,{children:[`persistent `,_jsx(_components.code,{children:`5xx`}),` across attempts or unrelated jobs`]}),_jsx(_components.td,{children:`Service incident`}),_jsxs(_components.td,{children:[`Stop retrying and contact support with the `,_jsx(_components.code,{children:`job_id`})]})]}),_jsxs(_components.tr,{children:[_jsxs(_components.td,{children:[`task `,_jsx(_components.code,{children:`status: failed`})]}),_jsx(_components.td,{children:`Background processing ended unsuccessfully`}),_jsxs(_components.td,{children:[`Classify `,_jsx(_components.code,{children:`error`}),`; resubmit only when the class is retryable`]})]})]})]}),`\n`,_jsx(Heading,{level:`2`,id:`submission-and-task-failures`,children:`Submission and task failures`}),`\n`,_jsx(Heading,{level:`3`,id:`the-submit-request-was-rejected`,children:`The submit request was rejected`}),`\n`,_jsx(_components.p,{children:`When the HTTP response is not successful, the request did not enter the normal\nasynchronous lifecycle. Read the response body before deciding what to do.`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[`For `,_jsx(_components.code,{children:`400`}),`–`,_jsx(_components.code,{children:`403`}),`, change the input, credentials, account state, or balance.`]}),`\n`,_jsxs(_components.li,{children:[`For `,_jsx(_components.code,{children:`429`}),`, wait for existing work to finish.`]}),`\n`,_jsxs(_components.li,{children:[`For a transient `,_jsx(_components.code,{children:`5xx`}),`, use a bounded retry policy.`]}),`\n`]}),`\n`,_jsxs(_components.p,{children:[`If a response already contains a `,_jsx(_components.code,{children:`job_id`}),`, persist it and query that task rather\nthan creating a replacement.`]}),`\n`,_jsx(Heading,{level:`3`,id:`the-accepted-task-later-failed`,children:`The accepted task later failed`}),`\n`,_jsxs(_components.p,{children:[`A submit can return successfully and the task can later reach\n`,_jsx(_components.code,{children:`status: failed`}),`. Read `,_jsx(_components.code,{children:`error.message`}),` and `,_jsx(_components.code,{children:`error.raw_message`}),`, then classify the\nfailure:`]}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:`moderation, invalid parameters, and unsupported follow-up actions require a\nchanged request;`}),`\n`,_jsx(_components.li,{children:`timeouts, provider rate limits, and generic execution failures may be retried\nas a new task;`}),`\n`,_jsx(_components.li,{children:`repeated failures for the same valid request should be escalated.`}),`\n`]}),`\n`,_jsx(_components.p,{children:`Failed tasks are terminal. Do not keep polling them.`}),`\n`,_jsx(Heading,{level:`2`,id:`retry-without-creating-accidental-jobs`,children:`Retry without creating accidental jobs`}),`\n`,_jsx(_components.p,{children:`Legnext does not provide a submit idempotency key and does not deduplicate by\nprompt. Every repeated POST can create another billable task.`}),`\n`,_jsxs(_components.ol,{children:[`\n`,_jsxs(_components.li,{children:[`Persist the first returned `,_jsx(_components.code,{children:`job_id`}),`.`]}),`\n`,_jsxs(_components.li,{children:[`Poll that task through `,_jsx(_components.a,{href:`/api-reference/task-management/get-task`,children:`Get Task`}),`.`]}),`\n`,_jsxs(_components.li,{children:[`Deduplicate callbacks and completed-task processing by `,_jsx(_components.code,{children:`job_id`}),`.`]}),`\n`,_jsx(_components.li,{children:`Use your own operation ID or database constraint so two workers cannot submit\nthe same user request.`}),`\n`,_jsxs(_components.li,{children:[`Retry a submit only when no `,_jsx(_components.code,{children:`job_id`}),` was returned and accepting a possible\nduplicate is preferable to dropping the request.`]}),`\n`]}),`\n`,_jsxs(_components.p,{children:[`An internal task status of `,_jsx(_components.code,{children:`retry`}),` means Legnext is already resubmitting after a\ntransient provider failure. Keep waiting; do not submit a second task.`]}),`\n`,_jsx(Heading,{level:`2`,id:`common-non-retryable-corrections`,children:`Common non-retryable corrections`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:`Check the generated request schema for missing fields and enum values.`}),`\n`,_jsxs(_components.li,{children:[`Use the `,_jsx(_components.a,{href:`/getting-started/image-parameters`,children:`image parameter matrix`}),` for\nversion-specific Midjourney flags.`]}),`\n`,_jsxs(_components.li,{children:[`Pin `,_jsx(_components.code,{children:`--v 6.1`}),` when using legacy Character Reference (`,_jsx(_components.code,{children:`--cref`}),`); the API\ndefault is V7.`]}),`\n`,_jsxs(_components.li,{children:[`Remove unsupported flags named by a `,_jsx(_components.code,{children:`400`}),` response.`]}),`\n`,_jsxs(_components.li,{children:[`For a rejected follow-up action, choose another source image or regenerate the\nbase image. `,_jsx(_components.code,{children:`available_actions`}),` is advisory, not a guarantee.`]}),`\n`,_jsx(_components.li,{children:`For moderation failures, change the prompt or referenced image instead of\nrepeatedly submitting the same content.`}),`\n`]}),`\n`,_jsx(Heading,{level:`2`,id:`when-to-contact-support`,children:`When to contact support`}),`\n`,_jsxs(_components.p,{children:[`Email `,_jsx(_components.a,{href:`mailto:support@legnext.ai`,children:`support@legnext.ai`}),` after a bounded retry\nschedule when:`]}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[`multiple unrelated valid tasks fail with `,_jsx(_components.code,{children:`5xx`}),`;`]}),`\n`,_jsx(_components.li,{children:`the same request fails repeatedly without an actionable validation message;`}),`\n`,_jsx(_components.li,{children:`credits appear inconsistent after the task reaches a terminal state; or`}),`\n`,_jsx(_components.li,{children:`a task remains non-terminal beyond your operational timeout.`}),`\n`]}),`\n`,_jsxs(_components.p,{children:[`Include the `,_jsx(_components.code,{children:`job_id`}),`, endpoint, UTC timestamp, HTTP status, and sanitized error\nobject. Never send the API key.`]})]})}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":"Errors \u0026 recovery","description":"Decide whether to fix, wait, retry, or escalate a Legnext API failure.","href":"/api-reference/errors"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[{"title":"Read the failure","slug":"read-the-failure","depth":2,"children":[]},{"title":"Recovery matrix","slug":"recovery-matrix","depth":2,"children":[]},{"title":"Submission and task failures","slug":"submission-and-task-failures","depth":2,"children":[{"title":"The submit request was rejected","slug":"the-submit-request-was-rejected","depth":3,"children":[]},{"title":"The accepted task later failed","slug":"the-accepted-task-later-failed","depth":3,"children":[]}]},{"title":"Retry without creating accidental jobs","slug":"retry-without-creating-accidental-jobs","depth":2,"children":[]},{"title":"Common non-retryable corrections","slug":"common-non-retryable-corrections","depth":2,"children":[]},{"title":"When to contact support","slug":"when-to-contact-support","depth":2,"children":[]}],"codeExamples":{}},"jsLinks":[],"subdomain":"leggie","siteName":"Legnext AI API","title":"Errors \u0026 recovery - Legnext AI API","navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"lastModified":"2026-07-30T22:43:05.404Z","originalFileLocation":"api-reference/errors.mdx"},"headHtml":"\u003cscript data-mint-head>(function(){var d=document.documentElement,p=null;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=\"system\"}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=\"Decide whether to fix, wait, retry, or escalate a Legnext API failure.\">\u003cmeta data-mint-head name=\"application-name\" content=\"Legnext AI API\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/leggie/uqxQGNHR68mj-cfe/_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/leggie/uqxQGNHR68mj-cfe/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/leggie/uqxQGNHR68mj-cfe/_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/leggie/uqxQGNHR68mj-cfe/_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/leggie/uqxQGNHR68mj-cfe/_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/leggie/uqxQGNHR68mj-cfe/_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/leggie/uqxQGNHR68mj-cfe/_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/leggie/uqxQGNHR68mj-cfe/_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/leggie/uqxQGNHR68mj-cfe/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"Errors \u0026amp; recovery - Legnext AI API\">\u003cmeta data-mint-head property=\"og:description\" content=\"Decide whether to fix, wait, retry, or escalate a Legnext API failure.\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"Legnext AI API Documentation\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://docs.legnext.ai/api-reference/errors\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://legnext.ai/og-image.png\">\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=\"Legnext AI API - Midjourney Image \u0026amp; Video Generation\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"Professional API for AI-powered image and video generation using Midjourney models\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://legnext.ai/og-image.png\">\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/leggie/uqxQGNHR68mj-cfe/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"Legnext AI API\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#9333EA\">\u003clink data-mint-head rel=\"canonical\" href=\"https://docs.legnext.ai/api-reference/errors\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/api-reference/errors.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://docs.legnext.ai/#organization\",\"name\":\"Legnext AI API\",\"url\":\"https://docs.legnext.ai\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/leggie/YWSsPTgoYu8cYOsa/logo/light.svg?fit=max\u0026auto=format\u0026n=YWSsPTgoYu8cYOsa\u0026q=85\u0026s=3476ba306e8316af3dc44ed04638f199\"}},{\"@type\":\"WebSite\",\"@id\":\"https://docs.legnext.ai#website\",\"name\":\"Legnext AI API\",\"url\":\"https://docs.legnext.ai\",\"publisher\":{\"@id\":\"https://docs.legnext.ai/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://docs.legnext.ai/api-reference/errors#webpage\",\"url\":\"https://docs.legnext.ai/api-reference/errors\",\"name\":\"Errors \u0026 recovery\",\"description\":\"Decide whether to fix, wait, retry, or escalate a Legnext API failure.\",\"dateModified\":\"2026-07-30T22:43:05.404Z\",\"isPartOf\":{\"@id\":\"https://docs.legnext.ai#website\"},\"breadcrumb\":{\"@id\":\"https://docs.legnext.ai/api-reference/errors#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://docs.legnext.ai/api-reference/errors#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"API basics\",\"item\":\"https://docs.legnext.ai/getting-started/authentication\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Errors \u0026 recovery\",\"item\":\"https://docs.legnext.ai/api-reference/errors\"}]},{\"@type\":[\"Article\",\"TechArticle\"],\"@id\":\"https://docs.legnext.ai/api-reference/errors#article\",\"headline\":\"Errors \u0026 recovery\",\"name\":\"Errors \u0026 recovery\",\"description\":\"Decide whether to fix, wait, retry, or escalate a Legnext API failure.\",\"url\":\"https://docs.legnext.ai/api-reference/errors\",\"mainEntityOfPage\":{\"@id\":\"https://docs.legnext.ai/api-reference/errors#webpage\"},\"image\":\"https://legnext.ai/og-image.png\",\"dateModified\":\"2026-07-30T22:43:05.404Z\",\"publisher\":{\"@id\":\"https://docs.legnext.ai/#organization\"},\"isPartOf\":{\"@id\":\"https://docs.legnext.ai#website\"}}]}\u003c/script>\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"Legnext AI API\",\"creator\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","siteName":"Legnext AI API","nav":{"global":null,"groups":[{"group":"Start here","icon":"rocket","pages":[{"title":"Integrate with an AI coding agent","sidebarTitle":"Agent setup","icon":"https://mintlify.s3.us-west-1.amazonaws.com/leggie/icon/agents/claude-code.svg","href":"/getting-started/ai-agents"},{"title":"First API request","href":"/getting-started/quickstart"},{"title":"Bring Your Own Account (BYOK)","href":"/getting-started/byok"},{"title":"Prompting Basics","href":"/getting-started/prompting-basics"},{"title":"Advanced Prompting","href":"/getting-started/prompting-advanced"}]},{"group":"API basics","icon":"book-open","pages":[{"title":"Authentication","href":"/getting-started/authentication"},{"title":"Task lifecycle","description":"Integrate Legnext's asynchronous submit, wait, and persist workflow safely.","href":"/getting-started/task-lifecycle"},{"title":"Errors \u0026 recovery","href":"/api-reference/errors"},{"title":"Output Storage","description":"Persist generated files before delivery URLs and follow-up actions expire.","href":"/getting-started/output-storage"}]},{"group":"Reference","icon":"brackets-curly","pages":[{"title":"Models","href":"/getting-started/models"},{"title":"Image Parameters","mode":"wide","href":"/getting-started/image-parameters"},{"title":"Video Parameters","href":"/getting-started/video-parameters"},{"title":"SDKs \u0026 client libraries","href":"/sdks"}]},{"group":"Platform integrations","icon":"puzzle","pages":[{"title":"n8n","href":"/integrations/n8n"},{"title":"Postman","href":"/integrations/postman"},{"title":"Make","href":"/integrations/make"}]},{"group":"API reference","icon":"code","pages":[{"group":"Image Generation","pages":[{"title":"Text to Image","openapi":"POST /v1/diffusion","href":"/api-reference/image-generation/diffusion"},{"title":"Variation","openapi":"POST /v1/variation","href":"/api-reference/image-generation/variation"},{"title":"Upscale","openapi":"POST /v1/upscale","href":"/api-reference/image-generation/upscale"},{"title":"Reroll","openapi":"POST /v1/reroll","href":"/api-reference/image-generation/reroll"},{"title":"Blend","openapi":"POST /v1/blend","href":"/api-reference/image-generation/blend"},{"title":"Describe","openapi":"POST /v1/describe","href":"/api-reference/image-generation/describe"},{"title":"Shorten","openapi":"POST /v1/shorten","href":"/api-reference/image-generation/shorten"},{"title":"Pan","openapi":"POST /v1/pan","href":"/api-reference/image-generation/pan"},{"title":"Outpaint","openapi":"POST /v1/outpaint","href":"/api-reference/image-generation/outpaint"},{"title":"Inpaint","openapi":"POST /v1/inpaint","href":"/api-reference/image-generation/inpaint"},{"title":"Remix","openapi":"POST /v1/remix","href":"/api-reference/image-generation/remix"},{"title":"Edit","openapi":"POST /v1/edit","href":"/api-reference/image-generation/edit"},{"title":"Upload paint","openapi":"POST /v1/upload-paint","href":"/api-reference/image-generation/upload-paint"},{"title":"Retexture","openapi":"POST /v1/retexture","href":"/api-reference/image-generation/retexture"},{"title":"Remove Background","openapi":"POST /v1/remove-background","href":"/api-reference/image-generation/remove-background"},{"title":"Midjourney Enhance","openapi":"POST /v1/enhance","href":"/api-reference/image-generation/enhance"}]},{"group":"Video Generation","pages":[{"title":"Video Diffusion","openapi":"POST /v1/video-diffusion","href":"/api-reference/video-generation/video-diffusion"},{"title":"Extend Video","openapi":"POST /v1/extend-video","href":"/api-reference/video-generation/extend-video"},{"title":"Video Upscale","openapi":"POST /v1/video-upscale","href":"/api-reference/video-generation/video-upscale"}]},{"group":"Task Management","pages":[{"title":"Get Task","openapi":"GET /v1/job/{job_id}","href":"/api-reference/task-management/get-task"}]},{"group":"Account Management","pages":[{"title":"Get Account Balance","openapi":"GET /account/balance","href":"/api-reference/account-management/get-balance"}]}]},{"group":"Updates","icon":"newspaper","pages":[{"title":"Changelog","sidebarTitle":"Changelog","href":"/changelog"}]}]},"title":"Errors \u0026 recovery - Legnext AI API","buildId":"dpl_EnxDqhjaNc9a8MVa833TGULPd9uJ","deploymentId":"dpl_EnxDqhjaNc9a8MVa833TGULPd9uJ","dynamics":[],"chunks":[]}