[GH-ISSUE #7724] Add support for additionalFields to api-key plugin #19516

Closed
opened 2026-04-15 18:43:54 -05:00 by GiteaMirror · 1 comment
Owner

Originally created by @thomasmol on GitHub (Jan 31, 2026).
Original GitHub issue: https://github.com/better-auth/better-auth/issues/7724

Is this suited for github?

  • Yes, this is suited for github

Similar to other schemas that can be extended with additionalFields, I'd like to see the api-key plugin have this too.

There was already a PR: https://github.com/better-auth/better-auth/pull/5999 but that one has since been closed. Similar to the PR, i'd like to use this to add something like organizationId to the schema

Describe the solution you'd like

Have an option for specifying additional schema fields similar to e.g. the organization plugin:https://www.better-auth.com/docs/plugins/organization#additional-fields-1

Describe alternatives you've considered

Store extra data in metadata fields, but this is suboptimal

Additional context

No response

Originally created by @thomasmol on GitHub (Jan 31, 2026). Original GitHub issue: https://github.com/better-auth/better-auth/issues/7724 ### Is this suited for github? - [x] Yes, this is suited for github ### Is your feature request related to a problem? Please describe. Similar to other schemas that can be extended with `additionalFields`, I'd like to see the api-key plugin have this too. There was already a PR: https://github.com/better-auth/better-auth/pull/5999 but that one has since been closed. Similar to the PR, i'd like to use this to add something like `organizationId` to the schema ### Describe the solution you'd like Have an option for specifying additional schema fields similar to e.g. the organization plugin:https://www.better-auth.com/docs/plugins/organization#additional-fields-1 ### Describe alternatives you've considered Store extra data in `metadata` fields, but this is suboptimal ### Additional context _No response_
GiteaMirror added the lockedenhancement labels 2026-04-15 18:43:54 -05:00
Author
Owner

@better-auth-agent[bot] commented on GitHub (Jan 31, 2026):

It seems like you've raised a feature request to add support for additionalFields in the api-key plugin. This is a great idea, as it can enhance the plugin's functionality by allowing you to attach custom fields, such as organizationId, directly to API keys—similar to how it operates with the organization plugin.

Currently, there is an open enhancement discussion around this topic, which highlights the need for such functionality. The goal is to enable the API key plugin to support schema extensions for custom fields easily [2]. This improvement would help avoid the issues associated with using metadata fields, which you mentioned as suboptimal [1].

Next steps might involve keeping an eye on the discussion thread for updates or providing more context on your use case, which could help prioritize this request.

Would you like more assistance on how to engage the community about this feature, or do you have other questions regarding Better Auth?

If you need more help, tag @better-auth-agent in a comment so I can respond.

DiagramDiscordGitHub

Diagram Join Star

<!-- gh-comment-id:3828726687 --> @better-auth-agent[bot] commented on GitHub (Jan 31, 2026): It seems like you've raised a feature request to add support for `additionalFields` in the `api-key` plugin. This is a great idea, as it can enhance the plugin's functionality by allowing you to attach custom fields, such as `organizationId`, directly to API keys—similar to how it operates with the organization plugin. Currently, there is an open enhancement discussion around this topic, which highlights the need for such functionality. The goal is to enable the API key plugin to support schema extensions for custom fields easily [[2]](https://github.com/better-auth/better-auth/issues/2410). This improvement would help avoid the issues associated with using `metadata` fields, which you mentioned as suboptimal [[1]](https://www.better-auth.com/docs/guides/supabase-migration-guide). Next steps might involve keeping an eye on the discussion thread for updates or providing more context on your use case, which could help prioritize this request. Would you like more assistance on how to engage the community about this feature, or do you have other questions regarding Better Auth? _If you need more help, tag @better-auth-agent in a comment so I can respond._ <!-- bot:webhook reply v1 --> [Diagram](https://repodiagrams.s3.eu-north-1.amazonaws.com/better-auth_ultra_detailed_interactive.html) • [Discord](https://discord.gg/better-auth) • [GitHub](https://github.com/better-auth/better-auth) [![Diagram](https://img.shields.io/badge/Diagram-2b3137?style=flat-square)](https://repodiagrams.s3.eu-north-1.amazonaws.com/better-auth_ultra_detailed_interactive.html) [![Join](https://img.shields.io/badge/join-5865F2?logo=discord&logoColor=white&style=flat-square)](https://discord.gg/better-auth) [![Star](https://img.shields.io/badge/star-181717?logo=github&logoColor=white&style=flat-square)](https://github.com/better-auth/better-auth)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#19516