Files
Every file the mailbox holds.
Files tools
| Tool | What it does |
|---|---|
| listFiles | Every file the mailbox holds, attachments sent and received and the files uploaded to it, searchable by name, filtered by kind, direction, address and the dates it was added, and sorted newest, oldest, largest or by name. Each one says whether it can be deleted. Returned a page at a time. |
| getFile | One file, whether it can be deleted and why not, with every download link it went out as and how often each was fetched. |
| getFileStats | The numbers on the Analytics tab of the Files page: files and space in all, split into received, sent and uploaded, the largest types, the addresses holding the most, the live download links and what was added each day of the last 30. |
| uploadFile | Upload a file the way the Upload button does, as base64 up to 5 MB. Its id can be attached to a send as { fileId }. A chat asks first unless you asked for it. |
| deleteFile | Delete an uploaded file that nothing depends on. Its bytes go for good. A chat always asks first. |
| deleteFiles | Delete up to 100 uploaded files in one call. Each one in use is kept and named with the reason, and an id that is not found is listed. A chat always asks first. |
| createFileLink | Publish a file at a public download link that opens with no sign-in, on the files host of the domain you name when it has one. Programs and scripts are refused. |
| revokeFileLink | Stop a public download link from working, for good, including in mail that already went out with it. |
| makeFilePrivate | Make a file private, as Make private on the Files page does: every public link to it stops working at once, in mail already sent too. A chat always asks first. |
Reading files needs files:read, and uploading, deleting and publishing or revoking links need files:write, which includes files:read. Reading an email with threads:read still reads the attachments on it. Somebody limited to some addresses sees only the files on those addresses, and uploads to the first one they can send from.
No tool returns the bytes. Downloading a file is GET /files/{id}/content on the REST API, files.download in the SDK or nextmail files download on the command line.
Only an upload that nothing depends on can be deleted. A received or sent file 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. An upload sent inside a message can go, because the sent message keeps its own copy.
Reference
listFiles
Every file this mailbox holds, the Files page: attachments that were received or sent, and files somebody uploaded. Each line gives the name, type, size, which address it belongs to, the thread it came on, and whether it can be deleted. Only an uploaded file that no message depends on can be deleted; a received or sent file stays with its message. q searches the name and the type, kind keeps images, PDFs, audio, video or text, direction keeps received (inbound), sent (outbound) or uploaded files, address keeps the files of one address, since and until bound when the file was added (ISO dates), and sort is newest (the default), oldest, largest or name. Somebody limited to some addresses sees only the files that belong to them. One page at a time: when more follow, the last line gives a cursor to pass back for the next page.
Inputs
qstring- Up to 200 characters
kindstring- One of
"image""pdf""audio""video""text" directionstring- One of
"inbound""outbound""uploaded" addressstring- 3 to 320 characters
sincestring- Format
date-time untilstring- Format
date-time sortstring- One of
"newest""oldest""largest""name" limitinteger- At least 1At most 100
cursorstring
Also available in
- API
GET /files- TypeScript
nextmail.files.list()nextmail.files.listAll()nextmail.files.iterate()- Python
files.list()files.list_all()files.iterate()- Ruby
files.listfiles.list_allfiles.iterate- PHP
files->listfiles->listAllfiles->iterate- Go
Files.ListFiles.ListAllFiles.Iterate- Java
files().listfiles().listAllfiles().iterate- C#
Files.ListAsyncFiles.ListAllAsyncFiles.IterateAsync
getFile
One file from listFiles by its id, whether it can be deleted and why not, and every download link it went out as: how often each was fetched, when last, and whether it was revoked. A file attached inside a message has no links, because nothing records when those are opened. One page at a time: when more follow, the last line gives a cursor to pass back for the next page.
Inputs
idstringRequired- 1 to 128 characters
limitinteger- At least 1At most 100
cursorstring
Also available in
- API
GET /files/{id}GET /files/{id}/links- TypeScript
nextmail.files.get()nextmail.files.listLinks()nextmail.files.listAllLinks()nextmail.files.iterateLinks()- Python
files.get()files.list_links()files.list_all_links()files.iterate_links()- Ruby
files.getfiles.list_linksfiles.list_all_linksfiles.iterate_links- PHP
files->getfiles->listLinksfiles->listAllLinksfiles->iterateLinks- Go
Files.GetFiles.ListLinksFiles.ListAllLinksFiles.IterateLinks- Java
files().getfiles().listLinksfiles().listAllLinksfiles().iterateLinks- C#
Files.GetAsyncFiles.ListLinksAsyncFiles.ListAllLinksAsyncFiles.IterateLinksAsync
getFileStats
The numbers on the Analytics tab of the Files page: how many files and how much space in all, split into received, sent and uploaded, the largest file types, the addresses holding the most, the download links still live with their downloads, and how many files were added each day of the last 30. Somebody limited to some addresses counts only the files that belong to them.
Inputs
Takes no input.
Also available in
- API
GET /files/stats- TypeScript
nextmail.files.stats()- Python
files.stats()- Ruby
files.stats- PHP
files->stats- Go
Files.Stats- Java
files().stats- C#
Files.StatsAsync
uploadFile
Upload a file to the Files page, the way the Upload button does. content is the file itself in base64, at most 5 MB once decoded; filename is the name it is stored under; contentType is its MIME type and defaults to application/octet-stream. Somebody limited to some addresses uploads to the first address they can send from; everybody else uploads to the whole workspace. The id it answers with can be attached to a send as { fileId }. Programs and scripts are refused, and uploads count against the workspace upload limits.
Inputs
filenamestringRequired- 1 to 255 characters
contentstringRequired- 1 to 6990515 characters
contentTypestring- Up to 255 characters
Also available in
- API
POST /files- TypeScript
nextmail.files.upload()- Python
files.upload()- Ruby
files.upload- PHP
files->upload- Go
Files.Upload- Java
files().upload- C#
Files.UploadAsync
deleteFile
Delete an uploaded file for good: its bytes are removed from storage and it leaves the Files page. Nothing brings it back. Only an uploaded file that no message 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 or waits on a message that has not gone out yet; listFiles says which files can be deleted.
Inputs
idstringRequired- 1 to 128 characters
Also available in
- API
DELETE /files/{id}- TypeScript
nextmail.files.delete()- Python
files.delete()- Ruby
files.delete- PHP
files->delete- Go
Files.Delete- Java
files().delete- C#
Files.DeleteAsync
deleteFiles
Delete up to 100 uploaded files in one call, the way deleteFile does one, as selecting several on the Files page and pressing Delete does. Each file that can be deleted is; each one a message depends on is kept and named with the reason; an id that is unknown, already deleted or out of reach is listed as not found. It cannot be undone.
Inputs
idsstring[]Required- 1 to 100 items
Also available in
createFileLink
Publish a file at a public download link that anybody holding it can open, with no sign-in. It answers with the link. The link lives on the files host of domain when that domain has one set up (files.<domain>), else on the files host of the address the file belongs to, else on the Nextmail API address. Programs and scripts are refused. revokeFileLink stops a link from working.
Inputs
idstringRequired- 1 to 128 characters
domainstring- 3 to 253 characters
Also available in
revokeFileLink
Stop a public download link from working, for good. Anybody who opens it afterwards, including from mail that already went out, gets nothing. getFile lists the links a file has and their ids.
Inputs
idstringRequired- 1 to 128 characters
linkIdstringRequired- 1 to 128 characters
Also available in
makeFilePrivate
Make a file private, as Make private on the Files page does: every public download link to it stops working at once, including the ones in mail that already went out. The file itself stays, and createFileLink can publish it again at a new link.
Inputs
idstringRequired- 1 to 128 characters