Skedarët
Çdo veprim në këtë grup: çfarë pranon, çfarë kthen dhe gabimet me të cilat mund të përgjigjet.
Veprimet
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
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.
Parametrat e pyetjes
qstringSearches the file name and its type. Words match loosely, and a close spelling is tried when nothing matches exactly.
Deri në 200 karakterekindstringKeeps one kind of file, the choices of the filter on the Files page: images, PDFs, audio, video or text.
Një nga"image""pdf""audio""video""text"directionstringKeeps one direction:
inboundfor files that arrived on a message,outboundfor files that went out on one, anduploadedfor files put on the Files page.Një nga"inbound""outbound""uploaded"addressstringKeeps the files of one address, the
deliveredToof the file, compared without regard to case.Deri në 320 karakteresincestringKeeps files added at or after this moment, as an ISO 8601 date or date-time.
Formatidate-timeuntilstringKeeps files added before this moment, as an ISO 8601 date or date-time.
Formatidate-timesortstringThe order. A cursor carries on in the order it was handed out in, and one handed out under another
sortis a 400invalid_cursor.Një nga"newest""oldest""largest""name"Parazgjedhja"newest"limitintegerRows per page, 1 to 100.
Të paktën 1Më së shumti 100Parazgjedhja25cursorstringThe 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 400invalid_cursor.
Kthen
A page of files in the order sort names.
Gabimet
Gabimet që mund të kthejë çdo veprim400401403404422500Katalogu i gabimeve
E disponueshme edhe në
POST/files
Upload a file
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.
Parametrat e pyetjes
filenamestringThe 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-Filenameis read instead.
Kokat
X-FilenamestringThe file name, URI encoded, for a client that would rather not put it in the URL.
filenamewins when both are sent.
Trupi i kërkesës
Lloji i përmbajtjes*/*
Kthen
Stored. direction is uploaded, usage is null and deletable is true.
Gabimet
- 400
upload_no_name: no name infilenameorX-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 lacksfiles: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.
Gabimet që mund të kthejë çdo veprim401404422500Katalogu i gabimeve
E disponueshme edhe në
GET/files/stats
Count files
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.
Kthen
The numbers on the Analytics tab of the Files page.
Gabimet
Gabimet që mund të kthejë çdo veprim400401403404422500Katalogu i gabimeve
E disponueshme edhe në
POST/files/batch-delete
Delete files in bulk
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.
Trupi i kërkesës
idsstring[]E detyrueshme1 to 100 file ids from
GET /files, each at most 128 characters. A repeated id counts once.Nga 1 deri në 100 elemente
Kthen
What was deleted, what was kept and why, and what was not found.
Gabimet
- 400
malformed_json: the body is not JSON.- 422
invalid_parameteronidsfor none or more than 100, andunknown_parameterfor any key butids.
Gabimet që mund të kthejë çdo veprim401403404500Katalogu i gabimeve
E disponueshme edhe në
GET/files/{id}
Retrieve a file
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.
Parametrat e shtegut
idstringE detyrueshmeThe id from
GET /files,file_and 24 hex.
Kthen
The file. GET /files/{id}/content has its bytes.
Gabimet
Gabimet që mund të kthejë çdo veprim400401403404422500Katalogu i gabimeve
E disponueshme edhe në
DELETE/files/{id}
Delete a file
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.
Parametrat e shtegut
idstringE detyrueshmeThe id from
GET /files,file_and 24 hex.
Kthen
Deleted. The bytes are gone and the file leaves the Files page.
objectstring- Një nga
"file" idstringdeletedboolean- Një nga
true
Gabimet
- 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_useonid: something depends on the file, so it stays. The message names the file and says why, andusageonGET /files/{id}says the same.
Gabimet që mund të kthejë çdo veprim400401403422500Katalogu i gabimeve
E disponueshme edhe në
GET/files/{id}/content
Download a file
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.
Parametrat e shtegut
idstringE detyrueshmeThe id from
GET /files,file_and 24 hex.
Parametrat e pyetjes
downloadstringtruealways answersContent-Disposition: attachment. Otherwise an image, a PDF or plain text answersinline.Një nga"true""false"
Kthen
application/octet-streamThe bytes, under the file's own Content-Type and name.
Gabimet
Gabimet që mund të kthejë çdo veprim400401403404422500Katalogu i gabimeve
E disponueshme edhe në
GET/files/{id}/links
List the download links of a file
Every download link made for this file, newest first, revoked ones included. A large attachment sent from OpenEmail travels as a link rather than inside the message, and each send makes a link of its own, and POST /files/{id}/links makes one on purpose, so this is how often each copy was fetched and when last.
A file attached inside a message has no links, because nothing records when those are opened.
Requires the files:read scope.
Parametrat e shtegut
idstringE detyrueshmeThe id from
GET /files,file_and 24 hex.
Parametrat e pyetjes
limitintegerRows per page, 1 to 100.
Të paktën 1Më së shumti 100Parazgjedhja25cursorstringThe 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 400invalid_cursor.
Kthen
A page of links, newest first.
Gabimet
Gabimet që mund të kthejë çdo veprim400401403404422500Katalogu i gabimeve
E disponueshme edhe në
POST/files/{id}/links
Publish a file at a public link
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.
Parametrat e shtegut
idstringE detyrueshmeThe id from
GET /files,file_and 24 hex.
Trupi i kërkesës
domainstringThe domain whose files host serves the link, such as
acme.comforfiles.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.
Kthen
The new link. url opens the file with no sign-in.
Gabimet
- 422
file_unshareable: the file is a program or script, which never gets a public link.
Gabimet që mund të kthejë çdo veprim400401403404500Katalogu i gabimeve
E disponueshme edhe në
DELETE/files/{id}/links
Revoke every link to a file
Makes the 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, and revoked says how many were still working. A file with no live links answers revoked: 0, so the call is safe to repeat. The file itself stays, and POST /files/{id}/links can publish it again at a new link.
A key limited to particular addresses reaches only the files that arrived at them, and any other file is a 404.
Requires the files:write scope.
Parametrat e shtegut
idstringE detyrueshmeThe id from
GET /files,file_and 24 hex.
Kthen
How many links stopped working.
Gabimet
Gabimet që mund të kthejë çdo veprim400401403404422500Katalogu i gabimeve
E disponueshme edhe në
DELETE/files/{id}/links/{linkId}
Revoke a public link
Stops a public link from working, for good, including in mail that already went out with it. Revoking a link that is already revoked answers with it unchanged. An unknown link is a 404 not_found.
Requires the files:write scope.
Parametrat e shtegut
idstringE detyrueshmeThe id from
GET /files,file_and 24 hex.linkIdstringE detyrueshmeThe link id from the links of the file.
Kthen
The link, with revokedAt set.
Gabimet
Gabimet që mund të kthejë çdo veprim400401403404422500Katalogu i gabimeve
E disponueshme edhe në
Objektet
Fileobject
objectstring- Një nga
"file" idstringfile_and 24 hex.filenamestringmimeTypestringsizeBytesintegerdirectionstringinboundfor a file that arrived,outboundfor one that was sent,uploadedfor one added on the Files page or withPOST /files.Një nga"inbound""outbound""uploaded"threadIdstring- Mund të jetë null
messageIdstring- Mund të jetë null
deliveredTostringThe 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
deliveredToit holds, so a file with none recorded reaches only an unrestricted key.Mund të jetë nullusagestringWhy the file is kept, or null when it can be deleted.
receivedandsentare files that came in or went out on a message, and they stay with it.linkedis an upload that went out as a download link that still works, andscheduledis one attached to a message that has not gone out yet.Mund të jetë nullNjë nga"received""sent""linked""scheduled"deletablebooleanWhether
DELETE /files/{id}will take it. True only for an upload that nothing depends on, which is whenusageis null.visibilitystringpublicwhile at least one download link to the file works: a link made withPOST /files/{id}/links, or the link a sent message carries for it.privateotherwise, and every upload starts private.Një nga"public""private"publicUrlstringA 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.
Mund të jetë nullcreatedAtstring- Formati
date-time
FileBatchDeleteobject
objectstring- Një nga
"file_batch_delete" deletedstring[]The ids this call deleted.
keptobject[]Files something depends on. Nothing happened to them.
idstringfilenamestringusagestringWhat keeps it, the same value as
usageon the file.Një nga"received""sent""linked""scheduled"reasonstringThe 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.
FileLinkobject
objectstring- Një nga
"file_link" idstringfshr_and 24 hex.fileIdstring- Mund të jetë null
filenamestringmimeTypestringsizeBytesintegerhoststringThe files domain the link was served from, or null for the default host.
Mund të jetë nullurlstringThe link: as it went out in the message, or as
POST /files/{id}/linkspublished it.publishedbooleanTrue for a link made with
POST /files/{id}/links. Such a link does not stop the file being deleted, and deleting the file revokes it. A link that went out in a message is false and keeps an upload from being deleted while it works.downloadsintegerFetches by a person. Scanners and link previewers are left out.
lastDownloadAtstring- Mund të jetë nullFormati
date-time revokedAtstringWhen the link stopped working, or null while it still works. An upload with a link that still works cannot be deleted.
Mund të jetë nullFormatidate-timecreatedAtstring- Formati
date-time
FileLinkListobject
objectstring- Një nga
"list" dataFileLink[]hasMorebooleanTrue when another page follows. Pass
nextCursorback ascursorto read it.nextCursorstringAn opaque cursor for the next page, or null on the last page. Pass it back unchanged.
Mund të jetë null
FileLinkRevocationobject
objectstringE detyrueshme- Një nga
"file_link_revocation" fileIdstringE detyrueshmerevokedintegerE detyrueshmeHow many links were still working and now are not. Links revoked earlier are not counted.
Të paktën 0
FileListobject
objectstring- Një nga
"list" dataFile[]hasMorebooleanTrue when another page follows. Pass
nextCursorback ascursorto read it.nextCursorstringAn opaque cursor for the next page, or null on the last page. Pass it back unchanged.
Mund të jetë null
FileStatsobject
objectstring- Një nga
"file_stats" totalsobjectEvery file counted here, however it came.
filesintegerbytesintegerTheir sizes added up.
receivedobjectFiles that came in on a message.
filesintegerbytesintegerTheir sizes added up.
sentobjectFiles that went out on a message.
filesintegerbytesintegerTheir sizes added up.
uploadedobjectFiles uploaded on the Files page or with
POST /files.filesintegerbytesintegerTheir sizes added up.
typesobject[]The 8 types taking the most bytes, largest first.
mimeTypestringfilesintegerbytesinteger
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.
daystringYYYY-MM-DD.Formatidatefilesintegerbytesinteger
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.
addressstringfilesintegerbytesinteger
linksobjectThe download links that still work.
sharesintegerHow many links.
downloadsintegerFetches by a person across all of them. Scanners and link previewers are left out.
lastDownloadAtstringThe latest fetch, or null when none was ever fetched.
Mund të jetë nullFormatidate-time