Skip to content

feat: track and display last used timestamp for API tokens - #2760

Closed
ggoswami777 wants to merge 1 commit into
documenso:mainfrom
ggoswami777:feat/api-token-last-used-at
Closed

ggoswami777 wants to merge 1 commit into
documenso:mainfrom
ggoswami777:feat/api-token-last-used-at

Conversation

@ggoswami777

Copy link
Copy Markdown
Contributor

Description

Hello! This PR implements the lastUsedAt field for API tokens to help users track token hygiene and security, as requested in #2756.

Changes

  • Schema: Added a nullable lastUsedAt DateTime field to the ApiToken model.
  • Backend Logic: Updated getApiTokenByToken to perform a non-blocking background write to lastUsedAt upon successful token validation. This ensures no additional latency is added to API requests.
  • Data Layer: Updated the library fetching logic and tRPC Zod schemas to include the new field.
  • UI: Displayed the "Last used on..." timestamp in the API Tokens list within Team Settings, alongside the creation and expiration dates.

Why?

This provides admins with a clear signal on whether a token is actively being used or is safe to rotate/delete, aligning with industry standards like GitHub and Stripe.

Testing

  • Verified that the timestamp updates correctly in the background when a token is used via the Public API.
  • Verified that the UI displays the date accurately once updated.
  • Verified that new tokens (with null timestamps) are handled gracefully by the UI and Zod schemas.

##screenshots
image

Fixes #2756

@vercel

vercel Bot commented May 2, 2026

Copy link
Copy Markdown

@ggoswami777 is attempting to deploy a commit to the Documenso Team Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai

coderabbitai Bot commented May 2, 2026 •

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are limited based on label configuration.

🏷️ Required labels (at least one) (1)
  • coderabbit

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: Repository UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: ef4bc393-f3d7-46d6-ac9a-3dcf52cd6bb5

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
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@github-actions github-actions Bot added apps: web Issues related to the webapp 🚨 migrations 🚨 Be advised: PR contains database migrations - Auto-Generated by GitHub Actions on raising a PR labels May 2, 2026
@github-actions

Copy link
Copy Markdown
Contributor

This PR has not seen activitiy for a while. It will be closed in 30 days unless further activity is detected.

@github-actions github-actions Bot added the Stale label Jul 31, 2026
@github-actions

github-actions Bot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

This PR has been closed because of inactivity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

apps: web Issues related to the webapp 🚨 migrations 🚨 Be advised: PR contains database migrations - Auto-Generated by GitHub Actions on raising a PR Stale

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: track last used timestamp for API tokens

1 participant