protocol

HTTP Status Code

HTTP status codes are three-digit numbers in server responses that indicate the outcome of a request — success, redirection, client error, or server error.

HTTP status codes are grouped into five classes by their first digit. 1xx codes are informational (rarely encountered by scrapers). 2xx codes signal success: 200 OK (content returned), 204 No Content (success with empty body). 3xx codes are redirects: 301 Moved Permanently, 302 Found (temporary redirect), 304 Not Modified (cached content still valid).

4xx codes indicate client-side errors: 400 Bad Request (malformed request), 401 Unauthorized (authentication required), 403 Forbidden (authenticated but not permitted), 404 Not Found (resource absent), 429 Too Many Requests (rate limited, check Retry-After header). 5xx codes indicate server-side errors: 500 Internal Server Error, 502 Bad Gateway, 503 Service Unavailable, 504 Gateway Timeout.

For scrapers, 403 and 429 are the most important to handle correctly. A 403 typically means the IP or session is blocked — rotating proxies or solving a challenge is needed. A 429 means the request rate should be reduced — respect the Retry-After header or apply exponential backoff. 5xx errors are generally transient and worth retrying.

Examples

import httpx

response = httpx.get("https://example.com")
match response.status_code:
    case 200:
        process(response.text)
    case 429:
        wait = int(response.headers.get("retry-after", 60))
        time.sleep(wait)
    case 403:
        rotate_proxy()
    case _ if response.status_code >= 500:
        retry_with_backoff()

Related Terms

Extract HTTP Status Code data from any website

AlterLab returns clean, structured data from any public URL — no scraper infrastructure needed. Start free, no credit card required.

View API docs

Your first scrape.
Sixty seconds.

$1 free balance. No credit card. No SDK.Just a POST request.

terminal
curl -X POST https://api.alterlab.io/v1/scrape \
-H "X-API-Key: YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{"url": "https://example.com", "formats": ["markdown"]}'

No credit card required · Up to 5,000 free scrapes · Balance never expires

    HTTP Status Code — Web Scraping Glossary | AlterLab