← All Tools

HTTP Request Builder

Build a request and get code that runs as-is in curl, JavaScript, Python, PHP, Go, Java, C# or Ruby. Quotes, backslashes, line breaks, $ or a leading @ are sent exactly as typed.

This page only writes code: it never sends your request, and everything stays in your browser.

Request Configuration

Generated Code


                    

Saved Requests (Local Storage)

Saved in this browser only. Values of headers and query parameters whose name looks like a credential (Authorization, Cookie, anything with key, token, secret, password or session in the name) and a user:password in the URL are left out. The body is saved as typed, so leave passwords out of it.

How the code is checked
  • Every value goes through the string escaping of the chosen language, so text such as ", \, ${x}, #{x}, a backtick or $(...) stays plain data and never becomes code.
  • curl uses --data-raw (a body starting with @ is not read as a file), --head for HEAD and --globoff when the URL has brackets.
  • A valid JSON body becomes a native object in JavaScript and Python (true/null become True/None). Invalid JSON, and JSON that would not arrive the same way (integers from 253 up, decimals with 16 or more significant digits, -0, duplicate keys, integer-like keys a JavaScript object would reorder) are sent as the exact text.
  • A user name and password in the URL become an Authorization: Basic header (fetch refuses credentials in a URL), a header with an empty value is written as Name; for curl and PHP so it is still sent, and a % that does not start an escape is written as %25.
  • Java leaves out the headers HttpClient refuses (Host, Content-Length, Connection, Expect, Upgrade); C# puts Content-Type on the body as .NET requires.
  • Each language was tested by running the generated program against a local echo server with tricky inputs and comparing the method, path, headers and body that arrived.

HTTP Reference

HTTP Methods

  • GET - Retrieve resource
  • POST - Create resource
  • PUT - Replace resource
  • PATCH - Partial update
  • DELETE - Remove resource
  • HEAD - Headers only

Common Headers

  • Content-Type
  • Authorization
  • Accept
  • User-Agent
  • Cache-Control
  • X-API-Key

Content Types

  • application/json
  • application/x-www-form-urlencoded
  • multipart/form-data
  • text/plain
  • text/xml

Status Codes

  • 200 - OK
  • 201 - Created
  • 400 - Bad Request
  • 401 - Unauthorized
  • 404 - Not Found
  • 500 - Server Error