BETTER-AUTH. UI
Mutations

useCreateApiKey

Create an API key for the current user.

Requires the Better Auth API key plugin.

Usage

import { authClient } from "@/lib/auth-client"
import { useCreateApiKey } from "@better-auth-ui/react/plugins/api-key"

const mutation = useCreateApiKey(authClient)

mutation.mutate(/* params */)

Options factory

import { createApiKeyOptions } from "@better-auth-ui/core/plugins/api-key"
import { useMutation } from "@tanstack/react-query"

const mutation = useMutation(createApiKeyOptions(authClient))

Params

Prop

Type

Last updated on

On this page