Skip to main content
GET
/
api
/
episodes
List Episodes
curl --request GET \
  --url https://api.example.com/api/episodes
{
  "data": [
    {
      "id": "<string>",
      "anime_mal_id": 123,
      "episode_id": 123,
      "video_url": "<string>",
      "image_url": "<string>",
      "title": "<string>",
      "description": "<string>",
      "date": "<string>"
    }
  ],
  "Retry-After": {}
}

Overview

This endpoint returns a list of episodes for a given anime ID with pagination support. Episodes include video URLs, thumbnails, titles, and descriptions.

Authentication

This endpoint does not require authentication.

Rate Limiting

This endpoint is protected by rate limiting middleware:
  • Default limit: 100 requests per 60 seconds
  • Returns 429 Too Many Requests when limit is exceeded
  • Includes Retry-After header in rate limit responses

Query Parameters

id
string
required
The MyAnimeList (MAL) ID of the anime. This is a required parameter.Example: 52991 (for One Piece)
page
number
default:"1"
The page number for pagination. Must be greater than 0.Example: 1

Response

data
array
Array of episode objects
id
string
Unique identifier for the episode
anime_mal_id
number
MyAnimeList ID of the parent anime
episode_id
number
Episode number within the series
video_url
string
URL to the video stream for this episode
image_url
string
Thumbnail or preview image URL for the episode
title
string
Episode title (if available)
description
string
Episode description or synopsis (if available)
date
string
Air date or release date of the episode (if available)

Example Request

curl -X GET "https://anidev.vercel.app/api/episodes?id=52991&page=1"

Example Response

{
  "data": [
    {
      "id": "ep-52991-1",
      "anime_mal_id": 52991,
      "episode_id": 1,
      "video_url": "https://example.com/video/ep1.m3u8",
      "image_url": "https://example.com/thumbnails/ep1.jpg",
      "title": "The Beginning",
      "description": "The adventure starts as our hero sets sail.",
      "date": "2024-01-01"
    },
    {
      "id": "ep-52991-2",
      "anime_mal_id": 52991,
      "episode_id": 2,
      "video_url": "https://example.com/video/ep2.m3u8",
      "image_url": "https://example.com/thumbnails/ep2.jpg",
      "title": "New Companions",
      "description": "Meeting new friends along the journey."
    }
  ]
}

Error Responses

Missing ID Parameter

Status Code: 400 Bad Request
{
  "error": "Anime ID is required",
  "type": "validation"
}

Invalid Page Number

Status Code: 400 Bad Request
{
  "error": "Page number must be greater than 0",
  "type": "validation"
}

Rate Limit Exceeded

Status Code: 429 Too Many Requests
{
  "error": "Too many requests, please try again later",
  "type": "tooManyRequests"
}
Retry-After
header
Number of seconds to wait before making another request

Server Error

Status Code: 500 Internal Server Error
{
  "error": "Internal server error"
}

Implementation Details

This endpoint uses Redis caching to improve performance and reduce database load. Cached responses are automatically invalidated based on TTL (Time To Live) settings.
  • Get Episode - Retrieve a specific episode by MAL ID and episode number
  • Get Anime - Get detailed information about an anime

Build docs developers (and LLMs) love