REST API
We are pleased to announce the release of the Cloudron REST API.
The REST API provides programmatic access to manage all aspects of the Cloudron. It can be used to perform just about any task that you can do on the Cloudron admin page including:
Add users, groups and mailboxes
Installing, configure, clone, backup and restore apps
Get a log of significant events
Change settings like the avatar, timezone, auto update pattern, certificates etc.
Backup and update the entire Cloudron
Getting started
First get an API token to authenticate requests. You can get one from the API Access
menu of your Cloudron.
The access token can be passed in the Authorization
header or access_token
query parameter to authenticate requests.
Quick tour
Let's start by adding a user (The cloudron is named selfhost.io
in the examples below):
curl -X POST -H "Content-Type: application/json" -d '{ "email": "friend@example.com" }' https://my.selfhost.io/api/v1/users?access_token=<token>
This will send an invite email to the new user with which they can sign up.
We can install any app from the Cloudron Store with a simple API call. To install Gogs in the subdomain git.selfhost.io
:
curl -X POST -H "Content-Type: application/json" -d '{ "appStoreId": "io.gogs.cloudronapp", "location": "git", "accessRestriction": null }' https://my.selfhost.io/api/v1/apps/install?access_token=<token>
accessRestriction
can be set to a group or a list of users to restrict access to the app.
To view the login events across all apps in your Cloudron:
curl -X GET https://my.selfhost.io/api/v1/eventlog?action=user.login?access_token=<token>
Docs
The complete API docs are here. If you have any questions feel free to mail us at support@cloudron.io