BETTER-AUTH. UI
Mutations

useCreateApiKey

Create an API key for the current user.

Requires the Better Auth API key plugin.

Usage

import { useAuth, useCreateApiKey } from "@better-auth-ui/react"

const { authClient } = useAuth()
const mutation = useCreateApiKey(authClient)

mutation.mutate(/* params */)

Options factory

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

const mutation = useMutation(createApiKeyOptions(authClient))

Params

Prop

Type

Last updated on

On this page