{{--
Copyright (c) ppy Pty Ltd
Routes marked with the OAuth label require a valid OAuth2 token for access.
More information about applications you have registered and granted permissions to can be found here.
The API supports the following grant types:
Authentication
Before you can use the osu!api, you will need to
Before you can get an OAuth token, you will need to register an OAuth application on your account settings page.
To register an OAuth application you will need to provide the:
| Name | Description |
|---|---|
| Application Name | This is the name that will be visible to users of your application. The name of your application cannot be changed. |
| Application Callback URL | The URL in your application where users will be sent after authorization. |
The Application Callback URL is required when for using Authorization Codes.
This may be left blank if you are only using Client Credentials Grants.
Your new OAuth application will have a Client ID and Client Secret; the Client Secret is like a password for your OAuth application, it should be kept private and do not share it with anyone else.
The flow to authorize users for your application is:
With the access token, you can make requests to osu!api on behalf of a user.
The token should be included in the header of requests to the API.
Authorization: Bearer @{{token}}
# With shell, you can just pass the correct header with each request curl "{{ $GLOBALS['cfg']['app']['url'] }}/api/[version]/[endpoint]" -H "Authorization: Bearer @{{token}}"
// This javascript example uses fetch()
fetch("{{ $GLOBALS['cfg']['app']['url'] }}/api/[version]/[endpoint]", {
headers: {
Authorization: 'Bearer @{{token}}'
}
});
Make sure to replace
@{{token}}with your OAuth2 token.
The Resource Owner is the user that a token acts on behalf of.
For Authorization Code Grant tokens, the Resource Owner is the user authorizing the token.
Client Credentials Grant tokens do not have a Resource Owner (i.e. is a guest user), unless they have been granted the {{ ApidocRouteHelper::scopeBadge('delegate') }} scope. The Resource Owner of tokens with the {{ ApidocRouteHelper::scopeBadge('delegate') }} scope is the owner of the OAuth Application that was granted the token.
Routes marked with requires user require the use of tokens that have a Resource Owner.
Client Credentials Grant tokens may be allowed to act on behalf of the owner of the OAuth client (delegation) by requesting the {{ ApidocRouteHelper::scopeBadge('delegate') }} scope, in addition to other scopes supporting delegation. When using delegation, scopes that support delegation cannot be used together with scopes that do not support delegation. Delegation is only available to Chat Bots.
The following scopes currently support delegation:
| Name |
|---|
| {{ ApidocRouteHelper::scopeBadge('chat.write') }} |
The following scopes are currently supported:
@php $scopeDescriptions = [ 'chat.read' => "Allows read chat messages on a user's behalf.", 'chat.write' => "Allows sending chat messages on a user's behalf.", 'chat.write_manage' => "Allows joining and leaving chat channels on a user's behalf.", 'delegate' => "Allows acting as the owner of a client; only available for [Client Credentials Grant](#client-credentials-grant).", 'forum.write' => "Allows creating and editing forum posts on a user's behalf.", 'friends.read' => 'Allows reading of the user\'s friend list.', 'identify' => 'Allows reading of the public profile of the user (`/me`).', 'public' => 'Allows reading of publicly available data on behalf of the user.', ]; @endphp| Name | Description |
|---|---|
| {{ $scope }} | {!! markdown_plain($description) !!} |
identify is the default scope for the Authorization Code Grant and always implicitly provided. The Client Credentials Grant does not currently have any default scopes.
Routes marked with lazer are intended for use by the osu!lazer client and not currently available for use with Authorization Code or Client Credentials grants.
Using the {{ ApidocRouteHelper::scopeBadge('chat.write') }} scope requires either
Your account settings page will show your registered OAuth applications, and all the OAuth applications you have granted permissions to.
You can generate a new Client Secret by choosing to "Reset client secret", however, this will disable all access tokens issued for the application.