Build with Aniwatch
Read the whole catalogue, match shows from MyAnimeList or AniList, send viewers straight to an episode, embed the player, and let people link their Aniwatch account to your site or app.
Titles, genres, episodes, airing schedule. No key needed to start.
MAL-id lookup, stable deep links and a player page you can embed.
OAuth 2.0 + PKCE. Read and write a user's library and watch progress.
# try it curl "/api/v1/lookup?mal_id=21&episode=1"
Authentication & limits
Every endpoint returns JSON. Rate-limit state is in the X-RateLimit-Limit, X-RateLimit-Remaining and X-RateLimit-Reset headers.
| How you call | Send | Limit | Use for |
|---|---|---|---|
| Anonymous | nothing | 60 / min per IP | Trying things out, small sites |
| API key | X-API-Key: aw_live_… | 600 / min per key (adjustable) | Your backend reading the catalogue |
| User token | Authorization: Bearer aw_at_… | 300 / min per connection | Acting for a signed-in user |
Errors
{ "error": { "code": "not_found", "message": "No title with that id." } }
| Status | code | Meaning |
|---|---|---|
| 400 | bad_request | A parameter is missing or invalid |
| 401 | invalid_key · invalid_token · unauthorized | Bad key, expired token, or the endpoint needs a user token |
| 403 | insufficient_scope | The user didn't grant the scope this endpoint needs |
| 404 | not_found | No such title, episode or endpoint |
| 429 | rate_limited | Slow down; see X-RateLimit-Reset |
| 503 | upstream_busy | Episode data is being fetched; retry in a few seconds |
Browse & search
/anime
Filter and page through the catalogue. Returns cards (no episodes).
| Param | Description |
|---|---|
q | Search English, romaji and native titles |
genre | Comma-separated; all must match (see /genres) |
type · year · season | TV, Movie, ONA… · 2025 · Fall |
status | Substring, e.g. currently for airing |
lang | sub or dub: only titles with that audio |
sort | updated (default), score, year, title |
page · per_page | Pagination; per_page up to 100 |
{
"data": [{ "id": 1642, "mal_id": 21, "title": "One Piece", "type": "TV", "year": 1999, "score": 8.73,
"sub_episodes": 1180, "dub_episodes": 1155, "poster": "https://…", "url": "…/#/anime/1642" }],
"pagination": { "page": 1, "per_page": 30, "total": 9057, "total_pages": 302 }
}
/search?q=frieren&limit=10
Quick search, best matches first.
/genres
All genres with title counts.
/home
recent, airing and top rows, 24 each.
Details & episodes
/anime/{id}
Everything about a title plus its episodes. Each episode has three ways to play it:
{ "number": 1, "title": "Episode 1", "languages": ["sub", "dub"],
"watch_url": "…/#/watch/8679/1", // full Aniwatch page
"embed_url": "…/embed/8679/1", // bare player for iframes / WKWebView (?lang=dub)
"sources": { "sub": "https://megaplay.buzz/…/sub", "dub": "…/dub" } }
/anime/{id}/episodes
/anime/{id}/episodes/{number}
503 upstream_busy for a few seconds while it's fetched for the first time. Retry with a short back-off.Lookup by MyAnimeList id
/lookup?mal_id={id}&episode={n}
The fastest way for another site to find a show here. AniList exposes the MAL id as idMal, so AniList-based sites match exactly. If you only have a title, pass title (and year) for a best-effort match; check match before trusting it.
GET /api/v1/lookup?mal_id=52991&episode=3
{ "match": "mal_id", // or "title_exact" / "title_fuzzy"
"data": { "id": 6351, "title": "Frieren: Beyond Journey's End", "sub_episodes": 28, …,
"url": "…/#/anime/6351", "watch_url": "…/#/watch/6351/3" } }
Deep links
Stable URLs you can put behind a “Watch on Aniwatch” button without calling the API first. Unknown ids fall back to a search.
| URL | Opens |
|---|---|
/go/mal/{mal_id} | The title's page |
/go/mal/{mal_id}?ep=5&lang=dub | Episode 5, dubbed |
/go/mal/{mal_id}?title=Frieren | Search for “Frieren” if the MAL id isn't on Aniwatch |
/go/{aniwatch_id} | The title's page by Aniwatch id |
Embeddable player
/embed/{id}/{episode}?lang=sub|dub is a full-bleed player page with no site chrome. Put it in an <iframe allowfullscreen> or a WKWebView.
<iframe src="/embed/6351/1?lang=sub" allow="autoplay; fullscreen" allowfullscreen style="width:100%;aspect-ratio:16/9;border:0"></iframe>
Progress events: the page forwards the player's messages to its parent as {source:"aniwatch", anime, episode, data}, where data includes {event:"CURRENT_TIME", time, duration} every ~2 s. In iOS it also posts the same data to window.webkit.messageHandlers.aniwatch. Use it to mark an episode watched (for example at 85%).
Commands: iframe.contentWindow.postMessage({aniwatchCommand:{cmd:"SEEK", value:90}}, "*"). PLAY_TOGGLE and GET_TIME also work.
Sign in with Aniwatch (OAuth 2.0)
Let people connect their Aniwatch account to your site or app. You get a token that can read or update their library and watch progress, limited to the scopes they approve. Standard authorization-code flow; PKCE is required for mobile and browser apps.
| Endpoint | |
|---|---|
GET /oauth/authorize | Send the user here |
POST /oauth/token | Exchange a code, or refresh. Form or JSON body. |
POST /oauth/revoke | Disconnect (send the refresh token to remove the whole connection) |
- Register your app in Admin → Developers. Choose Website (gets a
client_secret) or Mobile / browser (no secret, PKCE). Add every redirect URI exactly. http is allowed only forlocalhost; custom schemes likeaniwatch-ios://oauthare fine. - Redirect the user:
/oauth/authorize?response_type=code &client_id=aw_app_…&redirect_uri=https://kiroku.example/auth/aniwatch/callback &scope=profile%20history:read%20library:write&state=RANDOM &code_challenge=BASE64URL(SHA256(verifier))&code_challenge_method=S256
They sign in if needed and see a consent screen. You get back?code=…&state=…, or?error=access_denied. - Exchange the code (codes last 10 minutes and work once):
curl -X POST /oauth/token \ -d grant_type=authorization_code -d code=CODE \ -d redirect_uri=https://kiroku.example/auth/aniwatch/callback \ -d client_id=aw_app_… -d client_secret=aw_secret_… # or -d code_verifier=… for PKCE apps { "access_token": "aw_at_…", "token_type": "Bearer", "expires_in": 3600, "refresh_token": "aw_rt_…", "scope": "profile history:read library:write" }
- Call the API with
Authorization: Bearer aw_at_…. Access tokens last 1 hour. - Refresh with
grant_type=refresh_token. Refresh tokens last 60 days and rotate: always store the new one, because the old one stops working.
Users can see and disconnect apps any time in Settings → Connected apps. Treat a 401 invalid_token / invalid_grant as “disconnected”.
Scopes
| Scope | Allows |
|---|---|
profile | Display name and account id (never the email) |
library:read | Saved list, favorites, likes |
library:write | Add / remove saved and favorites |
history:read | Watch history and per-episode progress |
history:write | Mark episodes watched |
User endpoints
/me
profile/me/library
library:readReturns { saved: [], favorites: [], liked: [] }; each item has id, mal_id, title, poster, added_at.
/me/library/{id}
library:write{ "list": "saved" } // or "favorites"
/me/library/{id}?list=saved
library:write/me/history?since=2026-10-01T00:00:00Z
history:read{ "data": [{ "anime_id": 1642, "mal_id": 21, "title": "One Piece", "last_episode": 3, "language": "sub",
"episodes_watched": [1,2,3], "updated_at": "…", "resume_url": "…/#/watch/1642/3?lang=sub" }] }
/me/history/{anime_id}
history:read/me/history
history:write{ "mal_id": 21, "episodes": [4, 5], "language": "sub" } // or "anime_id", or a single "episode"
Guide: be a “where to watch” provider
For a tracker like Kiroku that stores AniList entries:
- Request
idMalin your AniList query and keep it with each entry. - From your server, call
GET /api/v1/lookup?mal_id=…with yourX-API-Key. If it matches, save a link{ site: "Aniwatch", url: "/go/mal/{idMal}" }. Use the/go/maldeep link because it stays valid even if Aniwatch's internal ids change. - Optional: add
?ep=Nto the link to resume at the next episode, or show/embed/{id}/{ep}inline. - Optional: add “Connect Aniwatch” (OAuth, website type) and read
/me/historyto fill in progress automatically. You can also push your to-watch list into/me/library.
Guide: iPhone app
- Register a Mobile / browser app with redirect
aniwatch-ios://oauth. Sign in withASWebAuthenticationSession+ PKCE (S256). Store tokens in the Keychain. - Browse with
/home,/anime,/search,/anime/{id}. Play an episode by loading itsembed_urlin aWKWebView. - In the web view: return
nilfromcreateWebViewWith(blocks pop-up ads) and cancel main-frame navigations that leave your Aniwatch domain. Listen onuserContentControllernameaniwatchfor progress, andPOST /me/historynear the end of an episode. - Generate the networking layer straight from the OpenAPI spec.