C++ wrapper for the Mastodon and Pleroma APIs.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
tastytea ef11508ca1
Bump maximum CMake version to 3.16.
1 month ago
cmake Setting -g for debug builds is redundant. 5 months ago
examples Catch JSON exceptions in nlohmann-json example. 5 months ago
include Add Support for Pleroma 2.0.2. 2 months ago
pkg-config Fix pkg-config file. 5 months ago
src Add Support for Pleroma 2.0.2. 2 months ago
tests Add test for unescape_html(). 5 months ago
.clang-tidy Update .clang-tidy. 5 months ago
.drone.yml Fix CI recipe. 5 months ago
.editorconfig Add skeleton. 6 months ago
.gitignore Expand git ignores. 6 months ago
CMakeLists.txt Bump maximum CMake version to 3.16. 1 month ago
CODE_OF_CONDUCT.adoc Add contributing guidelines and COC. 6 months ago
CONTRIBUTING.adoc Update contribution guidelines. 4 months ago
Doxyfile Add documentation. 6 months ago
LICENSE Add license. 6 months ago
README.adoc Add WITH_CLANG-TIDY to CMake recipe. 5 months ago
build_doc.sh Add documentation. 6 months ago



mastodonpp is a C++ wrapper for the Mastodon and Pleroma APIs. It replaces mastodon-cpp.

We aim to create a library that is comfortable, yet minimal. All API endpoints from Mastodon and Pleroma are stored in enum classes, to counteract typos and make your life easier. The network-facing code is built on libcurl, a mature and stable library that is available on most operating systems. The library does not parse the responses itself, but returns to you the raw data, because we know everyone has their favorite JSON library and we don’t want to impose our choice on you!


Here is a rough overview of the features:

  • GET, Streaming GET, POST, PATCH, PUT and DELETE requests.

  • ✓ Comfortable access to pagination headers.

  • ✓ Report maximum allowed character per post.

  • ✓ Simple function to register a new “app” (get an access token).

  • ✓ Report which mime types are allowed for posting statuses.

  • ✓ Find and retrieve NodeInfo.

  • ✓ Easy access to the libcurl handle for maximum configurability.

  • ✓ Set proxy server, User-Agent and the path to the CA bundle.


Have a look at the reference.


#include <mastodonpp/mastodonpp.hpp>
#include <iostream>

int main()
    mastodonpp::Instance instance{"example.com", "123AccessToken123"};
    mastodonpp::Connection connection{instance};

    const mastodonpp::parametermap parameters
            {"status", "How is the weather?"},
            {"poll[options]", vector<string_view>{"Nice", "not nice"}},
            {"poll[expires_in]", "86400"}
    auto answer{connection.post(mastodonpp::API::v1::statuses, parameters)};

    if (answer)
        std::cout << answer << std::endl;

More examples are included in the reference.



eselect repository enable tastytea
echo 'dev-cpp/mastodonpp' >> /etc/portage/package.accept_keywords/mastodonpp
emaint sync -r tastytea
emerge -a dev-cpp/mastodonpp

Debian and Ubuntu

We automatically generate packages for Debian buster (10) and Ubuntu bionic (18.04), but only for x86_64 (amd64). Download them at schlomp.space.

apt install ./libmastodonpp*.deb


We automatically generate packages for CentOS 8, but only for x86_64 (amd64). Download them at schlomp.space.

yum install ./libmastodonpp*.rpm

From source


  • Tested OS: Linux

  • C++ compiler with C++17 support (tested: GCC 7/8/9, clang 6/7)

  • CMake (at least: 3.9)

  • libcurl (at least: 7.56)

  • Optional

    • Documentation: Doxygen (tested: 1.8)

    • Tests: Catch (tested: 2.5 / 1.2)

    • DEB package: dpkg (tested: 1.19)

    • RPM package: rpm-build (tested: 4.11)

Get sourcecode


Download the current release at schlomp.space.

Development version
git clone https://schlomp.space/tastytea/mastodonpp.git


mkdir -p build && cd build
cmake ..
cmake --build . -- -j$(nproc --ignore=1)
CMake options:
  • -DCMAKE_BUILD_TYPE=Debug for a debug build.

  • -DWITH_TESTS=YES if you want to compile the tests.

  • -DWITH_EXAMPLES=YES if you want to compile the examples.

  • -DWITH_CLANG-TIDY=YES to check the sourcecode with clang-tidy while compiling.

  • One of:

    • -DWITH_DEB=YES if you want to be able to generate a deb-package.

    • -DWITH_RPM=YES if you want to be able to generate an rpm-package.

To create a deb or rpm package, run make package after compiling.

How to contribute

Read the Code of Conduct.

Reporting bugs or suggesting enhancements

Before reporting a bug, please perform a search to see if the problem has already been reported. If it has, add a comment to the existing issue instead of opening a new one. Same for enhancements.

You can also contact me via E-Mail, XMPP or the Fediverse if you don’t want to open an account.

Pull requests

Please use similar coding conventions as the rest of the project. The basic rule to remember is to write code in the same style as the existing/surrounding code. Add a copyright line with the year, your name and your email address to the files you edited, unless you don’t want to.

You can also send me your patches via E-Mail, ideally using git format-patch or git send-email.