help:pixiv api
Unofficial API specification
https://www.snip2code.com/Snippet/798193/Unofficial-API-specification-extracted-f
Intro
TODO: Document Pixiv's new Public API. See issue #2383 for some information.
Pixiv offers an API, called the Public API. It uses OAuth for authentication and JSON for responses.
Authentication
https://oauth.secure.pixiv.net/auth/token
TODO
Requests
You must include the "Authorization" header with the value "Bearer {ACCESS_TOKEN}", where {ACCESS_TOKEN} is what you received during the authentication step.
Make a GET request to the below URL to get information on the work with ID {ILLUST_ID}:
https://public-api.secure.pixiv.net/v1/works/{ILLUST_ID}.json
Valid GET parameters known:
image_sizes A comma-delimited list of which sizes of the image URLs you want returned to you. Currently known allowed values: small, medium, large, px_128x128, px_480mw (large refers to the biggest size, /img-original/)
profile_image_sizes A comma-delimited list of which sizes of the artist's avatar URLs you want returned to you. Currently known allowed values: px_170x170, px_50x50
include_stats Whether to include statistics such as view count for the image or not. Can be: true, false
Example results
{ "status":"success", "response":[ { "id":49270482, "title":"ツイログ", "caption":null, "tags":[ "神崎蘭子", "双葉杏", "アイドルマスターシンデレラガールズ", "Star!!", "アイマス5000users入り" ], "tools":[ "CLIP STUDIO PAINT" ], "image_urls":{ "large":"http://i3.pixiv.net/img-original/img/2015/03/14/17/53/32/49270482_p0.jpg" }, "width":1200, "height":951, "stats":{ "scored_count":8247, "score":81697, "views_count":191630, "favorited_count":{ "public":7804, "private":745 }, "commented_count":182 }, "publicity":0, "age_limit":"all-age", "created_time":"2015-03-14 17:53:32", "reuploaded_time":"2015-03-14 17:53:32", "user":{ "id":341433, "account":"nardack", "name":"Nardack", "is_following":false, "is_follower":false, "is_friend":false, "is_premium":null, "profile_image_urls":{ "px_50x50":"http://i1.pixiv.net/img19/profile/nardack/846482_s.jpg" }, "stats":null, "profile":null }, "is_manga":true, "is_liked":false, "favorite_id":0, "page_count":2, "book_style":"none", "type":"illustration", "metadata":{ "pages":[ { "image_urls":{ "large":"http://i3.pixiv.net/img-original/img/2015/03/14/17/53/32/49270482_p0.jpg", "medium":"http://i3.pixiv.net/c/1200x1200/img-master/img/2015/03/14/17/53/32/49270482_p0_master1200.jpg" } }, { "image_urls":{ "large":"http://i3.pixiv.net/img-original/img/2015/03/14/17/53/32/49270482_p1.jpg", "medium":"http://i3.pixiv.net/c/1200x1200/img-master/img/2015/03/14/17/53/32/49270482_p1_master1200.jpg" } } ] }, "content_type":null } ], "count":1 }
See here for a more complete listing of URLs you can request and their responses.
Old API
For information on Pixiv's old Smart Phone API, which was removed on May 11th, 2015, see below.
Obsolete SPAPI
Pixiv offers an API through several URLs:
http://spapi.pixiv.net/iphone/illust.php?illust_id={IDLIST} # individual images (comma-delimited list of IDs) http://spapi.pixiv.net/iphone/manga.php?illust_id={ID} # list of each page of a manga separately http://spapi.pixiv.net/iphone/novel.php?id={NOVEL_ID} # individual novel (does not support list of IDs) http://spapi.pixiv.net/iphone/new_illust.php # list of newest posts on pixiv http://spapi.pixiv.net/iphone/new_novel.php # list of newest novels on pixiv http://spapi.pixiv.net/iphone/new_novel_r18.php # list of newest R-18 novels on pixiv http://spapi.pixiv.net/iphone/bookmark_user_new_novel.php # list of newest novels from users you have bookmarked http://spapi.pixiv.net/iphone/mypixiv_new_novel.php # list of newest novels from your friends http://spapi.pixiv.net/iphone/ranking.php?mode={day/week/month} # daily/weekly/monthly ranking http://spapi.pixiv.net/iphone/search.php?s_mode={SEARCHMODE}&word={QUERY} # search http://spapi.pixiv.net/iphone/search_user.php?nick={USERNAME} # search users http://spapi.pixiv.net/iphone/member_illust.php?id={USERID} # view posts by specific user http://spapi.pixiv.net/iphone/member_novel.php?id={USERID} # view novels by specific user http://spapi.pixiv.net/iphone/illust_comments.php?illust_id={ID} # view comments on an image http://spapi.pixiv.net/iphone/novel_comments.php?id={NOVEL_ID} # view comments on a novel http://spapi.pixiv.net/iphone/user.php # returns the current user http://spapi.pixiv.net/iphone/user.php?level={1|2|3} # returns the current user. increasing level parameter increases the number of fields returned. http://spapi.pixiv.net/iphone/mypixiv_all.php?id={USER_ID} # friends list http://spapi.pixiv.net/iphone/bookmark.php?id={USER_ID}&rest={show|hide} # bookmarked images. rest=show mean public, rest=hide means private. http://spapi.pixiv.net/iphone/bookmark_novel.php?id={USER_ID}&rest={show|hide} # bookmarked novels http://spapi.pixiv.net/iphone/bookmark_user_all.php?id={USER_ID}&rest={show|hide} # bookmarked users http://spapi.pixiv.net/iphone/novel_text.php?id={NOVEL_ID} # body of this novel http://spapi.pixiv.net/iphone/novel_series.php?series_id={SERIES_ID} # list of novels in this series http://spapi.pixiv.net/iphone/novel_bookmarks.php?id={NOVEL_ID} # list of users who bookmarked this novel http://spapi.pixiv.net/iphone/novel_marker_all.php http://spapi.pixiv.net/iphone/hot_tags.php
The PHPSESSID parameter from your login cookie should be included in the query to access R-18 content. If you append &c_mode=count to the end, you'll receive the number of results returned by that search instead of the results themselves. If you append &p={PAGE} you can change pages. There are 50 results per page.
For images that have been deleted (i.e., bad id), or if you query for a R-18 image but don't pass a valid PHPSESSID, the API returns a "200 OK" HTTP code but an empty response. Private images (MyPicks, etc...) have an illust id of 0 and a generic thumbnail.
Responses are unlabeled CSV documents.
Example results
not-manga: "30095810","34904","jpg","とうほう。","4","ハマー@紅楼夢K-20b","http://i1.pixiv.net/img-inf/img/2012/09/14/00/01/30/30095810_128x128.jpg",,,"http://i2.pixiv.net/img04/img/aenobas/mobile/30095810_480mw.jpg?1348946035",,,"2012-09-14 00:01:30","東方 博麗霊夢 霧雨魔理沙 愛を感じる 集合絵 壁紙 東方Project250users入り クリック推奨 なにこれ超すごい","SAI","521","5156","15119","9/30<br />いなかった子たち追加しました!<br />これで全員のはず…!<br />(旧作など除く)<br />紅楼夢には全員分のラミカを持っていけそうです。",,,,"455","7","aenobas",,"0",,,"http://i2.pixiv.net/img04/profile/aenobas/mobile/7003904_80.jpg", "46277719","3077920","png","あき","76","奈津ナツナ","http://i2.pixiv.net/c/128x128/img-master/img/2014/09/30/23/58/34/46277719_128x128.jpg",,,"http://i2.pixiv.net/c/480x960/img-master/img/2014/09/30/23/58/34/46277719_480mw.jpg",,,"2014-09-30 23:58:34","創作 女の子 眼鏡 三つ編み お絵描き娘 秋","IllustStudio","1923","19130","15066",,,,,"3712","23","2725589",,"0",,,"http://i2.pixiv.net/img76/profile/2725589/mobile/7911641_80.jpg", manga: "30047501","34904","jpg","ねこねこレイマリ","4","ハマー@みみけっと八雲09","http://i2.pixiv.net/img04/img/aenobas/mobile/30047501_128x128.jpg",,,"http://i2.pixiv.net/img04/img/aenobas/mobile/30047501_480mw.jpg",,,"2012-09-11 20:18:34","東方 博麗霊夢 霧雨魔理沙 レイマリ なにこれ可愛い","SAI","219","2183","2699","http://www.pixiv.net/member_illust.php?mode=medium&illust_id=30033309の猫たちと暮らしたい妄想<br />首輪が嫌いなアクティブ霊夢と<br />本を与えておくと大人しくなるインドア魔理沙","2",,,"96","2","aenobas",,"0", "46273081","101605","jpg","サムス。","11","アリオ","http://i2.pixiv.net/c/128x128/img-master/img/2014/09/30/21/27/34/46273081_128x128.jpg",,,"http://i2.pixiv.net/c/480x960/img-master/img/2014/09/30/21/27/34/46273081_480mw.jpg",,,"2014-09-30 21:27:34","メトロイド サムス ゼロスーツサムス スマブラ スマブラ3DS/WiiU グラビティスーツ スマブラ100users入り サムス・アラン","SAI","581","5798","6172","サイラックス参戦遅いな...","3",,,"597","11","sunnysaidup",,"0",,,"http://i1.pixiv.net/img11/profile/sunnysaidup/mobile/1686150_80.jpg", animated image: "44313524","3246089","jpg","うごくイラスト機能と聞いて","79","くぅる","http://i1.pixiv.net/c/128x128/img-master/img/2014/06/26/01/08/59/44313524_square1200.jpg",,,"http://i1.pixiv.net/c/480x960/img-master/img/2014/06/26/01/08/59/44313524_master1200.jpg",,,"2014-06-26 01:08:59","うごイラ 魔法少女まどか☆マギカ 暁美ほむら","IllustStudio","7","70","174","以前動画用に描いたものでテストです。ホントに動いたスゴイヨ!",,,,"8","0","riku8671",,"0",,,"http://i1.pixiv.net/img79/profile/riku8671/mobile/5490053_80.jpg", user: ,"8213129",,,,"えび193","http://i1.pixiv.net/img131/profile/akasaka0079/mobile/7987172_80.jpg",,,,,,,,,,,,,,,,,,"akasaka0079",, comment: ,"131585",,,,"神代一郎","http://i2.pixiv.net/img12/profile/neo-itirou/mobile/6075897_80.jpg",,,,,,"2014-09-29 22:58",,,,,,"ネクタイになりたい",,,,,,"neo-itirou",,
Explanation of result fields for works
0: illust id 1: user ID # 2: extension 3: image title 4: image directory (the "78" in "http://i2.pixiv.net/img78/img/demekyon/46187950.jpg") 5: artist nickname 6: mobile thumbnail (128x128), can be in /img-inf/ or /img-master/ form 7: unused/empty 8: unused/empty 9: mobile thumbnail (480mw) 10: unused/empty 11: unused/empty 12: upload date 13: space-delimited list of tags 14: drawing software (e.g. SAI) 15: number of ratings 16: total score (sum of all ratings) 17: number of views 18: image description (raw HTML) 19: number of pages (empty if not a manga sequence) 20: unused/empty 21: unused/empty 22: number of favorites 23: number of comments 24: artist username 25: unused/empty 26: R-18 marker (0 is safe, 1 is R-18, 2 is R-18G) 27: novel series id (blank for illustrations and novels not part of a series) 28: unused/empty 29: mobile profile image 30: unused/empty
Explanation of result fields for users
0: unused/empty 1: user id 2-4: unused/empty 5: artist nickname 6: mobile profile image 7-23: unused/empty 24: artist username 25: unused/empty
Explanation of result fields for comments
0: unused/empty 1: user id 2-4: unused/empty 5: commenter nickname 6: mobile profile image 7-11: unused/empty 12: comment date 13-17: unused/empty 18: comment body 19-23: unused/empty 24: commenter username 25: unused/empty
Examples of the API in use: