Build on RaozanTV
A REST API that answers JSON: show this site's videos in your own app or on your own website, sign members in, let them comment, like, subscribe and bring videos in.
1. A key
Sign in, open Settings → API keys, give the key a name and tick what it may do. The key starts with avk_; you can show and copy it there again at any time. Send it with every call as a header:
X-API-Key: avk_your_key_here
What a key may do:
read | Read - Public videos, channels, categories, Shorts, playlists and comments. |
account | Account - Register and sign members in, read and change the signed-in member's own details and playlists. |
write | Write - Comment, like and subscribe as the signed-in member. |
upload | Upload - Bring a video in by its link (an import) as the signed-in member. |
Keep the key on your server when you can. A key used from a web page is seen by everybody who opens it: give such a key the Read scope only, and list your site under the key's "sites that may use it from a browser" so nobody else can borrow it.
2. The address
https://raozantv.com/developer-api/{route}
Every answer looks like {"ok": true, "data": ..., "meta": {...}}, or {"ok": false, "error": {"code": "...", "message": "..."}} with the HTTP status that fits (401 no or bad key, 403 not allowed, 404 not found, 422 wrong input, 429 too many calls). Lists carry meta.page and meta.next_page.
Limits: so many calls a minute and a day per key (the site decides; your key's page shows them). The headers X-RateLimit-Limit and X-RateLimit-Remaining tell you where you are.
3. Try it
curl -H "X-API-Key: avk_your_key_here" "https://raozantv.com/developer-api/videos?sort=trending&limit=5" curl -H "X-API-Key: avk_your_key_here" "https://raozantv.com/developer-api/videos/qMUJH2kQTmg"
const res = await fetch("https://raozantv.com/developer-api/videos?sort=latest&limit=12", {
headers: { "X-API-Key": "avk_your_key_here" }
});
const json = await res.json();
if (json.ok) {
json.data.forEach(v => console.log(v.title, v.url, v.thumbnail));
}
$ch = curl_init("https://raozantv.com/developer-api/videos/qMUJH2kQTmg");
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ['X-API-Key: avk_your_key_here'],
]);
$video = json_decode(curl_exec($ch), true)['data'] ?? null;
echo $video['title'], ' - ', $video['url'], PHP_EOL;
foreach ($video['files'] ?? [] as $f) {
echo $f['quality'], ': ', $f['url'], PHP_EOL;
}
4. Every route
| Route | Needs | What it does | |
|---|---|---|---|
| GET | status | read | The site, the API and what your key may do. |
| GET | videos | read | Videos. ?sort=latest|trending|popular|oldest|liked, ?q= words, ?category= id or slug, ?channel= username, ?tag=, ?page=, ?limit= (up to 50). |
| GET | videos/{id} | read | One video with its description, tags and - when the site allows it - the files the signed-in member may play. |
| GET | videos/{id}/related | read | Videos like it. |
| GET | videos/{id}/comments | read | Its comments with their replies. ?sort=top|newest|oldest |
| POST | videos/{id}/comments | write | Comment as the signed-in member: body, parent (a comment id to answer). |
| POST | videos/{id}/like | write | Like (value=1), dislike (-1) or take it back (0). |
| GET | search | read | Videos and channels for ?q=. |
| GET | channels | read | Channels with videos, the biggest first. ?q= to look for one. |
| GET | channels/{username} | read | One channel. |
| GET | channels/{username}/videos | read | Its videos. ?sort=latest|popular|oldest |
| GET | channels/{username}/playlists | read | Its public playlists. |
| POST | channels/{username}/subscribe | write | Subscribe (subscribe=1) or leave (0) as the signed-in member. |
| GET | categories | read | Every category. |
| GET | categories/{slug} | read | The videos of one category. |
| GET | shorts | read | Shorts, the newest first (when the Shorts plugin is on). |
| GET | playlists/{id} | read | A playlist with its videos. |
| POST | auth/register | account | Make an account: username, email, password, name. Answers a token. |
| POST | auth/login | account | Sign a member in: login (username or e-mail), password, and code when they use two-step sign-in. Answers a token. |
| GET | auth/me | account | Who the token belongs to. |
| POST | auth/logout | account | Ends the token. |
| GET | me | account | The member the call acts for. |
| GET | me/videos | account | Their own videos, drafts and private ones included. |
| GET | me/playlists | account | Their playlists. |
| GET | me/subscriptions | account | The channels they follow. |
| POST | import | upload | Bring a video in by its link (YouTube, Vimeo, Facebook, another AIO Video site and the rest the site imports from): url, title, description, tags, privacy, category. |
POST bodies may be a form (application/x-www-form-urlencoded) or JSON (application/json).
5. Members: register, sign in, act for them
A key alone acts for the member who made it (good for your own scripts). An app used by other people signs each of them in and sends their token along with the key:
curl -X POST -H "X-API-Key: avk_your_key_here" \
-d "login=member@example.com" -d "password=their-password" \
"https://raozantv.com/developer-api/auth/login"
# {"ok":true,"data":{"token":"avt_...","token_type":"Bearer","expires_in":2592000,"member":{...}}}
curl -X POST -H "X-API-Key: avk_your_key_here" -H "Authorization: Bearer avt_..." \
-d "body=Lovely video!" "https://raozantv.com/developer-api/videos/qMUJH2kQTmg/comments"
When the member uses two-step sign-in the first answer is 401 twofa_required (with the way: app or email); send the same call again with code. auth/register takes username, email, password and name and answers a token too.
A video's answer carries files - the sizes this member may play, as the site's own player would get them - when the site allows it; locked says age or region when it may not be played here, and embed_url is the player to put in an iframe.
6. "Sign in with RaozanTV" on your own site
This site is also an OAuth 2.0 / OpenID Connect provider: your site can put a "Continue with RaozanTV" button on its sign-in page without ever seeing a password. Everything a library needs is in the discovery document:
https://raozantv.com/.well-known/openid-configuration
An AIO Video site does it without a library: Admin → Plugins → "Sign in with another site", paste this site's address, done.