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
- id: C1 claim: Use -X or --request to change the method name curl sends. source: S1 evidence: "You can tell curl to change the method into something else by using the"
- id: C2 claim: -X changes only the request text, not curl's other behavior. source: S1 evidence: "This command-line option only changes the text in the outgoing request"
- id: C3 claim: --request only changes the word used in the HTTP request. source: S2 evidence: "This option only changes the actual word used in the HTTP request, it does not"
- id: C4 claim: You do not normally need --request, because dedicated options select common methods. source: S2 evidence: "Normally you do not need this option."
Sources
- [S1] Request method. Everything curl. https://everything.curl.dev/http/modify/method.html . License: CC-BY-4.0. Accessed 2026-11-16.
- [S2] --request. curl/curl (GitHub). https://github.com/curl/curl/blob/master/docs/cmdline-opts/request.md . License: curl license (MIT-derived). Accessed 2026-11-16.
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
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.},
}
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.