Skip to content

Accounts ​

Generated from core/api/router.go. Edit the router, not this file.

MethodPathWho can call it
GET/api/v1/usersAdmin
POST/api/v1/usersAdmin
PATCH/api/v1/users/:idAdmin
POST/api/v1/users/:id/passwordAdmin

GET /api/v1/users ​

Who can call itAdmin
HandleruserHandler.List
Display tokenRefused — not a viewer-safe GET

Admin throughout, including the list. A list of accounts is a map of who can do what to the CA hierarchy, and it is exactly what somebody who has taken over one account wants next.

Responses ​

StatusBody
200An object with data (User[]), total
500{ "error": … }
Example request
bash
curl -X GET 'https://certpilot.example.com/api/v1/users' \
  -H 'Authorization: Bearer <token>'

POST /api/v1/users ​

Who can call itAdmin
HandleruserHandler.Create
Display tokenRefused — not a viewer-safe GET

Request body ​

CreateUserInput describes a new local account.

FieldTypeDescription
emailstringrequiredan email address
display_namestring
rolestringrequired
passwordstringPassword is optional. Omitted, CertPilot generates one and returns it once — which is the better default, because a password chosen by the person creating the account is a password two people know.

Responses ​

StatusBody
201An object with initial_password, message (string), user (User)
400{ "error": … }
· an email address and a role are required
409{ "error": … }
500{ "error": … }
· could not generate a password
Example request
bash
curl -X POST 'https://certpilot.example.com/api/v1/users' \
  -H 'Authorization: Bearer <token>' \
  -H 'Content-Type: application/json' \
  -d '{
  "email": "<email>",
  "role": "<role>",
  "display_name": "<display_name>",
  "password": "<password>"
}'

PATCH /api/v1/users/:id ​

Who can call itAdmin
HandleruserHandler.Update
Display tokenRefused — not a viewer-safe GET

Parameters ​

NameInDefault
idpathrequired

Request body ​

UpdateUserInput carries only what an administrator may change. Pointers, so that omitting a field leaves it alone rather than blanking it.

FieldTypeDescription
rolestring
statusstring

Responses ​

StatusBody
200An object with user (User)
400{ "error": … }
· nothing to change
· status must be ACTIVE or SUSPENDED
404{ "error": … }
· no such account
409{ "error": … }
500{ "error": … }
Example request
bash
curl -X PATCH 'https://certpilot.example.com/api/v1/users/<id>' \
  -H 'Authorization: Bearer <token>' \
  -H 'Content-Type: application/json' \
  -d '{
  "role": "<role>",
  "status": "<status>"
}'

POST /api/v1/users/:id/password ​

Who can call itAdmin
HandleruserHandler.ResetPassword
Display tokenRefused — not a viewer-safe GET

Resetting somebody else's password does not require the old one — that is the point, it is the path back from a locked-out colleague.

Parameters ​

NameInDefault
idpathrequired

Responses ​

StatusBody
200An object with initial_password, message
404{ "error": … }
· no such account
500{ "error": … }
· could not read the account
· could not generate a password
Example request
bash
curl -X POST 'https://certpilot.example.com/api/v1/users/<id>/password' \
  -H 'Authorization: Bearer <token>'