cURL Import & Export
Most API docs show examples as curl commands. DotFetch can turn one into a request, and turn your request back into a command you can paste into a terminal.
Import a cURL command
- Click 📥 Import in the Request Builder toolbar, or Import cURL in Quick Actions.
- Paste the command and confirm.
BASH
curl -X POST "https://httpbin.org/post?source=docs" \
-H "Content-Type: application/json" \
-H "X-Trace: abc123" \
-d '{"name":"Ada","role":"admin"}'becomes:
| Part | Value |
|---|---|
| Method | POST |
| URL | https://httpbin.org/post |
| Params | source = docs |
| Headers | Content-Type: application/json, X-Trace: abc123 |
| Body | {"name":"Ada","role":"admin"} |
What the importer understands:
| cURL option | Becomes |
|---|---|
-X / --request | The method |
The first http:// or https:// URL | URL, with the ?query split into the Params tab |
-H / --header (quoted) | One header row each |
-d, --data, --data-raw, --data-binary | The body. If there's a body and no -X, the method becomes POST, as curl does. |
Line breaks with \ are fine. Other options (-u, -F, --compressed, cookies) aren't imported. After importing, set those up in the right tab, such as Auth → Basic Auth for -u.
Export as cURL
Click 📤 Export to copy the current request as a curl command:
BASH
curl \
-X POST \
"https://httpbin.org/post?source=docs" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer eyJhbGciOi..." \
-d "{\"name\":\"Ada\",\"role\":\"admin\"}"The command includes:
- the method, URL, and enabled Params-tab rows
- enabled headers, plus the header from the Auth tab (Bearer, API key, or OAuth token). Basic Auth becomes
-u "user:pass", and an API key in query mode is added to the URL. - the body. JSON bodies are compacted onto one line.
-kwhen SSL verification is off for this request
Two things to watch:
{{VARIABLES}}are not filled in. The command contains{{BASE_URL}}literally, because curl doesn't know your.env. Replace them before running.- Secrets are included if you typed them directly into the Auth tab. Don't paste the command anywhere public. See cURL export and secrets.