Skip to content

PeerTube API

by cpy.re

OAuthHTTPSSocial
Open documentation ↗

Overview

The PeerTube API is built on HTTP(S) and is RESTful. You can use your favorite HTTP/REST library for your programming language to use PeerTube. The spec API is fully compatible with [openapi-generator](https://github.com/OpenAPITools/openapi-generator/wiki/API-client-generator-HOWTO) which generates a client SDK in the language of your choice - we generate some client SDKs automatically: - [Python](https://framagit.org/framasoft/peertube/clients/python) - [Go](https://framagit.org/framasoft/peertube/clients/go) - [Kotlin](https://framagit.org/framasoft/peertube/clients/kotlin) See the [REST API quick start](https://docs.joinpeertube.org/api/rest-getting-started) for a few examples of using the PeerTube API. # Authentication When you sign up for an account on a PeerTube instance, you are given the possibility to generate sessions on it, and authenticate there using an access token. Only __one access token can currently be used at a time__. ## Roles Accounts are given permissions based on their role. There are three roles on PeerTube: Administrator, Moderator, and User. See the [roles guide](https://docs.joinpeertube.org/admin/managing-users#roles) for a detail of their permissions. # Errors The API uses standard HTTP status codes to indicate the success or failure of the API call, completed by a [RFC7807-compliant](https://tools.ietf.org/html/rfc7807) response body. ``` HTTP 1.1 404 Not Found Content-Type: application/problem+json; charset=utf-8 { "detail": "Video not found", "docs": "https://docs.joinpeertube.org/api/rest-reference.html#operation/getVideo", "status": 404, "title": "Not Found", "type": "about:blank" } ``` We provide error `type` values for [a growing number of cases](https://github.com/Chocobozzz/PeerTube/blob/develop/shared/models/server/server-error-code.enum.ts), but it is still optional. Types are used to disambiguate errors that bear the same status code and are non-obvious: ``` HTTP 1.1 403 Forbidden Content-Type: application/problem+json; charset=utf-8 { "detail": "Cannot get this video regarding follow constraints", "docs": "https://docs.joinpeertube.org/api/rest-reference.html#operation/getVideo", "status": 403, "title": "Forbidden", "type": "https://docs.joinpeertube.org/api/rest-reference.html#section/Errors/does_not_respect_follow_constraints" } ``` Here a 403 error could otherwise mean that the video is private or blocklisted. ### Validation errors Each parameter is evaluated on its own against a set of rules before the route validator proceeds with potential testing involving parameter combinations. Errors coming from validation errors appear earlier and benefit from a more detailed error description: ``` HTTP 1.1 400 Bad Request Content-Type: application/problem+json; charset=utf-8 { "detail": "Incorrect request parameters: id", "docs": "https://docs.joinpeertube.org/api/rest-reference.html#operation/getVideo", "instance": "/api/v1/videos/9c9de5e8-0a1e-484a-b099-e80766180", "invalid-params": { "id": { "location": "params", "msg": "Invalid value", "param": "id", "value": "9c9de5e8-0a1e-484a-b099-e80766180" } }, "status": 400, "title": "Bad Request", "type": "about:blank" } ``` Where `id` is the name of the field concerned by the error, within the route definition. `invalid-params.<field>.location` can be either 'params', 'body', 'header', 'query' or 'cookies', and `invalid-params.<field>.value` reports the value that didn't pass validation whose `invalid-params.<field>.msg` is about. ### Deprecated error fields Some fields could be included with previous versions. They are still included but their use is deprecated: - `error`: superseded by `detail` - `code`: superseded by `type` (which is now an URI) # Rate limits We are rate-limiting all endpoints of PeerTube's API. Custom values can be set by administrators: | Endpoint (prefix: `/api/v1`) | Calls | Time frame | |------------------------------|---------------|--------------| | `/*` | 50 | 10 seconds | | `POST /users/token` | 15 | 5 minutes | | `

PeerTube is a social API from cpy.re. Requests are authenticated with OAuth. It is served over HTTPS. Its OpenAPI description documents 186 endpoints.

At a glance

Authentication
OAuth
HTTPS
Yes
CORS
Unknown
Category
Social
Base URL
https://peertube2.cpy.re
Version
5.1.0
Endpoints
186
Spec updated
2023-03-06

Make a first request

Replace the placeholders; the documentation says exactly where credentials go.

cURL
curl -X GET "https://peertube2.cpy.re/api/v1/abuses" \
  -H "Accept: application/json" \
  -H "Authorization: Bearer YOUR_TOKEN"
JavaScript
const response = await fetch("https://peertube2.cpy.re/api/v1/abuses", {
  method: "GET",
  headers: {
    "Accept": "application/json",
    "Authorization": "Bearer YOUR_TOKEN",
  },
});
const data = await response.json();
console.log(data);
Python
import requests

response = requests.request(
    "GET",
    "https://peertube2.cpy.re/api/v1/abuses",
    headers={
    "Accept": "application/json",
    "Authorization": "Bearer YOUR_TOKEN",
    },
    timeout=30,
)
print(response.json())

Endpoints

MethodPathWhat it does
GET/api/v1/abusesList abuses
POST/api/v1/abusesReport an abuse
PUT/api/v1/abuses/{abuseId}Update an abuse
DELETE/api/v1/abuses/{abuseId}Delete an abuse
GET/api/v1/abuses/{abuseId}/messagesList messages of an abuse
POST/api/v1/abuses/{abuseId}/messagesAdd message to an abuse
DELETE/api/v1/abuses/{abuseId}/messages/{abuseMessageId}Delete an abuse message
GET/api/v1/accountsList accounts
GET/api/v1/accounts/{name}Get an account
GET/api/v1/accounts/{name}/followersList followers of an account
GET/api/v1/accounts/{name}/ratingsList ratings of an account
GET/api/v1/accounts/{name}/video-channel-syncsList the synchronizations of video channels of an account
GET/api/v1/accounts/{name}/video-channelsList video channels of an account
GET/api/v1/accounts/{name}/video-playlistsList playlists of an account
GET/api/v1/accounts/{name}/videosList videos of an account
GET/api/v1/blocklist/statusGet block status of accounts/hosts
GET/api/v1/configGet instance public configuration
GET/api/v1/config/aboutGet instance "About" information
GET/api/v1/config/customGet instance runtime configuration
PUT/api/v1/config/customSet instance runtime configuration
DELETE/api/v1/config/customDelete instance runtime configuration
GET/api/v1/custom-pages/homepage/instanceGet instance custom homepage
PUT/api/v1/custom-pages/homepage/instanceSet instance custom homepage
POST/api/v1/jobs/pausePause job queue
POST/api/v1/jobs/resumeResume job queue
GET/api/v1/jobs/{state}List instance jobs
POST/api/v1/metrics/playbackCreate playback metrics
GET/api/v1/oauth-clients/localLogin prerequisite
GET/api/v1/pluginsList plugins
GET/api/v1/plugins/availableList available plugins
POST/api/v1/plugins/installInstall a plugin
POST/api/v1/plugins/uninstallUninstall a plugin
POST/api/v1/plugins/updateUpdate a plugin
GET/api/v1/plugins/{npmName}Get a plugin
GET/api/v1/plugins/{npmName}/public-settingsGet a plugin's public settings
GET/api/v1/plugins/{npmName}/registered-settingsGet a plugin's registered settings
PUT/api/v1/plugins/{npmName}/settingsSet a plugin's settings
GET/api/v1/search/video-channelsSearch channels
GET/api/v1/search/video-playlistsSearch playlists
GET/api/v1/search/videosSearch videos
GET/api/v1/server/audit-logsGet instance audit logs
GET/api/v1/server/blocklist/accountsList account blocks
POST/api/v1/server/blocklist/accountsBlock an account
DELETE/api/v1/server/blocklist/accounts/{accountName}Unblock an account by its handle
GET/api/v1/server/blocklist/serversList server blocks
POST/api/v1/server/blocklist/serversBlock a server
DELETE/api/v1/server/blocklist/servers/{host}Unblock a server by its domain
GET/api/v1/server/followersList instances following the server
DELETE/api/v1/server/followers/{nameWithHost}Remove or reject a follower to your server
POST/api/v1/server/followers/{nameWithHost}/acceptAccept a pending follower to your server
POST/api/v1/server/followers/{nameWithHost}/rejectReject a pending follower to your server
GET/api/v1/server/followingList instances followed by the server
POST/api/v1/server/followingFollow a list of actors (PeerTube instance, channel or account)
DELETE/api/v1/server/following/{hostOrHandle}Unfollow an actor (PeerTube instance, channel or account)
GET/api/v1/server/logsGet instance logs
POST/api/v1/server/logs/clientSend client log
GET/api/v1/server/redundancy/videosList videos being mirrored
POST/api/v1/server/redundancy/videosMirror a video
DELETE/api/v1/server/redundancy/videos/{redundancyId}Delete a mirror done on a video
PUT/api/v1/server/redundancy/{host}Update a server redundancy policy
GET/api/v1/server/statsGet instance stats
GET/api/v1/usersList users
POST/api/v1/usersCreate a user
POST/api/v1/users/ask-send-verify-emailResend user verification link
GET/api/v1/users/meGet my user information
PUT/api/v1/users/meUpdate my user information
GET/api/v1/users/me/abusesList my abuses
DELETE/api/v1/users/me/avatarDelete my avatar
POST/api/v1/users/me/avatar/pickUpdate my user avatar
GET/api/v1/users/me/history/videosList watched videos history
POST/api/v1/users/me/history/videos/removeClear video history
DELETE/api/v1/users/me/history/videos/{videoId}Delete history element
PUT/api/v1/users/me/notification-settingsUpdate my notification settings
GET/api/v1/users/me/notificationsList my notifications
POST/api/v1/users/me/notifications/readMark notifications as read by their id
POST/api/v1/users/me/notifications/read-allMark all my notification as read
GET/api/v1/users/me/subscriptionsGet my user subscriptions
POST/api/v1/users/me/subscriptionsAdd subscription to my user
GET/api/v1/users/me/subscriptions/existGet if subscriptions exist for my user
GET/api/v1/users/me/subscriptions/videosList videos of subscriptions of my user
GET/api/v1/users/me/subscriptions/{subscriptionHandle}Get subscription of my user
DELETE/api/v1/users/me/subscriptions/{subscriptionHandle}Delete subscription of my user
GET/api/v1/users/me/video-playlists/videos-existCheck video exists in my playlists
GET/api/v1/users/me/video-quota-usedGet my user used quota
GET/api/v1/users/me/videosGet videos of my user
GET/api/v1/users/me/videos/importsGet video imports of my user
GET/api/v1/users/me/videos/{videoId}/ratingGet rate of my user for a video
POST/api/v1/users/registerRegister a user
GET/api/v1/users/registrationsList registrations
POST/api/v1/users/registrations/ask-send-verify-emailResend verification link to registration email
POST/api/v1/users/registrations/requestRequest registration
DELETE/api/v1/users/registrations/{registrationId}Delete registration
POST/api/v1/users/registrations/{registrationId}/acceptAccept registration
POST/api/v1/users/registrations/{registrationId}/rejectReject registration
POST/api/v1/users/registrations/{registrationId}/verify-emailVerify a registration email
POST/api/v1/users/revoke-tokenLogout
POST/api/v1/users/tokenLogin
GET/api/v1/users/{id}Get a user
PUT/api/v1/users/{id}Update a user
DELETE/api/v1/users/{id}Delete a user

Showing the first 100 of 186 endpoints; the full list is in the documentation.

Questions

Does the PeerTube API need an API key?

Yes. The PeerTube API uses OAuth authentication; the documentation explains how to get credentials.

Does the PeerTube API support HTTPS?

Yes, the PeerTube API is served over HTTPS.

How many endpoints does the PeerTube API have?

Its OpenAPI description lists 186 endpoints in version 5.1.0. The first 100 are shown on this page.

What are alternatives to the PeerTube API?

Other Social APIs include Blogger, Facebook, Twitter, Pinterest, TikTok.

Compare alternatives →

Listed from APIs.guru (CC0).