whatisgithub

What is cpr?

libcpr/cpr — explained in plain English

Analysis updated 2026-06-24

7,329C++Audience · developerComplexity · 2/5Setup · moderate

In one sentence

A C++ library that makes HTTP requests simple, GET, POST, file uploads, with a clean one-line function call instead of the dozens of lines of setup code that libcurl normally requires.

Mindmap

mindmap
  root((repo))
    What it does
      HTTP requests
      Simple interface
      Wraps libcurl
    Request Types
      GET
      POST
      DELETE
    Features
      Authentication
      Async requests
      Proxy support
    Tech Stack
      C++
      libcurl
      CMake
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

What do people build with it?

USE CASE 1

Fetch JSON data from a REST API in a C++ application with a single readable GET call instead of libcurl boilerplate

USE CASE 2

Send POST requests with form fields or file uploads to a web server from a C++ program

USE CASE 3

Make asynchronous HTTP requests in a multi-threaded C++ application so the rest of the program keeps running while waiting for a response

What is it built with?

C++libcurlCMake

How does it compare?

libcpr/cprendless-sky/endless-skygoogle/glog
Stars7,3297,3237,365
LanguageC++C++C++
Setup difficultymoderateeasymoderate
Complexity2/53/52/5
Audiencedevelopergeneraldeveloper

Figures from each repo's GitHub metadata at analysis time.

How do you get it running?

Difficulty · moderate Time to first run · 30min

Requires a C++17-compatible compiler, CMake integration pulls in libcurl automatically as a dependency.

So what is it?

CPR (C++ Requests) is a C++ library for making HTTP requests, the kind of network call an application makes when it needs to talk to a web server or external API. The library wraps an older, lower-level tool called libcurl, which works reliably but requires a lot of boilerplate code to use directly. CPR hides that complexity behind a simpler interface, modeled after Python's popular Requests library. In practice this means that fetching data from a web address, sending form data, or uploading a file goes from dozens of lines of configuration code down to a single readable function call. The library supports all common request types: GET (fetch data), POST (submit data), PUT (update), DELETE, and others used in web APIs. It also handles authentication (Basic, Bearer, Digest, and NTLM), cookies, proxy servers, connection timeouts, and HTTPS encryption. Requests can be made synchronously, where your program waits for the response before continuing, or asynchronously, where the request runs in the background and a callback is triggered when the response arrives. The library is built to work safely when multiple parts of a program are making requests at the same time, which is a requirement in multi-threaded applications. Installation is available through several routes. C++ projects using CMake can pull CPR in automatically as a dependency without managing libcurl separately. Package managers exist for Arch Linux, Fedora, Windows (NuGet), macOS (MacPorts), and FreeBSD. A C++17-compatible compiler is required for current versions, though older releases supported C++11.

Copy-paste prompts

Prompt 1
I'm writing a C++ app with CMake and want to use CPR to call a REST API endpoint and parse the JSON response. Show me how to add CPR as a CMake dependency and write a GET request that prints the response body.
Prompt 2
I need to POST form data with a file attachment to an HTTP endpoint from my C++ program using CPR. Show me the code to build the request with form fields and a file upload.
Prompt 3
I want to make async HTTP GET requests in my multi-threaded C++ app using CPR so the main thread isn't blocked. Show me how to use CPR's async API and handle the response in a callback.

Frequently asked questions

What is cpr?

A C++ library that makes HTTP requests simple, GET, POST, file uploads, with a clean one-line function call instead of the dozens of lines of setup code that libcurl normally requires.

What language is cpr written in?

Mainly C++. The stack also includes C++, libcurl, CMake.

How hard is cpr to set up?

Setup difficulty is rated moderate, with roughly 30min to a first successful run.

Who is cpr for?

Mainly developer.

Open on GitHub → Ask about another repo

This repo across BitVibe Labs

Verify against the repo before relying on details.