aboutsummaryrefslogtreecommitdiff
path: root/docs/openapi.yaml
blob: d546f1610787324f51b654d19872f7ebcca2329a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
openapi: 3.0.3
info:
  title: Metachan API
  description: |
    > **CAUTION**: I _do not_ provide pre-hosted instances of the MetaChan API. You will need to host your own instance of the API to use it. MetaChan is provided on an "as-is" basis and fetches data from various public sources and projects, some of which may have rate limits, restrictions, and even contain pirated content. The API is intended for personal use only and should not be used for commercial purposes. I do not take any responsibility for any legal issues that may arise from using the API. Please use it at your own risk. I _do not_ condone piracy or illegal distribution of content.

    
    # MetaChan
    ![MetaChan](https://i.redd.it/rg4mpacfm1wz.png)
    Welcome to **MetaChan**. MetaChan is an Anime and Manga metadata API that provides a RESTful interface for accessing metadata for various anime and manga titles. MetaChan best integrates with [MyAnimeList](https://myanimelist.net/) and uses **MAL IDs** as the primary identifier for anime and manga titles. [AniList](https://anilist.co/) is also supported partially and will reverse lookup MAL IDs.
    
  version: 1.0.0
  contact:
    name: API Support
    url: https://github.com/luciferreeves/metachan
  license:
    name: MIT
    url: https://opensource.org/licenses/MIT

tags:
  - name: health
    description: Health check and system status endpoints
  - name: anime
    description: Anime information endpoints
  - name: episodes
    description: Episode-specific endpoints
  - name: characters
    description: Character and voice actor endpoints

paths:
  /health:
    get:
      tags:
        - health
      summary: Get system health status
      description: Returns the current health status of the API including memory usage, database status, and running tasks
      operationId: getHealth
      responses:
        '200':
          description: Successful response with health status
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HealthStatus'
              example:
                $ref: './data.json#/health'

  /a/{id}:
    get:
      tags:
        - anime
      summary: Get anime details
      description: |
        Retrieves comprehensive information about an anime including metadata, episodes, characters, and streaming details.
        
        Supports both MyAnimeList (MAL) IDs and AniList IDs via the `provider` query parameter.
        - **Default**: Uses MAL ID
        - **With provider=anilist**: Uses AniList ID and reverse lookups MAL ID
      operationId: getAnime
      parameters:
        - name: id
          in: path
          required: true
          description: The anime ID (MAL ID by default, or AniList ID when provider=anilist)
          schema:
            type: integer
            example: 1
        - name: provider
          in: query
          required: false
          description: The ID provider type. Omit for MAL ID, use 'anilist' for AniList ID
          schema:
            type: string
            enum: [anilist]
            example: anilist
      responses:
        '200':
          description: Successful response with anime details
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Anime'
              example:
                $ref: './data.json#/a~1id'
        '400':
          description: Bad request - Invalid or missing ID
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error: "Query parameter MAL ID is required"
        '404':
          description: Anime not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error: "Anime mapping not found"
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error: "Failed to fetch anime details"

  /a/{id}/episodes:
    get:
      tags:
        - episodes
      summary: Get all episodes for an anime
      description: |
        Retrieves a list of all episodes for the specified anime, including metadata like titles, air dates, scores, and episode counts.
        
        The response includes both individual episode data and aggregate statistics (total, aired, subbed, dubbed counts).
        
        Supports both MyAnimeList (MAL) IDs and AniList IDs via the `provider` query parameter.
      operationId: getAnimeEpisodes
      parameters:
        - name: id
          in: path
          required: true
          description: The anime ID (MAL ID by default, or AniList ID when provider=anilist)
          schema:
            type: integer
            example: 1
        - name: provider
          in: query
          required: false
          description: The ID provider type. Omit for MAL ID, use 'anilist' for AniList ID
          schema:
            type: string
            enum: [anilist]
      responses:
        '200':
          description: Successful response with episodes list
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AnimeEpisodes'
              example:
                $ref: './data.json#/a~1id~1episodes'
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Anime not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'

  /a/{id}/episodes/{episodeId}:
    get:
      tags:
        - episodes
      summary: Get single episode details
      description: |
        Retrieves detailed information about a specific episode including:
        - Episode metadata (titles, description, air date, scores)
        - Streaming sources for both subbed and dubbed versions
        - Filler/recap indicators
        
        Streaming data is cached for 7 days to improve performance.
        
        Supports both MyAnimeList (MAL) IDs and AniList IDs via the `provider` query parameter.
      operationId: getAnimeEpisode
      parameters:
        - name: id
          in: path
          required: true
          description: The anime ID (MAL ID by default, or AniList ID when provider=anilist)
          schema:
            type: integer
            example: 1
        - name: episodeId
          in: path
          required: true
          description: The unique episode ID (hash generated from episode titles)
          schema:
            type: string
            example: "a1b2c3d4e5f6"
        - name: provider
          in: query
          required: false
          description: The ID provider type. Omit for MAL ID, use 'anilist' for AniList ID
          schema:
            type: string
            enum: [anilist]
      responses:
        '200':
          description: Successful response with episode details
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AnimeSingleEpisode'
              example:
                $ref: './data.json#/a~1id~1episodes~1episodeid'
        '400':
          description: Bad request - Invalid or missing parameters
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error: "Episode ID is required"
        '404':
          description: Episode not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error: "Episode not found"
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'

  /a/{id}/characters:
    get:
      tags:
        - characters
      summary: Get anime characters
      description: |
        Retrieves a list of characters for the specified anime, including:
        - Character information (name, image, role)
        - Voice actors for each character
        - Voice actor languages
        
        Supports both MyAnimeList (MAL) IDs and AniList IDs via the `provider` query parameter.
      operationId: getAnimeCharacters
      parameters:
        - name: id
          in: path
          required: true
          description: The anime ID (MAL ID by default, or AniList ID when provider=anilist)
          schema:
            type: integer
            example: 1
        - name: provider
          in: query
          required: false
          description: The ID provider type. Omit for MAL ID, use 'anilist' for AniList ID
          schema:
            type: string
            enum: [anilist]
      responses:
        '200':
          description: Successful response with characters list
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/AnimeCharacter'
              example:
                $ref: './data.json#/a~1id~1characters'
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Anime not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'

components:
  schemas:
    Error:
      type: object
      required:
        - error
      properties:
        error:
          type: string
          description: Error message describing what went wrong
          example: "Resource not found"

    HealthStatus:
      type: object
      properties:
        status:
          type: string
          example: "healthy"
        timestamp:
          type: string
          format: date-time
        uptime:
          type: string
          example: "2h 30m 15s"
        memory:
          $ref: '#/components/schemas/MemoryStats'
        database:
          $ref: '#/components/schemas/DatabaseStatus'
        tasks:
          type: object
          additionalProperties:
            $ref: '#/components/schemas/TaskStatus'

    MemoryStats:
      type: object
      properties:
        used:
          type: string
          example: "256 MB"
        total:
          type: string
          example: "512 MB"
        free:
          type: string
          example: "256 MB"
        usage:
          type: string
          example: "50.00%"

    DatabaseStatus:
      type: object
      properties:
        connected:
          type: boolean
        last_checked:
          type: string
          format: date-time

    TaskStatus:
      type: object
      properties:
        status:
          type: string
          enum: [idle, running, completed, failed]
        last_run:
          type: string
          format: date-time
        next_run:
          type: string
          format: date-time

    AnimeTitles:
      type: object
      properties:
        english:
          type: string
          example: "Cowboy Bebop"
        japanese:
          type: string
          example: "カウボーイビバップ"
        romaji:
          type: string
          example: "Cowboy Bebop"
        synonyms:
          type: array
          items:
            type: string

    AnimeImages:
      type: object
      properties:
        small:
          type: string
          format: uri
        large:
          type: string
          format: uri
        original:
          type: string
          format: uri

    AnimeLogos:
      type: object
      properties:
        small:
          type: string
          format: uri
        medium:
          type: string
          format: uri
        large:
          type: string
          format: uri
        xlarge:
          type: string
          format: uri
        original:
          type: string
          format: uri

    AnimeScores:
      type: object
      properties:
        score:
          type: number
          format: float
          example: 8.75
        scored_by:
          type: integer
          example: 150000
        rank:
          type: integer
          example: 42
        popularity:
          type: integer
          example: 150
        members:
          type: integer
          example: 500000
        favorites:
          type: integer
          example: 25000

    AiringStatus:
      type: object
      properties:
        from:
          $ref: '#/components/schemas/AiringDate'
        to:
          $ref: '#/components/schemas/AiringDate'
        string:
          type: string
          example: "Apr 3, 1998 to Apr 24, 1999"

    AiringDate:
      type: object
      properties:
        day:
          type: integer
        month:
          type: integer
        year:
          type: integer
        string:
          type: string

    AnimeBroadcast:
      type: object
      properties:
        day:
          type: string
          example: "Saturdays"
        time:
          type: string
          example: "01:00"
        timezone:
          type: string
          example: "JST"
        string:
          type: string
          example: "Saturdays at 01:00 (JST)"

    AnimeGenres:
      type: object
      properties:
        name:
          type: string
          example: "Action"
        genre_id:
          type: integer
        url:
          type: string
          format: uri

    AnimeProducer:
      type: object
      properties:
        name:
          type: string
        producer_id:
          type: integer
        url:
          type: string
          format: uri

    AnimeStudio:
      type: object
      properties:
        name:
          type: string
          example: "Sunrise"
        studio_id:
          type: integer
        url:
          type: string
          format: uri

    AnimeLicensor:
      type: object
      properties:
        name:
          type: string
        producer_id:
          type: integer
        url:
          type: string
          format: uri

    AnimeMappings:
      type: object
      description: External database IDs for cross-referencing
      properties:
        anidb:
          type: integer
        anilist:
          type: integer
        anime_countdown:
          type: integer
        anime_planet:
          type: string
        ani_search:
          type: integer
        imdb:
          type: string
        kitsu:
          type: integer
        live_chart:
          type: integer
        notify_moe:
          type: string
        simkl:
          type: integer
        tmdb:
          type: integer
        tvdb:
          type: integer

    AnimeAiringEpisode:
      type: object
      properties:
        airing_at:
          type: integer
          description: Unix timestamp
        episode:
          type: integer

    EpisodeTitles:
      type: object
      properties:
        english:
          type: string
        japanese:
          type: string
        romaji:
          type: string

    AnimeStreamingSource:
      type: object
      properties:
        url:
          type: string
          format: uri
          description: Direct streaming URL
        server:
          type: string
          description: Server/provider name
          example: "Maria"
        type:
          type: string
          enum: [HLS, MP4]
          description: Type of streaming link

    AnimeStreaming:
      type: object
      properties:
        sub:
          type: array
          items:
            $ref: '#/components/schemas/AnimeStreamingSource'
        dub:
          type: array
          items:
            $ref: '#/components/schemas/AnimeStreamingSource'

    AnimeSingleEpisode:
      type: object
      properties:
        id:
          type: string
          description: Unique episode identifier (hash)
        titles:
          $ref: '#/components/schemas/EpisodeTitles'
        description:
          type: string
        aired:
          type: string
        score:
          type: number
          format: float
        filler:
          type: boolean
        recap:
          type: boolean
        forum_url:
          type: string
          format: uri
        url:
          type: string
          format: uri
        thumbnail_url:
          type: string
          format: uri
        streaming:
          $ref: '#/components/schemas/AnimeStreaming'

    AnimeEpisodes:
      type: object
      properties:
        total:
          type: integer
          description: Total number of episodes
        aired:
          type: integer
          description: Number of aired episodes
        subbed:
          type: integer
          description: Number of subbed episodes available
        dubbed:
          type: integer
          description: Number of dubbed episodes available
        episodes:
          type: array
          items:
            $ref: '#/components/schemas/AnimeSingleEpisode'

    AnimeVoiceActor:
      type: object
      properties:
        id:
          type: integer
        url:
          type: string
          format: uri
        image_url:
          type: string
          format: uri
        name:
          type: string
        language:
          type: string
          example: "Japanese"

    AnimeCharacter:
      type: object
      properties:
        id:
          type: integer
        url:
          type: string
          format: uri
        image_url:
          type: string
          format: uri
        name:
          type: string
        role:
          type: string
          enum: [Main, Supporting]
        voice_actors:
          type: array
          items:
            $ref: '#/components/schemas/AnimeVoiceActor'

    AnimeSeason:
      type: object
      properties:
        id:
          type: integer
        titles:
          $ref: '#/components/schemas/AnimeTitles'
        synopsis:
          type: string
        type:
          type: string
          enum: [TV, OVA, Movie, Special, ONA, Music]
        source:
          type: string
        airing:
          type: boolean
        status:
          type: string
          enum: [Finished Airing, Currently Airing, Not yet aired]
        airing_status:
          $ref: '#/components/schemas/AiringStatus'
        duration:
          type: string
        images:
          $ref: '#/components/schemas/AnimeImages'
        scores:
          $ref: '#/components/schemas/AnimeScores'
        season:
          type: string
          enum: [winter, spring, summer, fall]
        year:
          type: integer
        current:
          type: boolean

    Anime:
      type: object
      properties:
        id:
          type: integer
          description: MyAnimeList ID
        titles:
          $ref: '#/components/schemas/AnimeTitles'
        synopsis:
          type: string
        type:
          type: string
          enum: [TV, OVA, Movie, Special, ONA, Music]
        source:
          type: string
        airing:
          type: boolean
        status:
          type: string
          enum: [Finished Airing, Currently Airing, Not yet aired]
        airing_status:
          $ref: '#/components/schemas/AiringStatus'
        duration:
          type: string
        images:
          $ref: '#/components/schemas/AnimeImages'
        logos:
          $ref: '#/components/schemas/AnimeLogos'
        covers:
          $ref: '#/components/schemas/AnimeImages'
        color:
          type: string
          description: Hex color code
        genres:
          type: array
          items:
            $ref: '#/components/schemas/AnimeGenres'
        scores:
          $ref: '#/components/schemas/AnimeScores'
        season:
          type: string
          enum: [winter, spring, summer, fall]
        year:
          type: integer
        broadcast:
          $ref: '#/components/schemas/AnimeBroadcast'
        producers:
          type: array
          items:
            $ref: '#/components/schemas/AnimeProducer'
        studios:
          type: array
          items:
            $ref: '#/components/schemas/AnimeStudio'
        licensors:
          type: array
          items:
            $ref: '#/components/schemas/AnimeLicensor'
        seasons:
          type: array
          items:
            $ref: '#/components/schemas/AnimeSeason'
        episodes:
          $ref: '#/components/schemas/AnimeEpisodes'
        next_airing_episode:
          $ref: '#/components/schemas/AnimeAiringEpisode'
        airing_schedule:
          type: array
          items:
            $ref: '#/components/schemas/AnimeAiringEpisode'
        characters:
          type: array
          items:
            $ref: '#/components/schemas/AnimeCharacter'
        mappings:
          $ref: '#/components/schemas/AnimeMappings'