mailboxShares.grant
Give another user access to this mailbox.
Lets another identity in the same account open this mailbox — the shared team inbox and delegated-assistant case. The rights value decides what they may do with it.
Sending one grant replaces any previous grant for that identity, so this is how you widen or narrow access as well as how you create it. Both parties must belong to the same account, and a mailbox cannot be shared with itself.
Access takes effect immediately: rights are re-read on every request, so there is no cache to wait out — and revoking is equally immediate.
A grant covers reading and organising mail only. It never allows sending as the mailbox owner, and it never allows the recipient to re-share the mailbox or change grants.
openemail.mailboxShares.grant(
mailboxId: string,
granteeIdentityId: string,
body: PutMailShareBody,
options?: CallOptions,
): ApiPromise<MailShare>It calls PUT /mailboxes/{mailboxId}/shares/{granteeIdentityId}: Give another user access to this mailbox in the API reference.
Example
const mailShare = await openemail.mailboxShares.grant(mailboxId, granteeIdentityId, { rights: '…' })Arguments
| Argument | Type | Description |
|---|---|---|
mailboxId | string | ULID of the mailbox whose access is being managed. The path's {mailboxId}. |
granteeIdentityId | string | ULID of the identity being given (or losing) access. The path's {granteeIdentityId}. |
body | PutMailShareBody | The request's body. |
Options
It takes no options of its own. Every call also takes signal, timeout, retry and headers, which say how that one call is sent (call options).
Answer
Awaited, it is the API's JSON, MailShare. It is an ApiPromise: .withResponse() gives the same with the Response it came in, for its headers.
Errors
| Status | What it means |
|---|---|
400 | validation_failed — malformed body. invalid_rights — the rights value is not a known preset and not a valid letter set; the response carries an invalidLetters array naming the offending letters. self_share_prohibited — a mailbox cannot be shared with itself. rights_not_allowed_on_folder_share — a folder-scoped grant may only carry lrswit (read, private read/unread marks, write flags/keywords within the scope, file into a named in-scope folder, and trash out of the folder — never expunge or folder administration); the response names the offending letters and the allowed set. empty_label_scope — labelScope was an empty list, which would be a grant that can see nothing; use DELETE to revoke instead. unknown_label — one or more named folders do not exist in this mailbox; the response names them. label_scope_too_large — more folders were named than one grant may carry; the response carries the max. invalid_label_scope — a scope entry was not a folder identifier. grantee_has_no_mail_store — the grantee is an identity of this account without a mail store, which has no mail session to read a share in. cross_account_share_refused — the grantee belongs to a different account (system principals only; tenants receive 404 instead, so the API cannot be used to discover identities in other accounts) |
401 | unauthorized: the bearer credential is missing, malformed, expired, or revoked. Carries a WWW-Authenticate: Bearer challenge |
404 | not_found — the mailbox does not exist or is not yours to manage, or the grantee identity does not exist or belongs to another account |
409 | mail_share_grantee_limit or mail_share_readable_store_limit: a new grant would exceed the share fan-out cap; the response carries max. Existing grants remain editable. |
413 | too_large: JSON request body exceeds 1 MiB or 500,000 values (object keys included), checked before parsing |
503 | temporary_failure: the platform's storage could not answer just now; retry after the Retry-After window. Any operation can answer this. A write that got it may have been applied, so retry it with the same idempotency key where it takes one, or read the state back first (see Transient failures in the API description) |
A failed call rejects with a RequestError: its status, and its code, the API's error. Decide on the code: one status covers several.
Types
It names these types of the API, each on a page of its own: MailShare, PutMailShareBody.