Duolingo
Duolingo copied to clipboard
Request: Call to get daily XP totals for past 7 days
I want to recreate the Graph that displays the XP score for the last 7 days on a Tidbyt device: https://www.tidbyt.com
Currently the API let's you get the current daily XP score for right now, but I'd really like a call that also returns the total XP achieved for each of the past 7 days. Maybe something like this:
# Sample Response
{
'xp_1dayago': 105,
'xp_2daysago': 48,
'xp_3daysago': 207,
'xp_4daysago': 0,
'xp_5daysago': 86,
'xp_6daysago': 54,
}
Would this be at all possible? Is there any way to get this data from Duolingo?
Hi @saltedlolly,
It is possible with duolingo API, but this package doesn't implement this method.
The endpoint is www.duolingo.com/users/{userID}/xp_summaries
It returns an array for the given time range, as following:

Hope it helps.
Thanks - this is just what I have been looking for! Unfortunately, I'm struggling to make it work. Could you possibly provide me with an example query? Sorry, I'm quite new at this.
I tried https://www.duolingo.com/users/6364229/xp_summaries?startDate=2022-02-16&endDate=2022-02-17&timezone=Europe/London
but got nothing.
Sorry, my bad. The URL should be https://www.duolingo.com/2017-06-30/users/6364229/xp_summaries?startDate=2022-02-16&endDate=2022-02-17&timezone=Europe/London
The 2017-06-30 is missing. It's just a fixed prefix Duolingo currently use for their API endpoint.
Example:
GET /2017-06-30/users/6364229/xp_summaries?startDate=2022-02-16&endDate=2022-02-17&timezone=Europe%2FLondon HTTP/1.1
Authorization: Bearer <your_jwt_token_here>
Content-Type: text/plain; charset=utf-8
Host: www.duolingo.com
"summaries":[{"gainedXp":87,"frozen":false,"streakExtended":true,"userId":6364229,"dailyGoalXp":50,"date":1645056000,"repaired":false},{"gainedXp":null,"frozen":true,"streakExtended":false,"userId":6364229,"dailyGoalXp":null,"date":1644969600,"repaired":false}]}
Amazing! Exactly what I needed! And even better it seems I don't even need to be authenticated. Many thanks.
You're right, it works even without Authorization header or cookies, didn't realize that before.
Thanks for all your help. As an aside, is there a query I can make to return the userid of a provided username?
Yes, there is an endpoint which returns user information by username, it contains among other fields the userID:
https://www.duolingo.com/2017-06-30/users?username=<username>
e.g.:
https://www.duolingo.com/2017-06-30/users?username= igorskh
returns
{
"users": [
{
"joinedClassroomIds": [],
"streak": 1873,
"id": 14397890
}
]
}
Lot's of other things as well, but you can get ID from here.
Hi @saltedlolly,
It is possible with duolingo API, but this package doesn't implement this method.
The endpoint is www.duolingo.com/users/{userID}/xp_summaries
It returns an array for the given time range, as following:
![]()
Hope it helps.
@igorskh, could you tell me where you took that API screenshot? I have previously searched for documentation on Duolingo's API, but had little success. What you have in that screenshot is certainly the kind of thing I would be interested in looking at.
@igorskh, could you tell me where you took that API screenshot? I have previously searched for documentation on Duolingo's API, but had little success. What you have in that screenshot is certainly the kind of thing I would be interested in looking at.
@golmschenk I have a repo with openAPI docs https://github.com/igorskh/duolingo-api
I thought you might be interested to see what I built: https://twitter.com/saltedlolly/status/1512107599747067913