Skip to content

Admin API: Invitations

Operations to invite people to a space, revoke invitations, and accept invitations. 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 invitation details GET /admin/api/invitations/{token}
Accept an invitation POST /admin/api/invitations/{token}/accept
List invitations not yet accepted GET /admin/api/spaces/{slug}/invitations
Invite a member POST /admin/api/spaces/{slug}/invitations
Revoke an invitation DELETE /admin/api/spaces/{slug}/invitations/{id}

Invitation details (shown on the accept screen).

GET /admin/api/invitations/{token}
  • Login: not required

Parameters:

Name In Type Required Constraints Description
token path string Yes Link token

Responses:

Status Body Reason
200 InvitationInfo (application/json)
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/invitations/<token>"

Accepts the invitation. If you are logged in with the account for the invited email address, you join the space. If there is no account, one is created and joins.

POST /admin/api/invitations/{token}/accept
  • Login: not required

Parameters:

Name In Type Required Constraints Description
token path string Yes Link token

Request body (application/json, optional):

NewAccount or null.

Responses:

Status Body Reason
200 AcceptResponse (application/json)
400 Error (application/json) An input value breaks a rule (including JSON syntax errors). Errors with their locations are in issues
404 Error (application/json) Not found
409 Error (application/json) Already a member, a user with the same email address exists, or a usage limit was reached (limit in the body)
415 Error (application/json) Content-Type: application/json is missing
422 Error (application/json) The JSON has the wrong shape (a required key is missing, a type is wrong, or there is an unknown key)

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/invitations/<token>/accept" \
-H "Content-Type: application/json" \
-d '{
"name": "<name>",
"password": "<password>"
}'
GET /admin/api/spaces/{slug}/invitations
  • Login: required (session or access token)

Parameters:

Name In Type Required Constraints Description
slug path string Yes Slug of the space

Responses:

Status Body Reason
200 Array of Invitation (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. A space you are not a member of also returns 404

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/spaces/<slug>/invitations" \
-H "Authorization: Bearer <access token>"
POST /admin/api/spaces/{slug}/invitations
  • Login: required (session or access token)

Parameters:

Name In Type Required Constraints Description
slug path string Yes Slug of the space

Request body (application/json):

Name Type Required Constraints Description
email string Yes Email address of the person to invite
roleId string Yes ID of the role given on joining (see roles list)

Responses:

Status Body Reason
201 CreatedInvitation (application/json)
400 Error (application/json) An input value breaks a rule (including JSON syntax errors). Errors with their locations are in issues
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. A space you are not a member of also returns 404
409 Error (application/json) Already a member, or a usage limit was reached (limit in the body)
415 Error (application/json) Content-Type: application/json is missing
422 Error (application/json) The JSON has the wrong shape (a required key is missing, a type is wrong, or there is an unknown key)
429 Error (application/json) Too many invitations created. Try again after the number of seconds in Retry-After

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/spaces/<slug>/invitations" \
-H "Authorization: Bearer <access token>" \
-H "Content-Type: application/json" \
-d '{
"email": "<email>",
"roleId": "<roleId>"
}'
DELETE /admin/api/spaces/{slug}/invitations/{id}
  • Login: required (session or access token)

Parameters:

Name In Type Required Constraints Description
slug path string Yes Slug of the space
id path string Yes ID

Responses:

Status Body Reason
204 None
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. A space you are not a member of also returns 404

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 DELETE "https://<hostname>.hakocms.net/admin/api/spaces/<slug>/invitations/<id>" \
-H "Authorization: Bearer <access token>"