Errors

The bitHuman API error format, HTTP status codes, and the full error-code catalog with resolution steps.

Error response format

All errors follow the same structure:

{
  "error": {
    "code": "ERROR_CODE",
    "message": "Human-readable description of what went wrong.",
    "httpStatus": 401
  },
  "status": "error",
  "status_code": 401
}

HTTP status codes

StatusMeaningCommon cause
200SuccessRequest completed.
400Bad RequestMalformed JSON or unexpected payload shape.
401UnauthorizedInvalid or missing api-secret header.
402Payment RequiredInsufficient credits — top up to continue.
404Not FoundAgent, resource, or endpoint doesn’t exist.
413Payload Too LargeFile exceeds the size limit.
415Unsupported Media TypeFile type not supported.
422Validation ErrorBody parsed but failed schema validation.
429Rate LimitedToo many requests — see rate limits.
500Internal ErrorServer-side error — retry or contact support.
503Service UnavailableAll workers busy — retry with backoff.

Error codes

Authentication

CodeHTTPResolution
UNAUTHORIZED401Check your api-secret header. Get a valid secret from Developer → API Keys.
MISSING_AUTH401Add the api-secret header to your request.
ACCOUNT_SUSPENDED401/403Balance below the -11 suspension floor. Top up, then contact support if it persists.
INSUFFICIENT_BALANCE402Top up credits at www.bithuman.ai.

Agent operations

CodeHTTPResolution
AGENT_NOT_FOUND404Check the agent code. Use POST /v1/validate to confirm your secret has access.
AGENT_FAILED400Generation failed. Check error_message; retry with different parameters.
VALIDATION_ERROR422Body failed schema validation. Include all required fields.
NO_ACTIVE_ROOMS404The agent must be in an active session before you can /speak or /add-context.
MISSING_PARAM400A required parameter was not provided.

File operations

CodeHTTPResolution
FILE_TOO_LARGE413Images 10 MB, video 100 MB, audio 50 MB, docs 10 MB.
UNSUPPORTED_TYPE415Supported: JPEG, PNG, WebP, MP4, WAV, MP3, OGG.
DOWNLOAD_FAILED400Ensure the URL is publicly accessible and returns a valid file.

Dynamics

CodeHTTPResolution
DYNAMICS_NOT_FOUND404Generate dynamics first with POST /v1/dynamics/generate.

Session & infrastructure

CodeHTTPResolution
RATE_LIMITED429Back off and retry. See rate limits.
SESSION_LIMIT429Concurrent-session limit reached. Wait for a session to end or upgrade your tier.
NO_AVAILABLE_WORKERS503All workers busy. Retry with exponential backoff (up to 5 times).
INTERNAL_ERROR500Retry once. If persistent, report via Discord.

Handling errors in Python

import requests

resp = requests.post(
    "https://api.bithuman.ai/v1/agent/generate",
    headers={"api-secret": api_secret, "Content-Type": "application/json"},
    json={"prompt": "You are a helpful assistant"},
)

if resp.status_code == 200:
    print("Agent generating:", resp.json()["agent_id"])
elif resp.status_code == 401:
    print("Invalid API secret. Check BITHUMAN_API_SECRET.")
elif resp.status_code == 429:
    print("Rate limited. Wait and retry.")
elif resp.status_code == 503:
    print("Workers busy. Retry in a few seconds.")
else:
    error = resp.json().get("error", {})
    print(f"Error {error.get('code')}: {error.get('message')}")

For 429 and 503, use exponential backoff with jitter — see rate limits for the recommended retry strategy.