Ir a la documentación
CLI

openemail files

Cada comando de este espacio de nombres, con sus argumentos, opciones y ejemplos.

Comandos

Every attachment the mailbox holds, sent and received, and the files uploaded to it, with their bytes, the download links they went out as and whether each can be deleted.

Cada comando de aquí también acepta las opciones globales, como --json, --profile y --dry-run. Ver las opciones globales

openemail files list

List one page of the files the mailbox holds

Alcancesfiles:readNecesita iniciar sesiónAliasls

Uso

openemail files list [flags]

Resolves one page of the Files page: every attachment the mailbox holds, sent and received, and every file uploaded to it, with its name, type, size, the address it came to, the thread it belongs to and whether it can be deleted.

Only an upload that nothing depends on can be deleted, and its deletable is true. Every other row has a usage saying what keeps it: received, sent, linked for an upload that went out as a download link that still works, or scheduled for one attached to a message that has not gone out yet.

A key limited to particular addresses or domains sees only the files that arrived at them, the same boundary the thread list uses, so it does not see files uploaded for the whole workspace. A deleted file is not listed.

The index starts from the day it shipped, so an older mailbox lists what has arrived since. Older attachments are still on their messages, where threads.listAttachments reads them.

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.

Opciones

--q <value>

Searches the file name and its type. Words match loosely, and a close spelling is tried when nothing matches exactly.

--kind <value>

Keeps one kind: image, pdf, audio, video or text, the choices of the filter on the Files page.

--direction <value>

Keeps one direction: inbound for files that arrived on a message, outbound for files that went out on one, uploaded for files put on the Files page.

--address <value>

Keeps the files of one address, the deliveredTo of the file, compared without regard to case.

--since <when>

Keeps files added at or after this moment. A Date or an ISO 8601 string.

--until <when>

Keeps files added before this moment. A Date or an ISO 8601 string.

--sort <value>

newest (the default), oldest, largest or name. A cursor carries on in the order it was handed out in.

Predeterminado"newest"
--limit <n>

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

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

Ejemplos

openemail files list
With optional flags
openemail files list --kind pdf --sort largest
Walk every page and stop after 100 items
openemail files list --all --max 100
One JSON object per line when piped
openemail files list --all > files.ndjson

También disponible en

API
GET /files
SDK
files.list()

openemail files get

Read one file by id

Alcancesfiles:readNecesita iniciar sesiónAliasshowview

Uso

openemail files get <id> [flags]

Resolves one file: its name, type, size, whether it was sent, received or uploaded, the address it came to, the thread and message it belongs to, and whether it can be deleted. download fetches its bytes.

deletable is true only for an upload that nothing depends on. Otherwise usage says what keeps it: received or sent for a file that came in or went out on a message, linked for an upload that went out as a download link that still works, and scheduled for one attached to a message that has not gone out yet.

Argumentos

<id>Obligatorio

The id from list, file_ and 24 hex.

Ejemplos

openemail files get file_6bb640f5b99e47deb758f1f5
Print the raw JSON
openemail files get file_6bb640f5b99e47deb758f1f5 --json

También disponible en

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

openemail files stats

Count the files and the space they take

Alcancesfiles:readNecesita iniciar sesión

Uso

openemail files stats [flags]

Returns the numbers on the Analytics tab of the Files page in one request: how many files the mailbox holds and how many bytes they take, in all and split into received, sent and uploaded, the file types and the addresses taking the most space, how many files arrived on each of the last 30 days, and the download links still working with how often they were fetched.

Deleted files are not counted. A key limited to particular addresses or domains counts only the files that arrived at them, so files uploaded for the whole workspace are left out of its numbers.

Ejemplos

openemail files stats
Print the raw JSON
openemail files stats --json

También disponible en

API
GET /files/stats
SDK
files.stats()

openemail files download

Fetch the bytes of a file

Alcancesfiles:readNecesita iniciar sesión

Uso

openemail files download <id> [flags]

Resolves with the file exactly as it is stored, the same bytes the Download action on the Files page saves. The response carries the file's own Content-Type and name.

Argumentos

<id>Obligatorio

The id from list.

Opciones

-o, --out <file>

Write the file here. Required on a terminal. Without it, piped output gets the raw bytes

Ejemplos

openemail files download file_6bb640f5b99e47deb758f1f5
Save the file
openemail files download file_6bb640f5b99e47deb758f1f5 --out report.pdf

También disponible en

API
GET /files/{id}/content
SDK
files.download()

openemail files upload

Upload a file to the Files page

Alcancesfiles:writeNecesita iniciar sesión

Uso

openemail files upload <data> [flags]

Stores the bytes as a new file, the way the Upload button on the Files page does, and resolves with it: direction is uploaded, usage is null and deletable is true. Attach it to a send as { fileId } in emails.send, which is how a file larger than the inline cap goes out.

data is a Blob, an ArrayBuffer or a Uint8Array, sent as the request body. The name travels as the filename query parameter, and it is cleaned rather than refused: characters a file name cannot hold become _, and a name longer than 255 characters is cut, keeping its extension. The type is --content-type, or a Blob's own type when that is left out, and application/octet-stream without either. A value that is not shaped like a MIME type is stored as application/octet-stream too.

A key limited to particular addresses or domains uploads to the first address it holds, which becomes deliveredTo. An unlimited key uploads for the whole workspace and deliveredTo is null, so a narrowed key never reaches that file afterwards.

Argumentos

<data>Obligatorio

The file: a Blob, ArrayBuffer or Uint8Array, not empty and at most 100 MB.

Opciones

--filename <value>

The name the file is stored and downloaded under, such as report.pdf. A missing or blank name throws before anything is sent.

--content-type <value>

The MIME type, such as application/pdf. Left out, a Blob's own type is used, else application/octet-stream.

--timeout-ms <n>

How long the upload may take, in milliseconds. Left out, it is 10 minutes, or the client --timeout-ms when that is longer. 0 waits as long as it takes.

Ejemplos

The required values only
openemail files upload ./photo.jpg
With optional flags
openemail files upload ./photo.jpg --filename report.pdf --content-type application/pdf

También disponible en

API
POST /files
SDK
files.upload()

openemail files delete

Delete an uploaded file for good

Alcancesfiles:writeNecesita iniciar sesión
Te pide confirmación
Aliasrmdelremove

Uso

openemail files delete <id> [flags]

Removes an uploaded file: its bytes are deleted from storage and it leaves the Files page. The row stays, marked deleted, so the index knows the file existed. There is no undo.

Only an upload that nothing depends on can be deleted, the files whose deletable is true. A file that was received or sent stays with its message, and so does an upload that went out as a download link that still works or is attached to a message that has not gone out yet. Those are refused with 409 file_in_use, and the message names the file and says why. An upload that was sent inside a message can still be deleted, because the message keeps its own copy, which is listed as a separate sent file.

deleteMany deletes up to 100 in one call and reports the ones it kept instead of failing.

Argumentos

<id>Obligatorio

The id from list.

Ejemplos

openemail files delete file_6bb640f5b99e47deb758f1f5
Skip the confirmation, for scripts
openemail files delete file_6bb640f5b99e47deb758f1f5 --yes

También disponible en

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

openemail files delete-many

Delete up to 100 files in one call

Alcancesfiles:writeNecesita iniciar sesión
Te pide confirmación

Uso

openemail files delete-many <ids...> [flags]

Deletes every file in ids that can be deleted, the way delete deletes one, and reports the rest instead of failing. It is what selecting several files on the Files page and pressing Delete does.

Only an uploaded file that nothing depends on can be deleted. A file that was received or sent stays with its message, and so does an upload that went out as a download link that still works or is attached to a message that has not gone out yet. Each of those comes back in kept with its usage and a reason in plain words. An id that is unknown, already deleted or outside the addresses a narrowed key holds comes back in missing. The rule is checked again at the moment of deleting, so a file that became used in between is kept.

There is no undo.

Argumentos

<ids...>ObligatorioUno o varios

1 to 100 file ids from list. More than 100, or none, is a 422 on ids. A repeated id counts once.

Ejemplos

openemail files delete-many file_6bb640f5b99e47deb758f1f5
Skip the confirmation, for scripts
openemail files delete-many file_6bb640f5b99e47deb758f1f5 --yes

También disponible en

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