C++ wrapper for the Mastodon and Pleroma APIs.
Go to file
tastytea c48f1dc3d0
continuous-integration/drone/push Build is passing Details
add maintenance mode notice
2022-11-13 06:24:35 +01:00
cmake don't add -fsanitize=undefined if MinGW is used 2022-11-13 06:17:34 +01:00
examples Reformat examples. 2020-11-13 14:05:28 +01:00
include Fix some warnings. 2020-11-13 14:17:44 +01:00
pkg-config Fix pkg-config file. 2020-01-10 20:20:05 +01:00
src Make direction a string_view in answer_type::parse_pagination(). 2021-02-08 17:28:46 +01:00
tests add support for testing with catch 3 2022-08-01 14:21:06 +02:00
.clang-format Update .clang-tidy, add .clang-format. 2020-11-13 13:41:13 +01:00
.clang-tidy Update .clang-tidy. 2020-11-30 20:52:56 +01:00
.drone.yml Typo in CI recipe. 2020-11-20 22:52:57 +01:00
.editorconfig Add skeleton. 2020-01-03 08:32:03 +01:00
.gitignore Generate API documentation with CMake. 2020-11-13 14:25:22 +01:00
CMakeLists.txt Version bump 0.5.7. 2020-11-13 15:07:41 +01:00
CODE_OF_CONDUCT.adoc Add contributing guidelines and COC. 2020-01-03 06:30:29 +01:00
CONTRIBUTING.adoc Update contribution guidelines. 2020-02-16 14:08:17 +01:00
LICENSE Add license. 2020-01-03 06:29:45 +01:00
README.adoc add maintenance mode notice 2022-11-13 06:24:35 +01:00



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

mastodonpp is in maintenance mode. I will continue to fix bugs, but wont add new features. If youd like to adopt this project, please get in touch.

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 dont 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.


Packaging status


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


The git-version is available via the AUR: https://aur.archlinux.org/packages/mastodonpp-git/.

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_DOC=YES if you want to generate the API documentation.

  • -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.


mastodonpp has been reported to compile with MinGW GCC, but http_method::DELETE has to be renamed, because Windows headers define a DELETE macro.