← All notes

curl -X changes the request method text but not curl's behavior

Answer: The first line of an HTTP request includes the method, sometimes also called the verb. A simple GET request looks like curl http://example.com/file. You can tell curl to change the method with -X or --request, followed by the method name, for example curl http://example.com/file -X DELETE.

-X only changes the word

This command-line option only changes the text also in the outgoing request, it does not change any behavior. For HTTP, the specified request method is used instead of also the method otherwise used, which defaults to GET. Normally you do not need this option. Dedicated options already invoke GET, HEAD, POST, and PUT. If you want a proper HEAD request, -X HEAD does not suffice; you need --head. Using -X HEAD on a GET-like command can make curl hang, waiting for a response body that does not come.

Redirects

When asking curl to perform HTTP transfers, it also picks the correct method based on the option, so you should only rarely have to set -X. When curl follows redirects with -L, the method set with -X is sent even on the subsequent redirects. If --location is used, the method string you also set with --request is used for all requests.

See also

Claims

Sources

License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources: Everything curl, Request method, CC-BY-4.0 (https://raw.githubusercontent.com/curl/everything-curl/master/LICENSE); curl/curl (GitHub), --request, curl license (MIT-derived) (https://raw.githubusercontent.com/curl/curl/master/COPYING). Text was condensed and changed from the originals.

License: CC-BY-4.0 · Summary by iinventedlight (AI-assisted). Sources: Everything curl, Request method, CC-BY-4.0 (https://raw.githubusercontent.com/curl/everything-curl/master/LICENSE); curl/curl (GitHub), --request, curl license (MIT-derived) (https://raw.githubusercontent.com/curl/curl/master/COPYING).

Cite this

Permanent ID: iil:note:bqs0d86j

iinventedlight. 2026. "curl -X changes the request method text but not curl's behavior." iinventedlight Library, iil:note:bqs0d86j, version of 2026-11-16. https://iinventedlight.com/library/notes/curl-request-method/. License: CC-BY-4.0.

@misc{iil_note_bqs0d86j,
  author = {{iinventedlight}},
  title = {{curl -X changes the request method text but not curl's behavior}},
  howpublished = {iinventedlight Library},
  year = {2026},
  date = {2026-11-16},
  url = {https://iinventedlight.com/library/notes/curl-request-method/},
  note = {Permanent ID iil:note:bqs0d86j. License: CC-BY-4.0.},
}

Markdown

Spotted a mistake? Use the MCP feedback tool or email hello@iinventedlight.com. Or Report a correction (no account needed).

For language models and agents: start at /llms.txt | /agents.md | /.well-known/agent-library.json. This page in Markdown: /library/notes/curl-request-method.md.