Get user scores
The users.getUserScores method on a Client instance makes a GET request to the users/{user}/scores/{type} endpoint and returns an array of the specified user’s scores. users.getUserScoresV2 makes a request to the same endpoint, but has the X-API-Version header set to 20220705.
Example
const scores = await api.users.getUserScores(14544646, 'best', {
query: {
mode: 'osu',
limit: 3
}
});
Parameters
| Parameter | Type | Optional | Description |
|---|---|---|---|
| user | number | ID of the user to get their scores | |
| type | UserScoreType | Score type |
If type is set to recent then the parameters are as follows:
| Parameter | Type | Optional | Description |
|---|---|---|---|
| user | number | ID of the user to get their scores | |
| type | ‘recent’ | Score type | |
| options | GetUserRecentScoresOptions | ✓ |
options.query
| Parameter | Type | Optional | Description |
|---|---|---|---|
| limit | number | ✓ | Limit number of results |
| offset | number | ✓ | Pagination offset |
| mode | GameMode | ✓ | Gamemode of the scores to return |
| include_fails | boolean | number | ✓ | Include failed scores? |
If type is set to best or firsts then the parameters are as follows:
| Parameter | Type | Optional | Description |
|---|---|---|---|
| user | number | ID of the user to get their scores | |
| type | ‘best’ | ‘firsts’ | Score type | |
| options | GetUserScoresOptions | ✓ |
options.query
| Parameter | Type | Optional | Description |
|---|---|---|---|
| limit | number | ✓ | Limit number of results |
| offset | number | ✓ | Pagination offset |
| mode | GameMode | ✓ | Gamemode of the scores to return |
Returns
If using users.getUserScores and type is set to recent:
Promise<UserBestScore[]>;
If using users.getUserScores and type is set to best or firsts:
Promise<UserScore[]>;
If using users.getUserScoresV2 and type is set to recent:
Promise<UserBestScoreV2[]>;
If using users.getUserScoresV2 and type is set to best or firsts:
Promise<UserScoreV2[]>;
Types
Possible Exceptions
See the error handling documentation for more information.
invalid_json_syntaxnetwork_errorunexpected_response
Notice that something is missing? Found a typo? Think something's incomplete? Or think that something can be explained better? Feel free to open a pull request or submit an issue on the library's Github repository .