Bunpro API when?

Hello, I recently noticed that there is an Bunpro API option in the settings page. Yet despite generating a key, I haven’t been able to figure out how or if it is even possible to use it. Is there a Bunpro API out yet? If not now when? I don’t want to do anything crazy, just collecting the daily reviews every so often for a dashboard and for some automation stuff. Had it working for a bit just mimicking the page requests, but it seems to have broken for me now.
image

5 Likes

This looks relevant

https://patrickayoup.github.io/pybunpro/

it doesn’t look like there are many endpoints set up, but there is grammar points, study queue, and user info

1 Like

That doesn’t seem official. Plus its just a library for python.

3 Likes

It actually seems outdated. What I meant was if you look at that documentation it could point you in the direction of some endpoints

pybunpro/pybunpro at master · patrickayoup/pybunpro · GitHubinit.py

like if you check the documentation in the code you can see the urls of the endpoints. However, it does not seem to be accurate anymore.

2 Likes

Welcome to the community! :tada:

We previously had an API, with Docs and everything.

Maintaining was slowing down our development on other stuff, so we deprecated the API and removed the Docs.
Accessing the API Key is still doable as you mentioned, and this is mainly because the routes are still accessible, just not documented.

If we get enough people offering to do free labor volunteer work on useful/cool community projects/plugins etc, we could defs reconsider!

You can also of course reverse engineer our API that’s currently used on the website.
Just note that we can’t make any guarantees on it not changing at any point in time, unlike a normal API system with docs and stuff.
DM me if you have any questions about that.

7 Likes

well count me in as one of those volunteers. ive enjoyed trying reverse engineer the API thus far. my issue is it seems that the authentication token expires and i have not been able to catch the network token that refreshes it. feels like even a basic API could be useful to some of us.

3 Likes

@veritas_nz you can count me in as well, I’m interested.

5 Likes

Any chance you could share the old API docs? With the understanding that they’re outdated–but there might be some stuff in there that’s still applicable?

3 Likes

@veritas_nz @highliuk if there’s any update on this, please let me know! Im down to help too. enjuichang (Eric) · GitHub

2 Likes

Made used of what we have and found a way to at least get some data from bunpro by reverse engineering the endpoints (potentially a security vulnerability but you do need user login info to get to this point). I used the troubled grammar/ghost grammar points to create a chatbot using llms (https://bunpro-llm.streamlit.app/). Feel free to fork and commit (GitHub - enjuichang/bunpro-llm: A Streamlit-powered Japanese grammar assistant that leverages your Bunpro account data and LLM technology to provide personalized Japanese grammar explanations and assistance.)

1 Like

I’m not good at the api stuff and just try to play a bit with the api’s of the websites I’m using. Therefore I tried to make any sens of the bunPro api. My knowledge are is not good enough to make out the api endpoints in the documentations of the other tools. The only working endpoint i could make out is “study_queue”. Do anybody has some other working endpoints for me?

Found these endpoints:

  • /api/frontend/user
  • /api/frontend/queue
  • /api/frontend/due
  • /api/frontend/user_furigana
  • /api/frontend/forecast_hourly
  • /api/frontend/base_stats
  • /api/frontend/jlpt_progress_mixed
  • /api/frontend/review_activity
  • /api/frontend/srs_level_overview

And they require this header: authorization: Token token=<your token>

It looks like that token is called frontend_api_token and I found mine on the Set-Cookie in a get request to: /settings/account

6 Likes

Yep. If you open the network tab in the dev tools you can find a lot more.
For instance, I needed to sync ~500 kanjis that I know how to read with Bunpro’s furigana toggling feature, so this snippet may help some of you:

curl -s -X POST \              
  "https://api.bunpro.jp/api/frontend/user/add_known_kanji" \
  -H "Authorization: Token token=<your token>" \
  -H "Content-Type: application/json" \
  -H "Accept: application/json" \
  -d '{
    "kanjis": ["皇", "公", "式", "弐", "条", "汽", "毒", "潮", "頁", "豆", "矛", "預", "勺", "勿", "尚", "斤", "瓜", "巾", "吊", "源", "綿", "絹", "錦", "猪", "吾", "印", "林", "松", "戸", "局", "胡", "且", "汐", "郎", "廊", "官", "礼", "堂", "償", "尺", "尽", "商", "洪", "志", "乱", "等", "季", "委", "刊", "害", "益", "憲", "翌", "紀", "改", "姓", "油", "井", "庁", "畿", "磯", "邸", "底", "育", "羊", "洋", "祥", "美", "業", "濃", "豊", "吉", "詰", "結", "投", "役", "没", "設", "段", "殺", "刹", "刈"]
  }'

you have a:

  • POST /api/frontend/user/add_known_kanji endpoint to add them (e.g. a kanji you know how to read)
  • DELETE /api/frontend/user/remove_known_kanji endpoint to remove them (e.g. a kanji you don’t know how to read)

It would be nice to have a shared Postman collection or something like that.

As @Fungalorex said the frontend_api_token is different from the API token found in the settings which, alas, does not work here.

PS: as noted here, it looks like numbers are not persisted (or at least, not so long). It looks like a bug.

4 Likes

Thanks for the replies.
I’m the stupid one which is not reading to the end. I tried the hole time with the wrong api key unless you told me that twice.
My hole project is based on Excel power query. This just works fine for me with wanikani. But I can’t figure out how to make this request to get my “other” api key with this tool.

@BakemonoNoNana can you tell more? What do you need to do specifically? I may help

I saw there’s an API key in my account and wanted to look for the API, then found this thread. What I wanted to do was to create a Firefox Addon to add random words I encounter in the wild to the bunpro vocab review queue since I’m enjoying this more than creating Anki cards (and frankly, your vocab database is huge).

I’ll gladly put it online if those endpoints exist and I could have access (search vocab, get vocab details, add to queue)

1 Like