PeerTube
v8.3.0https://peertube2.cpy.reLive Test Server (live data - latest nightly version)https://peertube3.cpy.reLive Test Server (live data - latest RC version)https://peertube.cpy.reLive Test Server (live data - stable version)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.
See the REST API quick start 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 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 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 (following RFC7807) and code (internal PeerTube code) values for a growing number of cases,
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
Example:
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'.
invalid-params.<field>.value reports the value that didn't pass validation whose invalid-params.<field>.msg is about.
max_file_size_reached
The uploaded file exceeds the instance-wide file size limit.
quota_reached
The uploaded file exceeds the user's storage quota.
does_not_respect_follow_constraints
The requested remote resource cannot be accessed because the instance does not follow its origin.
live_not_enabled
Live streaming is not enabled on the instance.
live_not_allowing_replay
Saving live replays is disabled on this instance, so a live cannot be created or updated with saveReplay enabled.
live_conflicting_permanent_and_save_replay
Not returned by PeerTube anymore: permanent lives can save replays.
max_instance_lives_limit_reached
The instance has reached its maximum number of simultaneous live streams.
max_user_lives_limit_reached
The user has reached the maximum number of simultaneous live streams.
incorrect_files_in_torrent
The torrent does not contain exactly one usable video file.
comment_not_associated_to_video
The comment is not associated with the requested video.
invalid_grant
The OAuth grant or refresh token is invalid.
invalid_client
Client authentication failed.
invalid_token
The access token is expired, revoked, malformed, or otherwise invalid.
unauthorized_request
The endpoint requires authentication but no access token was provided.
invalid_request
The authentication or token request is malformed: missing grant_type, malformed Authorization header,
access token sent using more than one method, or sent in the query string.
unsupported_grant_type
The grant_type is not supported. PeerTube supports password and refresh_token.
unauthorized_client
The OAuth client is not allowed to use the requested grant_type.
server_error
An unexpected error occurred while checking the access token.
missing_two_factor
The required two-factor authentication header is missing.
too_long_password
The password exceeds the maximum allowed length.
invalid_two_factor
The two-factor authentication code is invalid.
account_blocked
The account is blocked.
email_not_verified
The account email address has not been verified.
account_waiting_for_approval
The account is waiting for administrator approval.
account_approval_rejected
The account approval request was rejected.
runner_job_not_in_processing_state
The runner job is not in the processing state.
runner_job_not_in_pending_state
The runner job is not in the pending state.
unknown_runner_token
The runner token is unknown.
video_requires_password
A password is required to access the video.
incorrect_video_password
The password provided for the video is incorrect.
video_already_being_transcoded
The video is already being transcoded.
video_already_being_transcribed
The video is already being transcribed.
video_already_has_captions
The video already has captions.
max_user_video_quota_exceeded_for_user_export
The user requested an export including video files, but the total size of their videos is above the maximum allowed by the instance for such exports. Request an export without video files instead.
current_password_is_invalid
The current password is invalid.
current_password_is_missing
The action requires a password confirmation but currentPassword is missing.
password_confirmation_unavailable
The action requires a password confirmation but the user authenticates with an external auth plugin (OpenID Connect, SAML...), so PeerTube cannot check their password.
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 |
POST /users/register | 2* | 5 minutes |
POST /users/ask-send-verify-email | 3 | 5 minutes |
Depending on the endpoint, *failed requests are not taken into account. A service
limit is announced by a 429 Too Many Requests status code.
You can get details about the current state of your rate limit by reading the following headers:
| Header | Description |
|---|---|
X-RateLimit-Limit | Number of max requests allowed in the current time period |
X-RateLimit-Remaining | Number of remaining requests in the current time period |
X-RateLimit-Reset | Timestamp of end of current time period as UNIX timestamp |
Retry-After | Seconds to delay after the first 429 is received |
Password confirmation
If the security.password_confirmation.enabled setting is enabled (default), sensitive administrator actions require
the user password in the currentPassword field of the request body:
- Install or update a plugin/theme
- Change the custom JavaScript or CSS of the instance (
instance.customizationsof the custom configuration) - Create an administrator, or give the administrator role to a user
- Change the password, email or auth plugin (
pluginAuth) of an administrator
After 10 failed password confirmations in 10 minutes (configurable), the user receives a 429 Too Many Requests status code
until the end of the time frame, even with the correct password.
CORS
This API features Cross-Origin Resource Sharing (CORS), allowing cross-domain communication from the browser for some routes:
| Endpoint |
|------------------------- ---|
| /api/* |
| /download/* |
| /lazy-static/* |
| /.well-known/webfinger |
In addition, all routes serving ActivityPub are CORS-enabled for all origins.
Authentication
OAuth2oauth2Authenticating via OAuth requires the following steps:
- Have an activated account
- Generate an access token for that account at
/api/v1/users/token. - Make requests with the Authorization: Bearer <token> header
- Profit, depending on the role assigned to the account
Note that the access token is valid for 1 day and is given along with a refresh token valid for 2 weeks.
- Token URL
/api/v1/users/token
admin- Admin scopemoderator- Moderator scopeuser- User scope
- Static Video FilesGet public Web Video file, Get private Web Video file, Get public HLS video file and Get private HLS video file
- Video DownloadDownload video files
- Video FeedsServer syndication feeds of videos
- RegisterAs a visitor, you can use this API to open an account (if registrations are open on that PeerTube instance). As an admin, you should use the dedicated User creation API instead.
- SessionSessions deal with access tokens over time. Only one session token can currently be used at a time.
- AccountsAccounts encompass remote accounts discovered across the federation, and correspond to the main Actor, along with video channels a user can create, which are also Actors. When a comment is posted, it is done with your Account's Actor.
- UsersUsing some features of PeerTube require authentication, for which User provide different levels of permission as well as associated user information. Each user has a corresponding local Account for federation.
- User ExportsTo create an archive of user data.
- User ImportsTo import an archive of user data.
- My UserOperations related to your own User, when logged-in.
- My SubscriptionsOperations related to your subscriptions to video channels, their new videos, and how to keep up to date with their latest publications!
- My NotificationsNotifications following new videos, follows or reports. They allow you to keep track of the interactions and overall important information that concerns you. You MAY set per-notification type delivery preference, to receive the info either by mail, by in-browser notification or both.
- My HistoryOperations related to your watch history.
- VideoOperations dealing with listing, uploading, fetching or modifying videos.
- Video UploadOperations dealing with adding video or audio. PeerTube supports two upload modes, and three import modes.
- Video ImportsOperations dealing with listing, adding and removing video imports.
- Video CaptionsOperations dealing with listing, adding and removing closed captions of a video.
- Video ChaptersOperations dealing with managing chapters of a video.
- Video ChannelsOperations dealing with the creation, modification and listing of videos within a channel.
- Video CommentsOperations dealing with comments to a video. Comments are organized in threads: adding a comment in response to the video starts a thread, adding a reply to a comment adds it to its root comment thread.
- Video RatesLike/dislike a video.
- Video PlaylistsOperations dealing with playlists of videos. Playlists are bound to users and/or channels.
- Video StatsVideo statistics
- Ownership ChangeList video ownership changes, Accept ownership change request, Refuse ownership change request and 9 more
- Video MirroringPeerTube instances can mirror videos from one another, and help distribute some videos.
- Video FilesOperations on video files
- Video TranscodingVideo transcoding related operations
- Live VideosList live sessions and Get live session of a replay
- Channels SyncOperations dealing with synchronizing PeerTube user's channel with channels of other platforms
- Video PasswordsOperations on video passwords.
- Video Embed PrivacyGet video embed privacy, Update video embed privacy and Check if embed is allowed
- AbusesAbuses deal with reports of local or remote videos/comments/accounts alike.
- Video BlocksOperations dealing with blocking videos (removing them from view and preventing interactions).
- Account BlocklistGet block status of accounts/hosts, List accounts blocked by my account, Block an account by my account and 4 more
- Server BlocklistList blocked accounts by server, Block an account by server, Unblock an account by server and 7 more
- Watched WordsManage list of watched words to detect patterns on objects (like comments of videos)
- ConfigEach server exposes public information regarding supported videos and options.
- Client ConfigConfiguration of the web client.
- HomepageGet and update the custom homepage
- Instance FollowsManaging servers which the instance interacts with is crucial to the concept of federation in PeerTube and external video indexation. The PeerTube server then deals with inter-server ActivityPub operations and propagates information across its social graph by posting activities to actors' inbox endpoints.
- Instance RedundancyRedundancy is part of the inter-server solidarity that PeerTube fosters. Manage the list of instances you wish to help by seeding their videos according to the policy of video selection of your choice. Note that you have a similar functionality to mirror individual videos, see video mirroring.
- PluginsManaging plugins installed from a local path or from NPM, or search for new ones.
- StatsStatistics
- LogsOperations dealing with client, server and audit logs.
- JobJobs are long-running tasks enqueued and processed by the instance itself. No additional worker registration is currently available.
- Runner Registration TokenManage runner registration tokens.
- Runner JobsManage runner jobs and runner-side job execution.
- RunnersRegister, list and remove remote runners.
- Player SettingsOperations dealing with video player settings for videos and channels.
- ContactSend a message to the instance administrators.
- DebugAdministrative debug endpoints.
Models
- id
- UUIDv4
- shortUUIDtranslation of a uuid v4 with a bigger alphabet to have a shorter uuid
- usernameimmutable name of the user, used to find or mention its actor
- usernameChannelimmutable name of the channel, used to interact with its actor
- password
- currentPasswordPassword of the authenticated user, required if [password confirmation](https://docs.joinpeertube.org/api-rest-reference/api.html#password-confirmation) is enabled
- VideoCategorySetcategory id of the video (see [/videos/categories](https://docs.joinpeertube.org/api-rest-reference/api/operations/getcategories.html))
- VideoConstantNumber-Category
- VideoLicenceSetlicence id of the video (see [/videos/licences](https://docs.joinpeertube.org/api-rest-reference/api/operations/getlicences.html))
- VideoConstantNumber-Licence
- VideoLanguageSetlanguage id of the video (see [/videos/languages](https://docs.joinpeertube.org/api-rest-reference/api/operations/getlanguages.html))
- VideoConstantString-Language
- VideoPlaylistPrivacySetVideo playlist privacy policy (see [/video-playlists/privacies](https://docs.joinpeertube.org/api-rest-reference/api/operations/getplaylistprivacypolicies.html))
- VideoPlaylistPrivacyConstant
- VideoPlaylistTypeSetThe video playlist type (Regular = `1`, Watch Later = `2`)
- VideoPlaylistTypeConstant
- VideoPrivacySetprivacy id of the video (see [/videos/privacies](https://docs.joinpeertube.org/api-rest-reference/api/operations/getvideoprivacypolicies.html))
- VideoPrivacyConstant
- VideoCommentsPolicySetComments policy of the video (Enabled = `1`, Disabled = `2`, Requires Approval = `3`)
- VideoCommentsPolicyConstant
- VideoRecommendationScopeSetVideos that can be recommended next to a video: - `1` All videos - `2` Only videos of the platform that owns the reference video (or of the current platform if no video is given) - `3` Only videos of the account that owns the reference video - `4` Only videos of the channel of the reference video This is a preference of the video owner: applications displaying recommendations may not apply it
- VideoRecommendationScopeConstant
- VideoAIUsageSet**PeerTube >= 9.0** Use of AI in the video, declared by the video creator: - `1` Not specified - `2` No AI-generated content: nothing seen or heard in the video has been generated by AI - `3` Contains AI-generated content: some parts of the video have been generated by AI - `4` AI-generated: the whole video, or most of it, has been generated by AI
- VideoAIUsageConstant
- VideoCommercialContentSet**PeerTube >= 9.0** Commercial content in the video, declared by the video creator: - `1` None - `2` Promotional content: the creator promotes their own products, services or business - `3` Paid partnership: a third party paid, or provided goods or services, in exchange for the promotion
- VideoCommercialContentConstant
- BlockStatus
- NSFWPolicy
- NSFWFlag NSFW flags (can be combined using bitwise or operator) - `0` NONE - `1` VIOLENT - `2` EXPLICIT_SEX
- UserRoleThe user role (Admin = `0`, Moderator = `1`, User = `2`)
- UserAdminFlagsAdmin flags for the user (None = `0`, Bypass video blocklist = `1`)
- LiveVideoLatencyModeThe live latency mode (Default = `1`, High latency = `2`, Small Latency = `3`)
- LiveVideoReplaySettings
- VideoChannelActivityActionThe activity action: - CREATE: 1 - UPDATE: 2 - DELETE: 3 - UPDATE_CAPTIONS: 4 - UPDATE_CHAPTERS: 5 - UPDATE_PASSWORDS: 6 - CREATE_STUDIO_TASKS: 7 - UPDATE_SOURCE_FILE: 8 - UPDATE_ELEMENTS: 9 - REMOVE_CHANNEL_OWNERSHIP: 10 - CREATE_CHANNEL_OWNERSHIP: 11
- VideoChannelActivityTargetThe activity target: - VIDEO: 1, - PLAYLIST: 2, - CHANNEL: 3, - CHANNEL_SYNC: 4, - VIDEO_IMPORT: 5
- VideoStateConstant
- UserExportStateThe user export state: - `1`: Pending - `2`: Processing - `3`: Completed - `4`: Errored
- UserImportStateThe user import state: - `1`: Pending - `2`: Processing - `3`: Completed - `4`: Errored
- AbuseStateSetThe abuse state (Pending = `1`, Rejected = `2`, Accepted = `3`)
- AbuseStateConstant
- AbusePredefinedReasons
- VideoResolutionSetVideo resolution (`0`, `240`, `360`, `720`, `1080`, `1440` or `2160`) `0` is used as a special value for stillimage videos dedicated to audio, a.k.a. audio-only videos.
- VideoResolutionConstantresolutions and their labels for the video
- VideoScheduledUpdate
- AccountSummary
- VideoSummary
- VideoChannelSummary
- PlaylistElement
- Thumbnail
- VideoFile
- VideoStreamingPlaylists
- VideoStreamingPlaylists-HLS
- VideoInfo
- Video
- ServerError
- VideoDetails
- FileRedundancyInformation
- VideoRedundancy
- AccountBlock
- ServerBlock
- BlocklistSubscription
- BlocklistSubscriptionSummary
- BlocklistLog
- AutoMuteList
- CommentAutoTagPolicies
- VideoAutoTagPolicies
- AutomaticTagAvailable
- VideoImportStateConstant
- VideoCreateImport
- VideoImport
- VideoImportsList
- Abuse
- AbuseMessage
- VideoBlacklist
- VideoBlacklistCreate
- VideoBlacklistUpdate
- ChangeOwnershipRepresentation of a ownership change
- VideoPlaylist
- VideoComment
- VideoCommentThreadTree
- VideoCommentForOwnerOrAdmin
- Storyboard
- VideoCaption
- VideoChapters
- PodcastChaptersPodcasting 2.0 JSON chapters, see https://github.com/Podcastindex-org/podcast-namespace/blob/main/docs/examples/chapters/jsonChapters.md
- VideoSource
- ActorImage
- ActorInfo
- Actor
- Account
- UserViewingVideo
- VideoStatsOverall
- VideoStatsUserAgentDevice
- VideoStatsUserAgent
- VideoStatsRetention
- VideoStatsTimeserie
- ServerConfig
- SendClientLog
- ServerStats
- ServerConfigAbout
- InstanceTranslation
- ServerConfigCustom
- CustomHomepage
- Follow
- PredefinedAbuseReasonsReason categories that help triage reports
- JobType
- Job
- AddUserResponse
- VideoUploadRequestCommon
- VideoUploadRequestLegacy
- VideoUploadRequestResumable
- VideoUploadResponse
- VideoReplaceSourceRequestResumable
- UserImportResumable
- CommentThreadResponse
- CommentThreadPostResponse
- VideoTokenResponse
- VideoListResponse
- ChannelActivityListResponse
- UserNotificationSettings
- User
- UserWithStats
- AddUser
- UpdateUser
- UpdateMe
- GetMeVideoRating
- VideoRating
- RegisterUser
- UserRegistrationRequest
- UserRegistrationAcceptOrReject
- AuditLogAction
- AuditLogEntityType
- AuditLog
- UserRegistrationStateThe registration state (Pending = `1`, Rejected = `2`, Accepted = `3`)
- ChangeOwnershipStateThe ownership change state (Pending = `1`, Rejected = `2`, Accepted = `3`)
- UserRegistration
- OAuthClient
- OAuthToken-password
- OAuthToken-refresh_token
- VideoChannel
- VideoChannelEdit
- VideoChannelCreate
- VideoChannelUpdate
- VideoChannelList
- ImportVideosInChannelCreate
- VideoChannelSync
- VideoChannelSyncList
- VideoChannelSyncCreate
- MRSSPeerLink
- MRSSGroupContent
- VideoCommentsForXML
- VideosForXML
- NotificationSettingValueNotification type. One of the following values, or a sum of multiple values: - `0` NONE - `1` WEB - `2` EMAIL
- NotificationTypeNotification type. One of the following values: - `1` NEW_VIDEO_FROM_SUBSCRIPTION - `2` NEW_COMMENT_ON_MY_VIDEO - `3` NEW_ABUSE_FOR_MODERATORS - `4` BLACKLIST_ON_MY_VIDEO - `5` UNBLACKLIST_ON_MY_VIDEO - `6` MY_VIDEO_PUBLISHED - `7` MY_VIDEO_IMPORT_SUCCESS - `8` MY_VIDEO_IMPORT_ERROR - `9` NEW_USER_REGISTRATION - `10` NEW_FOLLOW - `11` COMMENT_MENTION - `12` VIDEO_AUTO_BLACKLIST_FOR_MODERATORS - `13` NEW_INSTANCE_FOLLOWER - `14` AUTO_INSTANCE_FOLLOWING - `15` ABUSE_STATE_CHANGE - `16` ABUSE_NEW_MESSAGE - `17` NEW_PLUGIN_VERSION - `18` NEW_PEERTUBE_VERSION - `19` MY_VIDEO_STUDIO_EDITION_FINISHED - `20` NEW_USER_REGISTRATION_REQUEST - `21` NEW_LIVE_FROM_SUBSCRIPTION - `22` MY_VIDEO_TRANSCRIPTION_GENERATED - `23` INVITED_TO_COLLABORATE_TO_CHANNEL - `24` ACCEPTED_TO_COLLABORATE_TO_CHANNEL - `25` REFUSED_TO_COLLABORATE_TO_CHANNEL - `26` VIDEO_OWNERSHIP_CHANGED_REQUEST - `27` VIDEO_OWNERSHIP_CHANGED_ACCEPTED - `28` VIDEO_OWNERSHIP_CHANGED_REJECTED - `29` CHANNEL_OWNERSHIP_CHANGED_REQUEST - `30` CHANNEL_OWNERSHIP_CHANGED_ACCEPTED - `31` CHANNEL_OWNERSHIP_CHANGED_REJECTED - `32` AUTOMATIC_BLOCKLIST_UPDATE - `33` MY_VIDEO_STUDIO_EDITION_ERROR - `34` MY_VIDEO_DUPLICATION_ERROR
- NewFeatureInfoTypeRepresent a new feature that can be displayed to inform users. One of the following values: - `1` CHANNEL_COLLABORATION
- Notification
- NotificationListResponse
- Plugin
- PluginResponse
- LiveVideoUpdate
- LiveVideoResponse
- LiveSchedule
- TokenSession
- RequestTwoFactorResponse
- VideoStudioCreateTask
- LiveVideoSessionResponse
- PlaybackMetricCreate
- RunnerRegistrationToken
- Runner
- RunnerJobType
- RunnerJobStateThe runner job state: - `1` Pending - `2` Processing - `3` Completed - `4` Errored - `5` Waiting for a parent job - `6` Cancelled - `7` Parent had an error - `8` Parent has been cancelled
- RunnerJobStateConstant
- RunnerJobPayload
- RunnerJob
- RunnerJobAdmin
- WatchedWordsLists
- WatchedWordsSubscription
- VideoPassword
- VideoPasswordList
- AddVideoPasswords
- VideoEmbedPrivacyThe video embed privacy level: - `1` All allowed: anyone can embed the video - `2` Allowlist: only the domains in the allowlist can embed the video - `3` Remote restrictions: the remote instance has restrictions on where the video can be embedded - `4` Nobody can embed this video
- PlayerThemeThe player theme to use
- PlayerThemeChannelSettingPlayer theme setting for a channel: - `instance-default` Use the instance default theme - `galaxy` Use the galaxy theme - `lucide` Use the lucide theme
- PlayerThemeVideoSettingPlayer theme setting for a video: - `channel-default` Use the channel default theme - `instance-default` Use the instance default theme - `galaxy` Use the galaxy theme - `lucide` Use the lucide theme
- PlayerVideoSettingsPlayer settings for a video
- PlayerChannelSettingsPlayer settings for a channel
- PlayerVideoSettingsUpdatePlayer settings update for a video
- PlayerChannelSettingsUpdatePlayer settings update for a channel
- FileStorageThe file storage type: - `0` File system - `1` Object storage
- VideoChannelCollaboratorRepresentation of a channel collaboration
- VideoChannelCollaboratorStateThe user import state: - `1`: Pending - `2`: Accepted
