[PR #7424] [MERGED] feat(api-keys): pagination support for list-api-keys #32902

Closed
opened 2026-04-17 23:36:35 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/7424
Author: @ping-maxwell
Created: 1/16/2026
Status: Merged
Merged: 1/20/2026
Merged by: @himself65

Base: canaryHead: feat/list-api-keys-pagination-support


📝 Commits (4)

  • b6bfcbf feat(api-keys): pagination support for list-api-keys
  • c6b8072 Update packages/better-auth/src/plugins/api-key/routes/list-api-keys.ts
  • 73a2c13 Update packages/better-auth/src/plugins/api-key/routes/list-api-keys.ts
  • 7926223 fix: move top level

📊 Changes

4 files changed (+623 additions, -175 deletions)

View changed files

📝 docs/content/docs/plugins/api-key.mdx (+52 -2)
📝 packages/better-auth/src/plugins/api-key/adapter.ts (+157 -34)
📝 packages/better-auth/src/plugins/api-key/api-key.test.ts (+217 -18)
📝 packages/better-auth/src/plugins/api-key/routes/list-api-keys.ts (+197 -121)

📄 Description

Breaking Change

Note that this changes the return type/value of the endpoint.


Summary by cubic

Adds pagination and sorting to the list API keys endpoint. This is a breaking change: the endpoint now returns a paginated object instead of an array.

  • New Features

    • Query params: limit, offset, sortBy, sortDirection ("asc" | "desc").
    • Returns { apiKeys, total, limit?, offset? } for easier paging.
    • Works in both database and secondary-storage modes (in-memory sorting/pagination when needed).
    • OpenAPI docs and usage examples updated; tests cover pagination and sorting.
  • Migration

    • Update client code to use result.apiKeys instead of the previous array response.
    • Read result.total for the full count, and result.limit/result.offset for the current page.

Written for commit 7926223b0d. Summary will update on new commits.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/better-auth/better-auth/pull/7424 **Author:** [@ping-maxwell](https://github.com/ping-maxwell) **Created:** 1/16/2026 **Status:** ✅ Merged **Merged:** 1/20/2026 **Merged by:** [@himself65](https://github.com/himself65) **Base:** `canary` ← **Head:** `feat/list-api-keys-pagination-support` --- ### 📝 Commits (4) - [`b6bfcbf`](https://github.com/better-auth/better-auth/commit/b6bfcbfd82fdc5eeb4a019e9cf44f8f6afea52a4) feat(api-keys): pagination support for list-api-keys - [`c6b8072`](https://github.com/better-auth/better-auth/commit/c6b80720470fe29be796ff9f4ce1419d4559f804) Update packages/better-auth/src/plugins/api-key/routes/list-api-keys.ts - [`73a2c13`](https://github.com/better-auth/better-auth/commit/73a2c139be36c833f8d6992def4b994864442a63) Update packages/better-auth/src/plugins/api-key/routes/list-api-keys.ts - [`7926223`](https://github.com/better-auth/better-auth/commit/7926223b0dd17b0cd066c3188dfe4e87fd8d0a47) fix: move top level ### 📊 Changes **4 files changed** (+623 additions, -175 deletions) <details> <summary>View changed files</summary> 📝 `docs/content/docs/plugins/api-key.mdx` (+52 -2) 📝 `packages/better-auth/src/plugins/api-key/adapter.ts` (+157 -34) 📝 `packages/better-auth/src/plugins/api-key/api-key.test.ts` (+217 -18) 📝 `packages/better-auth/src/plugins/api-key/routes/list-api-keys.ts` (+197 -121) </details> ### 📄 Description ## Breaking Change Note that this changes the return type/value of the endpoint. <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Adds pagination and sorting to the list API keys endpoint. This is a breaking change: the endpoint now returns a paginated object instead of an array. - **New Features** - Query params: limit, offset, sortBy, sortDirection ("asc" | "desc"). - Returns { apiKeys, total, limit?, offset? } for easier paging. - Works in both database and secondary-storage modes (in-memory sorting/pagination when needed). - OpenAPI docs and usage examples updated; tests cover pagination and sorting. - **Migration** - Update client code to use result.apiKeys instead of the previous array response. - Read result.total for the full count, and result.limit/result.offset for the current page. <sup>Written for commit 7926223b0dd17b0cd066c3188dfe4e87fd8d0a47. Summary will update on new commits.</sup> <!-- End of auto-generated description by cubic. --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-17 23:36:35 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#32902