Skip to main content

Documentation Index

Fetch the complete documentation index at: https://apixo.ai/docs/llms.txt

Use this file to discover all available pages before exploring further.

Overview

APIXO API uses two layers of error information:
  1. HTTP Status Codes — Returned immediately when request fails
  2. Failure Codes — Returned as failCode for failed tasks, or as a provider error identifier for some immediate errors
┌─────────────────────────────────────────────────────────────┐
│                      API Request Flow                        │
├─────────────────────────────────────────────────────────────┤
│                                                             │
│  POST /generateTask/{model}                                 │
│         │                                                   │
│         ├── Fail ──→ HTTP Status Code (400/401/429...)      │
│         │           Request rejected immediately             │
│         │                                                   │
│         └── Success ──→ 200 + taskId                        │
│                        Request accepted, task processing    │
│                             │                               │
│                             ▼                               │
│  GET /statusTask/{model}?taskId=xxx                         │
│         │                                                   │
│         ├── state: success ──→ resultUrls                   │
│         │                                                   │
│         └── state: failed ──→ Failure Code                  │
│                               (failCode/failMsg)             │
│                                                             │
└─────────────────────────────────────────────────────────────┘
TypeWhen TriggeredMeaningExample
HTTP Status CodeImmediately on requestRequest itself has issues401 Invalid API Key
Failure CodeImmediate error response or task status querySpecific provider or validation failureSensitiveContentDetected

HTTP Status Codes

CodeNameDescriptionAction
200OKRequest successfulProcess response normally
400Bad RequestInvalid request parametersCheck request body
401UnauthorizedInvalid or missing API KeyCheck API Key
402Payment RequiredInsufficient balanceTop up account
403ForbiddenContent violates policyModify content
404Not FoundResource not foundCheck model ID or task ID
429Too Many RequestsRate limit exceededWait and retry
500Server ErrorInternal server errorRetry later
502Bad GatewayUpstream provider errorRetry later
503Service UnavailableService temporarily unavailableRetry later
504Gateway TimeoutProvider timeoutRetry later

Failure Codes

When an async task fails, the status response includes failCode and failMsg:
{
  "code": 200,
  "message": "success",
  "data": {
    "state": "failed",
    "failCode": "SensitiveContentDetected",
    "failMsg": "Your content was flagged by OpenAI as violating content policies."
  }
}
Some immediate HTTP errors may use the same normalized codes and return the HTTP status shown in the tables below.
The same failCode can appear with slightly different failMsg text depending on the upstream provider. Use failCode for programmatic handling and show failMsg to support/debugging tools.

Content Policy and Safety

failCodeUsually returned withCommon meaningWhat to do
SensitiveContent400Prompt or media violates provider policyAdjust the prompt or media
SensitiveContentDetected400Content was flagged by a provider moderation systemRewrite the prompt or use safer inputs
InputImageSensitiveContentDetected400Input image contains restricted or unsupported contentUse a different image
InputOutputSensitiveContentDetected400Input or generated output was flagged as sensitiveTry different input content
ProhibitedContentDetected400Provider rejected prohibited contentTry a different prompt or media
NSFW400NSFW content detectedUse policy-compliant content
CopyrightFailed400Prompt, image, or output may violate copyright restrictionsRemove copyrighted artist/style references or use different media

Prompt and Parameter Validation

failCodeUsually returned withCommon meaningWhat to do
PromptLengthExceeded400Prompt exceeds provider length limitsShorten the prompt
PromptInvalid400Prompt is invalid, rejected, or incompatible with the selected mode/modelCheck model docs and simplify the input
InvalidPromptParameter400Prompt-related parameter is invalid or unsupportedCheck accepted values for the model
MissingParameter400One or more required request parameters are missingAdd the required field listed in the API docs
BadRequest400Request body is malformed or missing required fieldsValidate request JSON and required parameters
Validation error400Upstream provider rejected request validationCheck parameters and model constraints
ParameterError400A numeric or format constraint was not metAdjust the parameter to the allowed range
RatioError400Aspect ratio is invalid or unsupportedUse a supported ratio

Image, Video, and Media Inputs

failCodeUsually returned withCommon meaningWhat to do
ImageFormatIncorrect400Image format or MIME type is unsupportedUse a supported image format such as JPEG, PNG, or WebP
ImageSizeIncorrect400Image file size or pixel count is outside limitsResize or compress the image
InvalidImageSize400Image dimensions do not meet model requirementsCheck the model’s image size requirements
ImageNotAccess400Image URL cannot be fetched or image source is emptyUse a reachable image URL
ImageInvalid400Image was rejected by the providerTry a different image
ImageIncorrect400Image is duplicated, incompatible, or restrictedTry different source media
InputFormatIncorrect400Input media format, resolution, or pixel count is unsupportedConvert or resize the media
Upload error400Uploaded media exceeds upload constraints, commonly 10MBCompress or resize the upload
VideoIncorrect400Video contains unsupported content such as real-person footageUse a different video
VideoInvalid400Video duration, resolution, or visible subject requirements are not metCheck the model’s video requirements
InputIncorrect400Input duration or shape is invalid for the modelAdjust the input to the documented limits
INVALID_IMAGE_URL400Cannot access image URLCheck URL accessibility
INVALID_LORA_URL400Cannot download LoRA modelCheck LoRA URL

Authentication, Quota, and Rate Limits

failCodeUsually returned withCommon meaningWhat to do
AppAuthFailed401Provider authentication failedContact support if your APIXO key is valid
InsufficientQuota402Account quota is insufficientCheck account balance or quota
InsufficientBalance402Provider balance is insufficientTop up balance or contact support
RateLimited429Provider rate limited the requestWait and retry with backoff
RateLimitExceeded429API or provider rate limit exceededReduce request frequency and retry later
Timeout504Provider request timed outRetry with backoff

Upstream and Processing Failures

failCodeUsually returned withCommon meaningWhat to do
CreateTaskFailed400Task could not be created by the upstream providerRetry later or adjust input
StreamError400Streaming response failedRetry later
UpstreamInternalError400, 500Provider is temporarily unavailable, overloaded, or returned an internal errorRetry later or route to another model
UpstreamError400Upstream response was invalid or failed unexpectedlyRetry later; contact support if persistent
UpstreamResultError400Result could not be fetched from upstream providerRetry later
Website TimeOut400Provider website did not respond in timeRetry later
Task TimeOut400Task expired or is outdatedCreate a new task
INVALID_TASK_ID400Previous task ID is invalid for the requested actionCheck the original task ID

Error Response Examples

HTTP Error (Immediate Return)

400 - Parameter Error
{
  "code": 400,
  "message": "Prompt exceeds provider limit (max 2000 chars)",
  "data": null
}
401 - Authentication Failed
{
  "code": 401,
  "message": "Invalid or missing API key",
  "data": null
}
402 - Insufficient Quota
{
  "code": 402,
  "message": "Insufficient quota. Please check your account balance.",
  "data": null
}
429 - Rate Limited
{
  "code": 429,
  "message": "Provider rate limited, please retry later",
  "data": null
}
504 - Timeout
{
  "code": 504,
  "message": "Provider timeout, please retry later",
  "data": null
}

Task Failure (When Querying Status)

Content Violation
{
  "code": 200,
  "message": "success",
  "data": {
    "taskId": "task_12345678",
    "state": "failed",
    "failCode": "SensitiveContentDetected",
    "failMsg": "Your content was flagged by OpenAI as violating content policies.",
    "createTime": 1767965610929,
    "completeTime": 1767965652317
  }
}
NSFW Content
{
  "code": 200,
  "message": "success",
  "data": {
    "taskId": "task_12345678",
    "state": "failed",
    "failCode": "NSFW",
    "failMsg": "NSFW, Try different input please.",
    "createTime": 1767965610929,
    "completeTime": 1767965652317
  }
}
Image Format Error
{
  "code": 200,
  "message": "success",
  "data": {
    "taskId": "task_12345678",
    "state": "failed",
    "failCode": "ImageFormatIncorrect",
    "failMsg": "Image format is incorrect",
    "createTime": 1767965610929,
    "completeTime": 1767965652317
  }
}
Transient Upstream Error
{
  "code": 200,
  "message": "success",
  "data": {
    "taskId": "task_12345678",
    "state": "failed",
    "failCode": "UpstreamInternalError",
    "failMsg": "Request temporarily unavailable, please try again later.",
    "createTime": 1767965610929,
    "completeTime": 1767965652317
  }
}

Error Handling Best Practices

For immediate HTTP errors, retry only transient statuses such as 429, 500, 502, 503, and 504. For task failures, retry only transient failCode values such as RateLimited, RateLimitExceeded, Timeout, CreateTaskFailed, StreamError, UpstreamInternalError, UpstreamError, UpstreamResultError, and Website TimeOut.

1. Retry Strategy

Error TypeRetry?Strategy
400 (Parameter Error)NoFix parameters then retry
401 (Auth Failed)NoCheck API Key
402 (Insufficient Funds)NoCheck balance or quota
429 (Rate Limited)YesExponential backoff, wait 60s then retry
500 (Server Error)YesExponential backoff, max 3 times
502 / 503 (Provider Unavailable)YesExponential backoff, max 3 times
504 (Timeout)YesWait then retry, max 3 times
Transient task failureYesRetry only known transient failCode values
Content ViolationNoModify content then retry
Parameter or media validation errorNoFix input then retry

2. Exponential Backoff Example

async function retryWithBackoff(fn, maxRetries = 3) {
  for (let i = 0; i < maxRetries; i++) {
    try {
      return await fn();
    } catch (error) {
      if (error.code === 429 || error.code >= 500) {
        const delay = Math.pow(2, i) * 1000; // 1s, 2s, 4s
        await new Promise(resolve => setTimeout(resolve, delay));
      } else {
        throw error;
      }
    }
  }
  throw new Error('Max retries exceeded');
}

3. Content Moderation Tips

Content moderation is handled by upstream AI providers. Violations cannot be appealed through APIXO — modify your content and resubmit.
To avoid content violation errors:
  • Avoid violence, pornography, politically sensitive content
  • Check that input images comply with content policy
  • Use clear, specific descriptions, avoid ambiguous expressions
  • Test with simple, safe content first

4. Monitoring and Logging

Recommended to log for debugging:
  • taskId — Unique task identifier
  • failCode — Failure code
  • failMsg — Failure message
  • Request parameters (sanitized)

Provider-Specific Errors

OpenAI

failCodeDescription
SensitiveContentDetectedContent flagged by OpenAI as violation
InputImageSensitiveContentDetectedImages containing real people not supported

MidJourney

failCodeDescription
Website TimeOutMidJourney website unresponsive after multiple attempts
INVALID_TASK_IDInvalid previous task ID for upscale/vary

Seedream (ByteDance)

failCodeDescription
outputimagesensitivecontentdetectedOutput image contains sensitive content
InvalidImageSizeInvalid image dimensions

FAQ

Q: Got 429 error, how long should I wait?
A: Wait 60 seconds then retry, or use exponential backoff strategy.
Q: How to avoid PromptLengthExceeded error?
A: Each model has different prompt length limits, check the model documentation. Generally keep under 2000 characters.
Q: Can I appeal SensitiveContentDetected error?
A: This is the upstream AI provider’s content moderation result. Recommend modifying content and resubmitting.
Q: What should I do with 5xx errors?
A: These are temporary server issues. Use exponential backoff retry, max 3 times. If persistent, contact support.
Q: Why does task status return 200 but state is failed? A: HTTP 200 means the status query succeeded, but task execution failed. Use failCode and failMsg for the actual failure reason.

Support

Experiencing persistent errors? Contact support with:
  • taskId — Failed task ID
  • failCode — Error code
  • Request parameters (sanitized)
  • Error occurrence time
Technical Support: support@apixo.ai