#Errors and limits
How AI Studio reports problems, what each status and code means, and which limits apply. The page for each API has the full error table per endpoint; this page is the overview.
{BASE_URL} = https://studio.scaletechsolutions.ai/api/v1#Error format
Errors come back with an HTTP status and a JSON body with detail:
{"detail": "Session not found."}Some errors add a stable code you can branch on, either next to detail or inside it:
{"detail": "This agent is unavailable right now. Please try again later.", "code": "agent_budget_exceeded"}Validation errors (422) use FastAPI's standard list:
{"detail": [{"loc": ["body", "message"], "msg": "Field required", "type": "missing"}]}An unexpected server error (500) carries a request_id. Include it, with the time, when you report a problem:
{"detail": "An unexpected error occurred. Our team has been notified.", "request_id": "1c672aa8-..."}#Status codes
| Status | Meaning | What to do |
|---|---|---|
| 200 / 201 | Success (201: something was created) | |
| 202 | Accepted: the work was queued (a webhook trigger, a folder sync) | Check the result later; see the API's page. |
| 204 | Success, no body (a delete or revoke) | |
| 307 | Redirect to a short-lived download URL (knowledge base downloads) | Follow redirects. |
| 400 | The request can't be done as asked (unsupported file type, disabled trigger, a connection that needs reconnecting) | Read detail; fix the input or the setup. |
| 401 | Not authenticated: no Authorization: Bearer header, or an invalid or revoked key | Check the key and the header. |
| 402 | A spending limit is reached | Try again after it resets. See Spending limits. |
| 403 | Authenticated, but not allowed (a key used for another agent, a missing permission) | Use the right key, or ask the owner for access. |
| 404 | Not found, or not yours (several routes answer 404 for something that belongs to someone else) | Check the ids. |
| 409 | Conflicts with what exists (a duplicate name, a folder already connected) | Use the existing item or another name. |
| 422 | Invalid input (missing field, wrong type, value out of range) | Fix the request using the detail list. |
| 429 | Too many requests (only where noted) | Wait and retry with backoff. |
| 500 | The run or request failed on our side | Retry; if it persists, report the request_id. |
| 502 | An outside system AI Studio depends on did not answer (for example your database) | Retry later; check that system. |
#Agents API
Common to every /public/agents route:
| Status | detail | Cause |
|---|---|---|
| 401 | "Not authenticated" | No Authorization: Bearer header |
| 401 | "Invalid or revoked API key" | Unknown or revoked key, or its creator's account is deactivated |
| 403 | "This API key does not have access to this agent." | The key belongs to another agent |
| 404 | "Agent not found." | The agent was deleted or deactivated, or the key's creator lost access to it |
| 404 | "Session not found." | Wrong session, another agent's, or created by another key |
POST .../chat also returns 402 (spending limit) and 500 "An error occurred during agent execution.".
#Errors while streaming
POST .../stream reports a failure during the turn as an error event, not an HTTP status:
{"type": "error", "code": "ai_rate_limited", "message": "..."}code | Meaning | What to do |
|---|---|---|
ai_key_invalid | The AI provider rejected AI Studio's model key | Tell the agent's owner; nothing to fix on your side. |
ai_rate_limited | The AI provider is rate limiting | Retry after a short wait. |
ai_request_rejected | The AI provider refused this request; message may say why (for example an image too large) | Change the input. |
ai_unavailable | The AI provider is down or timed out | Retry later. |
agent_budget_exceeded | The agent's spending limit is reached | Retry after it resets. |
agent_allowance_exceeded | Your key's allowance on this agent is used up | Retry after it resets, or ask the owner to raise it. |
org_budget_exceeded | The organization's spending limit is reached | Retry after it resets. |
org_member_limit_exceeded | The key owner's personal limit in the organization is reached | Retry after it resets. |
chat_failed | Anything else | Retry; report it if it persists. |
#Knowledge base API
| Status | detail (examples) | Cause |
|---|---|---|
| 400 | "Unsupported file type. Supported formats: ..." | The file type can't be ingested |
| 400 | "Your ... connection has expired. ..." with header X-Reconnect-Required | The cloud account behind a folder source must be reconnected in the app |
| 401 | "Not authenticated" / "Invalid or revoked API key" | As above |
| 404 | "Knowledge base not found", "Document not found", "Folder source not found" | Wrong id, or not this key's knowledge base |
| 409 | "'<name>' is already connected to this knowledge base." | The folder is already a source |
Use the X-Reconnect-Required header rather than the message text to detect a connection that needs reconnecting. Details: Knowledge base API.
#Webhook triggers
| Status | detail | Cause |
|---|---|---|
| 202 | "Webhook received and task dispatched." | Accepted; the run happens in the background |
| 202 | "Webhook already received and processing." | Same Idempotency-Key sent again; nothing new runs |
| 400 | "Trigger is disabled" | The trigger is switched off |
| 404 | "Webhook trigger not found or unauthorized" | Wrong id or secret, or not a webhook trigger |
A 202 only means the run was queued. Whether it succeeded is in the trigger's run history in the app. See Webhooks and triggers.
#Spending limits
AI Studio can cap what is spent on AI, per day and per month, at several levels:
| Limit | Set by | Applies to |
|---|---|---|
| Agent limit | The agent's owner | Everything the agent spends, from any caller |
| Allowance per API key | The agent's owner | What one key may spend on the agent |
| Organization limit | An organization admin | All spending in the organization |
| Member limit | An organization admin | One member's spending |
When a limit is reached, new turns are refused: 402 from /chat with a code, or an error event from /stream. Public callers always get the same neutral message ("This agent is unavailable right now. Please try again later."); amounts are never shown. A limit is checked before a turn starts, so a turn already running finishes.
Limits reset at the start of the next UTC day or month. Only the owner or an admin can change them, in the app.
#Size and other limits
Time limits at a glance
Seconds, drawn on a logarithmic scale so short and long limits fit together.
| What | Limit |
|---|---|
| Agent run started by a webhook trigger | 600 seconds, then it is stopped and the execution marked failed |
| Schedule triggers | At least 5 minutes between runs |
| Knowledge base: text indexed per document | The first 40,000 characters (spreadsheets excepted) |
| Knowledge base: scanned PDFs | OCR reads up to 80 pages |
| Knowledge base: files synced from a cloud folder | 200 MB per file |
| Knowledge base: folder sync interval | 60 to 10,080 minutes (1 hour to 1 week) |
| Custom MCP tools | 30 seconds per call |
| Database connections (setup routes) | 10 requests per minute per user |
| Database queries | See Databases for row caps and timeouts |
#Getting help
When you report a problem, include:
- the time (UTC) and the endpoint,
- the
request_idfrom a 500, if there is one, - the agent id and session id (agents), or the document id (knowledge bases).