Skip to content

MT-23076: support expires_at on api token create and reset - #149

Draft
oshchyhol wants to merge 4 commits into
mainfrom
MT-23076-nodejs-api-token-expiration
Draft

MT-23076: support expires_at on api token create and reset#149
oshchyhol wants to merge 4 commits into
mainfrom
MT-23076-nodejs-api-token-expiration

Conversation

@oshchyhol

@oshchyhol oshchyhol commented Aug 7, 2026

Copy link
Copy Markdown

Motivation

MT-23076

The API token endpoints now accept an optional expires_at (createApiToken request body and a new optional resetApiToken body). This exposes it in the SDK.

Changes

  • add optional expires_at?: string | null to CreateApiTokenRequest (maps to the expires_at param of the createApiToken operation)
  • add ResetApiTokenRequest type and an optional params argument to apiTokens.reset(id, params?) (the resetApiToken operation now takes an optional body)
  • when params is omitted or has no expires_at key, reset sends no request body – identical to the previous behavior
  • expires_at: null is serialized as an explicit JSON null ("never expires"); omitting the key leaves the expiration to the server default (a 1-year default is being rolled out)
  • extend the api tokens example with the new option

How to test

  • apiTokens.create({ name, resources }) without expires_at – request body has no expires_at key, token is created as before
  • apiTokens.create({ ..., expires_at: "2027-06-01T00:00:00Z" }) – created token's expires_at matches the passed value
  • apiTokens.create({ ..., expires_at: null }) – created token never expires (expires_at: null in the response)
  • apiTokens.create({ ..., expires_at: "2020-01-01T00:00:00Z" }) (past date) – rejected, MailtrapError with the server's 422 message
  • apiTokens.reset(id) without params – no request body sent, reset works exactly as before
  • apiTokens.reset(id, { expires_at: null }) – new token never expires
  • apiTokens.reset(id, { expires_at: "<future date>" }) – new token expires at the passed value

Companion PRs

Caveat: release/merge only after falcon deploys MT-23076 and zap_api_token_expiration is enabled in production.

@coderabbitai

coderabbitai Bot commented Aug 7, 2026

Copy link
Copy Markdown

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: e6f2730a-6779-4397-b92d-19d7b5077734

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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.

1 participant