# API Error Reference — Agentalog

Every 4xx or 5xx response under `/api/*` uses **RFC 9457** (`Content-Type: application/problem+json; charset=utf-8`), with a stable `code` and backward-compatible `error` and `message` fields.

## Standard envelope

```json
{
  "type": "https://agentalog.com/errors#invalid_session",
  "title": "Invalid session",
  "status": 401,
  "detail": "Sign in to an account session on this domain or supply a supported API credential.",
  "instance": "/api/me",
  "code": "invalid_session",
  "error": "invalid_session",
  "message": "Sign in to an account session on this domain or supply a supported API credential."
}
```

- `type`: problem type URI (`https://<host>/errors#<code>`).
- `title`: short summary of the problem type.
- `status`: integer HTTP status code (400–599).
- `detail`: occurrence-specific human explanation.
- `instance`: request pathname without query parameters.
- `code`: stable snake_case machine error code.
- `error` / `message`: backward-compatible aliases of `code` and `detail`.
- Relevant headers: `Retry-After` (429/503), `Allow` (405), and `PAYMENT-REQUIRED` (402 x402).

## Error code catalog

### Authentication & Access

| HTTP | Code | Description |
|---:|---|---|
| 401 | `unauthorized` | **Unauthorized** — Authentication is required or the supplied credential was not accepted. |
| 401 | `invalid_session` | **Invalid session** — Sign in to an account session on this domain or supply a supported API credential. |
| 401 | `account_required` | **Account required** — This operation requires a signed-in account. |
| 401 | `invalid_api_key` | **Invalid API key** — The API key (`mmk_…`) is invalid, revoked, or does not belong to this organization or product. |
| 401 | `invalid_token` | **Invalid token** — The bearer or OAuth token is invalid, expired, or revoked. |
| 401 | `invalid_wallet_token` | **Invalid wallet credential** — The wallet token (`mmw_…`) is invalid or expired. Authenticate the wallet again. |
| 401 | `wallet_proof_required` | **Wallet proof required** — Authenticate the paying wallet (`mmw_…`) to inspect or recover this payment. |
| 403 | `forbidden` | **Forbidden** — Your credential is valid, but it does not grant permission for this resource or action. |
| 403 | `organization_mfa_required` | **Second factor required** — Organization owners and admins must authenticate with a second factor (passkey or authenticator). |
| 403 | `organization_domain_locked` | **Organization domain locked** — This action is restricted by the organization's custom domain policy. |
| 403 | `human_verification_required` | **Human verification required** — Complete the interactive verification or use a paid/authenticated API route. |
| 403 | `bot_blocked` | **Automated crawler blocked** — Automated crawlers, indexers and liveness probes cannot submit this form. |
| 403 | `turnstile_failed` | **Verification failed** — The verification challenge did not succeed. Request a new challenge and try again. |

### Validation & Input

| HTTP | Code | Description |
|---:|---|---|
| 400 | `bad_request` | **Bad Request** — The request is malformed or missing required parameters. |
| 400 | `invalid_request` | **Invalid request** — The request URL, headers, or parameters failed validation. |
| 400 | `bad_json` | **Invalid JSON** — The request body could not be parsed as valid JSON. |
| 400 | `invalid_organization` | **Invalid organization** — Supply a valid organization identifier in X-Organization-Id or the route path. |
| 400 | `name` | **Invalid name** — Provide a valid name within the allowed length. |
| 400 | `email` | **Invalid email** — Provide a valid email address. |
| 400 | `message` | **Invalid message** — Provide a message with the required minimum length. |
| 409 | `conflict` | **Conflict** — The request conflicts with the current resource state or reuses an Idempotency-Key with a different payload. |
| 413 | `payload_too_large` | **Payload too large** — The request body exceeds the maximum size allowed for this route. |
| 413 | `body_too_large` | **Payload too large** — The request payload exceeds the maximum size accepted by this endpoint. |
| 413 | `too_large` | **Payload too large** — The submitted payload exceeds the endpoint size limit. |
| 422 | `unprocessable_entity` | **Unprocessable entity** — The request is well-formed, but one or more field values are semantically invalid. |

### Payment, Credit & Quota

| HTTP | Code | Description |
|---:|---|---|
| 402 | `payment_required` | **Payment required** — Pay per call via x402 (USDC on Base using PAYMENT-REQUIRED / accepts[]) or supply a prepaid credit token in X-Credito. |
| 402 | `payment_verification_failed` | **Payment verification failed** — The submitted x402 payment proof was rejected. Inspect detail and the quoted PAYMENT-REQUIRED terms. |
| 401 | `credito_invalido` | **Invalid credit token** — The prepaid credit token (`cred_…`) is unknown or invalid. |
| 401 | `credito_simulado` | **Simulated credit rejected** — Development test credit tokens are not accepted in production. |
| 402 | `saldo_insuficiente` | **Insufficient balance** — The account or prepaid credit balance is too low for this call. Top up credit or pay via x402. |
| 404 | `not_for_sale` | **Not for sale** — This paid route or SKU is not currently offered on this product. |

### Rate Limits

| HTTP | Code | Description |
|---:|---|---|
| 429 | `rate_limited` | **Too many requests** — Request rate or concurrency limit exceeded. Wait for the duration in the Retry-After header before retrying. |
| 429 | `rate_limit_exceeded` | **Rate limit exceeded** — The free allowance or rate window was exceeded. Wait for the next window, sign in, or pay per call. |

### Resources & Routing

| HTTP | Code | Description |
|---:|---|---|
| 404 | `not_found` | **Not found** — The API route or requested resource does not exist (or is not accessible to your credential). |
| 404 | `nao_encontrado` | **Not found** — The API route or requested resource does not exist (Portuguese-language product code equivalent to not_found). |
| 404 | `organization_not_found` | **Organization not found** — The organization does not exist or your account is not a member of it. |
| 404 | `path_template_nao_expandido` | **Unexpanded path template** — This path contains literal catalog placeholders (such as `{id}`). Replace each placeholder with a concrete value. |
| 405 | `method_not_allowed` | **Method not allowed** — This HTTP method is not accepted on this endpoint. Check the Allow header for supported methods. |
| 408 | `request_timeout` | **Request timeout** — The client did not send the complete request within the server timeout. |
| 408 | `upload_timeout` | **Upload timeout** — The request body was not received within the allowed time window. |

### Server & Availability

| HTTP | Code | Description |
|---:|---|---|
| 500 | `internal_error` | **Internal server error** — An unexpected error occurred while processing the request. Retrying is safe on idempotent routes. |
| 502 | `bad_gateway` | **Bad gateway** — An upstream dependency returned an invalid response. Retry later. |
| 502 | `send_fail` | **Delivery failed** — The upstream delivery service could not complete the request. Retry later. |
| 503 | `service_unavailable` | **Service unavailable** — The service is temporarily unavailable or at capacity. Check Retry-After and try again. |
| 503 | `auth_unavailable` | **Authentication service unavailable** — The shared authentication backend is temporarily unavailable. Retry in a moment. |
| 503 | `mail_cfg` | **Mail transport not configured** — Contact mail delivery is not configured on this instance. |

### Product-specific codes

| HTTP | Code | Description |
|---:|---|---|
| 400 | `cartao_dados` | Invalid card data (`cartao_dados`, with the `campo`). (POST /api/credito/asaas/{id}/cartao) |
| 400 | `cartao_hospedado` | Credit amount outside `pacotes` and `exatos`, amount out of range, invalid CPF/CNPJ, name or e-mail, direct card payload (`cartao_hospedado`), or the gateway refused the payer (`pagador_recusado`, with the reason in `detalhe`). (POST /api/credito/asaas) |
| 400 | `confirmation_required` | Missing `accept_data_removal: true` (`confirmation_required`). (POST /api/plans/cancel) |
| 400 | `fix_url` | `action` outside the list; `reason` missing on `block` or above 300 characters; `fix` outside `approve`; `fix_url` (URL or kind inside the fix); or the refused field of the fix (`name`, `tagline`, `category`, `golpe`). (POST /api/admin/listings/{id}) |
| 400 | `gated_tools` | `gated_tools` is missing or contains invalid tool names. (POST /api/protection/services/{id}/policy) |
| 400 | `invalid_query` | Invalid JSON, `query` shorter than 2 chars (`invalid_query`) or prompt-injection/script attempt (`prompt_injection_blocked`, emits security alert). Not charged. (GET /api/x402/smart-filter, POST /api/catalog/smart-filter) |
| 400 | `missing_input` | Paid without `url` (`missing_input`, with `example`), or with an invalid or credential-bearing `url` (`url`). Not charged. (GET /api/x402/check) |
| 400 | `nao_vigiavel` | Invalid JSON, unavailable skill review, unsupported source or a listing that cannot be watched (`nao_vigiavel`). (POST /api/me/vigia) |
| 400 | `pagador_recusado` | Credit amount outside `pacotes` and `exatos`, amount out of range, invalid CPF/CNPJ, name or e-mail, direct card payload (`cartao_hospedado`), or the gateway refused the payer (`pagador_recusado`, with the reason in `detalhe`). (POST /api/credito/asaas) |
| 400 | `prompt_injection_blocked` | Invalid JSON, `query` shorter than 2 chars (`invalid_query`) or prompt-injection/script attempt (`prompt_injection_blocked`, emits security alert). Not charged. (GET /api/x402/smart-filter, POST /api/catalog/smart-filter) |
| 401 | `key_required` | The account API key or session is missing (`key_required`). (GET /api/skills/{id}/copy) |
| 401 | `session_ended` | Sign in first (`account_required`), or the session ended (`session_ended`). (POST /api/plans/cancel, POST /api/plans/{plan}/grace) |
| 402 | `api_somente_pago` | Direct HTTP API without payment/credit (`api_somente_pago`), unauthenticated MCP (`requer_autenticacao_mcp`), or daily free allowance (1/day) / global cap reached: returns x402 quote (US$ 0.01) and credit top-up packages. (POST /api/catalog/smart-filter) |
| 402 | `requer_autenticacao_mcp` | Direct HTTP API without payment/credit (`api_somente_pago`), unauthenticated MCP (`requer_autenticacao_mcp`), or daily free allowance (1/day) / global cap reached: returns x402 quote (US$ 0.01) and credit top-up packages. (POST /api/catalog/smart-filter) |
| 403 | `forbidden_origin` | Cross-site browser request blocked (`forbidden_origin`) or missing/invalid Cloudflare Turnstile verification (`human_verification_required` / `turnstile_failed`, emits security alert). (POST /api/catalog/smart-filter) |
| 403 | `service_not_protected` | The skill is not in this account's protection (`service_not_protected`). (GET /api/skills/{id}/copy) |
| 404 | `tools_not_read` | The listing does not exist or is not visible (`not_found`), or its tools were not read yet (`tools_not_read`). (GET /api/listings/{id}/tools) |
| 404 | `unknown_plan` | Unknown plan (`unknown_plan`). (POST /api/plans/{plan}, POST /api/plans/{plan}/grace) |
| 409 | `billing_off` | Plans are not on sale now (`sales_closed`) or billing is off (`billing_off`). (POST /api/plans/{plan}) |
| 409 | `not_verifiable` | Only skills published on public GitHub can be verified (`not_verifiable`). (POST /api/skills/{id}/verification) |
| 409 | `not_verified` | The listing is not a remote Streamable HTTP MCP server, asks for its own login, is a skill without a verified copy (`not_verified`), or another protection purchase is in progress. (POST /api/protection/services) |
| 409 | `offer_unavailable` | No offer for this account or plan (`offer_unavailable`). (POST /api/plans/{plan}/grace) |
| 409 | `sales_closed` | Plans are not on sale now (`sales_closed`) or billing is off (`billing_off`). (POST /api/plans/{plan}) |
| 413 | `query_too_long` | Query exceeds 300 characters (`query_too_long`) or body exceeds 16 KiB (`body_too_large`). (GET /api/x402/smart-filter, POST /api/catalog/smart-filter) |
| 422 | `cartao_recusado` | Card declined (`cartao_recusado`). (POST /api/credito/asaas/{id}/cartao) |
| 503 | `asaas_ocupado` | Automatic Pix unavailable in this app, the gateway is busy (`asaas_ocupado`, wait `retry_after_s`), or too many charges from people not signed in waiting for payment. (POST /api/credito/asaas) |
| 503 | `check_unavailable` | The check is unavailable (`check_unavailable`). Not charged. (GET /api/x402/check) |

## Protocol exceptions

`/mcp` keeps JSON-RPC 2.0, OAuth 2.1 routes follow RFC 6749, and LLM provider proxies under `/v1/*` preserve the upstream provider format.

---

- HTML: https://agentalog.com/errors
- OpenAPI: https://agentalog.com/openapi.json
- llms.txt: https://agentalog.com/llms.txt
- API: https://agentalog.com/api/
