Invite members and set roles with the CLI
Invite people to a space, and set what they can do with roles. You can do with commands what you can do in [メンバー](Members) in the admin. How roles work and how the built-in roles differ are explained in Invite members and choose roles.
Prerequisites
Section titled “Prerequisites”- You are logged in with
hakocms-cliand have set the space (Log in with the CLI) - You have the [メンバーとロールの管理](Manage members and roles) permission in the space. Among the built-in roles, [オーナー](Owner) and [管理者](Admin) have it
- You cannot invite someone with a role stronger than your own, or change someone whose role is stronger than yours
Invite a person
Section titled “Invite a person”-
Look up the IDs of the space’s roles.
ターミナルウィンドウ hakocms-cli roles listID NAMEhpwlxw82lyzo ownerl1flnze8uq8y adminxzread23pccy editor4coq44vlhdh2 viewerowneris owner,adminis admin,editoris editor, andvieweris viewer. -
Create an invitation by passing an email address and a role ID. Replace
<role ID>with the ID you looked up in step 1.ターミナルウィンドウ hakocms-cli invitations create --email writer@example.com --role-id <role ID>id: 03ddcn6ai83demail: writer@example.comrole: {"id":"xzread23pccy","name":"editor"}expiresAt: 2026-10-30T04:19:30.401Zurl: https://<hostname>.hakocms.net/admin/invitations/hinv_Ab3dE7kQx2mP9sT4vW8yZc1fH6jL0nR5uX7bD3gK2qMemailSent: false -
When
emailSentisfalse, give the acceptance link inurlto the person yourself. When it istrue, an email has reached the person.
- The acceptance link is shown only this once. If you forget to note it, cancel the invitation and create it again
- Invitations expire in 7 days
- Only the person with the invited email address can accept the invitation
To invite many people at once, create invitations from a file (emails.txt) with one email address per line.
while read -r email; do hakocms-cli invitations create --email "$email" --role-id <role ID> \ --jq '"\(.email) \(.url)"'done < emails.txtEach email address and its acceptance link are shown, one per line.
View and cancel invitations
Section titled “View and cancel invitations”List the invitations that have not been accepted yet.
hakocms-cli invitations listID EMAIL ROLE NAME EXPIRES AT CREATED AT03ddcn6ai83d writer@example.com editor 2026-10-30T04:19:30.401Z 2026-10-23T04:19:30.401ZWhen you cancel an invitation, its acceptance link stops working.
hakocms-cli invitations delete <invitation ID>Change a member’s role or remove a member
Section titled “Change a member’s role or remove a member”hakocms-cli members listUSER ID USER EMAIL ROLE NAME JOINED ATdatlmiw39a7z you@example.com owner 2026-10-23T04:17:48.865ZChange the role. <user ID> is the [USER ID] in the list.
hakocms-cli members update <user ID> --role-id <role ID>Remove the member from the space. A removed person can no longer access the space, effective immediately.
hakocms-cli members remove <user ID>You cannot change your own role or remove yourself. To leave a space yourself, use hakocms-cli members leave.
Create a role
Section titled “Create a role”When the built-in roles are not enough, you can create a role that sets the allowed operations for each content type. The shape of the permissions is the same as on the [ロール](Roles) screen in the admin.
Check the values you can pass with the following command before you create one.
hakocms-cli roles create --helpThe shape is explained in Invite members and choose roles and Admin API reference: roles.
Verify
Section titled “Verify”In [メンバー](Members) in the admin, check that the invitations and member roles have changed.
Related
Section titled “Related”- Invite members and choose roles: differences between roles, and working in the admin
- CLI command reference: invitations, members, roles
- Add people to an organization: the organization in the account and billing screen (separate from space members)