Files API
Upload, list, update and delete files, including large chunked uploads.
All endpoints need authentication unless noted.
| Method | Endpoint | Description |
|---|---|---|
POST | /api/files | Upload a file |
GET | /api/files | List your files |
PATCH | /api/files/{id} | Change visibility or password |
DELETE | /api/files/{id} | Delete a file |
GET POST DELETE | /api/files/{id}/expiry | Read, set or remove an expiry date |
GET | /api/files/{id}/download | Download a file |
GET | /api/files/{id}/ocr | Text found in an image |
GET | /api/files/shared | Files others have shared with you |
POST | /api/files/chunks | Start a large upload |
Upload a File
POST /api/files
Send the file as multipart/form-data. This is what ShareX and the other upload tools use.
| Field | Type | Description |
|---|---|---|
file | file | Required. The file to upload. |
visibility | PUBLIC or PRIVATE | Defaults to PUBLIC. Private files are only visible to you. |
password | string | Ask viewers for this password before showing the file. 8 to 72 characters. |
expiresAt | ISO 8601 date | Delete the file at this time. |
domain | string | One of your verified custom domains to use in the returned link. |
allowSuggestions | true or false | Let collaborators suggest edits to text files. |
Response:
url is the link to share. If you upload through one of your verified custom domains, or pass domain, the link uses that domain.
Errors:
| Status | When |
|---|---|
400 | No file, an invalid field, or a blocked file type |
403 | Your email isn't verified, or domain isn't one of your verified domains |
413 | The file is larger than your upload limit, or would take you over your storage quota. Use a chunked upload for big files. |
Uploads are checked for malware in the background. A file found to be malicious is removed.
Large Files
Large files upload in parts. The web uploader uses 5 MB parts.
1. Start the upload
POST /api/files/chunks
domain is optional, as for normal uploads.
Response:
2. Upload each part
PUT /api/files/chunks/{uploadId}/part/{partNumber}
Send the raw bytes of the part as the request body. Parts are numbered from 1.
Response:
Keep each part's number and etag for the last step.
Uploading straight to storage
On S3 storage you can upload parts directly to the bucket instead: GET /api/files/chunks/{uploadId}/part/{partNumber} returns a signed url to PUT the part to, and the ETag response header is the part's etag. This is faster for very large files, but the bucket must be reachable from your device.
3. Finish the upload
POST /api/files/chunks/{uploadId}/complete
expiresAt is optional. The response is the file, without the success/data wrapper:
Chunked uploads are public. Use PATCH /api/files/{id} afterwards to make one private or add a password.
List Your Files
GET /api/files
| Query | Description |
|---|---|
page | Page number, from 1. |
limit | Files per page. Defaults to 24. |
search | Match file names. |
sortBy | newest (default), oldest, largest, smallest, name, most-viewed, least-viewed or most-downloaded. |
types | Comma-separated file types, as returned by GET /api/files/types. |
visibility | public, private or hasPassword, comma-separated. |
dateFrom, dateTo | Only files uploaded in this range (ISO dates). |
squadId | List a squad's files instead of your own. You must be a member. |
Response:
size is in megabytes. Add urlPath to your instance's address to get the link.
Update a File
PATCH /api/files/{id}
Both fields are optional. Passwords must be 8 to 72 characters; set password to null to remove it. The response is the updated file, without the success/data wrapper:
Delete a File
DELETE /api/files/{id}
Deletes the file and frees the storage. Returns { "success": true }.
Expiry
GET /api/files/{id}/expiry
Returns { "success": true, "data": { "expiresAt": "..." } }, or null if the file doesn't expire.
POST /api/files/{id}/expiry
action is what happens when the file expires: DELETE (default) or SET_PRIVATE.
DELETE /api/files/{id}/expiry
Removes the expiry.
Download a File
GET /api/files/{id}/download
Downloads the file as an attachment and counts the download. Add ?password=... for password-protected files.
To show a file in a page or app instead, use its link with /raw added, for example https://embrly.ca/aB3dE/screenshot.png/raw.
Text in Images
GET /api/files/{id}/ocr
Returns the text Emberly found in an image, if any. Text is extracted in the background after upload. Add ?password=... for password-protected files.
Shared With You
GET /api/files/shared
Files other people have added you to as a collaborator. Supports page and limit.