Reference

HTTP status codes reference for bot developers

The most useful question about a status code is not what it means but what your bot should do next. Type a code or a word to filter.

100

Continue

The server received the request headers; the client may send the body.

What a bot should do: Handled by your HTTP library; rarely seen in bot code.

101

Switching Protocols

The server agrees to switch protocols, typically to WebSocket.

What a bot should do: Expected when a gateway connection (Discord, Slack Socket Mode) upgrades to WebSocket.

200

OK

The request succeeded.

What a bot should do: Success. For webhooks, return 200 quickly so the platform does not retry.

201

Created

A new resource was created.

What a bot should do: Success; read the Location header or body for the new resource id.

202

Accepted

Accepted for processing, but not finished yet.

What a bot should do: Ideal webhook reply when you queue work for later. Poll or wait for a callback for the result.

204

No Content

Success with no response body.

What a bot should do: Success. Do not try to parse JSON from the empty body. Discord returns this for many actions.

206

Partial Content

Only part of the resource is returned, as requested by a Range header.

What a bot should do: Used when resuming large file downloads.

301

Moved Permanently

The resource has a new permanent URL.

What a bot should do: Update the URL in your config. Webhook senders usually do not follow redirects, so register the final URL.

302

Found

Temporary redirect to another URL.

What a bot should do: Follow it for GET requests if your client allows; do not rely on it for webhook endpoints.

304

Not Modified

The cached copy is still valid (conditional request).

What a bot should do: Good news for scrapers and feed readers: reuse your cached copy and save bandwidth.

307

Temporary Redirect

Temporary redirect that keeps the method and body.

What a bot should do: Safe to repeat the same POST at the new URL.

308

Permanent Redirect

Permanent redirect that keeps the method and body.

What a bot should do: Update stored URLs; repeat the request at the new location.

400

Bad Request

The request is malformed or has invalid parameters.

What a bot should do: Do not retry unchanged. Log the error description: Telegram and Discord explain exactly which field is wrong.

401

Unauthorized

Missing or invalid authentication.

What a bot should do: Check the token and header format (Bot, Bearer). Stop and alert: retrying will not help and may get the token flagged.

403

Forbidden

Authenticated, but not allowed to do this.

What a bot should do: Missing permissions or scopes, or the user blocked the bot. Do not retry; mark the chat as inactive if blocked.

404

Not Found

The resource or endpoint does not exist.

What a bot should do: Check the path, API version and ids. For a deleted message or channel, drop the job.

405

Method Not Allowed

The endpoint does not accept this HTTP method.

What a bot should do: Use the documented method (often POST). Your own webhook should return 405 for GET if it only accepts POST.

406

Not Acceptable

The server cannot produce the format requested in Accept.

What a bot should do: Send Accept: application/json or remove the header.

408

Request Timeout

The server gave up waiting for the request.

What a bot should do: Retry with backoff; check for slow uploads.

409

Conflict

The request conflicts with the current state.

What a bot should do: Telegram returns 409 when getUpdates runs while a webhook is set, or two pollers run at once. Fix the setup, do not retry.

410

Gone

The resource was removed permanently.

What a bot should do: Remove it from your database and stop requesting it.

411

Length Required

A Content-Length header is required.

What a bot should do: Send the body as a buffer or string so the client sets Content-Length.

412

Precondition Failed

A conditional header (If-Match) did not match.

What a bot should do: Someone else changed the resource; refetch and reapply.

413

Content Too Large

The request body is too large.

What a bot should do: Compress or split the file, or use the platform's upload endpoint and size limits.

414

URI Too Long

The URL is too long.

What a bot should do: Move parameters from the query string into a POST body.

415

Unsupported Media Type

The body format is not supported.

What a bot should do: Set the right Content-Type (application/json, multipart/form-data).

418

I'm a teapot

An April Fools' joke code from RFC 2324, sometimes used to refuse bots.

What a bot should do: Treat it like 403: the site does not want automated traffic.

422

Unprocessable Content

Well-formed request with semantic errors (validation failed).

What a bot should do: Fix the payload using the validation details; do not retry unchanged.

425

Too Early

The server will not process a request that might be replayed.

What a bot should do: Retry after the TLS handshake completes (avoid 0-RTT for non-idempotent calls).

426

Upgrade Required

The client must switch to another protocol.

What a bot should do: Upgrade TLS or HTTP version as indicated by the Upgrade header.

428

Precondition Required

The server requires a conditional request.

What a bot should do: Send If-Match with the current ETag.

429

Too Many Requests

Rate limit exceeded.

What a bot should do: Wait for Retry-After (Telegram: parameters.retry_after, Discord: retry_after in seconds) then retry with jittered backoff. Queue outgoing messages per chat.

431

Request Header Fields Too Large

Headers are too large.

What a bot should do: Trim cookies or oversized custom headers.

451

Unavailable For Legal Reasons

Blocked for legal reasons in this region.

What a bot should do: Do not try to bypass it; log and skip.

500

Internal Server Error

The server failed unexpectedly.

What a bot should do: Retry with exponential backoff and jitter, a few times at most. If your webhook returns 500, the platform will retry delivery.

501

Not Implemented

The server does not support this functionality.

What a bot should do: Do not retry; use a different method or endpoint.

502

Bad Gateway

A proxy or gateway got an invalid response upstream.

What a bot should do: Transient: retry with backoff. Telegram and Discord occasionally return it during incidents.

503

Service Unavailable

Overloaded or down for maintenance.

What a bot should do: Retry later, honoring Retry-After if present. Use a circuit breaker to avoid piling up requests.

504

Gateway Timeout

An upstream server did not respond in time.

What a bot should do: Retry idempotent requests. For non-idempotent ones, check whether the action happened first.

507

Insufficient Storage

The server cannot store what is needed.

What a bot should do: Retry much later or contact the provider.

520

Web Server Returned an Unknown Error

Cloudflare-specific: the origin returned an empty or unexpected response.

What a bot should do: If it is your origin, check its logs. If it is an API, retry with backoff.

521

Web Server Is Down

Cloudflare-specific: the origin refused the connection.

What a bot should do: Your server or tunnel is down; restart it.

522

Connection Timed Out

Cloudflare-specific: TCP connection to the origin timed out.

What a bot should do: Check firewall rules and that the origin is reachable.

524

A Timeout Occurred

Cloudflare-specific: the origin took longer than 100 seconds to respond.

What a bot should do: Move long work to a background job and return 202 quickly.

Retry or not: the short version

  • Retry with backoff and jitter: 408, 429 (after Retry-After), 500, 502, 503, 504.
  • Fix the request first: 400, 405, 413, 415, 422.
  • Stop and alert or clean up: 401, 403, 404, 410.

Related: Backoff calculator, Reliability and rate limits guide.