Skip to content

Commit 5a52ef4

Browse files
docs: clarify scoped access token entitlement (#1579)
1 parent a7df916 commit 5a52ef4

3 files changed

Lines changed: 26 additions & 6 deletions

File tree

docs/api-reference/sourcebot-public.openapi.json

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2423,7 +2423,7 @@
24232423
"Scoped Access Tokens"
24242424
],
24252425
"summary": "Create a scoped access token",
2426-
"description": "Creates an opaque bearer token that expires exactly one hour after issuance and is restricted to the requested repositories. Repository IDs are validated atomically against the API-key owner's current access; the request fails if any ID is missing or inaccessible. Repository IDs are returned by GET /api/repos.\n\nThis endpoint requires a Sourcebot API key. Scoped access tokens, OAuth tokens, and browser sessions cannot mint another scoped access token. The returned token is independent of the API key after issuance and cannot be refreshed.",
2426+
"description": "Creates an opaque bearer token that expires exactly one hour after issuance and is restricted to the requested repositories.",
24272427
"security": [
24282428
{
24292429
"bearerToken": []
@@ -2432,6 +2432,9 @@
24322432
"apiKeyHeader": []
24332433
}
24342434
],
2435+
"x-mint": {
2436+
"content": "<Info>\nThe scoped access token APIs require a custom entitlement. To request access, contact [team@sourcebot.dev](mailto:team@sourcebot.dev).\n</Info>"
2437+
},
24352438
"requestBody": {
24362439
"required": true,
24372440
"content": {
@@ -2503,7 +2506,7 @@
25032506
"Scoped Access Tokens"
25042507
],
25052508
"summary": "Revoke a scoped access token",
2506-
"description": "Immediately revokes a scoped access token created by the authenticated API-key owner. This endpoint requires a Sourcebot API key.",
2509+
"description": "Immediately revokes a scoped access token created by the authenticated API-key owner.",
25072510
"security": [
25082511
{
25092512
"bearerToken": []
@@ -2512,6 +2515,9 @@
25122515
"apiKeyHeader": []
25132516
}
25142517
],
2518+
"x-mint": {
2519+
"content": "<Info>\nThe scoped access token APIs require a custom entitlement. To request access, contact [team@sourcebot.dev](mailto:team@sourcebot.dev).\n</Info>"
2520+
},
25152521
"parameters": [
25162522
{
25172523
"schema": {

docs/docs/api-reference/authentication.mdx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@ curl -X POST https://your-sourcebot-instance.com/api/search \
3535

3636
## Using a scoped access token
3737

38+
<Info>
39+
The scoped access token APIs require a custom entitlement. To request access, contact [team@sourcebot.dev](mailto:team@sourcebot.dev).
40+
</Info>
41+
3842
Scoped access tokens are short-lived bearer credentials intended for clients that should only access a specific set of repositories. Create one with a Sourcebot API key by calling `POST /api/ee/scoped_access_token` with repository names:
3943

4044
```bash

packages/web/src/openapi/publicApiDocument.ts

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,12 @@ This API is only available with an active Sourcebot license. [More information](
5050
</Note>
5151
`;
5252

53+
const SCOPED_ACCESS_TOKEN_ENTITLEMENT_INFO = dedent`
54+
<Info>
55+
The scoped access token APIs require a custom entitlement. To request access, contact [team@sourcebot.dev](mailto:team@sourcebot.dev).
56+
</Info>
57+
`;
58+
5359
const publicFileTreeNodeSchema: SchemaObject = {
5460
type: 'object',
5561
properties: {
@@ -456,9 +462,7 @@ export function createPublicOpenApiDocument(version: string) {
456462
tags: [scopedAccessTokensTag.name],
457463
summary: 'Create a scoped access token',
458464
description: dedent`
459-
Creates an opaque bearer token that expires exactly one hour after issuance and is restricted to the requested repositories. Repository IDs are validated atomically against the API-key owner's current access; the request fails if any ID is missing or inaccessible. Repository IDs are returned by GET /api/repos.
460-
461-
This endpoint requires a Sourcebot API key. Scoped access tokens, OAuth tokens, and browser sessions cannot mint another scoped access token. The returned token is independent of the API key after issuance and cannot be refreshed.
465+
Creates an opaque bearer token that expires exactly one hour after issuance and is restricted to the requested repositories.
462466
`,
463467
security: [
464468
{ [securitySchemeNames.bearerToken]: [] },
@@ -480,6 +484,9 @@ export function createPublicOpenApiDocument(version: string) {
480484
403: errorJson('The current authentication method is not an API key, or the API-key owner is not permitted to perform this operation.'),
481485
500: errorJson('Unexpected token creation failure.'),
482486
},
487+
'x-mint': {
488+
content: SCOPED_ACCESS_TOKEN_ENTITLEMENT_INFO,
489+
},
483490
});
484491

485492
registry.registerPath({
@@ -488,7 +495,7 @@ export function createPublicOpenApiDocument(version: string) {
488495
operationId: 'revokeScopedAccessToken',
489496
tags: [scopedAccessTokensTag.name],
490497
summary: 'Revoke a scoped access token',
491-
description: 'Immediately revokes a scoped access token created by the authenticated API-key owner. This endpoint requires a Sourcebot API key.',
498+
description: 'Immediately revokes a scoped access token created by the authenticated API-key owner.',
492499
security: [
493500
{ [securitySchemeNames.bearerToken]: [] },
494501
{ [securitySchemeNames.apiKeyHeader]: [] },
@@ -507,6 +514,9 @@ export function createPublicOpenApiDocument(version: string) {
507514
404: errorJson('Scoped access token not found.'),
508515
500: errorJson('Unexpected token revocation failure.'),
509516
},
517+
'x-mint': {
518+
content: SCOPED_ACCESS_TOKEN_ENTITLEMENT_INFO,
519+
},
510520
});
511521

512522
// EE: User Management

0 commit comments

Comments
 (0)