diff --git a/docs/docs/api/routes/api-tokens.md b/docs/docs/api/routes/api-tokens.md new file mode 100644 index 000000000..168b24433 --- /dev/null +++ b/docs/docs/api/routes/api-tokens.md @@ -0,0 +1,67 @@ +# API Token Management + +These endpoints relate to managing a users created API Tokens. +These tokens are likely to be generated from an OAuth2 integration, but in the future users may be able to create their own API Keys manually. + +!!! note + All of the below endpoints require [Self Key](../auth.md) level authentication. You cannot interact with these endpoints with Bearer auth. + +***** + +## Retrieve all API Tokens + +`GET /api/v1/users/:userID/api-tokens` + +### Parameters + +None. + +### Response + +| Property | Type | Description | +| :: | :: | :: | +| `` | APIKeyDocument | An array of APIKeyDocuments that belong to this user. | + +### Example + +#### Request +``` +GET /api/v1/users/1/api-tokens +``` + +#### Response +```json +[{ + "identifier": "Fervidex Token", + "token": "foobar", + "permissions": {"submit_score": true}, + "userID": 1, + "fromOAuth2Client": "FERVIDEX_OA2_CLIENT_ID" +}] +``` + +***** + +## Delete a specific token. + +`DELETE /api/v1/users/:userID/api-token/:token` + +### Parameters + +None. + +### Response + +Empty Object. + +### Example + +#### Request +``` +DELETE /api/v1/users/1/api-token/foobar +``` + +#### Response +```json +{} +``` diff --git a/docs/mkdocs.yml b/docs/mkdocs.yml index 1bffb525f..e09fd0aa0 100644 --- a/docs/mkdocs.yml +++ b/docs/mkdocs.yml @@ -60,6 +60,7 @@ nav: - "api/routes/gpt.md" - "api/routes/admin.md" - "api/routes/ugpt-showcase.md" + - "api/routes/api-tokens.md" - "api/routes/oauth2.md" - "api/routes/oauth2-clients.md"