Duolingo
Duolingo copied to clipboard
Mobile app API inventory
General
https://www.duolingo.com/api/1/version_info
https://www.duolingo.com/api/1/users/show?id=?????
https://www.duolingo.com/api/1/store/get_items
Skills:
- main skill page
https://api.duolingo.com/api/1/skills/show?id=?????
- lessons
https://api.duolingo.com/api/1/sessions?device=mobile&select_capable=true&offline=true&lesson_number=???&type=lesson&skill_id=????&speak_capable=true
Sentence:
http://d2.duolingo.com/words/hints/de/en?sentence=plus+separated+words.&format=new
It appears this API can take arbitrary sentences.
Other
The cloudflare URL should be replaced with static.duolingo.com, which is the value returned by https://www.duolingo.com/api/1/version_info
for the TTS CDN url.
Fresh Login
There's a cookie, duo_ab
, with some unknown value. it's included in the GET of the first request. My guess is some kind of device ID.
-
https://www.duolingo.com/api/1/version_info
I log in.
- POST
https://www.duolingo.com/login
.- password: (password)
- login: (username)
This request sets a cookie auth_tkt.
Response body: {'response': 'OK', 'username': (username), 'user_id': (user id)}
- GET
https://www.duolingo.com/api/1/users/show?id={user_id}
- GET
https://www.duolingo.com/api/1/version_info
. The response body appears to be the same. - GET
https://www.duolingo.com/api/1/store/get_items
.
After that, it starts getting the next available skills, including every lesson and their sentence audio.
Switching Languages
- POST
/api/1/me/switch_language
- from_language: en
- learning_language=fr
response body: an object with
-
languages
(incl. ones not being learned, with current_learning set to True or False)-
language_data
-
-
fr
(or chosen language)- various info about the language, incl. skills. It's the same as the
language_data
returned by the users/show?id={user_id} endpoint.
- various info about the language, incl. skills. It's the same as the
Looks like the mobile API is a much better base for writing the duolingo API than the web api, since it doesn't allow the developers to do things like embed their TTS url in the webpage.
I've been writing some documentation here: http://tschuy.com/duolingo/duolingo.html
@tschuy
http://tschuy.com/duolingo/duolingo.html
Is a broken link - are the docs up yet?
@samwest88 FYI http://tschuy.com/duolingo/ doesnt look recent
@tylerwhipple @samwest88 it's on github: https://github.com/tschuy/duolingo/blob/master/docs/source/api/endpoints.rst I broke the Github Pages hosting for now, I'll get around to it eventually :P
https://github.com/tschuy/duolingo/blob/master/docs/source/api/data.rst <-- explains a bit more about the data they return.
Regarding the value of the cookie duo_ab
: It refers to Duolingo's A/B tests and is two fields concatenated together. The first is a 40-byte hex-encoded (160 bits in binary) hash (probably SHA-1) of the second field. The second field is Base64-encoded JSON containing the following fields (as of this post):
- schools_new_signup_test
- web_branded_mobile_buttons_test
- signup_modal_buttons_experiment
- login_modal_experiment
Each field can be true
or false
independently.