Import and Export

Importing cURL commands

Turn a cURL command into a draft request.

Overview

API documentation, browser developer tools and colleagues often share requests as cURL commands. Relay reads a command and creates a draft with its method, URL, query parameters, headers, body, authentication and settings, so you can send it, edit it and save it to a collection.

Relay reads the command as text and never runs it. It doesn't start a shell, read files the command names, connect to the network or expand shell variables.

Import a command

  1. Choose File > Import > cURL Command…, or press Shift-Command-I. You can also click the Add button (+) at the bottom of the sidebar and choose Import > cURL Command….

    If the clipboard holds a cURL command, Relay pastes it for you.

  2. Paste or edit the command.

    The Preview beside it shows the method and URL, how many headers and query parameters the request has, its body type and its authentication. If Relay changed or left out part of the command, the warnings appear under Imported with warnings. If it can't import the command, the Preview explains why.

  3. Click Import.

The new draft opens in the request editor, in the window's workspace. To remove it again, choose Edit > Undo.

The command must start with curl or curl.exe. A leading $ prompt and lines continued with a backslash are fine.

Learn how options are imported

OptionImported as
The URL, or --urlThe request's URL. Its query string becomes query parameters.
-X, --requestThe method, including custom methods such as PURGE.
-I, --headThe HEAD method.
-H, --headerA header.
-A, --user-agentA User-Agent header.
-e, --refererA Referer header.
-b, --cookieA Cookie header, for cookies written inline as name=value.
-d, --data, --data-ascii, --data-binary, --data-rawThe body. Several are joined with &.
--data-urlencodeA form field.
--jsonA JSON body, plus Content-Type and Accept headers of application/json when the command doesn't set them.
-F, --form, --form-stringA multipart form field. A ;type= suffix sets the field's content type.
-G, --getQuery parameters made from the data options, sent with GET.
--url-queryA query parameter.
-u, --userBasic Auth. With --digest, --ntlm or --aws-sigv4, Digest Auth, NTLM or AWS Signature.
--oauth2-bearerBearer Token auth.
-k, --insecureVerify Certificates turned off.
-m, --max-timeThe request timeout.
--max-redirsMaximum Redirects. A value of 0 turns off Follow Redirects.
--post301, --post302, --post303Follow Original Method turned on.
--location-trustedKeep Authorization Across Origins turned on.
-L, --locationNothing. Relay follows redirects unless the request's settings say otherwise.

Settings such as the timeout and redirects go on the request's Settings tab. For details, see Configuring request settings.

Method

When the command has no -X option, Relay uses HEAD for -I, GET for -G, POST when the command sends data or form fields, and GET otherwise. Relay refuses a GET, HEAD or TRACE command that has a body; add -G to send the data in the query string instead.

Body

Relay chooses the body type from the command:

  • JSON: The command uses --json, or its Content-Type header names JSON. A body with a GraphQL query becomes a GraphQL body.
  • Form URL-Encoded: Every data option is a name=value pair and the command sets no Content-Type, or sets application/x-www-form-urlencoded.
  • Multipart Form: The command uses -F.
  • Text: Any other data, sent with the command's Content-Type.

Authentication

With -u and --ntlm, a user name written as DOMAIN\user fills in the NTLM domain. With --aws-sigv4 "aws:amz:REGION:SERVICE", Relay reads the region and service from the option, or from an amazonaws.com host when the option leaves them out, and an x-amz-security-token header becomes the session token. When -u has no password, cURL would ask for one; Relay imports an empty password and warns you.

Understand what's left out

Relay imports the parts of a command that describe the request, and warns you about the rest:

  • Options that control how cURL itself runs, such as --compressed, -s, -v, -o, -w, --retry, --connect-timeout, --cacert and -c, are ignored.
  • Proxy options (-x, --proxy, --preproxy, -U, --proxy-user, --noproxy) are left out. Relay's proxy is set in the Network pane of Relay > Settings.
  • Client certificate options (-E, --cert, --key, --cert-type, --key-type, --pass) are left out. Add client certificates in the workspace's Certificates tab instead.
  • --anyauth imports Basic Auth, and --negotiate auth is left out.
  • Shell variables such as $TOKEN stay in the request as written. Inside single quotes, a $ is just a character, so there's no warning.

Relay can't import a command that:

  • Reads from a file, such as -d @body.json, -H @headers.txt, -F file=@photo.jpg, -T or a cookie file. Paste the content inline, or for a file field, import without it and add the file in Relay.
  • Uses --next, -K, --config, --resolve, --connect-to, --interface, --unix-socket or --request-target.
  • Has more than one URL, or mixes --data and --form options.
  • Contains pipes, redirections, ;, &, or command substitution: backticks or $(…) outside single quotes.

Import a WebSocket command

A command for a ws:// or wss:// URL becomes a WebSocket draft. Relay keeps its headers, query parameters, authentication and settings. A WebSocket opens with a GET handshake and has no body, so a method other than GET and any data options are dropped with a warning. Add the data as a saved message instead. For more, see Connecting to a WebSocket server.

Import from an AI agent

An AI agent connected to Relay's MCP server can create the same draft with the add_draft_from_curl tool. For a list of tools, see MCP Tools.

See Also