Accounts
Generated from core/api/router.go. Edit the router, not this file.
| Method | Path | Who can call it |
|---|---|---|
GET | /api/v1/users | Admin |
POST | /api/v1/users | Admin |
PATCH | /api/v1/users/:id | Admin |
POST | /api/v1/users/:id/password | Admin |
GET /api/v1/users
| Who can call it | Admin |
| Handler | userHandler.List |
| Display token | Refused — 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
| Status | Body |
|---|---|
200 | An 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 it | Admin |
| Handler | userHandler.Create |
| Display token | Refused — not a viewer-safe GET |
Request body
CreateUserInput describes a new local account.
| Field | Type | Description | |
|---|---|---|---|
email | string | required | an email address |
display_name | string | ||
role | string | required | |
password | string | Password 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
| Status | Body |
|---|---|
201 | An 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 it | Admin |
| Handler | userHandler.Update |
| Display token | Refused — not a viewer-safe GET |
Parameters
| Name | In | Default | |
|---|---|---|---|
id | path | required |
Request body
UpdateUserInput carries only what an administrator may change. Pointers, so that omitting a field leaves it alone rather than blanking it.
| Field | Type | Description |
|---|---|---|
role | string | |
status | string |
Responses
| Status | Body |
|---|---|
200 | An 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 it | Admin |
| Handler | userHandler.ResetPassword |
| Display token | Refused — 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
| Name | In | Default | |
|---|---|---|---|
id | path | required |
Responses
| Status | Body |
|---|---|
200 | An object with initial_password, message |
404 | { "error": … } · no such account |
500 | { "error": … } · could not generate a password |
Example request
bash
curl -X POST 'https://certpilot.example.com/api/v1/users/<id>/password' \
-H 'Authorization: Bearer <token>'