Repository navigation
feat: manage project API tokens - #47
Merged
Merged
Conversation
bjarn
force-pushed
the
feat/project-api-tokens
branch
from
October 29, 2026 22:04
5fcb273 to
0c1a652
Compare
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
Non-breaking. Adds
Projects.APITokens, aProjectAPITokensServicethat manages Project API tokens, and regenerates the types from the latest API spec. Suggested version bump: minor.Projects.APITokens.List(ctx, projectID, *ListProjectApiTokensQuery, ...RequestOption) (*ListProjectApiTokensResponse, error)GET /projects/{projectId}/api-tokensProjects.APITokens.Iterate(ctx, projectID, *ListProjectApiTokensQuery, ...RequestOption) iter.Seq2[ProjectApiToken, error]GET /projects/{projectId}/api-tokens, followingnext_cursorProjects.APITokens.Create(ctx, projectID, StoreProjectApiTokenData, ...RequestOption) (*ProjectApiTokenCreatedResponse, error)POST /projects/{projectId}/api-tokensProjects.APITokens.Delete(ctx, projectID, tokenID, ...RequestOption) (*MessageResponse, error)DELETE /projects/{projectId}/api-tokens/{tokenId}Idempotency-Key. LikeTeam.InvitesandWebhooks.Deliveries, the paginated collection is a sub-resource. The service follows them: the same options, empty-ID validation, pagination iterator and error types (422 is a*ValidationError, 404 a*NotFoundError).ProjectApiTokenCreatedResponse.Data.Token. Use it to send through the API, or as the SMTP password when SMTP is enabled for the project;SMTPthen holds the host, ports and user name, and isnilotherwise. The list returns tokens without their values. The doc comments and README say so.Projects.RotateTokennow points atProjects.APITokens.TestEveryOperationHasAMethod) lists those three operations as pending. Every other operation is still strictly checked, and the test fails if a pending operation gets a method without being removed from the list.Projects.APITokensin the Team API table, with an example.API changes in the regenerated types
GET /projects/{projectId}/api-tokenspage[size],page[cursor],sort);ListProjectApiTokensQuery,ListProjectApiTokensQuerySortItem,ListProjectApiTokensResponseProjects.APITokens.List,Projects.APITokens.Iterate(this PR)POST /projects/{projectId}/api-tokensProjectApiTokenCreatedResponse, 422; bodyStoreProjectApiTokenData(Name, optionalShortToken)Projects.APITokens.Create(this PR)DELETE /projects/{projectId}/api-tokens/{tokenId}MessageResponseProjects.APITokens.Delete(this PR)GET /team/api-tokensListTeamApiTokensQuery,ListTeamApiTokensQuerySortItem,ListTeamApiTokensResponseTeam.APITokens.List,Team.APITokens.Iterate(stacked PR)POST /team/api-tokensTeamApiTokenCreatedResponse, 422; bodyStoreTeamApiTokenData(Name,Abilities, optionalExpiresAt)Team.APITokens.Create(stacked PR)DELETE /team/api-tokens/{tokenId}MessageResponseTeam.APITokens.Delete(stacked PR)ProjectApiToken,ProjectApiTokenSecret,ProjectApiTokenCreatedResponse,SmtpCredentialsProjectApiTokenSecretisProjectApiTokenplus the one-timeToken; the created response addsSMTP(nullable) andMessageTeamApiToken,TeamApiTokenSecret,TeamApiTokenCreatedResponseTeamApiTokenSecretisTeamApiTokenplus the one-timeTokenApiTokenSourcedashboard,api,cli,mcp)POST /projects/{projectId}/rotate-tokenNo existing type changes.
goreleasereports only compatible changes (see Checks).Usage
Checks
Run on this branch with
GOFLAGS=-buildvcs=false(worktree):test -z "$(gofmt -l .)": passesgo vet ./...: passessh scripts/generate.sh --check: passes (generated files up to date; the header check that CI runs also passes)go test -race -coverprofile=coverage.out ./...: passes (coverage 94.4%)go build ./...: passesgo mod tidy && git diff --exit-code go.mod: no changes (nogo.sum)go vet,go test -raceandgo buildwith Go 1.24.13 (minimum), 1.26.4 and 1.27.1: passgorelease -base=v3.2.0: only compatible changes; suggested version v3.3.0. It listsProjectAPITokensServiceandProjectsService.APITokensas added. Besides this PR's additions it listsWebhookEventInboundRejected: added, which is already onmain.Not run locally
Suggested release tag
v3.3.0, once this PR and the stacked team API token PR are merged (one minor release for both).