Skip to main content

API Request Builder

Configure the parts of an HTTP request, then generate ready-to-use cURL, Fetch, or Axios examples directly in your browser.

  • Clipboard
  • Export

Embed this widget

Customize the result, check the live preview, then copy the code.

Preview

Embed code type

Code to copy

Responsive and automatically resized by Bethemesh.

Method

One parameter per line: key=value

One header per line: Name: value

Was this tool useful?

How does this tool work?

Configure a complete HTTP request and generate matching cURL, Fetch, and Axios examples.

One configuration produces cURL, Fetch and Axios snippets. The generator does not contact the URL or measure response status or timing. HTTP(S) URLs are validated and serialized. key=value lines are appended to existing query parameters, including repeated keys. Headers use Name: value lines with name and control-character checks. For case-insensitively matching names, the last value wins.

JSON bodies are checked, then retained as their original text in the snippets. This avoids silently rewriting a large integer during generation. Content-Type: application/json is added when needed without overriding an explicit header. GET and HEAD bodies are rejected to keep the configuration usable with Fetch. Body choices are none, JSON and text; file uploads and multipart forms are not built.

Fetch output uses await and reads response text before parsing a body advertised as JSON. When executed, that parsing uses JavaScript numeric precision. Axios must already be available in your project; the snippet does not install it. cURL uses POSIX quoting. Execution rules differ: browsers enforce CORS and restrict headers, while cURL uses the terminal environment. Generating these snippets therefore does not guarantee identical responses in every context.

How to use this tool

  1. Describe the request

    Choose method, absolute URL, parameters and headers. Use dummy credentials when you plan to share the output.

  2. Select a body

    Choose JSON or text only for a method supported with a body here. Invalid JSON prevents all three variants from being generated.

  3. Adapt the client code

    Generate and copy or download the relevant snippet. Add appropriate error handling, status checks and authentication before integrating it into an application.

Use cases

Prototype an API call

Move quickly from a request idea to executable client code.

Compare HTTP clients

Review equivalent cURL, Fetch API, and Axios implementations.

Prepare documentation

Provide multiple consumption examples for the same endpoint.

Examples

A cURL search

The filter space is serialized into the query. The resulting command is text; no API response was requested.

Input

GET https://example.com/search; q=hello world

Result

curl 'https://example.com/search?q=hello+world'

A Fetch POST

The JSON body remains a string in the options. await needs a compatible JavaScript context; response handling runs only after you integrate the code.

Input

POST https://example.com/api; JSON {"name":"Ada"}

Result

const response = await fetch("https://example.com/api", {
  "method": "POST",
  "headers": {
    "Content-Type": "application/json"
  },
  "body": "{\"name\":\"Ada\"}"
});
const text = await response.text();
const data = text && response.headers.get("content-type")?.includes("json") ? JSON.parse(text) : text;

Tips and best practices

  • A 404 can return a Response without rejecting fetch. Add a response.ok check to implement your intended behavior.
  • Share configuration with dummy credentials. Downloaded files contain any authentication values you entered.
  • Generated code does not choose a retry policy. Define one according to the method and the actual operation’s idempotency.

Sources and references

Frequently asked questions

Why does cURL work when Fetch is blocked?

Browsers enforce CORS and header restrictions that terminals do not. Check server responses and allowed origins before assuming a generation error.

Is the Axios snippet standalone?

No. It assumes Axios is available and await is supported. Add imports, dependencies and error handling for your project.

Is JSON rewritten in the snippets?

The body is checked and preserved as text. Parsing a later JSON response is a separate operation that can round large numbers in JavaScript.

Can I compare response times here?

No. No request is executed. Use an HTTP client or development tools to test networking, status, authentication and timing.

Related tools

Tools similar or complementary to this one.

Similar tools

Generate a complete cURL command from an HTTP request.

DevelopmentUse this tool

Build custom HTTP headers and get output ready to use in your requests.

DevelopmentUse this tool

Format, minify, and validate JSON to make it easier to read or more compact.

DevelopmentFeaturedUse this tool