Skip to content

feat: manage team API tokens - #75

Merged
bjarn merged 1 commit into
feat/project-api-tokensfrom
feat/team-api-tokens
Oct 30, 2026
Merged

bjarn merged 1 commit into
feat/project-api-tokensfrom
feat/team-api-tokens

Conversation

@bjarn

@bjarn bjarn commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

What changed

Non-breaking. Suggested version: 3.3.0 (minor). Stacked on the project API tokens PR; retarget to main after that one merges.

  • Adds team().apiTokens(), a TeamApiTokens sub-resource for the team's API tokens: list(), iterate(), create(body) and delete(tokenId). It follows team().invites(): each method has the usual overloads with and without ListTeamApiTokensQuery and RequestOptions, validates the token ID before sending, and uses the team token.
  • create creates a token that 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 (expiresAt defaults to the requesting token's expiry). The token value is only returned once (data().token()); TeamApiTokenSecret.toString() prints it as [redacted].
  • delete makes a token stop working immediately. A token can only delete tokens whose abilities it also has.
  • Removes the pending list from the operation coverage test in TeamApiTest: every operation is now checked.

The generated types for these operations come with the PR below this one; this PR changes no generated files.

Usage

TeamApiTokenCreatedResponse created = lettermint.team().apiTokens().create(StoreTeamApiTokenData.builder()
    .name("Terraform")
    .abilities(List.of("read:domains", "write:projects"))
    .expiresAt("2027-01-01T00:00:00Z")
    .build());
String token = created.data().token(); // store it now; it is only returned once

for (TeamApiToken apiToken : lettermint.team().apiTokens().iterate()) {
    System.out.println(apiToken.name() + " " + apiToken.abilities());
}

lettermint.team().apiTokens().delete(created.data().id());

Checks

  • ./gradlew checkGeneratedTypes with the latest spec: up to date (231 files)
  • ./gradlew clean build --no-daemon on JDK 17: passed (111 tests, 0 failures)
  • ./gradlew clean build --no-daemon on JDK 24: passed (111 tests, 0 failures)
  • CI build-output checks on the jar: Automatic-Module-Name: co.lettermint present, no okhttp bundled

Not run locally

  • JDK 21 and 25 (CI matrix); not installed locally. JDK 17 and 24 passed.
  • Windows (CI matrix).
  • ./gradlew checkstyleMain checkstyleTest: the build has no checkstyle tasks, and the workflow ignores the result (|| true).

Suggested release tag

v3.3.0, after the whole stack has merged.

@bjarn
bjarn requested a review from a team as a code owner October 29, 2026 16:53
@bjarn
bjarn added this pull request to stack #76 October 29, 2026 16:53
@bjarn
bjarn force-pushed the feat/team-api-tokens branch from f80c3d0 to f766193 Compare October 29, 2026 22:05
@bjarn
bjarn merged commit fa46c57 into main Oct 30, 2026
8 of 15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants