How it works
- You register an application and get a client ID and client secret.
- Your application sends the user to the Top.gg authorization page with the scopes it needs.
- The user signs in, selects one of their projects, and approves.
- Top.gg redirects back to you with a code. You exchange it for an access token and a refresh token.
- You call the v1 API with the access token. Refresh it when it expires.
What you can access
Access tokens work with the same v1 API as project tokens. Address endpoints by project ID. Project tokens use@me instead:
Each endpoint requires a scope the user granted. On top of the project endpoints, OAuth tokens can call:
GET /projectsto look up the project the authorization coversGET /users/@meto identify the user who authorized you/users/@me/projectsto list the user’s projects and create drafts for them- Project webhooks to create and manage vote webhooks
- Project integrations to connect and disconnect integrations
:project_id is the Top.gg project ID, the same id returned by GET /projects/@me. It is not the Discord application or server ID.Your application only manages what it created
Webhooks and integrations are shared between the project owner, the dashboard, and every application the owner authorized. To keep applications from interfering with each other, your application only sees and manages the webhooks it created and the integrations it connected. Everything else on the project is invisible to it, even with the matching scope.Tokens
Revoking a refresh token revokes the whole authorization. The user can also remove your application from their Top.gg settings at any time, which invalidates all tokens immediately.
If your application only acts on projects, the application token saves you from storing access tokens entirely: users authorize their projects once, and the single static token covers all of them. Access tokens remain necessary for the
user.* scopes.