Skip to main content

C++ SDK

The Permit.io C++ SDK is a client for the Permit API, generated from the Permit OpenAPI specification with OpenAPI Generator. This page is for C++ developers who want to manage Permit objects, such as users, tenants, and roles, from C++. The page covers what the repository contains, how to build the client library, and how to run permission checks from C++.

What the C++ SDK covers

The generated client calls the Permit API at https://api.permit.io, which manages policy and data objects. The client has no check() helper and no policy decision point (PDP) client, so it doesn't run permission checks.

To check permissions from C++, send an HTTP POST request to the /allowed endpoint of your PDP with the user, action, and resource. For the request and response bodies, see the PDP API reference.

The C++ SDK is not included in the SDK feature parity table, which covers the SDKs that implement permit.check().

Get the C++ SDK

The generated API classes, model classes, and a usage example are in the permitio/permit-cpp repository on GitHub. The API classes are in the client directory and live in the OpenAPI namespace, with names prefixed by OAI, for example OAIUsersApi and OAIUserCreate.

For the versions of CMake, Qt, and the compiler the project is built with, see the Requirements section of the permit-cpp README.

Build the C++ SDK

The client directory holds a CMake project that builds the API client as a library. Clone the repository and build the project:

git clone https://github.com/permitio/permit-cpp.git
cmake -S permit-cpp/client -B permit-cpp/build
cmake --build permit-cpp/build

The build succeeds when cmake --build reports no errors and writes the client library into permit-cpp/build. The CMake project calls find_package for Qt5Core, Qt5Network, and Qt5Gui, so cmake fails with a find_package error when the Qt5 development packages are missing.

Each API class takes a bearer token. Call setBearerToken() with your environment API key before you send a request, and connect to the signal of the operation you call, as the usage example in the README shows.

Get help with the C++ SDK

Ask questions and send feedback in the Permit.io Slack community.