Permissions
Learn how Appwrite Videos controls who can watch a stream with per-video permissions, and which scopes manage videos and encoding profiles.
5 min read
Appwrite Videos has two kinds of access: who can watch a stream, and who can manage videos, renditions, captions, and profiles.
Playback
Each video has its own permissions. Manifest, segment, caption, timeline, and thumbnail requests check the video's read permission.
The source file's permissions in Storage are checked only when the video is created: whoever creates it must be able to read the file. After that, playback never looks at the file, so the source can stay private while its stream is public.
| Goal | Grant Read on the video to |
|---|---|
| Public video on a website or in an app | Role.any() |
| Members-only video | Role.users(), or one user with Role.user('<USER_ID>') |
| Video for one team or role | Role.team('<TEAM_ID>'), or a team role such as Role.team('<TEAM_ID>', 'editor') |
Visitors who are not signed in can play a stream that grants Read to Role.any() or Role.guests(), but cannot read its details or list videos. Load the video's name and duration from your own database, or from your backend, when you show a public video.
Default permissions
When you create a video without permissions:
- With an API key, the video has no permissions. Only API keys and members of your project, in the Console, can read it, and it does not play anywhere else.
- From the Console, the video is private in the same way. Turn on Public playback in its settings to share it. See Change access later.
- With a user session, the user who created it gets read, update, and delete permissions.
Set permissions on create
Pass permissions when you create the video. For example, to share a recording with one team:
const sdk = require('node-appwrite');
const client = new sdk.Client() .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') .setProject('<PROJECT_ID>') .setKey('<API_KEY>');
const videos = new sdk.Videos(client);
const video = await videos.create({ videoId: '<VIDEO_ID>', bucketId: '<BUCKET_ID>', fileId: '<FILE_ID>', permissions: [sdk.Permission.read(sdk.Role.team('<TEAM_ID>'))] // optional});Signed-in users can also create videos from a client SDK, from files they can read. They can only grant permissions to roles they belong to.
Change access later
In the Console, open the video, select Settings, and use the Access card:
- Public playback grants or removes Read for Any as soon as you flip it.
- Permissions edits read, update, and delete for any role. Click Update to save.

While a video has no Read for Any, every tab of the video shows a This video is private notice with a link to these settings.
With a server SDK, update the video's permissions with videos.update(). The new list replaces the old one. Only the fields you pass change, so the name is kept:
const sdk = require('node-appwrite');
const client = new sdk.Client() .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') .setProject('<PROJECT_ID>') .setKey('<API_KEY>');
const videos = new sdk.Videos(client);
const video = await videos.update({ videoId: '<VIDEO_ID>', permissions: [sdk.Permission.read(sdk.Role.users())] // optional});Common setups
| App | Setup |
|---|---|
| Marketing site or public course preview | Grant Read to Role.any() on each video |
| Paid course or members area | Grant Read to the users or team who bought access, and update the video's permissions as people buy |
| Team workspace, such as internal recordings | Grant Read to the team, or to a team role such as editor |
| User uploads shown only to the uploader | Let the user create the video from their own session. They get access by default |
Private playback
For a video that is not readable by Role.any(), every manifest, playlist, and segment request must carry the viewer's identity. A request without it returns 404 with the video_not_found error.
Players load these URLs on their own, so on the web the request carries the viewer's session only when the browser sends the Appwrite session cookie. Browsers treat that cookie as a third-party cookie and often block it, unless your Appwrite endpoint is on a custom domain that shares your app's domain. With a custom domain, private videos play in any player, including Safari's native one.
Without a custom domain, use a player that lets you add request headers, and send a JWT for the signed-in user with each request. For example, with hls.js:
import { Client, Account } from 'appwrite'import Hls from 'hls.js'
const client = new Client() .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') .setProject('<PROJECT_ID>')const account = new Account(client)
let { jwt } = await account.createJWT()// JWTs expire after 15 minutes. Refresh before then for long videos.setInterval(async () => ({ jwt } = await account.createJWT()), 10 * 60 * 1000)
const hls = new Hls({ xhrSetup: (xhr) => xhr.setRequestHeader('X-Appwrite-JWT', jwt),})hls.loadSource('<HLS_MANIFEST_URL>')hls.attachMedia(document.getElementById('player'))Test private playback while signed in as a viewer, not only from the Console. The Console plays private videos for project members through its own access, so it does not show what your viewers get.
Renditions and captions
Renditions and captions have no permissions of their own. Anyone who can read the video can read them, and creating, changing, or deleting them requires update permission on the video.
Managing videos
API keys and Console sessions manage videos through scopes:
| Scope | Allows |
|---|---|
videos.read | List and read videos, renditions, captions, codecs, and playback media. Guests hold this scope |
videos.write | Create, update, and delete videos, renditions, and captions |
project.videos.profiles.read | List and read encoding profiles |
project.videos.profiles.write | Create, update, and delete encoding profiles |
Encoding profiles are project settings, so only API keys and the Console can manage them, not client SDKs.
Use an API key with these scopes from a server SDK. API keys skip video permissions, so they can read and change every video. On Appwrite Cloud with organization roles enabled, members manage videos according to their role.
Give each key only what it needs. A backend that only checks whether renditions are ready needs videos.read. A function that creates videos on upload needs videos.write. Never ship an API key in a client app; let viewers stream with their own session instead.
Was this page helpful?
Share what worked or what we should fix. Once approved, our agents automatically apply suggested updates to the docs.