Back to blog

    cURL basics

    What is a cURL command?

    A curl command is a terminal instruction that describes an HTTP request or another URL transfer in a repeatable text format.

    6 min readUpdated 2026-04-28

    Anatomy of a curl command

    Most curl commands include three parts: the curl program, the target URL, and optional flags. The URL says where the request goes. The flags say how the request should behave.

    Those flags can set the HTTP method, add headers, send a request body, attach credentials, upload files, or control redirects and timeouts.

    Example with method, header, and body

    This example creates a user by sending JSON to an API endpoint. The command uses -X to set the method, -H to add a header, and -d to send the JSON body.

    POST JSON with curl
    curl -X POST https://api.example.com/users \
      -H "Content-Type: application/json" \
      -d '{"name":"Ada","email":"[email protected]"}'

    Why curl commands are useful

    A curl command is easy to copy, paste, save in a bug report, or share with another developer. It captures the request clearly enough that someone else can reproduce it.

    That is why curl commands appear in API documentation, support tickets, browser DevTools, logs, and engineering notes.

    From curl to application code

    A curl command is great for testing, but most apps need code. Once the request works in curl, you can translate it into a language-specific HTTP client such as Python requests, JavaScript fetch, Node Axios, Go net/http, or PHP cURL.

    Try it with curlcode

    Have a curl command already? Paste it into one of the converters below to generate language-specific HTTP request code.

    Frequently asked questions

    Do curl commands only work for HTTP?

    No. curl supports many protocols, but most developer examples use HTTP or HTTPS.

    What does -H mean in curl?

    -H adds a request header, such as Content-Type, Authorization, or Accept.

    What does -d mean in curl?

    -d sends request data, commonly a JSON payload or form data.

    Can I run curl on Windows?

    Yes. Modern Windows includes curl, and it is also available on macOS and Linux.

    Related guides