🔒 Processed locally in your browser — no data uploaded
← Back to Home

API Request Builder

Method & URL
Headers (JSON)
Body (JSON, for POST/PUT/PATCH)
Generated Code

What the API Request Builder does

Describe one HTTP request and the page writes it out in four formats at once: a curl command, a JavaScript fetch call, a Python requests snippet and a Node.js https block. Fill in the method, the URL, headers as JSON and a JSON body where the method allows one, then press Generate Code. It is built for the moment an API document shows a curl example and you need the same call in your own language.

The page opens with the OpenAI chat completions endpoint already filled in, so the shape of a real request is visible before you type anything. Everything is assembled in your browser, which means the tool never contacts the endpoint, never checks that the URL exists and cannot tell you whether a key is valid. Treat the output as boilerplate that looks right and still needs running.

How to use it

  1. Pick the HTTP methodChoose GET, POST, PUT, PATCH or DELETE from the selector. The choice controls whether your body travels into the generated code: only POST, PUT and PATCH carry one across.
  2. Enter the URLPaste the complete endpoint including the scheme and any query string. Query parameters belong in this field, because the page has no separate parameter table to fill in.
  3. Add headers and bodyHeaders go in as one JSON object of names and values, usually an authorization bearer token and a content type. The body box accepts raw JSON and is used for the methods that take a payload.
  4. Generate and copyPress Generate Code and all four snippets appear in a single block under comment headings. Copy the format you need, then replace any sample token with a real credential before running it.

Options and formats

Method selectorFive standard verbs. GET and DELETE produce header-only snippets, while POST, PUT and PATCH add your body to all four languages, including the curl data flag.
Headers as JSONOne JSON object holding names and values, such as a bearer authorization and a content type. The pairs are copied into every snippet, and the number of headers found is reported beneath the output.
Body as JSONInserted as written rather than parsed, so it must already be valid JSON with double-quoted keys. It becomes a json argument in the Python snippet and a string value in the fetch and Node versions.
Generated formatscurl, JavaScript fetch, Python requests and Node.js https, always in that order under comment headings. All four describe roughly the same request, so differences between them are worth a second look.
Clear buttonEmpties the URL, headers, body and output in one press, so the prefilled demo disappears too. There is no undo, so copy anything you still need before reaching for it.

Things to watch out for

Broken header JSON disappearsIf the header box is not valid JSON, the parsing failure is swallowed and the snippets come out with no headers at all. The header count under the output is the tell: zero when you typed two means the syntax broke somewhere.
Body ignored for GET and DELETEA body typed into the box is quietly dropped for those two methods. If you are replicating an API that genuinely accepts a payload with DELETE, the generated code will not match what you need.
Keys end up in the snippetAn authorization header is copied into the output as literal text, so screenshots, pasted snippets and bug reports leak the token. Swap it for an environment variable reference before sharing the code with anyone.
Node block assumes httpsThe Node.js variant strips the https prefix and hands the remainder to the https module, so an http URL or an unusually written host produces code that will not run. Check that line first when the Node snippet misbehaves.

Frequently asked questions

Does this tool actually send the request?

No. It builds text from your inputs and stops there, so you never see a status code, a response body or an authentication result. To find out whether a request works, run the generated curl line in a terminal or paste a snippet into your project.

Which language should I take if I only need one?

Take the format matching where the call will live: curl for a terminal check or a bug report, fetch for browser code, requests for a Python script or notebook, and the https block when a Node project cannot take another dependency.

Why did my authorization header vanish from the output?

Almost always invalid JSON in the header box, such as single quotes, a trailing comma or an unquoted key. The parser fails without a warning, so the request is generated as though no headers were supplied. Fix the syntax and generate again.

How do I add query parameters?

Type them into the URL field as part of the address, using a question mark and ampersands. There is no separate key-value table, and whatever you write is passed through to each snippet unchanged. Encode spaces and special characters yourself so the generated code stays valid.

Can I send a form-encoded body instead of JSON?

The body box is inserted as-is and every snippet labels it as JSON, so a form-encoded string lands in an argument meant for a JSON payload. For form posts, set the content type header and repair the body handling in the generated code by hand.

Is the generated Python code ready to run as it is?

Nearly ready. It assumes the requests library is installed and prints the parsed JSON response, so it breaks on an endpoint returning plain text or an HTML error page. Add error handling before putting the call into anything that runs unattended.