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

openemail contacts

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

Команды

The workspace address book: people it has written to, plus anybody you save yourself.

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

openemail contacts list

List the workspace contacts, most recently seen first

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

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

openemail contacts list [flags]

Returns one page of the workspace address book, ordered by lastSeenAt with the most recent first and contacts that have never been mailed last. source says where a row came from: manual for a contact somebody saved, in the app or through create, and auto for an address recorded when a member sent mail to it from the app composer. A saved contact stays manual when it is mailed later.

--source narrows the page to one origin, so { source: 'manual' } is the contacts somebody saved on purpose and { source: 'auto' } the ones the composer recorded. --q searches the name and the address.

This lists saved contacts only. listPeople lists everyone the Contacts page in the app shows, the addresses seen in mail included, with thread counts.

Paging is keyset. --limit takes 1 to 200 and defaults to 50, and nextCursor goes back as --cursor while hasMore is true. Never build a cursor yourself.

Contacts belong to the whole workspace rather than to any one address, so a key limited to particular addresses or domains reads and writes the same book as every other key. An app connected by a member who reaches only some addresses is refused with 422 capability_unsupported on addressAllowlist, on every contacts, audiences and broadcasts route.

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>

Rows per page, a whole number from 1 to 200. The server defaults to 50.

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

The nextCursor from the previous page. Never build one yourself.

--source <value>

manual or auto. Leave it out for the whole book.

--q <value>

Searches the name and the address, up to 200 characters. When nothing matches exactly on the first page, close spellings are returned instead, and the pages that follow keep matching the same way.

--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 contacts list
With optional flags
openemail contacts list --limit 200 --source manual
Walk every page and stop after 100 items
openemail contacts list --all --max 100
One JSON object per line when piped
openemail contacts list --all > contacts.ndjson

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

API
GET /contacts
SDK
contacts.list()

openemail contacts get

Read one contact by email address

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

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

openemail contacts get <email> [flags]

Looks up a contact by address in the workspace address book. The address is trimmed and lower cased before the lookup, so [email protected] finds [email protected], and the SDK URL encodes it for the path.

A 404 means only that the address is not in the book. It says nothing about whether mail has been exchanged with it, since received mail never creates contacts.

Аргументы

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

The contact's address, matched case insensitively.

Примеры

openemail contacts get [email protected]
Print the raw JSON
openemail contacts get [email protected] --json

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

API
GET /contacts/{email}
SDK
contacts.get()

openemail contacts create

Save a contact in the workspace address book

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

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

openemail contacts create --email <value> [flags]
openemail contacts create --data <json|@file|-> [flags]

Adds one address to the workspace address book and returns the saved row. email is trimmed and lower cased before it is stored, so [email protected] and [email protected] are the same contact.

The contact is saved with source set to manual, the same value a contact typed into the app carries, and it joins the default audience as it is written. Every contact is in that audience for as long as it exists, so there is nothing to add afterwards. Name audiences of your own in --audience-ids to put it in them in the same call, or add it later with audiences.addContact. Sending --audience-ids also requires the audiences:write scope, since it writes memberships as well as a contact.

An address can be in the book once. A second create for an address that is already there is refused with 409 contact_exists rather than merged, so a retry cannot quietly overwrite a name somebody edited in the app. Read the existing row with get and change it with update.

Флаги

--email <value>

The address to save, trimmed and lower cased before it is stored. Required, here or in --data.

--name <value>

Display name. Leave it out to save the contact without one.

--notes <value>

Free text kept with the contact and shown beside it in the app.

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

Up to 25 audience ids to put the new contact in. The default audience is joined whether or not it is named. When this is present the key also needs audiences:write, or the call is refused with 403 before anything is saved.

--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 contacts create --email [email protected]
With optional flags
openemail contacts create --email [email protected] --name 'Grace Hopper' --notes 'Met at the compiler workshop'
Read the whole body from a JSON file
openemail contacts create --data @contact.json

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

API
POST /contacts
SDK
contacts.create()

openemail contacts update

Change a contact's name or notes

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

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

openemail contacts update <email> [flags]

Changes the fields you send and leaves the rest alone. A key you leave out keeps its stored value, and an explicit null clears it, so { notes: null } empties the notes while {} changes nothing.

The address cannot be changed. It is the contact's identity, its path segment and the unique key of the book, so moving a contact to a new address is a delete and a create, and that new contact starts with no audience membership beyond the default one.

source and lastSeenAt are the server's to set and are not accepted here. A contact recorded automatically stays auto after you give it a name.

Аргументы

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

The contact's address, matched case insensitively.

Флаги

--name <value>

New display name. Null clears it.

--notes <value>

New notes. Null clears them.

--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 contacts update [email protected] --name 'Grace Hopper'
Print the raw JSON
openemail contacts update [email protected] --name 'Grace Hopper' --json

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

API
PATCH /contacts/{email}
SDK
contacts.update()

openemail contacts delete

Delete somebody from the contacts and hide the address

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

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

openemail contacts delete <email> [flags]

Does what Delete does on the Contacts page in the app. A saved contact goes with its notes, its photo and every audience it was in, the default one included. The address is then hidden: listPeople leaves it out, and mail sent to it from the app composer no longer records it as a contact. The address can be one that was only ever seen in mail, which is how you take somebody off the people list, and wasSaved says which it was.

Nothing else moves: the mail exchanged with the address stays in the mailbox, and the address can still be written to. There is no undo. create or save afterwards brings the address back as a new contact with no name, no notes and no membership beyond the default audience.

Аргументы

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

The contact's address, matched case insensitively.

Примеры

openemail contacts delete [email protected]
Skip the confirmation, for scripts
openemail contacts delete [email protected] --yes

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

API
DELETE /contacts/{email}
SDK
contacts.delete()

openemail contacts set-audiences

Set exactly which audiences a contact is in

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

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

openemail contacts set-audiences <email> --audience-ids <a,b> [flags]
openemail contacts set-audiences <email> --data <json|@file|-> [flags]

Makes the contact's audiences match the list you send, the way the audience picker on a contact does in the app. The contact joins every listed audience it is not in yet and leaves every other one, in one transaction, and memberships it keeps keep their addedAt.

The default audience is always kept, whether or not you name it, so { audienceIds: [] } leaves the contact in the default audience alone. To add or remove one audience without restating the rest, use audiences.addContact or audiences.removeContact.

The address is trimmed and lower cased, the SDK URL encodes it for the path, and it has to be a contact already: an address that is not in the book is a 404 contact_not_found on email. Create it with create, which takes --audience-ids too. An id that is not an audience of this workspace is a 404 audience_not_found on --audience-ids, and nothing is changed.

Аргументы

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

The contact's address, matched case insensitively.

Флаги

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

Every audience the contact should be in, up to 100 ids. A repeated id counts once. More than 100 is a 422 invalid_parameter on --audience-ids, and an empty id is the same error on that entry, such as audienceIds.0. Required, here or in --data.

--data <json|@file|->

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

Примеры

openemail contacts set-audiences [email protected] --audience-ids aud_9f2c4b7e1a0d63d84c5f2e7b,aud_1c4e7a9b2d0f36e85a7c1b4d
Read the whole body from a JSON file
openemail contacts set-audiences [email protected] --data @contact.json

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

API
PUT /contacts/{email}/audiences
SDK
contacts.setAudiences()

openemail contacts list-people

List everyone on the Contacts page, saved or seen in mail

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

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

openemail contacts list-people [flags]

Returns one page of the people the Contacts page in the app lists: the saved contacts, and every address seen in mail as the sender or a recipient of a thread's newest message. Each row says whether it is saved, how many threads it shares with the mailbox and when mail last moved (lastAt). A person seen in mail and saved is one row. list is the saved contacts alone.

The addresses seen in mail are included only when the key also holds threads:read, because they are read out of the mail. Without it the page holds the saved contacts and seen is false. Deleted addresses and the mailbox's own addresses are never listed.

sort is recent, newest mail first and saved contacts never seen in mail after them, name, by name or else by address, ignoring case, or threads, most threads first. blockedBy on each row names the workspace blocklist rule that blocks it, and blocked: true narrows the page to those rows.

Paging is keyset. --limit takes 1 to 100 and defaults to 25, and nextCursor goes back as --cursor, with the same sort, q and blocked, while hasMore is true.

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

Флаги

--q <value>

Searches names, addresses and notes, up to 200 characters. When nothing matches exactly on the first page, close spellings are returned instead.

--email <value>

One address only, matched case insensitively: the way to read one person's thread count and last mail.

--sort <value>

recent (the default), name or threads.

По умолчанию"recent"
--blocked

true for only the people the workspace blocklist blocks, whole-domain rules included.

--limit <n>

Rows per page, 1 to 100. The server defaults to 25.

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

The nextCursor from the previous page. Never build one yourself.

--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 contacts list-people
With optional flags
openemail contacts list-people --sort threads --limit 50
Walk every page and stop after 100 items
openemail contacts list-people --all --max 100
One JSON object per line when piped
openemail contacts list-people --all > contacts.ndjson

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

API
GET /contacts/people
SDK
contacts.listPeople()

openemail contacts save

Save an address as a contact, or keep one that was recorded

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

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

openemail contacts save <email> [flags]

Does what Add to contacts and Keep in contacts do in the app, and is safe to call whatever state the address is in. An address that is not a contact yet becomes one with source manual. A contact recorded from a send becomes manual. A contact already saved keeps what it has. A deleted address is brought back.

--name replaces the stored name and leaving it out keeps it. --notes replaces the stored notes and null clears them. Unlike create, an address already in the book is not an error, and unlike update, an address not in the book is not one either.

Аргументы

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

The address, trimmed and lower cased on the server.

Флаги

--name <value>

Up to 200 characters. Left out, the stored name is kept.

--notes <value>

Up to 5,000 characters. null clears the notes; left out, they are kept.

--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 contacts save [email protected]
With optional flags
openemail contacts save [email protected] --name 'Grace Hopper'

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

API
PUT /contacts/{email}
SDK
contacts.save()

openemail contacts delete-many

Delete up to 200 contacts in one call

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

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

openemail contacts delete-many <emails...> [flags]

Deletes every address in emails the way delete deletes one: a saved contact goes with its notes, its photo and every audience membership, and every address is hidden, so mail sent to it from the app composer does not record it again. Addresses that were only seen in mail are hidden too.

An entry that is not an address comes back in invalid and the rest still go through. A repeated address counts once. There is no undo.

Аргументы

<emails...>ОбязательноОдин или несколько

1 to 200 addresses, matched case insensitively. More than 200, or none, is a 422 on emails.

Примеры

openemail contacts delete-many [email protected] [email protected]
Skip the confirmation, for scripts
openemail contacts delete-many [email protected] [email protected] --yes

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

API
POST /contacts/batch-delete
SDK
contacts.deleteMany()

openemail contacts set-photo

Upload the photo shown for a contact

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

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

openemail contacts set-photo <email> <data> [flags]

Sends the image bytes as the request body, replacing any photo the contact had. PNG, JPEG, WebP and GIF are accepted, up to 5 MB. The server fits the image into a 512 pixel square, stores it as WebP, keeps the first frame of an animation, and answers with the contact and its new photoUrl.

data is a Blob, an ArrayBuffer or a Uint8Array. The type is read from --content-type, or from a Blob's own type when that is left out. Without either the bytes go as application/octet-stream and the server refuses them with 422 invalid_image.

The address has to be a saved contact already: save it first.

Аргументы

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

The contact's address, matched case insensitively.

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

The image: a Blob, ArrayBuffer or Uint8Array.

Флаги

--content-type <value>

image/png, image/jpeg, image/webp or image/gif. Required unless data is a Blob with a type.

Примеры

The required values only
openemail contacts set-photo [email protected] ./photo.jpg
With optional flags
openemail contacts set-photo [email protected] ./photo.jpg --content-type image/jpeg

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

API
PUT /contacts/{email}/photo
SDK
contacts.setPhoto()

openemail contacts remove-photo

Remove a contact photo

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

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

openemail contacts remove-photo <email> [flags]

Takes the photo off the contact and deletes the stored image, the way Remove does on a contact in the app. The contact answers with photoUrl null. Removing a photo from a contact that has none changes nothing.

Аргументы

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

The contact's address, matched case insensitively.

Примеры

openemail contacts remove-photo [email protected]
Skip the confirmation, for scripts
openemail contacts remove-photo [email protected] --yes

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

API
DELETE /contacts/{email}/photo
SDK
contacts.removePhoto()

openemail contacts block

Block an address

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

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

openemail contacts block <email> [flags]

Puts the address on the workspace blocklist, the same list settings.update edits as blockedSenders, so mail from it is refused from then on. This is Block on a contact in the app. A plus tag is dropped: blocking [email protected] blocks [email protected], and every tag of it.

When a rule already blocks the address, a whole-domain rule included, nothing is added: created is false and blockedBy names that rule. The address does not have to be a contact.

Аргументы

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

The address to block.

Примеры

openemail contacts block [email protected]
Print the raw JSON
openemail contacts block [email protected] --json

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

API
POST /contacts/{email}/block
SDK
contacts.block()

openemail contacts unblock

Unblock an address

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

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

openemail contacts unblock <email> [flags]

Takes every workspace blocklist rule that blocks the address off the list and lists them in removed. This is Unblock on a contact in the app.

When one of them is a whole-domain rule, in blockedDomains, everybody at that domain is unblocked with it, so check removed when that matters. Rules set for one address or one domain in the settings are not touched. An address that no rule blocks answers with removed empty.

Аргументы

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

The address to unblock.

Примеры

openemail contacts unblock [email protected]
Skip the confirmation, for scripts
openemail contacts unblock [email protected] --yes

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

API
DELETE /contacts/{email}/block
SDK
contacts.unblock()

openemail contacts list-threads

List the conversations with one person

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

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

openemail contacts list-threads <email> [flags]

Returns one page of the threads the address wrote or was written to, in every folder: the Mail tab on a contact in the app. Each row is a summary, subject, from, receivedAt, messageCount, hasUnread and labels, and threads.get reads the messages behind its id.

--limit takes 1 to 100 and defaults to 25. Pass nextCursor back as --cursor, with the same q and sort, while hasMore is true.

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.

Аргументы

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

The address. It does not have to be a saved contact.

Флаги

--q <value>

Searches inside those threads, with the mailbox search syntax, up to 200 characters.

--sort <value>

newest (the default), oldest, sender or subject.

По умолчанию"newest"
--limit <n>

Threads per page, 1 to 100. The server defaults to 25.

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

The nextCursor from the previous page. Never build one yourself.

--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

Примеры

The required values only
openemail contacts list-threads [email protected]
With optional flags
openemail contacts list-threads [email protected] --q invoice
Walk every page and stop after 100 items
openemail contacts list-threads [email protected] --all --max 100
One JSON object per line when piped
openemail contacts list-threads [email protected] --all > contacts.ndjson

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

API
GET /contacts/{email}/threads
SDK
contacts.listThreads()

openemail contacts activity

Read how mail with one person has gone over a window

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

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

openemail contacts activity <email> [flags]

Returns the numbers behind the Activity tab on a contact in the app, over a window that ends now: messages received from the address and sent to it per bucket, the threads that moved, the threads whose newest message is theirs and so waits on a reply from the mailbox, when each side last wrote, and the median time each side takes to answer, in milliseconds.

--minutes sets how far back the window reaches, 90 days by default. grain sets the bucket width and the key shape, YYYY-MM-DD, YYYY-MM-DDTHH or YYYY-MM-DDTHH:MM, and --offset-minutes shifts the boundaries so days break where the reader's day does. buckets is sparse and oldest first. Mail in the bin or in spam is left out.

Аргументы

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

The address. It does not have to be a saved contact.

Флаги

--minutes <n>

Window length in minutes, from 1 to about 20 years. The server defaults to 90 days.

По умолчанию129600
--grain <value>

Bucket width: minute, hour or day, defaulting to day.

По умолчанию"day"
--offset-minutes <n>

Minutes east of UTC to cut the buckets in, from -840 to 840, defaulting to 0. Pass -new Date().getTimezoneOffset() for the local zone.

По умолчанию0

Примеры

openemail contacts activity [email protected]
Print the raw JSON
openemail contacts activity [email protected] --json

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

API
GET /contacts/{email}/activity
SDK
contacts.activity()