Skip to content

Work in a team org

Every account has a personal org. A team needs an org that several accounts share, with roles. This guide creates an org, invites a second person by email, and gives roles. Then, as the operator, it lists the orgs, sets the limits of the org, and suspends it. The org API has every call and rule.

This guide calls the API with curl, in the same way as the console does, so it shows each call. The console pages of an org do the same work in a browser (Use the console).

  • hopboxd with the control role on a laptop, as in Run the control role on a laptop, with the API on 127.0.0.1:7443.
  • A domain and an SMTP config, as in First sign-in on a new install. An invitation is for one verified email, so each person signs in with a magic link. A local mail catcher such as Mailpit works.
  • Two accounts, user1 and user2, each signed in with a magic link of First sign-in on a new install. In the default sign-up mode approval, an instance admin approves each new account first (Use the Admin area). Keep the session cookie of each one in a file: /tmp/hb/user1 and /tmp/hb/user2, each with one line of the form __Host-hopbox_session=<token>.

Define a function that calls the API as one of them, with the headers of the console:

API=http://127.0.0.1:7443
as() {
who=$1; shift
curl -s -X POST -H 'Content-Type: application/json' -H 'Connect-Protocol-Version: 1' \
-H 'Origin: https://example.com' -H "Cookie: $(cat /tmp/hb/$who)" "$@"
echo
}
admin() { ./bin/darwin_arm64/hopboxd admin --config /tmp/hb/hopboxd.toml "$@"; }

CreateOrg makes an org with you as its owner. A create call takes an idempotency key, so a retry with the same key returns the same org:

as user1 -H "Idempotency-Key: $(uuidgen)" -d '{"name":"org1"}' $API/hopbox.v1.OrgService/CreateOrg
{"org":{"id":"01a14565-a2df-75a1-9401-ed28dfa37fc4","name":"org1","role":"ORG_ROLE_OWNER","version":"1","createTime":"2026-10-16T15:47:31.166821Z"}}

Keep the ID:

ORG=01a14565-a2df-75a1-9401-ed28dfa37fc4

ListOrgs now shows the personal org of user1 first, then org1:

as user1 -d '{}' $API/hopbox.v1.OrgService/ListOrgs

A call that leaves out orgId acts in the personal org of the caller. A personal org belongs to one account, so it takes no invitations.

An owner invites with any role. An admin invites members only. An admin or an owner can change what runs in the private machines of every member (Read the members and the roles). So give these roles only to a person whom every member trusts. Invite user2 as an admin:

as user1 -d "{\"orgId\":\"$ORG\",\"email\":\"user2@example.org\",\"role\":\"ORG_ROLE_ADMIN\"}" \
$API/hopbox.v1.OrgService/CreateInvitation
{"invitation":{"id":"01a14565-a316-74dd-968e-fac72d706827","orgId":"01a14565-a2df-75a1-9401-ed28dfa37fc4","email":"user2@example.org","role":"ORG_ROLE_ADMIN","inviterAccountId":"01a14565-8448-774f-9317-ea6348e9a930","createTime":"2026-10-16T15:47:31.221754Z","expireTime":"2026-10-23T15:47:31.221754Z"},"url":"https://example.com/invite#token=vH_2434xeosR22NllAU0tHE8LoqC08ZYHX1JhHZK4UA","emailSent":true}

The response holds the link, and emailSent says that the server mailed it to user2 too. Without an SMTP config, emailSent is false, and you send the link to user2 yourself. The same goes for the file mail transport of a dev install (Mail). The link works once, for 7 days. Treat it as a password until then. A new invitation for the same email replaces this one, so its link stops working.

On an install with a console, user2 opens the link in a browser. The console page /invite reads the token after #token= and calls AcceptInvitation. Here, make that call yourself. The invitation is for user2@example.org, so user1 cannot use it:

TOKEN=vH_2434xeosR22NllAU0tHE8LoqC08ZYHX1JhHZK4UA
as user1 -d "{\"token\":\"$TOKEN\"}" $API/hopbox.v1.OrgService/AcceptInvitation
{"code":"failed_precondition","message":"failed precondition: the invitation is for user2@example.org, and the account has no verified email user2@example.org. Sign in with that email, then open the link again"}

The refused try leaves the invitation open. Then user2 accepts it:

as user2 -d "{\"token\":\"$TOKEN\"}" $API/hopbox.v1.OrgService/AcceptInvitation
{"org":{"id":"01a14565-a2df-75a1-9401-ed28dfa37fc4","name":"org1","role":"ORG_ROLE_ADMIN","version":"1","createTime":"2026-10-16T15:47:31.166821Z"}}

A second accept of the same link fails with not_found: the link works once.

Each member reads the members of the org:

as user2 -d "{\"orgId\":\"$ORG\"}" $API/hopbox.v1.OrgService/ListOrgMembers

The members of an org trust its admins and owners. An admin or an owner sets the env vars and secrets with the scope all, and these reach the private machines of every member (Set env vars and secrets). An admin cannot open a shell in the private machine of another member, but can change what runs there with such a value.

Only an owner makes other owners and admins. So user2, an admin, cannot change a role:

as user2 -d "{\"orgId\":\"$ORG\",\"accountId\":\"<the ID of user1>\",\"role\":\"ORG_ROLE_MEMBER\"}" \
$API/hopbox.v1.OrgService/SetOrgMemberRole
{"code":"permission_denied","message":"permission denied: a caller of kind session may not do org.member_set_role"}

Every org keeps at least one owner. So user1, the only owner, cannot leave yet:

as user1 -d "{\"orgId\":\"$ORG\"}" $API/hopbox.v1.OrgService/LeaveOrg
{"code":"failed_precondition","message":"failed precondition: the account is the only owner of the org, and every org keeps at least one owner. Make another member an owner first, or delete the org"}

To leave, user1 first makes user2 an owner with SetOrgMemberRole and the role ORG_ROLE_OWNER. An account that leaves an org loses what it made in the org and did not share.

as user2 -d "{\"orgId\":\"$ORG\"}" $API/hopbox.v1.OrgService/GetOrgUsage
{"usage":{},"limits":{"machines":3,"vcpus":6,"memoryBytes":"25769803776","diskBytes":"300000000000","storedStateBytes":"107374182400","snapshots":10,"backupBytes":"107374182400","savedBytesPerDay":"1099511627776","publicUrls":true}}

The org has no machines yet, so it uses nothing. The limits are the defaults of the install: 3 machines, 6 vCPUs, 24 GiB of RAM, 300 GB of disk, and public URLs. The org also keeps up to 100 GiB of stored state, 10 snapshots, and 100 GiB of backups. Its saves write up to 1 TiB in 24 hours. Outbound TCP port 25 stays closed, so outboundSmtp is left out. The personal org of a limited account has other defaults: 1 machine, 1 vCPU, 1 GiB of RAM, 5 GB of disk, and no public URL. It keeps no saved state, snapshot, or backup, and its saves write up to 20 GiB in 24 hours (the org API). A hibernate checks only the budget of 24 hours, so a limited account still hibernates its machine.

An instance admin sees the metadata of every org, but not its members or its resources. Root on a control server calls the admin API with hopboxd admin:

admin org list
01a14565-8448-7753-9c1f-5ec0a86b8d92 Personal personal members=1 active machines=0/3
01a14565-85d5-7087-a903-d66b5cabce88 Personal personal members=1 active machines=0/3
01a14565-a2df-75a1-9401-ed28dfa37fc4 org1 org members=2 active machines=0/3

Give org1 more room. A limit that you leave out takes the default of the install:

admin org set-limits --org-id $ORG --machines 10 --memory-gib 64
id 01a14565-a2df-75a1-9401-ed28dfa37fc4
name org1
members 2
state active
machines 0/10
vcpus 0/6
memory_bytes 0/68719476736
disk_bytes 0/300000000000
stored_state_bytes 0/107374182400
snapshots 0/10
backup_bytes 0/107374182400
saved_bytes_per_day 0/1099511627776
public_urls true
outbound_smtp false
version 2

The org hibernates many machines, and needs a larger budget of saves. Set it in whole GiB, and give the other overrides again:

admin org set-limits --org-id $ORG --machines 10 --memory-gib 64 --saved-gib-per-day 2048

The org needs to send mail to other mail servers, for example from a mail server of its own. Open outbound TCP port 25 for its machines, and give the other overrides again. Each machine of the org takes the change at its next start or reboot:

admin org set-limits --org-id $ORG --machines 10 --memory-gib 64 --saved-gib-per-day 2048 --outbound-smtp

Change the defaults of every other org with admin org default-limits set, for example --machines 5. The flags with the prefix --limited- change the defaults of the personal org of a limited account, for example --limited-disk-gb 10. Each new org brings its own limits, so a full account owns at most 3 orgs besides its personal org on a fresh install, and a limited account owns none. Change that cap with admin org default-limits set --max-orgs-per-account N.

Move an account between the tiers with admin account set-tier, with the ID that admin account list prints. A move keeps what the account has:

admin account set-tier --account-id 01a15c02-7d1e-7a4c-9b51-2b1c5e8f0a7d --tier full

To handle abuse, suspend the org:

admin org suspend --org-id $ORG --reason 'spam reports'

The members see the suspension and its reason:

as user1 -d "{\"orgId\":\"$ORG\"}" $API/hopbox.v1.OrgService/GetOrg
{"org":{"id":"01a14565-a2df-75a1-9401-ed28dfa37fc4","name":"org1","role":"ORG_ROLE_OWNER","suspended":true,"suspendTime":"2026-10-16T15:47:41.931248Z","suspendReason":"spam reports","version":"3","createTime":"2026-10-16T15:47:31.166821Z"}}

A suspended org sends no invitations and takes no new members. Reads still work. A suspension also stops the machines of the org, and blocks the create, the start, and the delete of a machine (the org API). The owners find the entry org.suspend of local_root in the audit log of the org:

as user1 -d "{\"orgId\":\"$ORG\",\"pageSize\":1}" $API/hopbox.v1.AuditService/ListAuditEntries

End the suspension:

admin org unsuspend --org-id $ORG

Only an owner deletes an org, and the request must hold its name in confirm. A suspended org keeps its data as evidence, so the delete waits for the end of the suspension:

as user1 -d "{\"orgId\":\"$ORG\",\"confirm\":\"org1\"}" $API/hopbox.v1.OrgService/DeleteOrg
{}

The delete removes the memberships, the invitations, and every resource of the org. A personal org goes only with its account (the sign-in, account, and audit API).