Skip to content

Create or recover the first admin

POST
/api/setup

First-run bootstrap. Available only while nobody on this install can sign in with a password — every later account is created by an admin, and self-registration is disabled. On a fresh install it creates the first user with role admin. On an install upgraded from pre-Better-Auth Libris, where the cutover migration created users with no credential, it attaches the submitted email and password to an EXISTING user (the one already holding that email, else the oldest admin, else the oldest user promoted to admin) rather than creating a duplicate person. Returns 409 once any credential exists, so this is safe to leave mounted.

Request Body

application/json
JSON
{
  
"email": "string",
  
"password": "string",
  
"name": "string"
}

Responses

The first admin credential was created

application/json
JSON
{
  
"id": "string",
  
"email": "string",
  
"name": "string",
  
"role": "string",
  
"adopted": true
}

Samples