Skip to content

Httpbin API

by httpbin.org

No authHTTPSCORSDevelopment
Open documentation ↗

Overview

A Simple HTTP Request & Response Service

Httpbin is a development API from httpbin.org. It needs no API key. It is served over HTTPS and allows browser requests (CORS). Its OpenAPI description documents 73 endpoints.

At a glance

Authentication
No auth
HTTPS
Yes
CORS
Yes
Category
Development
Base URL
https://httpbin.org
Version
0.9.2
Endpoints
73
Spec updated
2021-06-21

Make a first request

Replace the placeholders; the documentation says exactly where credentials go.

cURL
curl -X GET "https://httpbin.org/anything" \
  -H "Accept: application/json"
JavaScript
const response = await fetch("https://httpbin.org/anything", {
  method: "GET",
  headers: {
    "Accept": "application/json",
  },
});
const data = await response.json();
console.log(data);
Python
import requests

response = requests.request(
    "GET",
    "https://httpbin.org/anything",
    headers={
    "Accept": "application/json",
    },
    timeout=30,
)
print(response.json())

Endpoints

MethodPathWhat it does
GET/absolute-redirect/{n}Absolutely 302 Redirects n times.
GET/anythingReturns anything passed in request data.
POST/anythingReturns anything passed in request data.
PUT/anythingReturns anything passed in request data.
PATCH/anythingReturns anything passed in request data.
DELETE/anythingReturns anything passed in request data.
GET/anything/{anything}Returns anything passed in request data.
POST/anything/{anything}Returns anything passed in request data.
PUT/anything/{anything}Returns anything passed in request data.
PATCH/anything/{anything}Returns anything passed in request data.
DELETE/anything/{anything}Returns anything passed in request data.
GET/base64/{value}Decodes base64url-encoded string.
GET/basic-auth/{user}/{passwd}Prompts the user for authorization using HTTP Basic Auth.
GET/bearerPrompts the user for authorization using bearer authentication.
GET/brotliReturns Brotli-encoded data.
GET/bytes/{n}Returns n random bytes generated with given seed
GET/cacheReturns a 304 if an If-Modified-Since header or If-None-Match is present. Returns the same as a GET otherwise.
GET/cache/{value}Sets a Cache-Control header for n seconds.
GET/cookiesReturns cookie data.
GET/cookies/deleteDeletes cookie(s) as provided by the query string and redirects to cookie list.
GET/cookies/setSets cookie(s) as provided by the query string and redirects to cookie list.
GET/cookies/set/{name}/{value}Sets a cookie and redirects to cookie list.
GET/deflateReturns Deflate-encoded data.
GET/delay/{delay}Returns a delayed response (max of 10 seconds).
POST/delay/{delay}Returns a delayed response (max of 10 seconds).
PUT/delay/{delay}Returns a delayed response (max of 10 seconds).
PATCH/delay/{delay}Returns a delayed response (max of 10 seconds).
DELETE/delay/{delay}Returns a delayed response (max of 10 seconds).
DELETE/deleteThe request's DELETE parameters.
GET/denyReturns page denied by robots.txt rules.
GET/digest-auth/{qop}/{user}/{passwd}Prompts the user for authorization using Digest Auth.
GET/digest-auth/{qop}/{user}/{passwd}/{algorithm}Prompts the user for authorization using Digest Auth + Algorithm.
GET/digest-auth/{qop}/{user}/{passwd}/{algorithm}/{stale_after}Prompts the user for authorization using Digest Auth + Algorithm.
GET/dripDrips data over a duration after an optional initial delay.
GET/encoding/utf8Returns a UTF-8 encoded body.
GET/etag/{etag}Assumes the resource has the given etag and responds to If-None-Match and If-Match headers appropriately.
GET/getThe request's query parameters.
GET/gzipReturns GZip-encoded data.
GET/headersReturn the incoming request's HTTP headers.
GET/hidden-basic-auth/{user}/{passwd}Prompts the user for authorization using HTTP Basic Auth.
GET/htmlReturns a simple HTML document.
GET/imageReturns a simple image of the type suggest by the Accept header.
GET/image/jpegReturns a simple JPEG image.
GET/image/pngReturns a simple PNG image.
GET/image/svgReturns a simple SVG image.
GET/image/webpReturns a simple WEBP image.
GET/ipReturns the requester's IP Address.
GET/jsonReturns a simple JSON document.
GET/links/{n}/{offset}Generate a page containing n links to other pages which do the same.
PATCH/patchThe request's PATCH parameters.
POST/postThe request's POST parameters.
PUT/putThe request's PUT parameters.
GET/range/{numbytes}Streams n random bytes generated with given seed, at given chunk size per packet.
GET/redirect-to302/3XX Redirects to the given URL.
POST/redirect-to302/3XX Redirects to the given URL.
PUT/redirect-to302/3XX Redirects to the given URL.
PATCH/redirect-to302/3XX Redirects to the given URL.
DELETE/redirect-to302/3XX Redirects to the given URL.
GET/redirect/{n}302 Redirects n times.
GET/relative-redirect/{n}Relatively 302 Redirects n times.
GET/response-headersReturns a set of response headers from the query string.
POST/response-headersReturns a set of response headers from the query string.
GET/robots.txtReturns some robots.txt rules.
GET/status/{codes}Return status code or random status code if more than one are given
POST/status/{codes}Return status code or random status code if more than one are given
PUT/status/{codes}Return status code or random status code if more than one are given
PATCH/status/{codes}Return status code or random status code if more than one are given
DELETE/status/{codes}Return status code or random status code if more than one are given
GET/stream-bytes/{n}Streams n random bytes generated with given seed, at given chunk size per packet.
GET/stream/{n}Stream n JSON responses
GET/user-agentReturn the incoming requests's User-Agent header.
GET/uuidReturn a UUID4.
GET/xmlReturns a simple XML document.

Questions

Does the Httpbin API need an API key?

No. The Httpbin API can be called without an API key or sign-up, which makes it handy for prototypes and front-end demos.

Can I call the Httpbin API from the browser?

Yes. The Httpbin API sends CORS headers, so a web page can call it directly with fetch().

Does the Httpbin API support HTTPS?

Yes, the Httpbin API is served over HTTPS.

How many endpoints does the Httpbin API have?

Its OpenAPI description lists 73 endpoints in version 0.9.2. All of them are shown on this page.

What are alternatives to the Httpbin API?

Other Development APIs include Cloudflare, Azure DevOps, IPify, App Store Connect API, StackExchange.

Compare alternatives →

Listed from public-apis (MIT), public-apis database (MIT), APIs.guru (CC0).