# PeerTube API

> 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

- Category: [Social](https://www.openparable.com/apis/category/social)
- Provider: cpy.re
- Authentication: OAuth
- HTTPS: Yes
- CORS: Not stated
- Base URL: https://peertube2.cpy.re
- Documentation: https://docs.joinpeertube.org/api/rest-reference.html
- OpenAPI description: https://api.apis.guru/v2/specs/cpy.re/peertube/5.1.0/openapi.json
- Version: 5.1.0
- Specification updated: 2023-03-06

## Example request

```bash
curl -X GET "https://peertube2.cpy.re/api/v1/abuses" \
  -H "Accept: application/json" \
  -H "Authorization: Bearer YOUR_TOKEN"
```

## Endpoints

- `GET /api/v1/abuses` — List abuses
- `POST /api/v1/abuses` — Report an abuse
- `PUT /api/v1/abuses/{abuseId}` — Update an abuse
- `DELETE /api/v1/abuses/{abuseId}` — Delete an abuse
- `GET /api/v1/abuses/{abuseId}/messages` — List messages of an abuse
- `POST /api/v1/abuses/{abuseId}/messages` — Add message to an abuse
- `DELETE /api/v1/abuses/{abuseId}/messages/{abuseMessageId}` — Delete an abuse message
- `GET /api/v1/accounts` — List accounts
- `GET /api/v1/accounts/{name}` — Get an account
- `GET /api/v1/accounts/{name}/followers` — List followers of an account
- `GET /api/v1/accounts/{name}/ratings` — List ratings of an account
- `GET /api/v1/accounts/{name}/video-channel-syncs` — List the synchronizations of video channels of an account
- `GET /api/v1/accounts/{name}/video-channels` — List video channels of an account
- `GET /api/v1/accounts/{name}/video-playlists` — List playlists of an account
- `GET /api/v1/accounts/{name}/videos` — List videos of an account
- `GET /api/v1/blocklist/status` — Get block status of accounts/hosts
- `GET /api/v1/config` — Get instance public configuration
- `GET /api/v1/config/about` — Get instance "About" information
- `GET /api/v1/config/custom` — Get instance runtime configuration
- `PUT /api/v1/config/custom` — Set instance runtime configuration
- `DELETE /api/v1/config/custom` — Delete instance runtime configuration
- `GET /api/v1/custom-pages/homepage/instance` — Get instance custom homepage
- `PUT /api/v1/custom-pages/homepage/instance` — Set instance custom homepage
- `POST /api/v1/jobs/pause` — Pause job queue
- `POST /api/v1/jobs/resume` — Resume job queue
- `GET /api/v1/jobs/{state}` — List instance jobs
- `POST /api/v1/metrics/playback` — Create playback metrics
- `GET /api/v1/oauth-clients/local` — Login prerequisite
- `GET /api/v1/plugins` — List plugins
- `GET /api/v1/plugins/available` — List available plugins
- `POST /api/v1/plugins/install` — Install a plugin
- `POST /api/v1/plugins/uninstall` — Uninstall a plugin
- `POST /api/v1/plugins/update` — Update a plugin
- `GET /api/v1/plugins/{npmName}` — Get a plugin
- `GET /api/v1/plugins/{npmName}/public-settings` — Get a plugin's public settings
- `GET /api/v1/plugins/{npmName}/registered-settings` — Get a plugin's registered settings
- `PUT /api/v1/plugins/{npmName}/settings` — Set a plugin's settings
- `GET /api/v1/search/video-channels` — Search channels
- `GET /api/v1/search/video-playlists` — Search playlists
- `GET /api/v1/search/videos` — Search videos
- `GET /api/v1/server/audit-logs` — Get instance audit logs
- `GET /api/v1/server/blocklist/accounts` — List account blocks
- `POST /api/v1/server/blocklist/accounts` — Block an account
- `DELETE /api/v1/server/blocklist/accounts/{accountName}` — Unblock an account by its handle
- `GET /api/v1/server/blocklist/servers` — List server blocks
- `POST /api/v1/server/blocklist/servers` — Block a server
- `DELETE /api/v1/server/blocklist/servers/{host}` — Unblock a server by its domain
- `GET /api/v1/server/followers` — List instances following the server
- `DELETE /api/v1/server/followers/{nameWithHost}` — Remove or reject a follower to your server
- `POST /api/v1/server/followers/{nameWithHost}/accept` — Accept a pending follower to your server
- `POST /api/v1/server/followers/{nameWithHost}/reject` — Reject a pending follower to your server
- `GET /api/v1/server/following` — List instances followed by the server
- `POST /api/v1/server/following` — Follow 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/logs` — Get instance logs
- `POST /api/v1/server/logs/client` — Send client log
- `GET /api/v1/server/redundancy/videos` — List videos being mirrored
- `POST /api/v1/server/redundancy/videos` — Mirror 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/stats` — Get instance stats
- `GET /api/v1/users` — List users
- `POST /api/v1/users` — Create a user
- `POST /api/v1/users/ask-send-verify-email` — Resend user verification link
- `GET /api/v1/users/me` — Get my user information
- `PUT /api/v1/users/me` — Update my user information
- `GET /api/v1/users/me/abuses` — List my abuses
- `DELETE /api/v1/users/me/avatar` — Delete my avatar
- `POST /api/v1/users/me/avatar/pick` — Update my user avatar
- `GET /api/v1/users/me/history/videos` — List watched videos history
- `POST /api/v1/users/me/history/videos/remove` — Clear video history
- `DELETE /api/v1/users/me/history/videos/{videoId}` — Delete history element
- `PUT /api/v1/users/me/notification-settings` — Update my notification settings
- `GET /api/v1/users/me/notifications` — List my notifications
- `POST /api/v1/users/me/notifications/read` — Mark notifications as read by their id
- `POST /api/v1/users/me/notifications/read-all` — Mark all my notification as read
- `GET /api/v1/users/me/subscriptions` — Get my user subscriptions
- `POST /api/v1/users/me/subscriptions` — Add subscription to my user
- `GET /api/v1/users/me/subscriptions/exist` — Get if subscriptions exist for my user
- `GET /api/v1/users/me/subscriptions/videos` — List 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-exist` — Check video exists in my playlists
- `GET /api/v1/users/me/video-quota-used` — Get my user used quota
- `GET /api/v1/users/me/videos` — Get videos of my user
- `GET /api/v1/users/me/videos/imports` — Get video imports of my user
- `GET /api/v1/users/me/videos/{videoId}/rating` — Get rate of my user for a video
- `POST /api/v1/users/register` — Register a user
- `GET /api/v1/users/registrations` — List registrations
- `POST /api/v1/users/registrations/ask-send-verify-email` — Resend verification link to registration email
- `POST /api/v1/users/registrations/request` — Request registration
- `DELETE /api/v1/users/registrations/{registrationId}` — Delete registration
- `POST /api/v1/users/registrations/{registrationId}/accept` — Accept registration
- `POST /api/v1/users/registrations/{registrationId}/reject` — Reject registration
- `POST /api/v1/users/registrations/{registrationId}/verify-email` — Verify a registration email
- `POST /api/v1/users/revoke-token` — Logout
- `POST /api/v1/users/token` — Login
- `GET /api/v1/users/{id}` — Get a user
- `PUT /api/v1/users/{id}` — Update a user
- `DELETE /api/v1/users/{id}` — Delete a user

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

## Similar social APIs

- [Blogger](https://www.openparable.com/apis/blogger): The Blogger APIs allows client applications to view and update Blogger content
- [Facebook](https://www.openparable.com/apis/facebook): Facebook Login, Share on FB, Social Plugins, Analytics and more
- [Twitter](https://www.openparable.com/apis/twitter): Read and write Twitter data
- [Pinterest](https://www.openparable.com/apis/pinterest): The world's catalog of ideas
- [TikTok](https://www.openparable.com/apis/tiktok): Fetches user info and user's video posts on TikTok platform
- [Twitter API](https://www.openparable.com/apis/twitter-2): Use the X API with an all-new Developer Console and consumption-based billing. No fixed monthly costs, no monthly caps.
- [Telegram Bot](https://www.openparable.com/apis/telegram-bot): Simplified HTTP version of the MTProto API for bots
- [Zoom](https://www.openparable.com/apis/zoom): Video communication, web conferencing, chat, and webinars
- [vk](https://www.openparable.com/apis/vk): Read and write vk data
- [Tumblr](https://www.openparable.com/apis/tumblr): Read and write Tumblr Data
- [Discord](https://www.openparable.com/apis/discord): Make bots for Discord, integrate Discord onto an external platform
- [LinkedIn](https://www.openparable.com/apis/linkedin): The foundation of all digital integrations with LinkedIn

Listed from: APIs.guru (CC0). Check the provider's terms before use.

---

Source: https://www.openparable.com/apis/peertube (OpenParable). Cite the canonical URL above.
