Skip to content

Admin API: CLI login approval

Operations to approve or deny a login from the CLI in the admin. Common rules (authentication, error format, dates and times) are in the Admin API reference.

In the examples, replace <hostname> with the hostname of your environment and <access token> with an access token that starts with hako_pat_. Replace other values in angle brackets, such as <slug>, with the values described in each operation’s parameter table.

Operation Method and path
Get CLI login details GET /admin/api/cli-logins/{code}
Approve a CLI login (admin session only) POST /admin/api/cli-logins/{code}/approve
Deny a CLI login (admin session only) POST /admin/api/cli-logins/{code}/deny

Shown on the approval screen.

GET /admin/api/cli-logins/{code}
  • Login: required (session or access token)

Parameters:

Name In Type Required Constraints Description
code path string Yes CLI login code

Responses:

Status Body Reason
200 LoginView (application/json)
401 Error (application/json) Not logged in, or the access token is wrong, expired, or revoked
403 Error (application/json) Insufficient permission (including writes with a read-only access token and writes from another origin with a session)
404 Error (application/json) Not found

If the request fails, you get a 4xx or 5xx status and a JSON body with message. The meaning of each status is in the list of errors.

Example:

ターミナルウィンドウ
curl "https://<hostname>.hakocms.net/admin/api/cli-logins/<code>" \
-H "Authorization: Bearer <access token>"
POST /admin/api/cli-logins/{code}/approve
  • Login: required (session or access token)

Parameters:

Name In Type Required Constraints Description
code path string Yes CLI login code

Responses:

Status Body Reason
200 LoginView (application/json)
401 Error (application/json) Not logged in, or the access token is wrong, expired, or revoked
403 Error (application/json) Insufficient permission (including writes with a read-only access token and writes from another origin with a session)
404 Error (application/json) Not found
409 Error (application/json) This login has already been approved or denied

If the request fails, you get a 4xx or 5xx status and a JSON body with message. The meaning of each status is in the list of errors.

Example:

ターミナルウィンドウ
curl -X POST "https://<hostname>.hakocms.net/admin/api/cli-logins/<code>/approve" \
-H "Authorization: Bearer <access token>"
POST /admin/api/cli-logins/{code}/deny
  • Login: required (session or access token)

Parameters:

Name In Type Required Constraints Description
code path string Yes CLI login code

Responses:

Status Body Reason
200 LoginView (application/json)
401 Error (application/json) Not logged in, or the access token is wrong, expired, or revoked
403 Error (application/json) Insufficient permission (including writes with a read-only access token and writes from another origin with a session)
404 Error (application/json) Not found
409 Error (application/json) This login has already been approved or denied

If the request fails, you get a 4xx or 5xx status and a JSON body with message. The meaning of each status is in the list of errors.

Example:

ターミナルウィンドウ
curl -X POST "https://<hostname>.hakocms.net/admin/api/cli-logins/<code>/deny" \
-H "Authorization: Bearer <access token>"