Repository navigation
feat: manage team API tokens - #49
Merged
Merged
Conversation
Add `team.apiTokens` with `list`, `iterate`, `create` and `delete` for the team's API tokens (team token). A new token can only have abilities that the requesting token has, copies its IP allowlist and can't outlive it. `create` returns the token value once. The coverage test now checks every operation again.
bjornftw
approved these changes
Oct 30, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
Adds
team.apiTokens, a sub-resource for the team's API tokens, next toteam.membersandteam.invitesand in the same style (team token):list(query?, options?)GET /team/api-tokens(page: { size, cursor },sort)ListTeamApiTokensResponse(CursorPage<TeamApiToken>)iterate(query?, options?)next_cursorAsyncGenerator<TeamApiToken>create(body, options?)POST /team/api-tokenswithStoreTeamApiTokenDataTeamApiTokenCreatedResponse(201)delete(tokenId, options?)DELETE /team/api-tokens/{tokenId}MessageResponsecreatetakes aname, theabilities(for exampleread:domains) and an optionalexpires_at(ISO 8601 ornull). The new token can only have abilities that the requesting token has. It copies the requesting token's IP allowlist, and it can't outlive the requesting token:expires_atdefaults to, and can't be later than, its expiry.createreturns the token value once, indata.token. The docblock and README say to store it right away; as with project tokens, the SDK does not redact generated response types.listanditeratereturn token metadata only.deletestops the token from working immediately; a token can only delete tokens whose abilities it also has.PermissionError, a 422 the existingValidationError. No new error classes..and..token IDs are rejected before any request, as for the other methods.Idempotency-Key, so there is no idempotency option.TeamApiTokensis exported as a type, likeTeamInvites.team.apiTokensis in the Team API table and the Team API example.Stacked on #48. Non-breaking. Suggested bump: minor.
Usage
Checks
On this branch:
npm run lint: passednpm run type-check: passednpm run generate:check: generated files up to date with the pinned spec; the header-only mode that CI runs also passesnpm run test:coverage: 8 suites, 365 tests passednpm run build: passednpm run test:smoke: ESM import, CJS require and type declarations OKNot run locally
Nothing; every CI step was run locally.
Suggested release tag
v3.3.0(minor), together with #48 once both are merged.