{
    "info": {
        "name": "API Drama API",
        "description": "Ready-to-run requests for the API Drama API.\n\n**Setup (once):** open the collection → Variables tab → paste your key into `api_key` (current value) → Save.\n\nThe key is sent automatically as the `X-API-Key` header on every request. Change `platform` and `lang` to try other platforms and languages.\n\n**Typical flow for one video:** Home → copy an `id` into the `series_id` variable → Detail → Video.\n\nFull documentation: https://www.darkapis.cyou/docs.php",
        "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
    },
    "auth": {
        "type": "apikey",
        "apikey": [
            {
                "key": "key",
                "value": "X-API-Key",
                "type": "string"
            },
            {
                "key": "value",
                "value": "{{api_key}}",
                "type": "string"
            },
            {
                "key": "in",
                "value": "header",
                "type": "string"
            }
        ]
    },
    "variable": [
        {
            "key": "base_url",
            "value": "https://www.darkapis.cyou"
        },
        {
            "key": "api_key",
            "value": "YOUR_API_KEY"
        },
        {
            "key": "platform",
            "value": "bilitv"
        },
        {
            "key": "lang",
            "value": "en"
        },
        {
            "key": "series_id",
            "value": ""
        },
        {
            "key": "chapter_id",
            "value": "1"
        },
        {
            "key": "q",
            "value": "love"
        }
    ],
    "item": [
        {
            "name": "Drama",
            "item": [
                {
                    "name": "Get Home",
                    "request": {
                        "method": "GET",
                        "header": [],
                        "url": {
                            "raw": "{{base_url}}/api/v2/home?category_p={{platform}}&lang={{lang}}",
                            "host": [
                                "{{base_url}}"
                            ],
                            "path": [
                                "api",
                                "v2",
                                "home"
                            ],
                            "query": [
                                {
                                    "key": "category_p",
                                    "value": "{{platform}}",
                                    "description": "Platform slug. See /docs.php for the full list."
                                },
                                {
                                    "key": "lang",
                                    "value": "{{lang}}",
                                    "description": "Language code, e.g. en"
                                }
                            ]
                        },
                        "description": "Home feed for one platform in one language. Each item has id, title, author, cover, synopsis, status, genres, chapters, views, tags."
                    },
                    "response": []
                },
                {
                    "name": "Get Discover",
                    "request": {
                        "method": "GET",
                        "header": [],
                        "url": {
                            "raw": "{{base_url}}/api/v2/discover?category_p={{platform}}&lang={{lang}}&page=1&limit=20",
                            "host": [
                                "{{base_url}}"
                            ],
                            "path": [
                                "api",
                                "v2",
                                "discover"
                            ],
                            "query": [
                                {
                                    "key": "category_p",
                                    "value": "{{platform}}",
                                    "description": "Platform slug. See /docs.php for the full list."
                                },
                                {
                                    "key": "lang",
                                    "value": "{{lang}}",
                                    "description": "Language code, e.g. en"
                                },
                                {
                                    "key": "page",
                                    "value": "1",
                                    "description": "Page number"
                                },
                                {
                                    "key": "limit",
                                    "value": "20",
                                    "description": "Items per page (max 100)"
                                }
                            ]
                        },
                        "description": "Paginated list. Use `total` to work out how many pages exist."
                    },
                    "response": []
                },
                {
                    "name": "Get Banner",
                    "request": {
                        "method": "GET",
                        "header": [],
                        "url": {
                            "raw": "{{base_url}}/api/v2/banner?category_p={{platform}}&lang={{lang}}",
                            "host": [
                                "{{base_url}}"
                            ],
                            "path": [
                                "api",
                                "v2",
                                "banner"
                            ],
                            "query": [
                                {
                                    "key": "category_p",
                                    "value": "{{platform}}",
                                    "description": "Platform slug. See /docs.php for the full list."
                                },
                                {
                                    "key": "lang",
                                    "value": "{{lang}}",
                                    "description": "Language code, e.g. en"
                                }
                            ]
                        },
                        "description": "Featured / promotional titles."
                    },
                    "response": []
                },
                {
                    "name": "Get Search",
                    "request": {
                        "method": "GET",
                        "header": [],
                        "url": {
                            "raw": "{{base_url}}/api/v2/search?category_p={{platform}}&q={{q}}&lang={{lang}}&page=1",
                            "host": [
                                "{{base_url}}"
                            ],
                            "path": [
                                "api",
                                "v2",
                                "search"
                            ],
                            "query": [
                                {
                                    "key": "category_p",
                                    "value": "{{platform}}",
                                    "description": "Platform slug. See /docs.php for the full list."
                                },
                                {
                                    "key": "q",
                                    "value": "{{q}}",
                                    "description": "Search keyword"
                                },
                                {
                                    "key": "lang",
                                    "value": "{{lang}}",
                                    "description": "Language code, e.g. en"
                                },
                                {
                                    "key": "page",
                                    "value": "1",
                                    "description": "Page number"
                                }
                            ]
                        },
                        "description": "Search titles by keyword."
                    },
                    "response": []
                },
                {
                    "name": "Get Detail",
                    "request": {
                        "method": "GET",
                        "header": [],
                        "url": {
                            "raw": "{{base_url}}/api/v2/detail?category_p={{platform}}&id={{series_id}}&lang={{lang}}",
                            "host": [
                                "{{base_url}}"
                            ],
                            "path": [
                                "api",
                                "v2",
                                "detail"
                            ],
                            "query": [
                                {
                                    "key": "category_p",
                                    "value": "{{platform}}",
                                    "description": "Platform slug. See /docs.php for the full list."
                                },
                                {
                                    "key": "id",
                                    "value": "{{series_id}}",
                                    "description": "Title id from Home / Discover / Search"
                                },
                                {
                                    "key": "lang",
                                    "value": "{{lang}}",
                                    "description": "Language code, e.g. en"
                                }
                            ]
                        },
                        "description": "One title with its complete episode list (`data.chapters`)."
                    },
                    "response": []
                },
                {
                    "name": "Get Video",
                    "request": {
                        "method": "GET",
                        "header": [],
                        "url": {
                            "raw": "{{base_url}}/api/v2/video?category_p={{platform}}&id={{series_id}}&chapterId={{chapter_id}}&lang={{lang}}",
                            "host": [
                                "{{base_url}}"
                            ],
                            "path": [
                                "api",
                                "v2",
                                "video"
                            ],
                            "query": [
                                {
                                    "key": "category_p",
                                    "value": "{{platform}}",
                                    "description": "Platform slug. See /docs.php for the full list."
                                },
                                {
                                    "key": "id",
                                    "value": "{{series_id}}",
                                    "description": "Title id"
                                },
                                {
                                    "key": "chapterId",
                                    "value": "{{chapter_id}}",
                                    "description": "Episode number from Detail"
                                },
                                {
                                    "key": "lang",
                                    "value": "{{lang}}",
                                    "description": "Language code, e.g. en"
                                }
                            ]
                        },
                        "description": "Stream link and subtitles for one episode: `data.streams[0].url`, `data.subtitles`, plus next / previous episode ids."
                    },
                    "response": []
                }
            ]
        },
        {
            "name": "Settings",
            "item": [
                {
                    "name": "Get Categories",
                    "request": {
                        "method": "GET",
                        "header": [],
                        "url": {
                            "raw": "{{base_url}}/api/v2/categories",
                            "host": [
                                "{{base_url}}"
                            ],
                            "path": [
                                "api",
                                "v2",
                                "categories"
                            ],
                            "query": []
                        },
                        "description": "Platforms your key is allowed to use."
                    },
                    "response": []
                },
                {
                    "name": "Get Languages",
                    "request": {
                        "method": "GET",
                        "header": [],
                        "url": {
                            "raw": "{{base_url}}/api/v2/languages",
                            "host": [
                                "{{base_url}}"
                            ],
                            "path": [
                                "api",
                                "v2",
                                "languages"
                            ],
                            "query": []
                        },
                        "description": "Languages your key is allowed to use."
                    },
                    "response": []
                }
            ]
        },
        {
            "name": "Key",
            "item": [
                {
                    "name": "Get Key Status",
                    "request": {
                        "method": "GET",
                        "header": [],
                        "url": {
                            "raw": "{{base_url}}/api/v2/key/status",
                            "host": [
                                "{{base_url}}"
                            ],
                            "path": [
                                "api",
                                "v2",
                                "key",
                                "status"
                            ],
                            "query": []
                        },
                        "description": "Your plan, daily limit, requests used today, expiry date and the platforms / languages your key covers."
                    },
                    "response": []
                }
            ]
        }
    ],
    "event": [
        {
            "listen": "test",
            "script": {
                "type": "text/javascript",
                "exec": [
                    "pm.test('HTTP 200', function () { pm.response.to.have.status(200); });",
                    "pm.test('success is true', function () { pm.expect(pm.response.json().success).to.eql(true); });"
                ]
            }
        }
    ]
}