# API V2 Beta Documentation

**URL:** <https://community.wanikani.com/t/api-v2-beta-documentation/18987>\
**Category:** API And Third-Party Apps\
**Created:** [July 20, 2017, 12:11am UTC](https://community.wanikani.com/t/api-v2-beta-documentation/18987 "2017-07-20T00:11:57Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![viet](https://sea1.discourse-cdn.com/wanikanicommunity/user_avatar/community.wanikani.com/viet/32/41979_2.png) [@viet](https://community.wanikani.com/u/viet)\
**Post date:** [July 20, 2017, 12:11am UTC](https://community.wanikani.com/t/api-v2-beta-documentation/18987/1 "2017-07-20T00:11:57Z")

</div>

# Purpose

- Update the API to meet the needs of both the company and our users.
- Optimize the API to return only what is necessary.
- Set the API up for easier versioning, allowing for more frequent updates while maintaining older versions for reliability.

# Disclaimer

Expect breaking changes until the framework has been solidified. Keep in mind this is an beta! There may be more endpoints to come and the structure of API results can be changed dramatically before we release the 2.0 version.

# Documentation

[https://docs.api.wanikani.com](https://docs.api.wanikani.com/)

# Sunsetting V1

When V2 moves out of alpha/beta and becomes official we plan on sunsetting API V1. We have not decided on the length of this period, but are leaning towards four months.

---

<div class="post-metadata">

**Author:** ![viet](https://sea1.discourse-cdn.com/wanikanicommunity/user_avatar/community.wanikani.com/viet/32/41979_2.png) [@viet](https://community.wanikani.com/u/viet)\
**Post date:** [July 20, 2017, 12:12am UTC](https://community.wanikani.com/t/api-v2-beta-documentation/18987/2 "2017-07-20T00:12:15Z")

</div>



---

<div class="post-metadata">

**Author:** ![rfindley](https://sea1.discourse-cdn.com/wanikanicommunity/user_avatar/community.wanikani.com/rfindley/32/35202_2.png) [@rfindley](https://community.wanikani.com/u/rfindley)\
**Post date:** [July 20, 2017, 12:26am UTC](https://community.wanikani.com/t/api-v2-beta-documentation/18987/3 "2017-07-20T00:26:32Z")

</div>

A little light evening reading… 🙂

---

<div class="post-metadata">

**Author:** ![ccookf](https://sea1.discourse-cdn.com/wanikanicommunity/user_avatar/community.wanikani.com/ccookf/32/482054_2.png) [@ccookf](https://community.wanikani.com/u/ccookf)\
**Post date:** [July 20, 2017, 12:44am UTC](https://community.wanikani.com/t/api-v2-beta-documentation/18987/4 "2017-07-20T00:44:23Z")

</div>

So is the new API key setup always going to be a 36 char string in the format {XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}? I’m just a tad lazy…

Also, will the API ever open up additional information outside of user specific data? Not too long ago there was a guy asking about prerequisites and I ended up scraping parts of speech for a different experiment.

---

<div class="post-metadata">

**Author:** ![viet](https://sea1.discourse-cdn.com/wanikanicommunity/user_avatar/community.wanikani.com/viet/32/41979_2.png) [@viet](https://community.wanikani.com/u/viet)\
**Post date:** [July 20, 2017, 12:45am UTC](https://community.wanikani.com/t/api-v2-beta-documentation/18987/5 "2017-07-20T00:45:48Z")

</div>

> [@ccookf](#):
>
> Also, will the API ever open up additional information outside of user specific data? Not too long ago there was a guy asking about prerequisites and I ended up scraping parts of speech for a different experiment.

The subject endpoint provides the information you listed.

---

<div class="post-metadata">

**Author:** ![ccookf](https://sea1.discourse-cdn.com/wanikanicommunity/user_avatar/community.wanikani.com/ccookf/32/482054_2.png) [@ccookf](https://community.wanikani.com/u/ccookf)\
**Post date:** [July 20, 2017, 12:46am UTC](https://community.wanikani.com/t/api-v2-beta-documentation/18987/6 "2017-07-20T00:46:37Z")

</div>

I am blind. Sorry for missing that \>\<

---

<div class="post-metadata">

**Author:** ![viet](https://sea1.discourse-cdn.com/wanikanicommunity/user_avatar/community.wanikani.com/viet/32/41979_2.png) [@viet](https://community.wanikani.com/u/viet)\
**Post date:** [July 20, 2017, 12:47am UTC](https://community.wanikani.com/t/api-v2-beta-documentation/18987/7 "2017-07-20T00:47:18Z")

</div>

> [@ccookf](#):
>
> So is the new API key setup always going to be a 36 char string in the format {XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}? I’m just a tad lazy…

Pretty much. It is basically UUID.

---

<div class="post-metadata">

**Author:** ![viet](https://sea1.discourse-cdn.com/wanikanicommunity/user_avatar/community.wanikani.com/viet/32/41979_2.png) [@viet](https://community.wanikani.com/u/viet)\
**Post date:** [July 20, 2017, 1:07am UTC](https://community.wanikani.com/t/api-v2-beta-documentation/18987/8 "2017-07-20T01:07:24Z")

</div>

Oops. Forgot to add more text.

API V2 Alpha is live. Read the doc. Play around with it. Give us some feedback.

And if anyone knows how to reduce SSL handshake times, we would like to pick your brain 🙂

---

<div class="post-metadata">

**Author:** ![bladepoint](https://sea1.discourse-cdn.com/wanikanicommunity/user_avatar/community.wanikani.com/bladepoint/32/227280_2.png) [@bladepoint](https://community.wanikani.com/u/bladepoint)\
**Post date:** [July 20, 2017, 1:23am UTC](https://community.wanikani.com/t/api-v2-beta-documentation/18987/9 "2017-07-20T01:23:29Z")

</div>

Do you have an OpenAPI specification document you can share?

---

<div class="post-metadata">

**Author:** ![AnimeCanuck](https://sea1.discourse-cdn.com/wanikanicommunity/user_avatar/community.wanikani.com/animecanuck/32/576730_2.png) [@AnimeCanuck](https://community.wanikani.com/u/AnimeCanuck)\
**Post date:** [July 20, 2017, 1:29am UTC](https://community.wanikani.com/t/api-v2-beta-documentation/18987/10 "2017-07-20T01:29:21Z")

</div>

Because it says that we can get it (or change to it?) in the settings… I have a few basic questions.

**1)** So I expect this new API will mean that any old userscripts or community-made apps (like mobile ones) that have no support will no longer work. (When/if we switch to V2, Alpha or otherwise.) Correct?

**2)** Are we able to get this new V2 Alpha API to “play around with” and help test such scripts and/or changes, while _keeping our V1 API keys_? (So that older user scripts continue to work and/or in case something breaks, etc…?)

Glad to see that rfindley has already noticed this post. I was going to ping him if he hadn’t.

EDIT: Read the rest of the OP. Interesting to know about the sunsetting in advance… I’ll also be curious to see how this new API affects the idigtech stats page, and some other specific scripts (like @xMunch’s Ultimate Reorder). Hmm…

Viet, you and the other devs have been busy bees!!! (Or maybe not, since you admit to copy-paste-modify from Stripe (whomever they are). XD ^\_~) Thank you for keeping us updated and informed (even if I don’t fully understand everything, and this will probably break my mobile app by the end of the year.)

EDIT 2: Above questions @viet . Especially #2.

---

<div class="post-metadata">

**Author:** ![seanblue](https://sea1.discourse-cdn.com/wanikanicommunity/user_avatar/community.wanikani.com/seanblue/32/579844_2.png) [@seanblue](https://community.wanikani.com/u/seanblue)\
**Post date:** [July 20, 2017, 1:38am UTC](https://community.wanikani.com/t/api-v2-beta-documentation/18987/11 "2017-07-20T01:38:50Z")

</div>

> [@AnimeCanuck](#):
>
> and some other specific scripts (like @xMunch’s Ultimate Reorder)

Since I’ve been digging through xMunch’s script the last few days, I’m pretty sure it scrapes the UI and doesn’t actually make API calls.

---

<div class="post-metadata">

**Author:** ![AnimeCanuck](https://sea1.discourse-cdn.com/wanikanicommunity/user_avatar/community.wanikani.com/animecanuck/32/576730_2.png) [@AnimeCanuck](https://community.wanikani.com/u/AnimeCanuck)\
**Post date:** [July 20, 2017, 1:45am UTC](https://community.wanikani.com/t/api-v2-beta-documentation/18987/12 "2017-07-20T01:45:22Z")

</div>

Oh, that’s cool to know!

However, I know most of rfindley’s stuff that I use _does_… Ultimate Timeline [Basic Edition] for sure, Dashboard Progress Plus, Self-Study Quiz Edition, and others. But I guess I could be wrong on those other ones other than Timeline…???

---

<div class="post-metadata">

**Author:** ![carlostdev](https://sea1.discourse-cdn.com/wanikanicommunity/user_avatar/community.wanikani.com/carlostdev/32/274310_2.png) [@carlostdev](https://community.wanikani.com/u/carlostdev)\
**Post date:** [July 20, 2017, 1:49am UTC](https://community.wanikani.com/t/api-v2-beta-documentation/18987/13 "2017-07-20T01:49:12Z")

</div>

Thank you, thank you, thank you for that!

I’m planning to start a personal project that required such data and was starting to think about ways to scrape the requirements from the website, LOL.

Looking forward to this.

---

<div class="post-metadata">

**Author:** ![jprspereira](https://sea1.discourse-cdn.com/wanikanicommunity/user_avatar/community.wanikani.com/jprspereira/32/389740_2.png) [@jprspereira](https://community.wanikani.com/u/jprspereira)\
**Post date:** [July 20, 2017, 2:11am UTC](https://community.wanikani.com/t/api-v2-beta-documentation/18987/14 "2017-07-20T02:11:37Z")

</div>

I understood absolutely nothing.

Keep doing what you’re doing. You seem like cool people. I trust you 😃

---

<div class="post-metadata">

**Author:** ![seanblue](https://sea1.discourse-cdn.com/wanikanicommunity/user_avatar/community.wanikani.com/seanblue/32/579844_2.png) [@seanblue](https://community.wanikani.com/u/seanblue)\
**Post date:** [July 20, 2017, 2:22am UTC](https://community.wanikani.com/t/api-v2-beta-documentation/18987/15 "2017-07-20T02:22:01Z")

</div>

> [@viet](#):
>
> To page through the results, send additional requests with a page parameter.

I don’t know how this will be used, so let me know if my question is off base. Is there a use case where items actually get inserted (not just changed data for static items), such that two requests for back to back pages could actually miss an item or have a duplicate item returned? Basically some information is in position 250, but then something else is inserted there so when page two is requested, the new 250 is missed and the old 250 is returned again in position 251.

---

<div class="post-metadata">

**Author:** ![viet](https://sea1.discourse-cdn.com/wanikanicommunity/user_avatar/community.wanikani.com/viet/32/41979_2.png) [@viet](https://community.wanikani.com/u/viet)\
**Post date:** [July 20, 2017, 2:28am UTC](https://community.wanikani.com/t/api-v2-beta-documentation/18987/16 "2017-07-20T02:28:11Z")

</div>

It is ordered by ID, so the only time this shifting would be an issue if a resource gets deleted. It rarely happens. Leverage the `updated_after` filter or `data_updated_at` key if insertion of new resources is a concern.

The paging exists to control the file size of the responses.

* * *

One flow to go about getting the information is to hit up the collections to get all resources and cache them.

Then use the `updated_after` on future requests to pull in updated resources and update your cache.

On V1 there wasn’t a good way to get recently updated data. You would have to grab the full collection and check for data changes.

---

<div class="post-metadata">

**Author:** ![ccookf](https://sea1.discourse-cdn.com/wanikanicommunity/user_avatar/community.wanikani.com/ccookf/32/482054_2.png) [@ccookf](https://community.wanikani.com/u/ccookf)\
**Post date:** [July 20, 2017, 2:30am UTC](https://community.wanikani.com/t/api-v2-beta-documentation/18987/17 "2017-07-20T02:30:28Z")

</div>

Just curious, but will the ID’s ever be affected by content changes in the future?  
Edit: to clarify, it looks like there’s a general arrangement of radicals → kanji → vocab, even if a bit jumbled. If say a radical was added would that get inserted, or added to the end?

---

<div class="post-metadata">

**Author:** ![viet](https://sea1.discourse-cdn.com/wanikanicommunity/user_avatar/community.wanikani.com/viet/32/41979_2.png) [@viet](https://community.wanikani.com/u/viet)\
**Post date:** [July 20, 2017, 2:32am UTC](https://community.wanikani.com/t/api-v2-beta-documentation/18987/18 "2017-07-20T02:32:57Z")

</div>

IDs for subjects will never change. They stay constant.

IDs for assignments, review\_statistics, and study\_materials also stay constant unless a user resets; resets triggers deletion of resources (at the moment), so new ones will regenerate as the user begins to unlock them.

---

<div class="post-metadata">

**Author:** ![viet](https://sea1.discourse-cdn.com/wanikanicommunity/user_avatar/community.wanikani.com/viet/32/41979_2.png) [@viet](https://community.wanikani.com/u/viet)\
**Post date:** [July 20, 2017, 2:37am UTC](https://community.wanikani.com/t/api-v2-beta-documentation/18987/19 "2017-07-20T02:37:02Z")

</div>

> [@ccookf](#):
>
> If say a radical was added would that get inserted, or added to the end?

Like a new radical subject was added? If you hit the `/subjects` endpoint it will show up at the end since the default order is by :id. And every new resource creation is just an incremented id.

If you want to check to see if new resources have been added just use the `updated_after` filter and use the timestamp of the last time you made the request at the collection endpoint. Anytime data is changed on the resource the `data_updated_at` is updated. `updated_after` filters based on that field and a recently inserted item will have a recent `data_updated_at` timestamp.

---

<div class="post-metadata">

**Author:** ![viet](https://sea1.discourse-cdn.com/wanikanicommunity/user_avatar/community.wanikani.com/viet/32/41979_2.png) [@viet](https://community.wanikani.com/u/viet)\
**Post date:** [July 20, 2017, 2:40am UTC](https://community.wanikani.com/t/api-v2-beta-documentation/18987/20 "2017-07-20T02:40:54Z")

</div>

> [@AnimeCanuck](#):
>
> 1. So I expect this new API will mean that any old userscripts or community-made apps (like mobile ones) that have no support will no longer work. (When/if we switch to V2, Alpha or otherwise.) Correct?
> 2. Are we able to get this new V2 Alpha API to “play around with” and help test such scripts and/or changes, while keeping our V1 API keys? (So that older user scripts continue to work and/or in case something breaks, etc…?)

1. Correct.

2. V2 alpha is live now. Both V1 and V2 are active at the same time right now. Check the OP for instructions. Getting the authorization requires a little knowledge of request headers.

[Next page](https://community.wanikani.com/t/api-v2-beta-documentation/18987.md?page=2)
