Ir a la documentación
API

Archivos

Cada operación de este grupo: lo que acepta, lo que devuelve y los errores con los que puede responder.

Operaciones

Every file the mailbox holds, sent, received and uploaded, with its bytes, its totals and the download links it went out as. It is the Files page of the app, gated like the mail: threads:read reads it and threads:write uploads and deletes. Only an upload that no message or live download link uses can be deleted, one at a time or up to 100 at once. Received and sent files stay with their message.

GET/files

List files

Alcancesfiles:readLee

Every attachment the mailbox holds, sent and received, and every file uploaded to it, the Files page of the app: name, type, size, the address it came to, the thread it belongs to and whether it can be deleted. A deleted file is not listed.

Only an upload that nothing depends on can be deleted, and its deletable is true. Every other file has a usage saying 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.

Files have scopes of their own: files:read reads them and files:write uploads, deletes and publishes them. Reading an email with threads:read still reads the attachments on it. A key limited to particular addresses or domains sees only the files that arrived at them. It does not see files uploaded for the whole workspace, which have no deliveredTo.

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 GET /threads/{id}/messages/{messageId}/attachments reads them.

Requires the files:read scope.

Parámetros de consulta

qstring

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

Hasta 200 caracteres
kindstring

Keeps one kind of file, the choices of the filter on the Files page: images, PDFs, audio, video or text.

Uno de"image""pdf""audio""video""text"
directionstring

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

Uno de"inbound""outbound""uploaded"
addressstring

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

Hasta 320 caracteres
sincestring

Keeps files added at or after this moment, as an ISO 8601 date or date-time.

Formatodate-time
untilstring

Keeps files added before this moment, as an ISO 8601 date or date-time.

Formatodate-time
sortstring

The order. A cursor carries on in the order it was handed out in, and one handed out under another sort is a 400 invalid_cursor.

Uno de"newest""oldest""largest""name"Predeterminado"newest"
limitinteger

Rows per page, 1 to 100.

Al menos 1Como máximo 100Predeterminado25
cursorstring

The previous page's nextCursor, passed back as it came. It is opaque: it holds where the last row sat in this list's order, so a row deleted or edited between pages never breaks the walk, and the next page starts at the first row that sorts after it. A value this list did not hand out is a 400 invalid_cursor.

Devuelve

A page of files in the order sort names.

Errores

Los errores que puede devolver cualquier operación400401403404422500Catálogo de errores

También disponible en

SDK
files.list()files.listAll()files.iterate()
CLI
openemail files list
MCP
listFiles

POST/files

Upload a file

Alcancesfiles:writeCambia datos

Stores a file on the Files page, the way its Upload button does, and answers with it. Send the file itself as the body, up to 100 MB, with its type in Content-Type and its name in filename. Attach it to a send as { "fileId": "..." } in the attachments of POST /emails, which is how a file larger than the inline cap goes out.

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.

A workspace keeps up to 10 GB of uploads and takes 500 an hour. Nothing makes an upload safe to repeat, so after a lost response look for the file with GET /files before sending it again.

Requires the files:write scope.

Parámetros de consulta

filenamestring

The name the file is stored and downloaded under, such as report.pdf, taken as it is. 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. Left out, X-Filename is read instead.

Encabezados

X-Filenamestring

The file name, URI encoded, for a client that would rather not put it in the URL. filename wins when both are sent.

Cuerpo de la petición

Tipo de contenido*/*

binary

Devuelve

201File

Stored. direction is uploaded, usage is null and deletable is true.

Errores

400

upload_no_name: no name in filename or X-Filename. upload_empty: the body is empty. upload_dangerous: a program or script, judged by its name, which cannot be stored.

403

insufficient_scope: the key lacks files:write. upload_no_address: a key limited to particular addresses or domains that holds no address.

413

upload_too_large: the file is larger than 100 MB.

429

upload_rate_limited: 500 files were uploaded to this workspace in the last hour, deleted ones included. Try again later.

502

upload_failed: the file could not be stored, and nothing was kept. Try again.

507

upload_storage_full: the uploads on this workspace would pass 10 GB. Delete some first.

Los errores que puede devolver cualquier operación401404422500Catálogo de errores

También disponible en

SDK
files.upload()
CLI
openemail files upload
MCP
uploadFile

GET/files/stats

Count files

Alcancesfiles:readLee

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.

Requires the files:read scope.

Devuelve

The numbers on the Analytics tab of the Files page.

Errores

Los errores que puede devolver cualquier operación400401403404422500Catálogo de errores

También disponible en

SDK
files.stats()
CLI
openemail files stats
MCP
getFileStats

POST/files/batch-delete

Delete files in bulk

Alcancesfiles:writeElimina

Deletes up to 100 files in one call, each the way DELETE /files/{id} 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 upload that nothing depends on is deleted. A file that was received or sent, or an upload that went out as a download link that still works or is attached to a message that has not gone out yet, comes back in kept with its usage and a reason. 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.

Requires the files:write scope.

Cuerpo de la petición

idsstring[]Obligatorio

1 to 100 file ids from GET /files, each at most 128 characters. A repeated id counts once.

De 1 a 100 elementos

Devuelve

What was deleted, what was kept and why, and what was not found.

Errores

400

malformed_json: the body is not JSON.

422

invalid_parameter on ids for none or more than 100, and unknown_parameter for any key but ids.

Los errores que puede devolver cualquier operación401403404500Catálogo de errores

También disponible en

SDK
files.deleteMany()
CLI
openemail files delete-many
MCP
deleteFiles

GET/files/{id}

Retrieve a file

Alcancesfiles:readLee

One file, with usage and deletable saying whether it can be deleted and what keeps it when it cannot. A deleted file, one outside the addresses a narrowed key holds, and an unknown id all answer 404.

Requires the files:read scope.

Parámetros de ruta

idstringObligatorio

The id from GET /files, file_ and 24 hex.

Devuelve

200File

The file. GET /files/{id}/content has its bytes.

Errores

Los errores que puede devolver cualquier operación400401403404422500Catálogo de errores

También disponible en

SDK
files.get()
CLI
openemail files get
MCP
getFile

DELETE/files/{id}

Delete a file

Alcancesfiles:writeElimina

Deletes an uploaded file: its bytes are removed 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 answer 409 file_in_use. 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.

It needs the same scope as uploading. A key limited to particular addresses or domains may delete only a file that arrived at one of them. POST /files/batch-delete deletes many at once.

Requires the files:write scope.

Parámetros de ruta

idstringObligatorio

The id from GET /files, file_ and 24 hex.

Devuelve

200object

Deleted. The bytes are gone and the file leaves the Files page.

objectstring
Uno de"file"
idstring
deletedboolean
Uno detrue

Errores

404

resource_not_found: the id is unknown, the file is already deleted, or it is outside the addresses a narrowed key holds.

409

file_in_use on id: something depends on the file, so it stays. The message names the file and says why, and usage on GET /files/{id} says the same.

Los errores que puede devolver cualquier operación400401403422500Catálogo de errores

También disponible en

SDK
files.delete()
CLI
openemail files delete
MCP
deleteFile

GET/files/{id}/content

Download a file

Alcancesfiles:readLee

The file exactly as it is stored, the same bytes the Download action on the Files page saves. A file whose bytes are gone from storage answers 404 like a missing one.

Requires the files:read scope.

Parámetros de ruta

idstringObligatorio

The id from GET /files, file_ and 24 hex.

Parámetros de consulta

downloadstring

true always answers Content-Disposition: attachment. Otherwise an image, a PDF or plain text answers inline.

Uno de"true""false"

Devuelve

200binaryapplication/octet-stream

The bytes, under the file's own Content-Type and name.

Errores

Los errores que puede devolver cualquier operación400401403404422500Catálogo de errores

También disponible en

SDK
files.download()
CLI
openemail files download

POST/files/{id}/links

Publish a file at a public link

Alcancesfiles:writeCambia datos

Makes a public download link for the file that anybody holding it can open without signing in, which is how an image or document is referenced from an email or a web page. Each call makes a new link with its own download count. The link keeps working until it is revoked or the file is deleted.

A file that came in or went out on a message is copied to public storage first. Programs and scripts are refused with 422 file_unshareable.

Requires the files:write scope.

Parámetros de ruta

idstringObligatorio

The id from GET /files, file_ and 24 hex.

Cuerpo de la petición

domainstring

The domain whose files host serves the link, such as acme.com for files.acme.com. Left out, the domain of the address the file belongs to is used, and a file with no address, or a domain with no files host, is served from the API address.

Devuelve

The new link. url opens the file with no sign-in.

Errores

422

file_unshareable: the file is a program or script, which never gets a public link.

Los errores que puede devolver cualquier operación400401403404500Catálogo de errores

También disponible en

SDK
files.createLink()
CLI
openemail files create-link
MCP
createFileLink

Objetos

Fileobject

objectstring
Uno de"file"
idstring

file_ and 24 hex.

filenamestring
mimeTypestring
sizeBytesinteger
directionstring

inbound for a file that arrived, outbound for one that was sent, uploaded for one added on the Files page or with POST /files.

Uno de"inbound""outbound""uploaded"
threadIdstring
Puede ser null
messageIdstring
Puede ser null
deliveredTostring

The address it came to, lower-cased. An upload carries the first address its uploader was limited to, and none when the uploader was not limited, which the app shows as the whole workspace. A key limited to some addresses sees only files whose deliveredTo it holds, so a file with none recorded reaches only an unrestricted key.

Puede ser null
usagestring

Why the file is kept, or null when it can be deleted. received and sent are files that came in or went out on a message, and they stay with it. linked is an upload that went out as a download link that still works, and scheduled is one attached to a message that has not gone out yet.

Puede ser nullUno de"received""sent""linked""scheduled"
deletableboolean

Whether DELETE /files/{id} will take it. True only for an upload that nothing depends on, which is when usage is null.

visibilitystring

public while at least one download link to the file works: a link made with POST /files/{id}/links, or the link a sent message carries for it. private otherwise, and every upload starts private.

Uno de"public""private"
publicUrlstring

A working public download link, on the domain's own files host when one is set up and on ours otherwise. A published link is preferred over a link from a sent message. Null while the file is private.

Puede ser null
createdAtstring
Formatodate-time

FileBatchDeleteobject

objectstring
Uno de"file_batch_delete"
deletedstring[]

The ids this call deleted.

keptobject[]

Files something depends on. Nothing happened to them.

idstring
filenamestring
usagestring

What keeps it, the same value as usage on the file.

Uno de"received""sent""linked""scheduled"
reasonstring

The same in a sentence, such as "It went out as a download link that still works."

missingstring[]

Ids that are unknown, already deleted, or outside the addresses a narrowed key holds.

FileLinkRevocationobject

objectstringObligatorio
Uno de"file_link_revocation"
fileIdstringObligatorio
revokedintegerObligatorio

How many links were still working and now are not. Links revoked earlier are not counted.

Al menos 0

FileListobject

objectstring
Uno de"list"
dataFile[]
hasMoreboolean

True when another page follows. Pass nextCursor back as cursor to read it.

nextCursorstring

An opaque cursor for the next page, or null on the last page. Pass it back unchanged.

Puede ser null

FileStatsobject

objectstring
Uno de"file_stats"
totalsobject

Every file counted here, however it came.

filesinteger
bytesinteger

Their sizes added up.

receivedobject

Files that came in on a message.

filesinteger
bytesinteger

Their sizes added up.

sentobject

Files that went out on a message.

filesinteger
bytesinteger

Their sizes added up.

uploadedobject

Files uploaded on the Files page or with POST /files.

filesinteger
bytesinteger

Their sizes added up.

typesobject[]

The 8 types taking the most bytes, largest first.

mimeTypestring
filesinteger
bytesinteger
byDayobject[]

Files added on each of the last 30 days in UTC, today included, oldest first. A day on which none arrived has no entry, so a chart must fill the gaps.

daystring

YYYY-MM-DD.

Formatodate
filesinteger
bytesinteger
addressesobject[]

The 6 addresses holding the most bytes, largest first. A file uploaded for the whole workspace has no address, so it counts in the totals and never here.

addressstring
filesinteger
bytesinteger
linksobject

The download links that still work.

sharesinteger

How many links.

downloadsinteger

Fetches by a person across all of them. Scanners and link previewers are left out.

lastDownloadAtstring

The latest fetch, or null when none was ever fetched.

Puede ser nullFormatodate-time