HTTP Request Snippet Generator
Describe an HTTP request as JSON (method, url, headers, query, auth, body) and generate a client snippet — cURL, Browser Fetch, Node fetch, Axios, Python requests, or a Playwright API test. The request is validated (missing url, duplicate headers, body vs method, raw credentials) and template variables are surfaced. Runs in your browser; nothing is uploaded.
Auto-generates as you type. Ctrl+Enter to re-run.
How to use the Request Snippet Generator
Describe an HTTP request as a JSON spec — URL, method, headers, query, auth, and body — then export a client snippet: cURL, fetch, Node fetch, Axios, Python requests, or a Playwright API test. Useful for documenting an API, creating a reproducible request recipe for a bug report, or porting an example between languages. Runs locally; URL, headers, and body never leave your browser.
What it does
- Inputs: a JSON spec with URL, method (GET / POST / PUT / PATCH / DELETE / …), headers, query, body (JSON / text / form / multipart / GraphQL), and auth (Bearer / Basic / API key / cookie / custom).
- Outputs: cURL, Browser Fetch, Node fetch, Axios, Python requests, and a Playwright API test.
- Validates the request — missing url, duplicate or invalid headers, body vs method, and raw credentials — and pretty-prints the body.
- Handles form-encoded bodies, multipart uploads, and query parameters.
- Surfaces template variables (
{{var}}/${VAR}) so you keep secrets out of shared examples. - For a cURL command as input, use the dedicated cURL Converter; for a Postman collection, the OpenAPI → Postman Exporter.
When to use it
- Document an API endpoint with code samples in multiple languages.
- Create a copy-paste-ready request for a bug report or ticket.
- Hand off an API call from frontend to backend in a different language.
- Convert a documentation example into an executable command.
- Generate a Playwright API test from a known URL + body.
- Test an integration without writing throwaway code.
How to use it
- Write the request as a JSON spec (or start from the sample).
- Set headers, auth, and a body via the spec fields (
headers,auth,bodyType/body). - Pick the target — cURL, fetch, Axios, Python, or Playwright.
- Open the Validation tab to catch issues and the Env vars tab to review template variables.
- Copy the snippet straight into your terminal, code, or test suite.
- For a cURL command as input, use the cURL Converter; for OpenAPI sources use the OpenAPI Client Snippets.
Tips & pitfalls
- Set
Content-Type: application/jsonwhen sending a JSON body — or leave Auto Content-Type on and it is added for you. - For browser fetch, account for CORS — the request that works from the terminal may not work from the browser without server CORS support.
- Use
{{access_token}}instead of a rawAuthorizationvalue so snippets are safe to share; rotate a token if it leaks. - Use form encoding (
application/x-www-form-urlencoded) only when the server expects it; default to JSON for modern APIs. - Multipart uploads vary across libraries — verify the generated snippet matches your server's expectation.
FAQ
- How do I generate a cURL command from a JSON body? Write the request spec, pick cURL, and copy the generated command.
- Which targets are supported? cURL, Browser Fetch, Node fetch, Axios, Python requests, and a Playwright API test.
- How do I generate a Postman collection? Use the OpenAPI → Postman Exporter — this tool focuses on language snippets.
- Is my body uploaded? No. All generation runs locally in your browser.
- How does this differ from cURL Converter? The cURL Converter starts from a cURL command. This tool starts from a JSON request spec — pick whichever matches your starting point.
- Does it support auth? Yes — Bearer, Basic, API keys, cookie, and custom headers are handled per output target.
Runs locally in your browser. No uploads. Use Mask secrets to redact token-shaped values before sharing.