How to Send GET Requests With cURL – Full Guide With Examples
cURL is a lightweight command-line tool and “client url” that lets you run HTTP commands from any terminal. The most common way developers use it is with a curl get command, a powerful tool for retrieving data from web servers over HTTP and other protocols. In this guide we’ll focus on the curl command for get request patterns you use every day.
Published:
22.11.2025
Reading time:
8 min
You’ll see how to execute curl command and get output you can read and debug, how to inspect response headers and HTTP status codes, and how to adapt the same curl command for get to different APIs and specified resources. Along the way, you’ll learn when GET requests are best for testing and troubleshooting HTTP requests, downloading files, and talking to various protocols used on modern web servers.
Keep reading to get practical, copy-pasteable examples that make making HTTP requests with curl part of your daily toolkit.
What Is a GET Request in cURL?
A GET request is one of the core HTTP request methods used for retrieving data from a server. In the HTTP world, it’s designed to read, not change, resources: it doesn’t send a body by default and it shouldn’t modify state on the server side. It’s also the default method browsers use when you type a URL and hit Enter, which is why most simple web navigation is just a series of get requests under the hood.
Compared to other http requests, POST, PUT, and DELETE serve different purposes. POST requests and other post methods send data to create or submit something new. PUT and DELETE request methods are used to update or remove a specifying resource, usually including http bodies that describe what should change.
cURL simply speaks these http methods over the network. It includes HTTP by default but also supports various other protocols, and supports multiple options that let you choose which method to use. A basic HTTP GET request looks like a plain curl command with just the URL, while a more advanced examples adds headers, query parameters, and other options that cURL allows.
How to Send a GET Request Using cURL
cURL is a command-line tool — one of the most widely used line tools and a powerful command for working with URLs. It transfers data over various protocols like HTTP, HTTPS, and FTP servers. In this section, we’ll walk step by step through a curl command for get request usage.

Step 1: Run a Simple cURL GET Request
The simplest way to run curl commands is:
curl https://example.com
From most command lines this command starts with a URL, so curl uses GET as the default method without extra options. This is the basic curl get command you’ll run all the time, and the first step is to get comfortable making requests so curl sees what the server needs.
Step 2: Add Query Parameters to a GET Request
Often you need to pass query parameters in the URL:
curl "https://api.example.com/search?query=test&limit=10"
Here the URL encodes the parameters directly, following standard URL syntax. Alternatively, you can use various options like -G with -d “query=test” -d “limit=10” to build the query string automatically. When making http API calls, the request often needs correctly formatted query parameters instead of sent data in the body, because most API endpoints expect query parameters in GET requests.
Step 3: Retrieve and Display HTTP Headers
By default cURL only prints the body, but every HTTP response also comes with http headers that describe what you’re seeing. These response headers arrive before the body and include the HTTP status code, content type, caching rules, and more. Use curl -i to show headers and body together, curl -I for headers only, or curl -v to inspect raw header lines as cURL follows server responses while you save a named response to disk.
Step 4: Request Data in JSON Format
Many APIs return JSON, so you want your request data in that format. With cURL you can set request headers like -H “Accept: application/json”:
curl -H "Accept: application/json" https://api.example.com/users
Here curl allows you to tell the api which format you prefer, and the server sees that header and sends JSON back. cURL supports various content types, including JSON and XML, making retrieving data from web services consistent across responses.
Step 5: Follow Redirects Automatically
A basic curl command get might need to stop at the first hop because many servers return 3xx redirects, but cURL does not follow them by default. To allow following redirects, use:
curl -L http://example.com
This and the following commands display final responses, accurate http status codes, and the target URL.
Step 6: Send Cookies Along With a GET Request
Many web programs utilize cookies to log users in and track requests between servers.
Curl -c cookies.txt -b cookies.txt HTTPS://example.com/profile
sends and saves cookies. The cookie jar is filing previously sent data, making each new GET request authenticated.
Useful cURL GET Request Arguments
cURL supports various options that influence GET requests. They can be used with the above commands to cover most situations.
- -G, -d, –data-urlencode — Attach query parameters to the URL instead of the body for get requests, maintaining the default method.
- -H — Adds custom HTTP headers like as Accept, Authorization, and User-Agent, making it simple to convey tokens and meta data.
- Instead of publishing everything to the console, use -o file to save the body to disk for downloading files and storing a named response.
- -L — Allows the following redirects so that a single request can reach the final URL and http status.
- -s, -S, -v — Adjust verbosity: hide progress bar, display errors only, or display full debug output for failed requests.
- -I / –head — Run a quick HEAD request to inspect headers without transferring the complete body.
The -X option enables you override the method, as if you told curl which verb to use, but for most GET requests, these options make a simple curl GET command one of your most useful tools.
Advanced GET Request Techniques
Once you’re familiar with basic GET requests, you may use more complex patterns, such as storing output to files, sending lightweight HEAD requests, and wiring curl into Python automation scripts or requests-style tooling.
Follow Redirects and Save Output to a File
With -L and -o or -O, curl follows redirects and transfers data to a file.
Curl page.html http s://short.link/page
downloads files from a redirected URL and stores a named response for subsequent inspection.
Curl -L -o ip.txt ifconfig.me
logs your public IP address and responses.
Perform an HTTP HEAD Request
HEAD is an HTTP method that allows you to get simply the headers for a resource, without downloading the body. CURL Data Data -I runs https://example.com and prints http status, content type, content length, and 404 Not Found responses. The same procedure works for ftp servers and other methods, and many Python automation scripts request a HEAD in Python before downloading huge files.
Common Errors and How to Fix Them
Understanding failures in simple GET requests saves time.
• URL and DNS difficulties
In case of curl: (6) Host not resolved, URL syntax incorrect, or domain not found. Check the host, quotes, and parameters, then rerun the request with -v to observe how curl produces the http request.
• 4x/5x server responses
A non-2xx HTTP status such as 404 Not Found or 500 typically indicates incorrect parameters, an invalid specified resource, or a server problem. Compare response headers with a tiny python script making the same request.
• TLS/certificate issues
HTTPS validation fails with certificate faults. Debug with -v, temporarily use –insecure, or configure the right CA bundle instead of ignoring security.
• Limits on authorization and rate
401 or 403 indicate invalid or missing auth headers. After making http calls for scraping, python or curl should wait and retry if status 429 or 503 indicates rate limits.
Conclusion
Adding parameters and headers, sending cookies, following redirects, and saving output for further analysis has made a curl GET flexible. Together, these strategies make making HTTP requests from command lines easier to get right. For working with APIs and scripting automation alongside Python, curl is a powerful tool for developers and DevOps and one of the most useful tools.
FAQs
How can I see both headers and body in one command?
Use curl -i URL to print both response headers and body in one stream. For debugging, curl -v URL shows raw header lines plus the body, useful when requests fail or you must inspect http status codes.
How do I make authenticated GET requests with a token?
Use -H “Authorization: Bearer <token>” so cURL sends authenticated GET requests with the correct headers to your API. In Postman you can see how to get curl command from postman via the Code snippet view and reuse it in a python script for automation.
Can cURL GET requests be used for web scraping?
Yes, you can use cURL GET requests for basic web scraping or quick checks, but respect robots.txt, rate limits, and legal rules. For large-scale making http scraping, python libraries like requests are usually safer and more flexible.
Related posts


