Create the first admin
const url = 'http://localhost:8080/api/v1/setup';const options = { method: 'POST', headers: {'Content-Type': 'application/json'}, body: '{"setupToken":"example","name":"example","password":"example"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url http://localhost:8080/api/v1/setup \ --header 'Content-Type: application/json' \ --data '{ "setupToken": "example", "name": "example", "password": "example" }'Works only while the server has no accounts. The setup token is printed
in the server’s log at startup, so only someone who can read the log
can claim the server, unless the deployment set its own in
CHEK_SETUP_TOKEN.
Request Bodyrequired
Section titled “Request Bodyrequired”object
At least 8 characters and at most 1024 bytes.
Example generated
{ "setupToken": "example", "name": "example", "password": "example"}Responses
Section titled “Responses”The admin was created and signed in.
object
Send as Authorization: Bearer <token>.
object
Libraries a reader may open. Empty for admins, who see every library.
True on /api/v1/me for a shared demo account, which can’t change its settings. Absent otherwise.
Example
{ "user": { "role": "admin" }}The request was malformed.
object
Explains the problem to a developer.
Example
{ "code": "bad_request"}The signed-in user may not do this. demo_account when the user is a
shared demo account, named in CHEK_DEMO_USERS, which can’t change
its password, sessions, sign-in providers, extensions or annotations.
object
Explains the problem to a developer.
Example
{ "code": "bad_request"}The server already has an admin.
object
Explains the problem to a developer.
Example
{ "code": "bad_request"}The server failed; details are in its log.
object
Explains the problem to a developer.
Example
{ "code": "bad_request"}