AniwatchDevelopers ← Back to Aniwatch

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.

Base URL /api/v1Format JSONCORS openSpec OpenAPI 3.1
Catalogue API

Titles, genres, episodes, airing schedule. No key needed to start.

Provider tools

MAL-id lookup, stable deep links and a player page you can embed.

Sign in with Aniwatch

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 callSendLimitUse for
Anonymousnothing60 / min per IPTrying things out, small sites
API keyX-API-Key: aw_live_…600 / min per key (adjustable)Your backend reading the catalogue
User tokenAuthorization: Bearer aw_at_…300 / min per connectionActing for a signed-in user
API keys and OAuth apps are created by the site owner in Admin → Developers. Keep API keys and client secrets on your server. Never ship them in a web page or mobile app.

Errors

{ "error": { "code": "not_found", "message": "No title with that id." } }
StatuscodeMeaning
400bad_requestA parameter is missing or invalid
401invalid_key · invalid_token · unauthorizedBad key, expired token, or the endpoint needs a user token
403insufficient_scopeThe user didn't grant the scope this endpoint needs
404not_foundNo such title, episode or endpoint
429rate_limitedSlow down; see X-RateLimit-Reset
503upstream_busyEpisode data is being fetched; retry in a few seconds

Browse & search

GET

/anime

Filter and page through the catalogue. Returns cards (no episodes).

ParamDescription
qSearch English, romaji and native titles
genreComma-separated; all must match (see /genres)
type · year · seasonTV, Movie, ONA… · 2025 · Fall
statusSubstring, e.g. currently for airing
langsub or dub: only titles with that audio
sortupdated (default), score, year, title
page · per_pagePagination; 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 }
}
GET

/search?q=frieren&limit=10

Quick search, best matches first.

GET

/genres

All genres with title counts.

GET

/home

recent, airing and top rows, 24 each.

Details & episodes

GET

/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" } }
GET

/anime/{id}/episodes

GET

/anime/{id}/episodes/{number}

Episode lists are cached and refreshed automatically. A brand-new title can answer 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

GET

/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" } }

Stable URLs you can put behind a “Watch on Aniwatch” button without calling the API first. Unknown ids fall back to a search.

URLOpens
/go/mal/{mal_id}The title's page
/go/mal/{mal_id}?ep=5&lang=dubEpisode 5, dubbed
/go/mal/{mal_id}?title=FrierenSearch 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.

The video itself comes from a third-party player that shows its own ads. In your own app, block pop-ups and off-site navigation in the web view (see the iPhone guide).

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/authorizeSend the user here
POST /oauth/tokenExchange a code, or refresh. Form or JSON body.
POST /oauth/revokeDisconnect (send the refresh token to remove the whole connection)
  1. 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 for localhost; custom schemes like aniwatch-ios://oauth are fine.
  2. 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.
  3. 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" }
  4. Call the API with Authorization: Bearer aw_at_…. Access tokens last 1 hour.
  5. 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

ScopeAllows
profileDisplay name and account id (never the email)
library:readSaved list, favorites, likes
library:writeAdd / remove saved and favorites
history:readWatch history and per-episode progress
history:writeMark episodes watched

User endpoints

GET

/me

profile
GET

/me/library

library:read

Returns { saved: [], favorites: [], liked: [] }; each item has id, mal_id, title, poster, added_at.

PUT

/me/library/{id}

library:write
{ "list": "saved" }   // or "favorites"
DELETE

/me/library/{id}?list=saved

library:write
GET

/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" }] }
GET

/me/history/{anime_id}

history:read
POST

/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:

  1. Request idMal in your AniList query and keep it with each entry.
  2. From your server, call GET /api/v1/lookup?mal_id=… with your X-API-Key. If it matches, save a link { site: "Aniwatch", url: "/go/mal/{idMal}" }. Use the /go/mal deep link because it stays valid even if Aniwatch's internal ids change.
  3. Optional: add ?ep=N to the link to resume at the next episode, or show /embed/{id}/{ep} inline.
  4. Optional: add “Connect Aniwatch” (OAuth, website type) and read /me/history to fill in progress automatically. You can also push your to-watch list into /me/library.

Guide: iPhone app