Перейти к документации
CLI

openemail roles

Каждая команда этого пространства имён, с её аргументами, флагами и примерами.

Команды

What a member or an API key may do, drawn from one permission vocabulary.

Каждая команда здесь также принимает глобальные флаги, например --json, --profile и --dry-run. Глобальные флаги

openemail roles list

List every role in the workspace

Разрешенияroles:readНужен входПсевдонимыls

Использование

openemail roles list [flags]

Resolves one page of the roles the workspace defines. The seeded roles come first in ladder order (Owner, Admin, Member, Viewer, Developer, Billing) and custom roles follow alphabetically. The order is read from builtin, so a renamed seeded role keeps its place.

A workspace older than roles has no role rows, and the first read seeds them instead of returning an empty list. Seeding runs once per workspace, and afterwards only the owner role is ever restored, so a seeded role you delete stays deleted. Each row carries members and apiKeys counts computed at read time.

A role is a ceiling for the keys issued under it. What a key may do is its own scopes intersected with its role's permissions, resolved on every request, so a key holding emails:send under a role without it cannot send. A key with no role has no ceiling.

Add --all to walk every page: a table on a terminal, one JSON object per line when piped or with --ndjson, and one { items, hasMore, nextCursor } document with --json. --max <n> stops after that many items.

Флаги

--limit <n>

Page size, from 1 to 100. The server defaults to 25.

По умолчанию25
--cursor <value>

The nextCursor of the previous page. Leave it out for the first page.

--all

Fetch every page and stream the items as they arrive.

--max <n>

Stop after this many items. Implies --all.

--ndjson

Print every item as one JSON object per line. Implies --all

Примеры

openemail roles list
Walk every page and stop after 100 items
openemail roles list --all --max 100
One JSON object per line when piped
openemail roles list --all > roles.ndjson

Также доступно в

API
GET /roles
SDK
roles.list()

openemail roles get

Read one role with its usage counts

Разрешенияroles:readНужен входПсевдонимыshowview

Использование

openemail roles get <id> [flags]

Resolves a single role by id. There is no lookup by name, because every role's name except the owner's can be edited.

members and apiKeys are counted when you call rather than stored, so they describe what a deletion would have to move right now. permissions is the stored list with implied permissions already expanded, in canonical order, so it can be longer than what was sent when the role was written.

Аргументы

<id>Обязательно

Role id, role_ followed by 24 hex characters. Roles have no lookup by name.

Примеры

openemail roles get role_8b1f4c2e9a7d3b60e5f1a2c4
Print the raw JSON
openemail roles get role_8b1f4c2e9a7d3b60e5f1a2c4 --json

Также доступно в

API
GET /roles/{id}
SDK
roles.get()

openemail roles create

Create a custom role

Разрешенияroles:writeНужен входПсевдонимыnewadd

Использование

openemail roles create --name <value> --permissions <a,b> [flags]
openemail roles create --data <json|@file|-> [flags]

Writes a role the workspace defines for itself. builtin comes back null and both usage counts are zero. Only roles like this count toward the ceiling of 24 custom roles, past which the call is 422 role_limit_reached.

Implied permissions are expanded as the role is stored, so templates:write alone comes back holding templates:read too, and roles:write brings roles:read and members:read. Read the final list off the result rather than the request. A string that is not in the vocabulary is refused with 422 invalid_parameter rather than dropped.

Be careful with roles:write. Authority is resolved per request, so a key holding it can edit the very role that caps it and widen itself on the next call. Keep it off keys that only need to read.

Флаги

--name <value>

At most 48 characters after trimming, unique per workspace ignoring case. Blank is a 422. Required, here or in --data.

--permissions <a,b>Можно повторять

What the role grants, drawn from listPermissions. An empty array is accepted and makes a role that can do nothing. Required, here or in --data.

--description <value>

One sentence about who the role is for, at most 240 characters. Blank is stored as null.

--data <json|@file|->

The whole body as JSON, inline, from a file with @path, or - for standard input. Flags override its keys.

Примеры

The required values only
openemail roles create --name Support --permissions threads:write,emails:send,templates:read
With optional flags
openemail roles create --name Support --permissions threads:write,emails:send,templates:read --description 'Answers help@ and nothing else.'
Read the whole body from a JSON file
openemail roles create --data @role.json

Также доступно в

API
POST /roles
SDK
roles.create()

openemail roles update

Rename a role or replace what it grants

Разрешенияroles:writeНужен входПсевдонимыedit

Использование

openemail roles update <id> [flags]

Patches the name, description or permission list of a role. Every seeded role except Owner takes all three, so renaming Billing to Finance and rewriting what it grants is an ordinary update. The owner role refuses any edit with 409 role_immutable.

permissions replaces the whole list and is expanded with implied permissions on the way in. There is no way to add or remove one entry, so read the role, change the array and send all of it. Leave a field out to keep it, and send description: null to clear the note.

The change is live. Authority is resolved on every request, so narrowing a role takes effect for its members and keys on their next call without rotating anything, and widening it takes effect just as fast.

Аргументы

<id>Обязательно

Role id, role_ followed by 24 hex characters. Roles have no lookup by name.

Флаги

--name <value>

New name, at most 48 characters after trimming and unique per workspace ignoring case. Blank is a 422.

--description <value>

New note of at most 240 characters. Null or blank clears it.

--permissions <a,b>Можно повторять

Complete replacement list, expanded with implied permissions before it is stored.

--data <json|@file|->

The whole patch as JSON, inline, from a file with @path, or - for standard input. Flags override its keys.

Примеры

With optional flags
openemail roles update role_8b1f4c2e9a7d3b60e5f1a2c4 --name Finance
Print the raw JSON
openemail roles update role_8b1f4c2e9a7d3b60e5f1a2c4 --name Finance --json

Также доступно в

API
PATCH /roles/{id}
SDK
roles.update()

openemail roles delete

Delete a role and move whoever holds it

Разрешенияroles:writeНужен вход
Просит подтверждения
Псевдонимыrmdelremove

Использование

openemail roles delete <id> [flags]

Deletes a role. Every role except Owner can go, seeded ones included, and deleting a seeded role is permanent because seeding never runs twice. The owner role is refused with 409 role_undeletable.

While any member, API key or unanswered invitation still points at the role, the call needs --reassign-to and is refused with 409 role_in_use without it. The server will not guess, because a key whose role vanished would fall back to no ceiling at all, which is wider than the role being removed. Members, keys and pending invitations move to the named role in one transaction. A role nobody holds deletes without it.

The tombstone reports reassigned people and keysReassigned keys separately. Log the second: those programs keep running under a new ceiling and nobody is told.

Аргументы

<id>Обязательно

Role id, role_ followed by 24 hex characters. Roles have no lookup by name.

Флаги

--reassign-to <value>

Id of the role that inherits the members, keys and pending invitations. Required whenever the role is held. Sent as a query parameter.

Примеры

openemail roles delete role_8b1f4c2e9a7d3b60e5f1a2c4
Skip the confirmation, for scripts
openemail roles delete role_8b1f4c2e9a7d3b60e5f1a2c4 --yes

Также доступно в

API
DELETE /roles/{id}
SDK
roles.delete()

openemail roles list-permissions

List the permission vocabulary roles are written in

Разрешенияroles:readНужен вход

Использование

openemail roles list-permissions [flags]

Resolves every permission as a plain array, in the canonical order a stored role's permissions also uses. Each entry carries the label to show beside a checkbox and the group heading it belongs under, so a permission matrix can be rendered from this rather than from a list copied into your code.

scope is the field to branch on. Permissions and API key scopes share one alphabet, which is what lets a role cap a key, but they are not the same set. Six are console-only. addresses:all lets a role reach every address on every domain of the workspace, including ones added later, with no grant, billing:read and billing:write say who may see or change the plan, and workspace:manage who may manage the workspace. api-keys:read and api-keys:write are listed too, but API keys stay with the workspace owner whatever a role holds. No key or access token can ever hold any of the six, so they come back with scope: false. Filter on scope for a key scope picker and ignore it for a role editor.

Примеры

openemail roles list-permissions
Print the raw JSON
openemail roles list-permissions --json

Также доступно в

API
GET /roles/permissions
SDK
roles.listPermissions()