HTTP Request Builder avatar

HTTP Request Builder

Pricing

Pay per event

Go to Apify Store
HTTP Request Builder

HTTP Request Builder

Build HTTP requests and export as cURL, fetch, axios, and Python code — all four at once. Supports bearer, basic, and API key auth.

Pricing

Pay per event

Rating

0.0

(0)

Developer

Stas Persiianenko

Stas Persiianenko

Maintained by Community

Actor stats

0

Bookmarked

2

Total users

1

Monthly active users

3 days ago

Last modified

Categories

Share

Convert any HTTP request into ready-to-use code snippets in seconds. Input your method, URL, headers, body, and authentication — get back cURL, JavaScript fetch, axios, and Python requests code, perfectly formatted and ready to paste.

This is the inverse of a curl-to-code converter: you describe the request you want to make, and the builder generates all the boilerplate for every language at once.

What does HTTP Request Builder do?

HTTP Request Builder takes structured HTTP request parameters and generates syntactically correct, immediately runnable code snippets across four popular languages and tools:

  • cURL — the universal command-line HTTP client, works everywhere
  • JavaScript fetch — native browser and Node.js API, no dependencies needed
  • axios — the most popular Node.js/browser HTTP library (25M+ weekly downloads)
  • Python requests — the de facto standard HTTP library for Python

Supply a URL, method, headers, body, and authentication config — the builder handles formatting, escaping, encoding, and correct syntax for each target. Run a single actor call against 1 to 1,000 requests in one batch.

Who is HTTP Request Builder for?

Backend developers who switch between languages constantly:

  • Prototype an API call in Python, then need the same call in Node.js for production
  • Copy-paste a cURL command from API docs and need it as fetch or axios code
  • Share a request with a colleague who uses a different stack

API documentation writers and DevRel engineers:

  • Generate consistent, correct multi-language code samples for documentation
  • Produce cURL + Python + JS examples for every API endpoint in bulk
  • Ensure code samples are always syntactically valid (no more copy-paste errors)

QA engineers and testers:

  • Convert Postman/Insomnia requests to cURL for CI/CD pipeline integration
  • Generate test scripts in multiple languages from a single request definition
  • Validate API requests work identically across different HTTP client implementations

Students and developers learning APIs:

  • See the exact same request expressed in four different ways simultaneously
  • Understand how authentication headers translate across languages
  • Learn idiomatic patterns for each language (e.g., json= parameter in Python requests)

Why use HTTP Request Builder?

  • 🚀 Zero setup — no API key, no login, no configuration required
  • 🔄 All four formats at once — get cURL, fetch, axios, and Python in a single run
  • 🔐 Handles all auth types — bearer tokens, basic auth, and API key headers all correctly formatted
  • 📦 Batch processing — convert up to 1,000 requests in one actor run
  • 🎨 Pretty-print control — readable JSON bodies for docs or compact bodies for scripts
  • 💬 Optional code comments — toggle explanatory inline comments on or off
  • Correct escaping — shell special characters in cURL, JSON serialization in fetch/axios, Python dict syntax
  • 🔗 API-first — full programmatic access via the Apify API, scheduling, and webhooks

What code does it generate?

Language / ToolFormatNotes
cURLShell commandCorrect -H, -d, -X flags; single-quote escaping
JavaScript fetchasync/awaitNative browser + Node.js 18+; no dependencies
axiosasync/await with importWorks in Node.js and browser; idiomatic config object
Python requestsrequests libraryjson= for JSON bodies, data= for form/text; import requests included

Supported authentication types:

Auth typeHow it's appliedExample
Bearer tokenAuthorization: Bearer <token> headerJWT tokens, OAuth tokens
Basic authAuthorization: Basic <base64> headerUsername + password, encoded correctly
API keyCustom header with your key nameX-API-Key, x-rapidapi-key, etc.

How much does it cost to generate HTTP request code?

HTTP Request Builder uses pay-per-event (PPE) pricing. You are charged per request converted, plus a small one-time start fee.

PlanStart feePer request
Free ($5 credit)$0.005$0.00115
Starter (Bronze)$0.005$0.001
Scale (Silver)$0.005$0.00078
Business (Gold)$0.005$0.0006
Enterprise (Platinum)$0.005$0.0004
Enterprise Plus (Diamond)$0.005$0.00028

Real-world cost examples:

  • Convert 10 requests (docs sample set): ~$0.015 on Bronze
  • Convert 100 API endpoints for full documentation: ~$0.105 on Bronze
  • Convert 500 requests in a bulk batch: ~$0.505 on Bronze
  • With the free $5 credit: ~4,300 free requests before any charge

This actor uses no proxy (pure string computation) — compute costs are minimal.

How to generate HTTP request code snippets

  1. Go to HTTP Request Builder on Apify Store
  2. Click Try for free
  3. In the HTTP Requests field, add your request(s) as a JSON array
  4. Optionally enable Include code comments for annotated output
  5. Click Start and wait a few seconds
  6. View results in the Dataset tab — each row has cURL, fetch, axios, and Python columns

Example input for a simple GET request:

{
"requests": [
{
"url": "https://api.github.com/repos/apify/apify-sdk-js",
"method": "GET",
"headers": {
"Accept": "application/vnd.github+json"
}
}
]
}

Example input for a POST with bearer auth:

{
"requests": [
{
"url": "https://api.example.com/users",
"method": "POST",
"headers": { "Content-Type": "application/json" },
"body": "{\"name\": \"Alice\", \"role\": \"admin\"}",
"bodyType": "json",
"auth": { "type": "bearer", "token": "eyJhbGciOiJIUzI1NiJ9..." }
}
],
"prettyPrint": true,
"includeComments": true
}

Example input for a bulk batch (multiple requests):

{
"requests": [
{ "url": "https://api.example.com/users", "method": "GET" },
{ "url": "https://api.example.com/users/42", "method": "DELETE", "auth": { "type": "bearer", "token": "TOKEN" } },
{ "url": "https://api.example.com/users/42/posts", "method": "GET" }
]
}

Input parameters

ParameterTypeRequiredDefaultDescription
requestsarray✅ YesArray of HTTP request objects to convert (see structure below)
includeCommentsbooleanNofalseAdd inline code comments explaining each section
prettyPrintbooleanNotrueIndent JSON request bodies for readability

Request object fields:

FieldTypeRequiredDescription
urlstring✅ YesFull request URL including query string
methodstringNoHTTP method: GET, POST, PUT, PATCH, DELETE, HEAD, OPTIONS. Defaults to GET
headersobjectNoRequest headers as key-value pairs
bodystringNoRequest body as a string (JSON string, form-encoded, or plain text)
bodyTypestringNoHint: json, form, text, or none. Auto-detected from Content-Type if omitted
authobjectNoAuthentication config — see auth fields below
outputFormatsarrayNoLimit output to specific formats: ["curl", "fetch", "axios", "python"]. Defaults to all four

Auth object fields:

FieldTypeWhen requiredDescription
typestringAlwaysbearer, basic, or apikey
tokenstringbearerBearer token value
usernamestringbasicUsername for basic auth
passwordstringbasicPassword for basic auth
keystringapikeyHeader name (e.g. X-API-Key)
valuestringapikeyAPI key value

Output examples

Each dataset item contains the generated code for one input request:

{
"url": "https://api.github.com/repos/apify/apify-sdk-js",
"method": "GET",
"curl": "curl -X GET \\\n 'https://api.github.com/repos/apify/apify-sdk-js' \\\n -H 'Accept: application/vnd.github+json'",
"fetch": "const response = await fetch('https://api.github.com/repos/apify/apify-sdk-js', {\n ...\n});",
"axios": "import axios from 'axios';\n\nconst { data } = await axios({...});\n\nconsole.log(data);",
"python": "import requests\n\nresponse = requests.get('https://api.github.com/repos/apify/apify-sdk-js', headers=headers)\n\nprint(response.json())",
"error": null
}

POST with bearer auth output — cURL:

curl -X POST \
'https://api.example.com/users' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer eyJhbGciOiJIUzI1NiJ9...' \
-d '{
"name": "Alice",
"role": "admin"
}'

Same request in Python requests:

import requests
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer eyJhbGciOiJIUzI1NiJ9...',
}
json_data = {
"name": "Alice",
"role": "admin",
}
response = requests.post('https://api.example.com/users', headers=headers, json=json_data)
print(response.status_code)
print(response.json())

Tips for best results

  • 🎯 Use bodyType: "json" explicitly — even if your Content-Type is set, specifying bodyType ensures the correct Python json= parameter is used vs data=
  • 🔑 Put auth in the auth object, not headers — the builder handles correct encoding (e.g., base64 for basic auth) when using the auth field; manual headers skip this
  • 📋 Set outputFormats to reduce output size — if you only need cURL and Python, set outputFormats: ["curl", "python"] to skip fetch and axios
  • 🔄 Batch all related endpoints in one run — the $0.005 start fee is per run, not per request; batch 100 endpoints for $0.105 instead of running 100 separate times
  • 💅 Use prettyPrint: false for shell scripts — compact bodies are easier to inline in scripts and avoid multi-line heredoc complexity
  • 🧪 Test generated cURL in your terminal first — it's the most portable format and will quickly reveal any encoding issues

Integrations

HTTP Request Builder → API documentation pipeline:

  • Run the builder against your full endpoint list
  • Export the dataset as CSV or JSON
  • Import into your documentation platform (Readme.io, Stoplight, GitBook)
  • All four language examples generated in one pass — no manual code writing

HTTP Request Builder → GitHub Actions / CI:

  • Use the Apify API to call this actor in a CI step
  • Automatically regenerate code samples on every API schema change
  • Commit updated samples back to your docs repo via Git actions

HTTP Request Builder → Zapier / Make.com:

  • Connect Apify to your documentation tool via Zapier
  • Trigger code generation when a new endpoint is added to a Notion or Airtable database
  • Auto-post generated snippets to Slack for team review

Scheduled runs for living documentation:

  • Schedule the actor to regenerate code samples nightly
  • Catch breaking changes in API request parameters automatically
  • Keep documentation always in sync with actual request definitions

Using the Apify API

Run HTTP Request Builder programmatically via the Apify API:

Node.js:

import { ApifyClient } from 'apify-client';
const client = new ApifyClient({ token: 'YOUR_APIFY_TOKEN' });
const run = await client.actor('automation-lab/http-request-builder').call({
requests: [
{
url: 'https://api.example.com/users',
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ name: 'Alice' }),
bodyType: 'json',
auth: { type: 'bearer', token: 'MY_TOKEN' }
}
],
prettyPrint: true
});
const { items } = await client.dataset(run.defaultDatasetId).listItems();
console.log(items[0].curl);
console.log(items[0].python);

Python:

from apify_client import ApifyClient
client = ApifyClient('YOUR_APIFY_TOKEN')
run = client.actor('automation-lab/http-request-builder').call(run_input={
'requests': [
{
'url': 'https://api.example.com/users',
'method': 'POST',
'headers': {'Content-Type': 'application/json'},
'body': '{"name": "Alice"}',
'bodyType': 'json',
'auth': {'type': 'bearer', 'token': 'MY_TOKEN'}
}
],
'prettyPrint': True
})
items = client.dataset(run['defaultDatasetId']).list_items().items
print(items[0]['curl'])
print(items[0]['python'])

cURL:

curl -X POST "https://api.apify.com/v2/acts/automation-lab~http-request-builder/runs" \
-H "Authorization: Bearer YOUR_APIFY_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"requests": [
{
"url": "https://api.example.com/users",
"method": "GET"
}
]
}'

Use with AI agents via MCP

HTTP Request Builder is available as a tool for AI assistants that support the Model Context Protocol (MCP).

Add the Apify MCP server to your AI client — this gives you access to all Apify actors, including this one:

Setup for Claude Code

$claude mcp add --transport http apify "https://mcp.apify.com"

Setup for Claude Desktop, Cursor, or VS Code

Add this to your MCP config file:

{
"mcpServers": {
"apify": {
"url": "https://mcp.apify.com"
}
}
}

Your AI assistant will use OAuth to authenticate with your Apify account on first use.

Example prompts

Once connected, try asking your AI assistant:

  • "Use automation-lab/http-request-builder to convert this POST request to Python and axios: POST https://api.example.com/users with bearer token ABC123 and JSON body {"name": "Alice"}"
  • "Generate cURL and fetch code for a DELETE request to https://api.example.com/user/42 with basic auth (admin/secret)"
  • "Build code snippets for all four languages for these three API endpoints: GET /products, POST /orders, PATCH /orders/123"

Learn more in the Apify MCP documentation.

HTTP Request Builder is a pure utility tool — it performs no web scraping, makes no external HTTP connections, and does not interact with any third-party services. It is a code generator that transforms input data (your request parameters) into output data (code strings).

There are no legal concerns with using this tool. It generates code for you to use; the legal considerations of the requests you ultimately make with that code depend on the target API's terms of service and applicable law.

FAQ

What HTTP methods are supported? GET, POST, PUT, PATCH, DELETE, HEAD, and OPTIONS are all supported. Any other string is passed through as uppercase — useful if you need non-standard methods for testing.

Can I generate code for only one language instead of all four? Yes — use the outputFormats field in your request object: "outputFormats": ["curl", "python"] will skip fetch and axios, reducing output size and processing time.

Why does my Python output use json= instead of data= for the body? When bodyType is "json" (or detected from Content-Type: application/json), the actor uses Python's requests library json= parameter, which automatically serializes the dict and sets the correct Content-Type. This is the idiomatic Python pattern. Use "bodyType": "text" if you want the raw string body via data=.

How does the builder handle special characters in URLs or header values? In cURL output, single quotes and backslashes are correctly shell-escaped. In fetch/axios, strings are JSON-serialized. In Python, string values use safe representation. You do not need to pre-escape your values.

What happens if my JSON body string is invalid JSON? The actor passes the body through as a raw string rather than failing the entire request. The cURL output shows the body as-is; Python falls back to data= with the string. The error field will be null — invalid JSON bodies are handled gracefully.

How many requests can I batch in one run? There is no enforced limit. Batches of up to 1,000 requests work well in practice. Very large batches (10,000+) work but take longer due to dataset write overhead. The start fee ($0.005) is per run, not per request — batching maximizes value.

Can I use this to convert raw cURL commands to other languages? The actor takes structured parameters, not raw cURL command strings. Parse your cURL command into components (method, URL, headers, body) first, then pass them as structured input. Many online tools and libraries can parse cURL strings into structured objects.

Why are there no fetch/axios/python fields in my output? Check the outputFormats field in your request object — if set, only the specified formats are generated. The default (all four formats) applies when outputFormats is omitted.

Other developer tools you might find useful

Looking for more automation-lab tools for developers and API work?