This repository has been archived by the owner on Jun 8, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapi.yaml
7113 lines (6971 loc) · 203 KB
/
api.yaml
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
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
openapi: 3.0.3
tags:
- name: Manga
- name: Cover
- name: Chapter
- name: AtHome
- name: Feed
- name: Upload
- name: ScanlationGroup
- name: Author
- name: ChapterReadMarker
- name: Report
- name: Auth
- name: Account
- name: User
- name: Follows
- name: CustomList
- name: Legacy
- name: Captcha
- name: Infrastructure
- name: Rating
- name: Statistics
- name: Settings
info:
title: MangaDex API
version: 5.5.7
contact:
name: MangaDex staff team
email: [email protected]
description: |-
MangaDex is an ad-free manga reader offering high-quality images!
This document details our API as it is right now. It is in no way a promise to never change it, although we will endeavour to publicly notify any major change.
# Acceptable use policy
Usage of our services implies acceptance of the following:
- You **MUST** credit us
- You **MUST** credit scanlation groups if you offer the ability to read chapters
- You **CANNOT** run ads or paid services on your website and/or apps
These may change at any time for any and no reason and it is up to you check for updates from time to time.
# Security issues
If you believe you found a security issue in our API, please check our [security.txt](/security.txt) to get in touch privately.
# Authentication
You can login with the `/auth/login` endpoint. On success, it will return a JWT that remains valid for 15 minutes along with a session token that allows refreshing without re-authenticating for 1 month.
# Rate limits
The API enforces rate-limits to protect our servers against malicious and/or mistaken use. The API keeps track of the requests on an IP-by-IP basis.
Hence, if you're on a VPN, proxy or a shared network in general, the requests of other users on this network might affect you.
At first, a **global limit of 5 requests per second per IP address** is in effect.
> This limit is enforced across multiple load-balancers, and thus
is not an exact value but rather a lower-bound that we guarantee. The exact value will be somewhere in the range `[5, 5*n]` (with `n` being the number of
load-balancers currently active). The exact value within this range will depend on the current traffic patterns we are experiencing.
On top of this, **some endpoints are further restricted** as follows:
| Endpoint | Requests per time period | Time period in minutes |
|------------------------------------|-----------------------------|------------------------|
| **Account management** |
| `GET /account/available | 60 | 60 |
| `POST /account/create` | 5 | 60 |
| `POST /account/activate/{code}` | 30 | 60 |
| `POST /account/activate/resend` | 5 | 60 |
| `POST /account/recover` | 5 | 60 |
| `POST /account/recover/{code}` | 5 | 60 |
| `POST /user/email` | 1 | 60 |
| `DELETE /user/{id}` | 5 | 60 |
| **Authentication** |
| `POST /auth/login` | 30 | 60 |
| `POST /auth/refresh` | 60 | 60 |
| **Manga** |
| `POST /manga` | 10 | 60 |
| `PUT /manga/{id}` | 10 | 60 |
| `DELETE /manga/{id}` | 10 | 10 |
| `POST /manga/draft/{id}/commit` | 10 | 60 |
| **Authors** |
| `POST /author` | 10 | 60 |
| `PUT /author` | 10 | 1 |
| `DELETE /author/{id}` | 10 | 10 |
| **Covers** |
| `POST /cover` | 100 | 10 |
| `PUT /cover/{id}` | 100 | 10 |
| `DELETE /cover/{id}` | 10 | 10 |
| **Chapters** |
| `POST /chapter/{id}/read` | 300 | 10 |
| `PUT /chapter/{id}` | 10 | 1 |
| `DELETE /chapter/{id}` | 10 | 1 |
| **Scanlation groups** |
| `POST /group` | 10 | 60 |
| `PUT /group/{id}` | 10 | 1 |
| `DELETE /group/{id}` | 10 | 10 |
| **CDN** (i.e.: MangaDex@Home) |
| `GET /at-home/server/{id}` | 40 | 1 |
| **Uploads** |
| -> Sessions |
| `GET /upload` | 30 | 1 |
| `POST /upload/begin` | 20 (shared) | 1 |
| `POST /upload/begin/{id}` | 20 (shared) | 1 |
| `POST /upload/{id}/commit` | 10 | 1 |
| `DELETE /upload/{id}` | 30 | 1 |
| -> Files |
| `POST /upload/{id}` | 250 (shared) | 1 |
| `DELETE /upload/{id}/{id}` | 250 (shared) | 1 |
| `DELETE /upload/{id}/batch` | 250 (shared) | 1 |
| **reCaptcha** |
| `POST /captcha/solve` | 10 | 10 |
| **Reports** |
| `POST /report` | 10 | 1 |
| `GET /report` | 10 | 1 |
Calling these endpoints will further provide details via the following headers about your remaining quotas:
| Header | Description |
|---------------------------|-----------------------------------------------------------------------------|
| `X-RateLimit-Limit` | Maximal number of requests this endpoint allows per its time period |
| `X-RateLimit-Remaining` | Remaining number of requests within your quota for the current time period |
| `X-RateLimit-Retry-After` | Timestamp of the end of the current time period, as UNIX timestamp |
# Result Limit
Most of our listing endpoints will return a maximum number of total results that is currently capped at 10.000 items. Beyond that you will not receive any more items no matter how far you paginate and the results will become empty instead. This is for performance reasons and a limitation we will not lift.
Note that the limit is applied to a search query and list endpoints with or without any filters are search queries.
If you need to retrieve more items, use filters to narrow down your search.
# Reference Expansion
Reference Expansion is a feature of certain endpoints where relationships of a resource are expanded with their attributes, which reduces the amount of requests that need to be sent to the API to retrieve a complete set of data.
It works by appending a list of includes to the query with the type names from the relationships. If an endpoint supports this feature is indicated by the presence of the optional `includes` parameter.
## Example
To fetch a specific manga with `author`, `artist` and `cover_art` expanded, you can send the following request: `GET /manga/f9c33607-9180-4ba6-b85c-e4b5faee7192?includes[]=author&includes[]=artist&includes[]=cover_art`. You will now find the objects attributes inside the returned relationships array.
## Note
Your current user needs `*.view` permission on each type of reference you want to expand. Guests have most of these permissions and for logged-in user accounts you can check `GET /auth/check` to list all permissions you have been granted. For example, to be able to expand `cover_art`, you need to have been granted the `cover.view` permission, for `author` and `artist` types you need the `author.view` permission and so on.
If a reference can't be expanded, the request will still succeed and no error indication will be visible.
# Captchas
Some endpoints may require captchas to proceed, in order to slow down automated malicious traffic.
Legitimate users might also be affected, based on the frequency of write requests or due certain endpoints being particularly sensitive to malicious use, such as user signup.
Once an endpoint decides that a captcha needs to be solved, a 403 Forbidden response will be returned, with the error code `captcha_required_exception`.
The sitekey needed for recaptcha to function is provided in both the `X-Captcha-Sitekey` header field, as well as in the error context, specified as `siteKey` parameter.
The captcha result of the client can either be passed into the repeated original request with the `X-Captcha-Result` header or alternatively to the `POST /captcha/solve` endpoint.
The time a solved captcha is remembered varies across different endpoints and can also be influenced by individual client behavior.
Authentication is not required for the `POST /captcha/solve` endpoint, captchas are tracked both by client ip and logged in user id.
If you are logged in, you want to send the session token along, so you validate the captcha for your client ip and user id at the same time, but it is not required.
# Reading a chapter using the API
## Retrieving pages from the MangaDex@Home network
A valid [MangaDex@Home network](https://mangadex.network) page URL is in the following format: `{server-specific base url}/{temporary access token}/{quality mode}/{chapter hash}/{filename}`
There are currently 2 quality modes:
- `data`: Original upload quality
- `data-saver`: Compressed quality
You only need the chapter ID to start getting a chapter pages. Now by fetching `GET /at-home/server/{ chapterId }`
you'll get all required fields to compute MangaDex@Home page URLs:
| Field | Type | Description |
|----------------------|----------|-----------------------------------|
| `.chapter.hash` | `string` | MangaDex@Home Chapter Hash |
| `.chapter.data` | `array` | data quality mode filenames |
| `.chapter.dataSaver` | `array` | data-saver quality mode filenames |
The full URL is the constructed as follows
```
{ server .baseUrl }/{ quality mode }/{ chapter .chapter.hash }/{ chapter .chapter.{ quality mode }.[*] }
Examples
data quality: https://abcdefg.hijklmn.mangadex.network:12345/some-token/data/e199c7d73af7a58e8a4d0263f03db660/x1-b765e86d5ecbc932cf3f517a8604f6ac6d8a7f379b0277a117dc7c09c53d041e.png
base url: https://abcdefg.hijklmn.mangadex.network:12345/some-token
quality mode: data
chapter hash: e199c7d73af7a58e8a4d0263f03db660
filename: x1-b765e86d5ecbc932cf3f517a8604f6ac6d8a7f379b0277a117dc7c09c53d041e.png
data-saver quality: https://abcdefg.hijklmn.mangadex.network:12345/some-token/data-saver/e199c7d73af7a58e8a4d0263f03db660/x1-ab2b7c8f30c843aa3a53c29bc8c0e204fba4ab3e75985d761921eb6a52ff6159.jpg
base url: https://abcdefg.hijklmn.mangadex.network:12345/some-token
quality mode: data-saver
chapter hash: e199c7d73af7a58e8a4d0263f03db660
filename: x1-ab2b7c8f30c843aa3a53c29bc8c0e204fba4ab3e75985d761921eb6a52ff6159.jpg
```
If the server you have been assigned fails to serve images, you are allowed to call the `/at-home/server/{ chapter id }` endpoint again to get another server.
Whether successful or not, **please do report the result you encountered as detailed below**. This is so we can pull the faulty server out of the network.
# Manga Creation
Similar to how the Chapter Upload works, after a Mangas creation with the Manga Create endpoint it is in a "draft" state, needs to be submitted (committed) and get either approved or rejected by Staff.
The purpose of this is to force at least one CoverArt uploaded in the original language for the Manga Draft and to discourage troll entries. You can use the list-drafts endpoint to investigate the status of your submitted Manga Drafts. Rejected Drafts are occasionally cleaned up at an irregular interval. You can edit Drafts at any time, even after they have been submitted.
Because a Manga that is in the draft state is not available through the search, there are slightly different endpoints to list or retrieve Manga Drafts, but outside from that the schema is identical to a Manga that is published.
# Language Codes & Localization
To denote Chapter Translation language, translated fields such as Titles and Descriptions, the API expects a 2-letter language code in accordance with the [ISO 639-1 standard](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes). Additionally, some cases require the [5-letter extension](https://en.wikipedia.org/wiki/IETF_language_tag) if the alpha-2 code is not sufficient to determine the correct sub-type of a language, in the style of $language-$region, e.g. `zh-hk` or `pt-br`.
Because there is no standardized method of denoting romanized translations, we chose to append the `-ro` suffix. For example the romanized version of `五等分の花嫁` is `5Toubun no Hanayome` or `Gotoubun no Hanayome`. Both would have the `ja-ro` language code, alternative versions are inserted as alternative titles. This is a clear distinction from the localized `en` translation `The Quintessential Quintuplets`
Notable exceptions are in the table below, otherwise ask a staff member if unsure.
| alpha-5 | Description |
|---------|------------------------|
| `zh` | Simplified Chinese |
| `zh-hk` | Traditional Chinese |
| `pt-br` | Brazilian Portugese |
| `es` | Castilian Spanish |
| `es-la` | Latin American Spanish |
| `ja-ro` | Romanized Japanese |
| `ko-ro` | Romanized Korean |
| `zh-ro` | Romanized Chinese |
# Report
In order to keep track of the health of the servers in the network and to improve the quality of service and reliability, we ask that you call the
MangaDex@Home report endpoint after each image you retrieve, whether successfully or not.
It is a `POST` request against `https://api.mangadex.network/report` and expects the following payload with our example above:
| Field | Type | Description |
|-----------------------------|------------|-------------------------------------------------------------------------------------|
| `url` | `string` | The full URL of the image |
| `success` | `boolean` | Whether the image was successfully retrieved |
| `cached ` | `boolean` | `true` iff the server returned an `X-Cache` header with a value starting with `HIT` |
| `bytes` | `number` | The size in bytes of the retrieved image |
| `duration` | `number` | The time in miliseconds that the complete retrieval (not TTFB) of this image took |
Examples herafter.
**Success:**
```json
POST https://api.mangadex.network/report
Content-Type: application/json
{
"url": "https://abcdefg.hijklmn.mangadex.network:12345/some-token/data/e199c7d73af7a58e8a4d0263f03db660/x1-b765e86d5ecbc932cf3f517a8604f6ac6d8a7f379b0277a117dc7c09c53d041e.png",
"success": true,
"bytes": 727040,
"duration": 235,
"cached": true
}
```
**Failure:**
```json
POST https://api.mangadex.network/report
Content-Type: application/json
{
"url": "https://abcdefg.hijklmn.mangadex.network:12345/some-token/data/e199c7d73af7a58e8a4d0263f03db660/x1-b765e86d5ecbc932cf3f517a8604f6ac6d8a7f379b0277a117dc7c09c53d041e.png",
"success": false,
"bytes": 25,
"duration": 235,
"cached": false
}
```
While not strictly necessary, this helps us monitor the network's healthiness, and we appreciate your cooperation towards this goal. If no one reports
successes and failures, we have no way to know that a given server is slow/broken, which eventually results in broken image retrieval for everyone.
# Retrieving Covers from the API
## Construct Cover URLs
### Source (original/best quality)
`https://uploads.mangadex.org/covers/{ manga.id }/{ cover.filename }`<br/>
The extension can be png, jpeg or gif.
Example: `https://uploads.mangadex.org/covers/8f3e1818-a015-491d-bd81-3addc4d7d56a/4113e972-d228-4172-a885-cb30baffff97.jpg`
### <=512px wide thumbnail
`https://uploads.mangadex.org/covers/{ manga.id }/{ cover.filename }.512.jpg`<br/>
The extension is always jpg.
Example: `https://uploads.mangadex.org/covers/8f3e1818-a015-491d-bd81-3addc4d7d56a/4113e972-d228-4172-a885-cb30baffff97.jpg.512.jpg`
### <=256px wide thumbnail
`https://uploads.mangadex.org/covers/{ manga.id }/{ cover.filename }.256.jpg`<br/>
The extension is always jpg.
Example: `https://uploads.mangadex.org/covers/8f3e1818-a015-491d-bd81-3addc4d7d56a/4113e972-d228-4172-a885-cb30baffff97.jpg.256.jpg`
## ℹ️ Where to find Cover filename ?
Look at the [Get cover operation](#operation/get-cover) endpoint to get Cover information.
Also, if you get a Manga resource, you'll have, if available a `covert_art` relationship which is the main cover id.
# Static data
## Manga publication demographic
| Value | Description |
|------------------|---------------------------|
| shounen | Manga is a Shounen |
| shoujo | Manga is a Shoujo |
| josei | Manga is a Josei |
| seinen | Manga is a Seinen |
## Manga status
| Value | Description |
|------------------|---------------------------|
| ongoing | Manga is still going on |
| completed | Manga is completed |
| hiatus | Manga is paused |
| cancelled | Manga has been cancelled |
## Manga reading status
| Value |
|------------------|
| reading |
| on_hold |
| plan\_to\_read |
| dropped |
| re\_reading |
| completed |
## Manga content rating
| Value | Description |
|------------------|---------------------------|
| safe | Safe content |
| suggestive | Suggestive content |
| erotica | Erotica content |
| pornographic | Pornographic content |
## CustomList visibility
| Value | Description |
|------------------|---------------------------|
| public | CustomList is public |
| private | CustomList is private |
## Relationship types
| Value | Description |
|------------------|--------------------------------|
| manga | Manga resource |
| chapter | Chapter resource |
| cover_art | A Cover Art for a manga `*` |
| author | Author resource |
| artist | Author resource (drawers only) |
| scanlation_group | ScanlationGroup resource |
| tag | Tag resource |
| user | User resource |
| custom_list | CustomList resource |
`*` Note, that on manga resources you get only one cover_art resource relation marking the primary cover if there are more than one.
By default this will be the latest volume's cover art. If you like to see all the covers for a given manga, use the cover search endpoint for your mangaId and select the one you wish to display.
## Manga links data
In Manga attributes you have the `links` field that is a JSON object with some strange keys, here is how to decode this object:
| Key | Related site | URL | URL details |
|-------|---------------|-----------------------------------------------------------------------------------------------|----------------------------------------------------------------|
| al | anilist | https://anilist.co/manga/`{id}` | Stored as id |
| ap | animeplanet | https://www.anime-planet.com/manga/`{slug}` | Stored as slug |
| bw | bookwalker.jp | https://bookwalker.jp/`{slug}` | Stored as "series/{id}" |
| mu | mangaupdates | https://www.mangaupdates.com/series.html?id=`{id}` | Stored as id |
| nu | novelupdates | https://www.novelupdates.com/series/`{slug}` | Stored as slug |
| kt | kitsu.io | https://kitsu.io/api/edge/manga/`{id}` or https://kitsu.io/api/edge/manga?filter[slug]={slug} | If integer, use id version of the URL, otherwise use slug one |
| amz | amazon | N/A | Stored as full URL |
| ebj | ebookjapan | N/A | Stored as full URL |
| mal | myanimelist | https://myanimelist.net/manga/{id} | Store as id |
| cdj | CDJapan | N/A | Stored as full URL |
| raw | N/A | N/A | Stored as full URL, untranslated stuff URL (original language) |
| engtl | N/A | N/A | Stored as full URL, official english licenced URL |
## Manga related enum
This data is used in the "related" field of a Manga relationships
| Value | Description
|-------------------|-------------------
| monochrome | A monochrome variant of this manga
| colored | A colored variant of this manga
| preserialization | The original version of this manga before its official serialization
| serialization | The official serialization of this manga
| prequel | The previous entry in the same series
| sequel | The next entry in the same series
| main_story | The original narrative this manga is based on
| side_story | A side work contemporaneous with the narrative of this manga
| adapted_from | The original work this spin-off manga has been adapted from
| spin_off | An official derivative work based on this manga
| based_on | The original work this self-published derivative manga is based on
| doujinshi | A self-published derivative work based on this manga
| same_franchise | A manga based on the same intellectual property as this manga
| shared_universe | A manga taking place in the same fictional world as this manga
| alternate_story | An alternative take of the story in this manga
| alternate_version | A different version of this manga with no other specific distinction
# Chapter Upload
## In A Nutshell
To upload a chapter, you need to start an upload-session, upload files to this session and once done, commit the session with a ChapterDraft.
Uploaded Chapters will generally be put into a queue for staff approval and image processing before it is available to the public.
## Limits
- 1 Active Upload Session per user. Before opening a second session, either commit or abandon your current session
- 10 files per one PUT request is max
- 500 files per upload session is max
- 20 MB max uploaded session filesize
- 150 MB max total sum of all uploaded session filesizes
- Allowed file extensions: jpg, jpeg, png, gif
- Image must fit into max resolution of 10000x10000 px
## Example
You need to be logged in for any upload operation. Which Manga you're allowed to upload to and which contributing Scanlation Groups you're free to credit depend on your individual user state.
To start an upload session, we pick the manga-id we want to upload to and the group-ids we have to credit. We use the official test manga `f9c33607-9180-4ba6-b85c-e4b5faee7192` and the group "Unknown" with id `145f9110-0a6c-4b71-8737-6acb1a3c5da4`. If no group can be credited, we would not send any group-id at all, otherwise we can credit up to 5 groups.
Note that crediting all involved groups is mandatory, doing otherwise will lead to a rejection of your upload.
The first step is optional, but because only one upload session is allowed per user, we check if we have any open upload sessions by doing `GET /upload`. We expect a 404 response with error detail 'No upload session found'.
Next step is to begin our upload session. We send a `POST /upload/begin` with json data. (If you want to edit an existing chapter, append the chapter id after it `POST /upload/begin/db99d333-76e9-4e66-9c97-4831c43ac96c` with its version as the json payload)
Request:
```json
{
'manga' => 'f9c33607-9180-4ba6-b85c-e4b5faee7192',
'groups': [
'145f9110-0a6c-4b71-8737-6acb1a3c5da4'
]
}
```
Response:
```json
{
'result': 'ok',
'data': {
'id': '113b7724-dcc2-4fbc-968f-9d775fcb1cd6',
'type': 'upload_session',
'attributes': {
'isCommitted': false,
'isProcessed': false,
'isDeleted': false
},
'relationships': [
{
'id': '41ce3e1a-8325-45b5-af8e-06aaf648a0df',
'type': 'user'
},
{
'id': 'f9c33607-9180-4ba6-b85c-e4b5faee7192',
'type': 'manga'
},
{
'id': '145f9110-0a6c-4b71-8737-6acb1a3c5da4',
'type': 'scanlation_group'
}
]
}
}
```
the `data.id` is what you want to store because you will need it for the following steps. We will refer to it as the `uploadSessionId` from here on out.
Remember the `GET /upload` request from the beginning? Try it again and you will see that it will return the same uploadSessionId. You can only have one upload session per user until you commit or abandon it, which makes it easy for you to continue uploading at a later time.
Now that we have a `uploadSessionId`, we can upload images. Any .jpg, .jpeg, .png or .gif files are fine, archives like .zip, .cbz or .rar are not. You will have to extract those archives beforehand if you want to make this work.
For each file, send a POST request like `POST /upload/{uploadSessionId}` with the image data. FormData seems to work best with `Content-Type: multipart/form-data; boundary=boundary`, mileage might vary depending on your programming language. Join our discord and ask for advice if in doubt.
You can upload a number of files in a single request (currently max. 10). The response body will be successful (response.result == 'ok') but might also contain errors if one or more files failed to validate. It's up to you to handle bad uploads and retry or reupload as you see fit. Successful uploads will be returned in the data array as type `upload_session_file`
A successful response could look like this:
```json
{
'result': 'ok',
'errors': [],
'data': [
{
'id': '12cc211a-c3c3-4f64-8493-f26f9b98c6f6',
'type': 'upload_session_file',
'attributes': {
'originalFileName': 'testimage1.png',
'fileHash': 'bbf9b9548ee4605c388acb09e8ca83f625e5ff8e241f315eab5291ebd8049c6f',
'fileSize': 18920,
'mimeType': 'image/png',
'version': 1
}
}
]
}
```
Store the data[{index}].id attribute as the `uploadSessionFileId`, this will be the unique identifier for the file you just uploaded.
If you change your mind and want to remove a previously uploaded image, you can send a request like `DELETE /upload/{uploadSessionId}/{uploadSessionFileId}`, expecting a response like
```json
{
'response': 'ok'
}
```
Finally you can commit your upload session. We opened with a manga-id and group-ids but what we actually want is to upload a chapter. For that we have to build a payload consisting of two things: a chapterDraft and a pageOrder. The payload will look similar to the following:
```json
{
'chapterDraft': {
'volume': '1',
'chapter': '2.5',
'title': 'Read Online',
'translatedLanguage': 'en'
},
'pageOrder': [
'12cc211a-c3c3-4f64-8493-f26f9b98c6f6'
]
}
```
the `chapterDraft` is the chapter data you would like to create, the pageOrder is an ordered list of uploadSessionFileIds you uploaded earlier.
Order didnt matter, now it does. Any files you uploaded but do not specify in this pageOrder array will be deleted.
An example response is:
```json
{
'result': 'ok',
'data': {
'id': '14d4639b-5a8f-4f42-a277-b222412930ca',
'type': 'chapter',
'attributes': {
'volume': '1',
'chapter': '2.5',
'title': 'Read Online',
'translatedLanguage': 'en',
'publishAt': null,
'createdAt': '2021-06-16T00:40:22+00:00',
'updatedAt': '2021-06-16T00:40:22+00:00',
'version': 1
},
'relationships': [
{
'id': '145f9110-0a6c-4b71-8737-6acb1a3c5da4',
'type': 'scanlation_group'
},
{
'id': 'f9c33607-9180-4ba6-b85c-e4b5faee7192',
'type': 'manga'
},
{
'id': '41ce3e1a-8325-45b5-af8e-06aaf648a0df',
'type': 'user'
}
]
}
}
```
You just uploaded a chapter. Congratz!
The returned chapter has empty data and dataSaver attributes where otherwise the pages would be. This is because the image processing happens asynchroniously. Depending on how many chapters need to be processed at a given time, it might take a while for this to be updated.
The first time you upload a chapter in a language you didn't upload before, it will have to be approved by staff.
Until both imageprocessing and possible approval have happened, your chapter will be held back and not appear on the website or be found in the list and search endpoints.
As mentioned in the beginning, to edit a chapter use the `POST /upload/begin/{chapterId}` endpoint [`begin-edit-session`](#operation/begin-edit-session) with the current chapter version as the json POST-body payload, and the UploadSession will come pre-filled with the remote existing UploadSessionFiles which you can reorder, remove, upload new images and commit your changes afterward as if it was a new chapter.
# Bugs and questions
## I have a question
You may join [our Discord](https://discord.gg/mangadex)'s #dev-talk-api channel to ask questions or for help.
However we're all busy so please read the docs first, then a second time, or try searching in the channel. Then ask away if you can't figure it out.
## I found a bug
Please read the docs carefully and **triple-check** the request body you're actually sending to us.
If you're sure you found a bug, then congrats and please report it to us so we can fix it!
Every HTTP response from our services has a `X-Request-ID` header whose value is a UUID.
Please log it in your client and provide it to us. If your request has a body, please also provide the JSON body you sent (you did check it after all, right?).
If you're not sure how do do this, your client could look something similar to this pseudocode:
```
var httpResponse = httpClient.execute(httpRequest);
if (httpResponse.status >= 500) { # feel free to also log it for 4XXs
logger.error(```
Request ID: ${httpResponse.headers['X-Request-ID]'}
Request:
${httpRequest.body}
Response:
${httpResponse.body}
```);
}
```
servers:
- url: 'https://api.mangadex.org'
description: MangaDex Api
paths:
/ping:
get:
summary: Ping the server
tags:
- Infrastructure
security: []
responses:
'200':
description: Pong
content:
application/json:
schema:
type: string
default: pong
/manga:
get:
summary: Manga list
tags:
- Manga
responses:
'200':
description: Manga list
content:
application/json:
schema:
$ref: '#/components/schemas/MangaList'
'400':
description: Bad Request
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
operationId: get-search-manga
description: Search a list of Manga.
parameters:
- schema:
type: integer
default: 10
minimum: 0
maximum: 100
in: query
name: limit
- schema:
type: integer
minimum: 0
in: query
name: offset
- schema:
type: string
in: query
name: title
- schema:
type: array
items:
type: string
format: uuid
in: query
name: authors[]
- schema:
type: array
items:
type: string
format: uuid
in: query
name: artists[]
- schema:
type: integer
in: query
name: year
description: Year of release
- schema:
type: array
items:
type: string
format: uuid
in: query
name: includedTags[]
- schema:
type: string
enum:
- AND
- OR
default: AND
in: query
name: includedTagsMode
- schema:
type: array
items:
type: string
format: uuid
in: query
name: excludedTags[]
- schema:
type: string
enum:
- AND
- OR
default: OR
in: query
name: excludedTagsMode
- schema:
type: array
items:
type: string
enum:
- ongoing
- completed
- hiatus
- cancelled
in: query
name: status[]
- schema:
type: array
items:
type: string
pattern: ^[a-zA-Z\-]{2,5}$
in: query
name: originalLanguage[]
- schema:
type: array
items:
type: string
pattern: ^[a-zA-Z\-]{2,5}$
in: query
name: excludedOriginalLanguage[]
- schema:
type: array
items:
type: string
pattern: ^[a-zA-Z\-]{2,5}$
in: query
name: availableTranslatedLanguage[]
- schema:
type: array
items:
type: string
enum:
- shounen
- shoujo
- josei
- seinen
- none
in: query
name: publicationDemographic[]
- schema:
type: array
items:
type: string
format: uuid
in: query
name: ids[]
description: Manga ids (limited to 100 per request)
- schema:
type: array
default: [safe, suggestive, erotica]
items:
type: string
enum:
- safe
- suggestive
- erotica
- pornographic
in: query
name: contentRating[]
- schema:
type: string
description: "DateTime string with following format: YYYY-MM-DDTHH:MM:SS"
pattern: ^\d{4}-[0-1]\d-([0-2]\d|3[0-1])T([0-1]\d|2[0-3]):[0-5]\d:[0-5]\d$
in: query
name: createdAtSince
- schema:
type: string
description: "DateTime string with following format: YYYY-MM-DDTHH:MM:SS"
pattern: ^\d{4}-[0-1]\d-([0-2]\d|3[0-1])T([0-1]\d|2[0-3]):[0-5]\d:[0-5]\d$
in: query
name: updatedAtSince
- schema:
type: object
default:
latestUploadedChapter: desc
properties:
title:
type: string
enum:
- asc
- desc
year:
type: string
enum:
- asc
- desc
createdAt:
type: string
enum:
- asc
- desc
updatedAt:
type: string
enum:
- asc
- desc
latestUploadedChapter:
type: string
enum:
- asc
- desc
followedCount:
type: string
enum:
- asc
- desc
relevance:
type: string
enum:
- asc
- desc
in: query
name: order
style: deepObject
- schema:
type: array
items:
type: string
in: query
name: includes[]
- schema:
type: string
enum: ['0', '1', 'true', 'false']
in: query
name: hasAvailableChapters
- schema:
type: string
format: uuid
in: query
name: group
security: []
post:
summary: Create Manga
operationId: post-manga
parameters:
- schema:
type: string
default: application/json
name: Content-Type
in: header
required: true
responses:
'200':
description: Manga Created
content:
application/json:
schema:
$ref: '#/components/schemas/MangaResponse'
'400':
description: Bad Request
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'403':
description: Forbidden
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/MangaCreate'
description: The size of the body is limited to 64KB.
description: Create a new Manga.
tags:
- Manga
'/manga/{id}/aggregate':
parameters:
- schema:
type: string
format: uuid
name: id
in: path
required: true
description: Manga ID
get:
summary: Get Manga volumes & chapters
security: []
tags:
- Manga
parameters:
- schema:
type: array
items:
type: string
pattern: '^[a-zA-Z\-]{2,5}$'
in: query
name: translatedLanguage[]
- schema:
type: array
items:
type: string
format: uuid
minLength: 36
maxLength: 36
in: query
name: groups[]
responses:
'200':
description: OK
content:
application/json:
schema:
type: object
properties:
result:
type: string
default: ok
volumes:
type: object
additionalProperties:
type: object
properties:
volume:
type: string
count:
type: integer
chapters:
type: object
additionalProperties:
type: object
properties:
chapter:
type: string
id:
type: string
format: uuid
others:
type: array
items:
type: string
format: uuid
count:
type: integer
'/manga/{id}':
parameters:
- schema:
type: string
format: uuid
name: id
in: path
required: true
description: Manga ID
get:
summary: Get Manga
tags:
- Manga
parameters:
- schema:
type: array
items:
type: string
in: query
name: includes[]
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/MangaResponse'
'403':
description: Forbidden
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'404':