---
title: "Errors"
description: "The error envelope, every error code, and when to retry."
---

> Documentation Index
> Fetch the complete documentation index at: https://threadapi.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Errors

Errors share one standard JSON envelope:

```json
{
  "error": {
    "code": "not_found",
    "message": "Reddit has no such post or subreddit.",
    "retryable": false
  }
}
```

When an error response includes `Retry-After`, the envelope also includes `"retry_after"` in seconds:

```json
{
  "error": {
    "code": "upstream_busy",
    "message": "Reddit is refusing requests right now. Retry in a few seconds.",
    "retryable": true,
    "retry_after": 2,
    "request_id": "019318b7-4d7a-7f61-b4d2-28cb81a28a21"
  }
}
```

Retry only when `retryable` is `true`, waiting at least `Retry-After` seconds when the response provides one. Failed requests cost zero credits. Every response, error or not, carries an `X-Request-Id` header; include it whenever you report an issue.

| Status | Code | Meaning | Retry & Recovery Guidance |
| :--- | :--- | :--- | :--- |
| 400 | `invalid_request` | A parameter is missing, malformed, or exceeds allowed limits. The message specifies the exact parameter. | No. Fix the request parameters. |
| 401 | `unauthorized` | The API key is missing, invalid, or has been revoked. | No. Check `Authorization: Bearer tapi_...` or generate a new key in the [console](https://app.threadapi.dev/api-keys?utm_source=docs). |
| 402 | `insufficient_credits` | Your account credit balance is empty. | No immediate retry. [Purchase a credit pack](https://app.threadapi.dev/billing?utm_source=docs) to top up. |
| 402 | `monitor_limit_reached` | You have reached the active monitor limit for your plan. The error includes `limit` and `used`. | Delete unused monitors or purchase a larger credit pack to raise the limit. |
| 403 | `forbidden_scope` | The API key lacks the required scope for this endpoint. | No. Ensure your key has `reddit:read` scope. |
| 403 | `nsfw_subreddit` | The target subreddit is marked NSFW. | Retry with `nsfw=true` query parameter. |
| 403 | `reddit_refused` | Reddit refuses access to logged-out readers (private, quarantined, or age-gated community). | No. The content is inaccessible without an authenticated Reddit user session. |
| 404 | `not_found` | Reddit has no such post, comment, user, or subreddit, or it has been permanently banned. | No. Confirm the ID, URL, or subreddit name exists. |
| 409 | `duplicate_transaction` | Two credit transactions collided on the same transaction number. Rare. | Yes, retry the request. |
| 413 | `request_entity_too_large` | The request body is larger than the API accepts. | No. Send a smaller body. |
| 429 | `rate_limited` | Exceeded the requests-per-second or burst rate limit for your key, or too many failed sign-in attempts came from your IP. Includes `upgrade_url` when a credit pack would raise the limit. | Yes, after the duration specified in the `Retry-After` header. |
| 429 | `daily_quota_exceeded` | A free-tier key used its 100 requests for the current UTC day. | Wait until 00:00 UTC daily quota reset, or [purchase any credit pack](https://app.threadapi.dev/billing?utm_source=docs) to remove the daily limit. |
| 500 | `internal` | An unexpected error on our side. Nothing was billed. | Yes, retry shortly; report the `request_id` if it persists. |
| 502 | `upstream_error` | Upstream network or HTTP protocol error communicating with Reddit. | Yes, with exponential backoff and jitter. |
| 503 | `upstream_busy` | Reddit is refusing connections or upstream egress tunnel capacity is temporarily saturated. | Yes, wait for `Retry-After` seconds (or 1–3 seconds) and retry. |
| 503 | `upstream_blocked` | Reddit is temporarily blocking requests. | Yes, wait until the next check as indicated by `Retry-After`. |
| 503 | `upstream_timeout` | Reddit took longer than the request deadline to respond. | Yes, retry shortly. |
| 503 | `upstream_quota_exhausted` | All upstream Cloudflare Worker accounts have reached daily capacity limits. | No immediate retry. Automatic reset occurs at 00:00 UTC. Check [ThreadAPI Status](https://status.threadapi.dev) for operational updates. |
| 503 | `upstream_changed` | Reddit changed its web page markup structure (e.g. comment search). | No. ThreadAPI engineers are notified automatically to deploy an engine parser update. |
| 503 | `service_unavailable` | Core billing, authentication, or monitor store is undergoing brief maintenance. | Yes, retry after a few seconds. |

## Notes on Reddit content status

A post deleted on Reddit usually still exists as an empty shell: it returns `200 OK` with `[deleted]` as its author and body. A post removed by moderators returns `[removed]`. Neither counts as an error.

## Cached threads during a Reddit block

When a cached thread is available, the post endpoint can return it with fewer comments than requested. An expired copy is kept for up to two hours after its normal cache expiry and is marked `X-Cache: STALE`. `X-Cache-Age` and JSON `meta.cache_age_seconds` give its age in seconds. Successful cached reads use the usual credits. A request that needs Reddit and cannot use the cache returns `upstream_blocked` at zero credits.

Source: https://threadapi.dev/docs/errors/index.mdx
