HTTPBin API
HTTP request & response testing service — inspect headers, methods and more.
What it does
httpbin is a request-and-response testing service. Endpoints echo back whatever you send — headers, query string, body, cookies, your IP — and let you trigger specific status codes, delays, redirects, gzip/deflate, basic and bearer auth, and streaming responses. Perfect for exercising an HTTP client.
Base URL
Authentication
None. Some endpoints (/basic-auth/{user}/{pass}, /bearer) simulate auth so you can test your client’s credential handling, but the service itself is open.
Code examples
# See exactly what your client sends curl -s https://httpbin.org/anything -H "X-Demo: larzos" -d hello=world
import requests
# Test retry/timeout logic against a slow or failing endpoint
requests.get("https://httpbin.org/delay/3", timeout=5)
r = requests.get("https://httpbin.org/status/503")
print(r.status_code) # 503Rate limits & quotas
No published rate limit — but it is a shared free service, so don’t load-test against it. For heavy or CI use, run your own copy: the image kennethreitz/httpbin (or mccutchen/go-httpbin) is a one-line docker run.
Key response fields
| /anything | Echoes method, args, headers, JSON/form body, files and origin IP |
| /status/{codes} | Returns that status (comma-list picks one at random) |
| /delay/{n} | Waits n seconds (max 10) before responding |
| /headers, /ip, /user-agent | Just the named piece of request metadata |
| /cache, /etag/{tag}, /gzip | Test caching and content-encoding handling |
Common errors
| (by design) | /status/500 etc. return errors on purpose — that is the feature. |
| 503 / timeouts | Occasional when the public instance is overloaded — self-host for reliability. |
| 404 | Unknown path — check the endpoint list on the homepage. |
When to use it (and alternatives)
Reach for httpbin (or Postman Echo) whenever you need to see what your HTTP client actually sends, or to simulate slow, failing or redirecting servers. For fake data rather than echo behaviour use JSONPlaceholder.
FAQ
What is the difference between /anything and /get?
/get, /post etc. only accept that one method. /anything accepts any method and echoes the full request, which is usually what you want.
Can I rely on httpbin.org in my test suite?
For a few ad-hoc checks, yes. For CI, run kennethreitz/httpbin as a container so your tests don’t break when the public site is down or slow.
How do I test authentication?
Call /basic-auth/user/pass with those credentials (200) and without them (401), or /bearer with and without an Authorization: Bearer header.
New to APIs?
Short guides for working with this API — and any other.