Skip to content

Instantly share code, notes, and snippets.

@Victorsitou
Last active June 18, 2024 04:16
Show Gist options
  • Save Victorsitou/c38fa9fcb3a76c542bd55d5503af7535 to your computer and use it in GitHub Desktop.
Save Victorsitou/c38fa9fcb3a76c542bd55d5503af7535 to your computer and use it in GitHub Desktop.
Duolingo Private API

Duolingo Private API

I was bored and I wanted to know how to force a friend quest, so I decided to figure out which endpoint is used to do so. The method I used was using Proxyman to intercept the app's requests and decompiling the apk to read the .smali files.

Endpoint

The endpoint that the APP uses is https://android-api-cf.duolingo.com/, sometimes https://android-api-cf.duolingo.com/2017-06-30/ is used to indicate the API version (I think?).

Auhtorization

In order to use the API, you need to send an Authorization header, which is a Bearer token.

Friends Quests

Quest Object Structure

name type description
questId string the quest ID, in this format: startTimeSeconds|goalId|friendId
goalId string the goal ID of the quest, can be one of the found here
questThreshold integer this is the threshold that must be reached to complete the quest
questState string this is the current state of the quest, can be one of the found here
?completed boolean whether the quest is completed
?acknowledged boolean whether the quest is acknowledged that it's completed (?)
goalCategory string the goal category, can be one of the cound here
questPoints integer the number of points that will be added to the user's monthly goal when the quest is completed
otherQuestParticipants Quest Participant object the data of the other quest participants

Match Object Structure

name type description
matchSameClient boolean unknown
matchSameCourse boolean whether the match is the same course
matchedUser match user object the matched user's
potentialMutualFriends number the number of potential mutual friends that you could have started a match with (?)
user match user object your own match user
userTriggeredMatch boolean whether the own user started the match

Goal IDs

value description
xp_friends_quest friend quest with xp goal
lessons_friends_quest friend quest with lessons goal

Goal States

value description
FINISHED friend quest is finished
NOT_STARTED friend quest has not started

Goal Categories

value description
FRIENDS_QUESTS the goal is a friend quest

Quest Participant

name type description
userId string the ID of the participant
displayName string the displayed name of the participant
avatarUrl string the url of the other participant
historicalStats Historical Quest Stats object the historical stats of the other participant

Historical Quest Stats

name type description
goalCategory string the goal category
streak string the streak of that goal category

Match User

name type description
id integer the user's ID
name string the user's name
picture string the user's picture

GET - /users/{user_id}/quests (note: this endpoint doesn't require API version)

Gets the own user's last and active friends quests.

Parameters
name description
timezone the timezone (not sure if this is even used)

Response

name type description
quests list of quests the list of last and active friends quests

GET - /friends/users/{user_id}/friends-quests/match (note: this endpoint does require the API version)

Gets the current friends quests match.

Response

name type description
match Match object the current friends request match

POST - /friends/users/{user_id}/friends-quests/match (note: this endpoint does require the API version)

Start a friends quests match with someone.

JSON Parameters

name type description
targetUserId string the ID of the user you would like to start a match with

Response

name type description
success boolean whether starting the match succeed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment