curl

curl

curl is a small program used to fetch or send data over the internet from the command line. It is the standard tool for testing web addresses and programming interfaces without a browser.

When you want to view a web page, you type an address into your browser. The browser fetches the data from the remote machine and displays it nicely formatted. curl does the same retrieval, but without a window and without formatting. You type the command into a line of text, and curl writes the raw response directly into that same text window. The name stands for “Client for URL”: a program that requests a web address. It runs on Windows, macOS, Linux and practically every server, and has been freely available since 1998.

The standard tool for testing interfaces

Modern software rarely consists of a single program. Instead, many services talk to each other over the network. These handover points are called programming interfaces, or APIs for short. AI services like ChatGPT, too, are almost always accessed by developers through such an interface, not through the website.

When something doesn’t work in this process, you need the simplest possible test. That is exactly what curl is made for. It shows unvarnished what the remote server answers: the text, the error message, the status code. A browser, by contrast, would automatically reload, redirect or hide a lot of things. That’s why curl is considered a more honest window into the actual state of a service.

A second reason is its ubiquity. Almost every piece of technical documentation shows its examples as a curl command, because it works the same everywhere. Anyone who copies the command can immediately try out whether their access key is valid. Only afterwards do they build the call into their own programming language.

Structure of a curl call

The simplest case is: curl, a space, then the address. curl then sends a request to the server and outputs the response. This request follows the rulebook of the web, the HTTP protocol. It defines how a request and the matching response must be structured.

But almost always you need additions, so-called options. One option lets you provide an access key that proves who you are. With another, you send data of your own to the server, for example the question for an AI model. Such commands can quickly grow to several lines, but they are still just a single instruction.

What matters is what curl does not do. It doesn’t understand JavaScript and doesn’t visually render a page. Anyone who fetches a news site only gets the source code as a jumble of letters. curl is therefore not a replacement for a browser, but a measuring instrument for the connection behind it.

curl in docs, scripts and servers

You most commonly encounter curl in tutorials. Open the developer pages of OpenAI, Google or Stripe, and the first code example is usually a curl command. Installation guides, too, often contain a line that uses curl to download and run a script. With such lines, caution is warranted: you’re executing someone else’s code without having read it.

Invisibly, curl is also embedded in countless devices. The associated program library, libcurl, is built into cars, printers, TVs and game consoles. Developer Daniel Stenberg estimates the number of installations at several billion. The project is a frequently cited example of just how much the digital world depends on small, free programs.

A related term is wget. This tool specializes in downloading entire files and pages. curl, by contrast, covers more protocols and is meant more for sending individual requests back and forth. That’s why developers almost always reach for curl when testing interfaces.

Subscribe free. Unsubscribe the second it sucks.

High-signal news across AI, business, UX, and tech. Every morning.