curl -X POST -H 'Content-Type: application/json' -d '{"key":"val"}' https://api.example.com

Category: Networking

curl -X POST -H 'Content-Type: application/json' -d '{"key":"val"}' https://api.example.com

Send a JSON POST request to an API endpoint

-X sets the HTTP method, -H adds a header, -d provides the request body. This is the standard way to test REST API endpoints from the terminal — replace the URL and JSON body with your actual endpoint and payload.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.