# Check File Hash Source: https://docs.drime.cloud/api-reference/files/check-file-hash POST /file-entries/hash/check Check whether a file with a given content hash already exists (deduplication) ## Overview Checks whether the authenticated user already owns a file with the given **content hash** in a workspace. Use this before uploading to implement **instant uploads / deduplication**: if the content already exists, you can skip the upload entirely and reuse the existing entry. > [!NOTE] > > Drime stores a **SHA-256** hex digest of the file content in the `file_hash` field. The official > clients compute it at upload time and send it as `fileHash`, so the lookup only matches files > uploaded with a hash. ## Request Body **fileHash** `string` *required* SHA-256 hex digest of the file content (64 lowercase hex characters) **workspaceId** `integer` Workspace to search in. Defaults to `0` (personal space). ## Response **status** `string` Request status (`success`) **exists** `boolean` Whether a file with this content hash already exists for the current user in the workspace **entry** `object` The matching file entry object. Only present when `exists` is `true`. ```bash cURL theme={null} curl -X POST https://app.drime.cloud/api/v1/file-entries/hash/check \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "fileHash": "9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08", "workspaceId": 0 }' ``` ```javascript JavaScript theme={null} // Compute SHA-256 of a File in the browser const buffer = await file.arrayBuffer(); const digest = await crypto.subtle.digest('SHA-256', buffer); const fileHash = [...new Uint8Array(digest)] .map(b => b.toString(16).padStart(2, '0')) .join(''); const response = await fetch( 'https://app.drime.cloud/api/v1/file-entries/hash/check', { method: 'POST', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' }, body: JSON.stringify({ fileHash, workspaceId: 0 }) } ); const { exists, entry } = await response.json(); if (exists) { console.log(`Already uploaded as entry ${entry.id}, skipping upload`); } ``` ```python Python theme={null} import hashlib import requests with open('/path/to/file.pdf', 'rb') as f: file_hash = hashlib.sha256(f.read()).hexdigest() response = requests.post( 'https://app.drime.cloud/api/v1/file-entries/hash/check', headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'}, json={'fileHash': file_hash, 'workspaceId': 0} ) data = response.json() if data['exists']: print(f"Already uploaded as entry {data['entry']['id']}") ``` ```json 200 - File exists theme={null} { "status": "success", "exists": true, "entry": { "id": 485529678, "name": "document.pdf", "type": "pdf", "file_size": 1048576, "file_hash": "9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08", "workspace_id": 0 } } ``` ```json 200 - File does not exist theme={null} { "status": "success", "exists": false } ``` # Convert File Source: https://docs.drime.cloud/api-reference/files/convert-file POST /entry/convert Convert a file to a different format ## Overview Requests a server-side conversion of a file to a different format (e.g., JPEG to PNG, DOCX to PDF). ## Query Parameters **workspaceId** `integer` Workspace context ## Request Body **url** `string` *required* Source URL of the file to convert **filename** `string` *required* Original filename **outputformat** `string` *required* Desired output format (e.g., `png`, `pdf`, `jpg`) ## Response Returns the converted file or a success status depending on the conversion type. ```bash cURL theme={null} curl -X POST "https://app.drime.cloud/api/v1/entry/convert?workspaceId=0" \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "url": "https://storage.example.com/file.jpeg", "filename": "photo.jpeg", "outputformat": "png" }' ``` ```javascript JavaScript theme={null} const response = await fetch( 'https://app.drime.cloud/api/v1/entry/convert?workspaceId=0', { method: 'POST', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' }, body: JSON.stringify({ url: 'https://storage.example.com/file.jpeg', filename: 'photo.jpeg', outputformat: 'png' }) } ); const data = await response.json(); ``` ```python Python theme={null} import requests response = requests.post( 'https://app.drime.cloud/api/v1/entry/convert', params={'workspaceId': 0}, headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'}, json={ 'url': 'https://storage.example.com/file.jpeg', 'filename': 'photo.jpeg', 'outputformat': 'png' } ) print(response.json()) ``` ```json 200 - Success theme={null} { "status": "success", "fileEntry": { "id": 123456, "name": "photo.png", "type": "image", "mime": "image/png" } } ``` > [!NOTE] > > Supported conversions depend on the file type. Common conversions include image format changes and document to PDF. # Create Folder Source: https://docs.drime.cloud/api-reference/files/create-folder POST /folders Create a new folder ## Overview Creates a new folder in the specified location. ## Query Parameters **workspaceId** `integer` Workspace ID. Use `0` for personal workspace. ## Request Body **name** `string` *required* Name for the new folder **parentId** `integer` Parent folder ID. Use `null` to create in root. ## Response **folder** `object` The newly created folder object **status** `string` Request status (`success`) ```bash cURL theme={null} curl -X POST "https://app.drime.cloud/api/v1/folders?workspaceId=0" \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "name": "My New Folder", "parentId": null }' ``` ```javascript JavaScript theme={null} const response = await fetch( 'https://app.drime.cloud/api/v1/folders?workspaceId=0', { method: 'POST', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' }, body: JSON.stringify({ name: 'My New Folder', parentId: null // null = root, or specify folder ID }) } ); const { folder } = await response.json(); console.log(`Created folder: ${folder.name} (ID: ${folder.id})`); ``` ```python Python theme={null} import requests response = requests.post( 'https://app.drime.cloud/api/v1/folders', params={'workspaceId': 0}, headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'}, json={ 'name': 'My New Folder', 'parentId': None # None = root } ) folder = response.json()['folder'] print(f"Created folder: {folder['name']} (ID: {folder['id']})") ``` ```json 200 - Success theme={null} { "status": "success", "folder": { "id": 485529680, "name": "My New Folder", "type": "folder", "hash": "NDg1NTI5NjgwfA", "file_size": 0, "parent_id": null, "workspace_id": 0, "path": "485529680", "created_at": "2024-01-20T10:00:00.000000Z", "updated_at": "2024-01-20T10:00:00.000000Z" } } ``` ```json 422 - Validation Error theme={null} { "status": "error", "message": "The given data was invalid.", "errors": { "name": "The name field is required." } } ``` # Delete Entries Source: https://docs.drime.cloud/api-reference/files/delete-entries POST /file-entries/delete Move entries to trash or delete permanently ## Overview Deletes one or more file entries. By default, entries are moved to trash. Use `deleteForever: true` to permanently delete. > [!WARNING] > > Permanent deletion cannot be undone. Use with caution. ## Request Body **entryIds** `array` *required* Array of entry IDs to delete **deleteForever** `boolean` (default: false) When true, permanently delete instead of moving to trash **emptyTrash** `boolean` (default: false) When true with empty entryIds, permanently deletes all items in trash ## Response **status** `string` Request status (`success`) ```bash cURL theme={null} # Move to trash curl -X POST https://app.drime.cloud/api/v1/file-entries/delete \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "entryIds": [123, 456], "deleteForever": false }' # Permanently delete curl -X POST https://app.drime.cloud/api/v1/file-entries/delete \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "entryIds": [123, 456], "deleteForever": true }' # Empty trash curl -X POST https://app.drime.cloud/api/v1/file-entries/delete \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "entryIds": [], "emptyTrash": true }' ``` ```javascript JavaScript theme={null} // Move to trash const response = await fetch('https://app.drime.cloud/api/v1/file-entries/delete', { method: 'POST', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' }, body: JSON.stringify({ entryIds: [123, 456], deleteForever: false }) }); // Empty entire trash const emptyTrash = await fetch('https://app.drime.cloud/api/v1/file-entries/delete', { method: 'POST', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' }, body: JSON.stringify({ entryIds: [], emptyTrash: true }) }); ``` ```python Python theme={null} import requests # Move to trash response = requests.post( 'https://app.drime.cloud/api/v1/file-entries/delete', headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'}, json={ 'entryIds': [123, 456], 'deleteForever': False } ) # Empty trash response = requests.post( 'https://app.drime.cloud/api/v1/file-entries/delete', headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'}, json={ 'entryIds': [], 'emptyTrash': True } ) ``` ```json 200 - Success theme={null} { "status": "success" } ``` # Download File Source: https://docs.drime.cloud/api-reference/files/download-file GET /file-entries/download/{hash} Download a file or folder ## Overview Downloads a file by its hash. For folders, the contents are automatically zipped. > [!NOTE] > > You can pass **multiple hashes separated by commas** to download several > entries at once as a single ZIP archive. ## Path Parameters **hash** `string` *required* The file entry hash (e.g., `MzI2MHxwYWRkaQ`). Accepts several hashes separated by commas. ## Response Returns the file content with appropriate `Content-Type` and `Content-Disposition` headers. * For single files: The file is downloaded directly * For folders: A ZIP archive is created and downloaded ```bash cURL theme={null} # Download a file curl -O -J https://app.drime.cloud/api/v1/file-entries/download/MzI2MHxwYWRkaQ \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" # -O: Save with original filename # -J: Use filename from Content-Disposition header ``` ```javascript JavaScript theme={null} const hash = 'MzI2MHxwYWRkaQ'; const response = await fetch( `https://app.drime.cloud/api/v1/file-entries/download/${hash}`, { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } } ); // Get filename from Content-Disposition header const disposition = response.headers.get('Content-Disposition'); const filename = disposition?.match(/filename="(.+)"/)?.[1] || 'download'; // Download the file const blob = await response.blob(); const url = URL.createObjectURL(blob); const a = document.createElement('a'); a.href = url; a.download = filename; a.click(); URL.revokeObjectURL(url); ``` ```python Python theme={null} import requests hash = 'MzI2MHxwYWRkaQ' response = requests.get( f'https://app.drime.cloud/api/v1/file-entries/download/{hash}', headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'}, stream=True ) # Get filename from Content-Disposition header content_disposition = response.headers.get('Content-Disposition', '') filename = content_disposition.split('filename="')[1].rstrip('"') if 'filename=' in content_disposition else 'download' # Save file with open(filename, 'wb') as f: for chunk in response.iter_content(chunk_size=8192): f.write(chunk) print(f'Downloaded: {filename}') ``` ``` HTTP/1.1 200 OK Content-Type: image/jpeg Content-Disposition: attachment; filename="photo.jpg" Content-Length: 2048576 [binary file content] ``` > [!NOTE] > > For folders, the response will have `Content-Type: application/zip` and the filename will end with `.zip`. # Duplicate Entries Source: https://docs.drime.cloud/api-reference/files/duplicate-entries POST /file-entries/duplicate Create copies of files and folders ## Overview Creates duplicates of one or more file entries. The copies are created in the same location with "(copy)" appended to the name. ## Query Parameters **workspaceId** `integer` Workspace context ## Request Body **entryIds** `array` *required* Array of entry IDs to duplicate **destinationId** `integer` Optional destination folder ID. If not provided, copies are created in the same location. ## Response **entries** `array` Array of newly created duplicate entries **status** `string` Request status (`success`) ```bash cURL theme={null} curl -X POST "https://app.drime.cloud/api/v1/file-entries/duplicate?workspaceId=0" \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "entryIds": [123] }' ``` ```javascript JavaScript theme={null} const response = await fetch( 'https://app.drime.cloud/api/v1/file-entries/duplicate?workspaceId=0', { method: 'POST', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' }, body: JSON.stringify({ entryIds: [123] }) } ); const { entries } = await response.json(); console.log('Created duplicates:', entries); ``` ```python Python theme={null} import requests response = requests.post( 'https://app.drime.cloud/api/v1/file-entries/duplicate', params={'workspaceId': 0}, headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'}, json={'entryIds': [123]} ) duplicates = response.json()['entries'] ``` ```json 200 - Success theme={null} { "status": "success", "entries": [ { "id": 124, "name": "document (copy).pdf", "type": "pdf", "file_size": 1048576, "parent_id": null, "created_at": "2024-01-20T10:00:00.000000Z" } ] } ``` # Extract Archive Source: https://docs.drime.cloud/api-reference/files/extract-archive POST /file-entries/{entryId}/extract Extract contents of a ZIP archive ## Overview Extracts the contents of a ZIP archive to a specified folder. Supports password-protected archives. ## Path Parameters **entryId** `integer` *required* The ZIP file entry ID ## Query Parameters **workspaceId** `integer` Workspace context ## Request Body **parentId** `integer` *required* Destination folder ID. Use `0` for root. **password** `string` Password for encrypted archives. Use `null` for unencrypted. ## Response **message** `string` Success message **status** `string` Request status (`success`) ```bash cURL theme={null} # Extract unencrypted archive curl -X POST "https://app.drime.cloud/api/v1/file-entries/123/extract?workspaceId=0" \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "parentId": 456, "password": null }' # Extract password-protected archive curl -X POST "https://app.drime.cloud/api/v1/file-entries/123/extract?workspaceId=0" \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "parentId": 456, "password": "secretpassword" }' ``` ```javascript JavaScript theme={null} const entryId = 123; const response = await fetch( `https://app.drime.cloud/api/v1/file-entries/${entryId}/extract?workspaceId=0`, { method: 'POST', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' }, body: JSON.stringify({ parentId: 456, // destination folder password: null // or 'password' for encrypted archives }) } ); const data = await response.json(); console.log(data.message); ``` ```python Python theme={null} import requests entry_id = 123 response = requests.post( f'https://app.drime.cloud/api/v1/file-entries/{entry_id}/extract', params={'workspaceId': 0}, headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'}, json={ 'parentId': 456, 'password': None # or 'password' for encrypted } ) print(response.json()['message']) ``` ```json 200 - Success theme={null} { "message": "Archive extracted successfully.", "status": "success" } ``` ```json 422 - Invalid Archive theme={null} { "status": "error", "message": "Invalid archive or wrong password." } ``` # Get Available Name Source: https://docs.drime.cloud/api-reference/files/get-available-name POST /entry/getAvailableName Get an alternative filename when duplicates exist ## Overview When a file with the same name already exists, this endpoint suggests an alternative filename by appending a counter (e.g., "file.txt" becomes "file (1).txt"). ## Request Body **name** `string` *required* Original filename that needs an alternative **parentId** `integer` Parent folder ID where the file will be uploaded. Use `null` for root. **workspaceId** `integer` Workspace ID ## Response **name** `string` Suggested alternative filename with counter ```bash cURL theme={null} curl -X POST https://app.drime.cloud/api/v1/entry/getAvailableName \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "name": "report.pdf", "parentId": null, "workspaceId": 0 }' ``` ```javascript JavaScript theme={null} const response = await fetch('https://app.drime.cloud/api/v1/entry/getAvailableName', { method: 'POST', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' }, body: JSON.stringify({ name: 'report.pdf', parentId: null, workspaceId: 0 }) }); const { name } = await response.json(); console.log(`Use filename: ${name}`); // "report (1).pdf" ``` ```python Python theme={null} import requests response = requests.post( 'https://app.drime.cloud/api/v1/entry/getAvailableName', headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'}, json={ 'name': 'report.pdf', 'parentId': None, 'workspaceId': 0 } ) new_name = response.json()['name'] print(f'Use filename: {new_name}') # "report (1).pdf" ``` ```json 200 - First duplicate theme={null} { "name": "report (1).pdf" } ``` ```json 200 - Second duplicate theme={null} { "name": "report (2).pdf" } ``` > [!TIP] > > Use this in conjunction with `/uploads/validate` to handle duplicate files gracefully. # Get File Backup History Source: https://docs.drime.cloud/api-reference/files/get-file-backup GET /file-backup Get version history for a file ## Overview Returns backup/version history for a given file. Shows previous versions that can be restored. ## Query Parameters **file\_id** `integer` *required* File entry ID **workspaceId** `integer` Workspace ID **perPage** `integer` (default: 15) Items per page ## Response **pagination** `object` Paginated list of backup versions **Pagination properties** **data** `array` Array of backup entries **current\_page** `integer` Current page number **total** `integer` Total number of backups **status** `string` Request status (`success`) ```bash cURL theme={null} curl "https://app.drime.cloud/api/v1/file-backup?file_id=123&workspaceId=0" \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" ``` ```javascript JavaScript theme={null} const fileId = 123; const response = await fetch( `https://app.drime.cloud/api/v1/file-backup?file_id=${fileId}&workspaceId=0`, { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } } ); const { pagination } = await response.json(); const backups = pagination.data; ``` ```python Python theme={null} import requests response = requests.get( 'https://app.drime.cloud/api/v1/file-backup', params={'file_id': 123, 'workspaceId': 0}, headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'} ) backups = response.json()['pagination']['data'] ``` ```json 200 - Success (with backups) theme={null} { "pagination": { "current_page": 1, "data": [ { "id": 456, "name": "document_backup_20240115.pdf", "file_size": 1048576, "created_at": "2024-01-15T10:30:00.000000Z" } ], "total": 1, "per_page": 15 }, "status": "success" } ``` ```json 200 - Success (no backups) theme={null} { "pagination": { "current_page": 1, "data": [], "total": 0, "per_page": 15 }, "status": "success" } ``` # List File Entries Source: https://docs.drime.cloud/api-reference/files/get-file-entries GET /drive/file-entries Get a list of files and folders ## Overview Returns a paginated list of file entries (files and folders) that the user has access to. Supports filtering, searching, and sorting. ## Query Parameters **workspaceId** `integer` (default: 0) Workspace ID. Use `0` for personal workspace. **perPage** `integer` (default: 50) Number of entries per page **page** `integer` (default: 1) Page number (1-indexed) **parentIds** `array` Filter to entries that are children of specified folder IDs **folderId** `string` Display files in specified folder (by hash) **query** `string` Search query to filter entry names **type** `string` Filter by file type: `folder`, `image`, `text`, `audio`, `video`, `pdf` **deletedOnly** `boolean` Return only trashed entries **starredOnly** `boolean` Return only starred entries **recentOnly** `boolean` Return only recently accessed entries **sharedOnly** `boolean` Return only entries shared with you **orderBy** `string` (default: updated\_at) Sort field: `updated_at`, `created_at`, `name`, `file_size` **orderDir** `string` (default: desc) Sort direction: `asc` or `desc` ## Response **data** `array` Array of file entry objects **folder** `object` Current folder info (null if listing root) **current\_page** `integer` Current page number **last\_page** `integer` Total number of pages **total** `integer` Total number of entries ```bash cURL theme={null} curl "https://app.drime.cloud/api/v1/drive/file-entries?workspaceId=0&perPage=50" \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" ``` ```javascript JavaScript theme={null} const params = new URLSearchParams({ workspaceId: 0, perPage: 50, orderBy: 'name', orderDir: 'asc' }); const response = await fetch( `https://app.drime.cloud/api/v1/drive/file-entries?${params}`, { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } } ); const { data: files, total } = await response.json(); console.log(`Found ${total} files`); ``` ```python Python theme={null} import requests response = requests.get( 'https://app.drime.cloud/api/v1/drive/file-entries', params={ 'workspaceId': 0, 'perPage': 50, 'orderBy': 'name', 'orderDir': 'asc' }, headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'} ) data = response.json() files = data['data'] print(f"Found {data['total']} files") ``` ```json 200 - Success theme={null} { "data": [ { "id": 485529677, "name": "My Documents", "type": "folder", "hash": "NDg1NTI5Njc3fA", "file_size": 0, "parent_id": null, "workspace_id": 0, "created_at": "2024-01-15T10:30:00.000000Z", "updated_at": "2024-01-15T10:30:00.000000Z" }, { "id": 485529678, "name": "photo.jpg", "type": "image", "hash": "NDg1NTI5Njc4fA", "file_size": 2048576, "mime": "image/jpeg", "extension": "jpg", "parent_id": null, "workspace_id": 0, "created_at": "2024-01-14T08:20:00.000000Z", "updated_at": "2024-01-14T08:20:00.000000Z" } ], "folder": null, "current_page": 1, "last_page": 1, "per_page": 50, "total": 2, "from": 1, "to": 2 } ``` # Get File Entry Source: https://docs.drime.cloud/api-reference/files/get-file-entry GET /file-entries/{entryId}/model Get details for a specific file or folder ## Overview Returns detailed information about a specific file or folder entry, as JSON. > [!NOTE] > > Mind the `/model` suffix. `GET /file-entries/{entryId}` without it returns the file's > **content**, not its details. To download a file, see [Download File](/api-reference/files/download-file). ## Path Parameters **entryId** `integer` *required* The file entry ID ## Query Parameters **workspaceId** `integer` Workspace context ## Response **fileEntry** `object` The file entry object with all details **FileEntry properties** **id** `integer` Unique entry identifier **name** `string` File or folder name **type** `string` Entry type, for example `folder`, `image`, `file`, `text`, `audio`, `video`, `pdf` **hash** `string` URL-safe encoded identifier, used in share links and download URLs. This is **not** a hash of the file content (see `file_hash`). **file\_hash** `string` Hex digest of the file content, when available. Until [Verify File Integrity](/api-reference/files/verify-file-integrity) has run on the entry, it is not computed by Drime from the stored bytes: it is the hash the client declared at upload time (`fileHash` body param), or `null` if none was declared. A file whose content was replaced in place by the desktop sync holds an MD5 (32 characters) instead. After Verify File Integrity it is always the SHA-256 of the stored bytes. **file\_size** `integer` File size in bytes (0 for folders) **mime** `string` MIME type of the file **extension** `string` File extension **parent\_id** `integer` Parent folder ID (null for root) **workspace\_id** `integer` Workspace ID **url** `string` Relative URL of the file's content (`api/v1/file-entries/{id}`). `null` for folders. **thumbnail\_url** `string` Signed URL of the thumbnail, valid for 7 days. `null` when the file has no thumbnail. **created\_at** `string` When the entry was created in Drime (ISO 8601, UTC) **updated\_at** `string` Last server-side modification: rename, move, content replace (ISO 8601, UTC) **client\_last\_modified** `integer` Original modification time of the file on the client machine, as a Unix epoch in **milliseconds**. Set at upload time (`lastModified` body param) or via [Set File Metadata](/api-reference/files/set-file-metadata). `null` if never provided. **captured\_at** `string` EXIF capture date for photos and videos (ISO 8601, UTC). Drives the photo timeline. **status** `string` Request status (`success`) ```bash cURL theme={null} curl https://app.drime.cloud/api/v1/file-entries/485529678/model \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" ``` ```javascript JavaScript theme={null} const entryId = 485529678; const response = await fetch( `https://app.drime.cloud/api/v1/file-entries/${entryId}/model`, { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } } ); const { fileEntry } = await response.json(); ``` ```python Python theme={null} import requests entry_id = 485529678 response = requests.get( f'https://app.drime.cloud/api/v1/file-entries/{entry_id}/model', headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'} ) file_entry = response.json()['fileEntry'] ``` ```json 200 - Success theme={null} { "status": "success", "fileEntry": { "id": 485529678, "name": "photo.jpg", "type": "image", "hash": "NDg1NTI5Njc4fA", "file_hash": "9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08", "file_size": 2048576, "mime": "image/jpeg", "extension": "jpg", "parent_id": null, "workspace_id": 0, "url": "api/v1/file-entries/485529678", "thumbnail_url": "https://storage.example.com/485529678/thumbnail.jpg?X-Amz-Expires=604800&X-Amz-Signature=...", "created_at": "2024-01-14T08:20:00.000000Z", "updated_at": "2024-01-14T08:20:00.000000Z", "client_last_modified": 1705220400000, "captured_at": "2024-01-13T17:45:12.000000Z" } } ``` # Get File Tags Source: https://docs.drime.cloud/api-reference/files/get-file-tags GET /file-entry-tags Search or list file tags ## Overview Returns tags that can be applied to file entries, optionally filtered by a search query. Useful for autocomplete functionality. ## Query Parameters **query** `string` Search query to filter tags ## Response **tags** `array` Array of tag objects **Tag properties** **id** `integer` Tag ID **name** `string` Tag name ```bash cURL theme={null} curl "https://app.drime.cloud/api/v1/file-entry-tags?query=project" \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" ``` ```javascript JavaScript theme={null} const response = await fetch( 'https://app.drime.cloud/api/v1/file-entry-tags?query=project', { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } } ); const { tags } = await response.json(); ``` ```python Python theme={null} import requests response = requests.get( 'https://app.drime.cloud/api/v1/file-entry-tags', params={'query': 'project'}, headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'} ) tags = response.json()['tags'] ``` ```json 200 - Success theme={null} { "tags": [ { "id": 1, "name": "project-alpha" }, { "id": 2, "name": "project-beta" }, { "id": 3, "name": "starred" } ] } ``` # Get Folder Count Source: https://docs.drime.cloud/api-reference/files/get-folder-count GET /folders/{folderId}/count Get the number of items in a folder ## Overview Returns the total count of items (files and subfolders) in a specific folder. ## Path Parameters **folderId** `integer` *required* The folder ID ## Response **count** `integer` Number of items in the folder ```bash cURL theme={null} curl https://app.drime.cloud/api/v1/folders/123/count \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" ``` ```javascript JavaScript theme={null} const folderId = 123; const response = await fetch( `https://app.drime.cloud/api/v1/folders/${folderId}/count`, { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } } ); const { count } = await response.json(); console.log(`Folder contains ${count} items`); ``` ```python Python theme={null} import requests folder_id = 123 response = requests.get( f'https://app.drime.cloud/api/v1/folders/{folder_id}/count', headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'} ) count = response.json()['count'] print(f'Folder contains {count} items') ``` ```json 200 - Success theme={null} { "count": 16 } ``` ```json 404 - Not Found theme={null} { "message": "No query results for model [App\\Folder] 111344" } ``` # Get Folder Path Source: https://docs.drime.cloud/api-reference/files/get-folder-path GET /folders/{folderHash}/path Get the breadcrumb path for a folder ## Overview Returns the folder hierarchy path (breadcrumbs) from root to the specified folder. Useful for navigation UI. ## Path Parameters **folderHash** `string` *required* The folder hash ## Query Parameters **vaultId** `integer` Optional vault ID for encrypted folders ## Response **path** `array` Array of folder objects from root to target **status** `string` Request status (`success`) ```bash cURL theme={null} curl https://app.drime.cloud/api/v1/folders/MTExMzQ0fHBhZA/path \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" ``` ```javascript JavaScript theme={null} const folderHash = 'MTExMzQ0fHBhZA'; const response = await fetch( `https://app.drime.cloud/api/v1/folders/${folderHash}/path`, { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } } ); const { path } = await response.json(); // Build breadcrumb string const breadcrumb = path.map(f => f.name).join(' / '); console.log(breadcrumb); // "Documents / Projects / 2024" ``` ```python Python theme={null} import requests folder_hash = 'MTExMzQ0fHBhZA' response = requests.get( f'https://app.drime.cloud/api/v1/folders/{folder_hash}/path', headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'} ) path = response.json()['path'] breadcrumb = ' / '.join(f['name'] for f in path) print(breadcrumb) ``` ```json 200 - Success theme={null} { "path": [ { "id": 111344, "name": "Documents", "type": "folder", "path": "111344", "hash": "MTExMzQ0fHBhZA" }, { "id": 111345, "name": "Projects", "type": "folder", "path": "111344/111345", "hash": "MTExMzQ1fHBhZA" }, { "id": 111346, "name": "2024", "type": "folder", "path": "111344/111345/111346", "hash": "MTExMzQ2fHBhZA" } ], "status": "success" } ``` # Get User Folders Source: https://docs.drime.cloud/api-reference/files/get-user-folders GET /users/{userId}/folders Get folder tree for a user ## Overview Returns the folder structure for a user, useful for building folder tree navigation. ## Path Parameters **userId** `integer` *required* The user ID ## Query Parameters **workspaceId** `integer` Filter by workspace. Use `0` for personal workspace. **vault** `integer` Set to `1` to return only vault (encrypted) folders ## Response **folders** `array` Array of folder objects **rootFolder** `object` Root folder information **status** `string` Request status (`success`) ```bash cURL theme={null} curl "https://app.drime.cloud/api/v1/users/15843/folders?workspaceId=0" \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" ``` ```javascript JavaScript theme={null} const userId = 15843; const response = await fetch( `https://app.drime.cloud/api/v1/users/${userId}/folders?workspaceId=0`, { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } } ); const { folders, rootFolder } = await response.json(); ``` ```python Python theme={null} import requests user_id = 15843 response = requests.get( f'https://app.drime.cloud/api/v1/users/{user_id}/folders', params={'workspaceId': 0}, headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'} ) data = response.json() folders = data['folders'] root = data['rootFolder'] ``` ```json 200 - Success theme={null} { "folders": [ { "id": 111344, "name": "Documents", "parent_id": null, "path": "111344", "type": "folder", "workspace_id": 0, "permissions": { "files.update": true, "files.create": true, "files.download": true, "files.delete": true }, "hash": "MTExMzQ0fHBhZA" }, { "id": 111345, "name": "Photos", "parent_id": null, "path": "111345", "type": "folder", "workspace_id": 0 } ], "rootFolder": { "type": "folder", "id": 0, "hash": "0", "path": "", "name": "All Files", "workspace_id": 0 }, "status": "success" } ``` # Move Entries Source: https://docs.drime.cloud/api-reference/files/move-entries POST /file-entries/move Move files and folders to a different location ## Overview Moves one or more file entries to a different folder. ## Query Parameters **workspaceId** `integer` Workspace context ## Request Body **entryIds** `array` *required* Array of entry IDs to move **destinationId** `integer` Destination folder ID. Use `null` to move to root. ## Response **entries** `array` Array of moved file entry objects **status** `string` Request status (`success`) ```bash cURL theme={null} curl -X POST "https://app.drime.cloud/api/v1/file-entries/move?workspaceId=0" \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "entryIds": [123, 456], "destinationId": 789 }' ``` ```javascript JavaScript theme={null} const response = await fetch( 'https://app.drime.cloud/api/v1/file-entries/move?workspaceId=0', { method: 'POST', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' }, body: JSON.stringify({ entryIds: [123, 456], destinationId: 789 // folder ID, or null for root }) } ); const { entries } = await response.json(); ``` ```python Python theme={null} import requests response = requests.post( 'https://app.drime.cloud/api/v1/file-entries/move', params={'workspaceId': 0}, headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'}, json={ 'entryIds': [123, 456], 'destinationId': 789 # folder ID, or None for root } ) entries = response.json()['entries'] ``` ```json 200 - Success theme={null} { "status": "success", "entries": [ { "id": 123, "name": "document.pdf", "parent_id": 789, "updated_at": "2024-01-20T10:00:00.000000Z" }, { "id": 456, "name": "photo.jpg", "parent_id": 789, "updated_at": "2024-01-20T10:00:00.000000Z" } ] } ``` # Restore Entries Source: https://docs.drime.cloud/api-reference/files/restore-entries POST /file-entries/restore Restore files from trash ## Overview Restores one or more file entries from trash back to their original location. ## Request Body **entryIds** `array` *required* Array of entry IDs to restore ## Response **status** `string` Request status (`success`) ```bash cURL theme={null} curl -X POST https://app.drime.cloud/api/v1/file-entries/restore \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "entryIds": [123, 456] }' ``` ```javascript JavaScript theme={null} const response = await fetch('https://app.drime.cloud/api/v1/file-entries/restore', { method: 'POST', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' }, body: JSON.stringify({ entryIds: [123, 456] }) }); const data = await response.json(); ``` ```python Python theme={null} import requests response = requests.post( 'https://app.drime.cloud/api/v1/file-entries/restore', headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'}, json={'entryIds': [123, 456]} ) print(response.json()) ``` ```json 200 - Success theme={null} { "status": "success" } ``` > [!TIP] > > To get a list of trashed files, use the `/drive/file-entries` endpoint with `deletedOnly=true`. # Set File Metadata Source: https://docs.drime.cloud/api-reference/files/set-file-metadata POST /file-entries/{entryId}/metadata Set the original modification time (SetModTime), EXIF data or Live Photo link of a file ## Overview Updates metadata on an existing file **without re-uploading its content**. This is the endpoint to use when you need to: * **Preserve the original modification time** of a file after upload (equivalent to rclone's `SetModTime`) * Attach or merge **EXIF data** after the file content has been uploaded * Link an iOS **Live Photo** to its video counterpart > [!NOTE] > > At least one of `lastModified` or `exifData` must be provided, otherwise the request fails with a `422` error. ## Path Parameters **entryId** `integer` *required* The **numeric** file entry ID. Entry hashes are not accepted on this endpoint. ## Request Body **lastModified** `integer` Original client-side modification time as a **Unix epoch in milliseconds** (e.g. `1712345678000`). Stored in the entry's `client_last_modified` field and merged into its EXIF data. > [!WARNING] > > Milliseconds, not seconds. `1712345678` (seconds) would be interpreted as January 1970. **exifData** `string | object` EXIF metadata to merge into the entry. Accepts either: * A **base64-encoded JSON** string * A raw **JSON string** * A plain **JSON object** Existing EXIF keys are preserved; provided keys overwrite matching ones. If the merged EXIF contains a capture date, the entry's `captured_at` (used by the photo timeline) is updated too. **livePhotoCID** `string` Apple Live Photo content identifier. Only stored if the entry does not already have one. ## Response **status** `string` Request status (`success`) **updated** `boolean` `true` when the metadata was stored ```bash cURL theme={null} curl -X POST https://app.drime.cloud/api/v1/file-entries/485529678/metadata \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "lastModified": 1712345678000 }' ``` ```javascript JavaScript theme={null} const entryId = 485529678; // Preserve the file original mtime after upload const response = await fetch( `https://app.drime.cloud/api/v1/file-entries/${entryId}/metadata`, { method: 'POST', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' }, body: JSON.stringify({ lastModified: file.lastModified // ms epoch from the File API }) } ); const { updated } = await response.json(); ``` ```python Python theme={null} import os import requests entry_id = 485529678 path = '/path/to/local/file.pdf' # os.path.getmtime returns seconds - convert to milliseconds mtime_ms = int(os.path.getmtime(path) * 1000) response = requests.post( f'https://app.drime.cloud/api/v1/file-entries/{entry_id}/metadata', headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'}, json={'lastModified': mtime_ms} ) print(response.json()) # {'status': 'success', 'updated': True} ``` ```json 200 - Success theme={null} { "status": "success", "updated": true } ``` ```json 422 - No metadata provided theme={null} { "status": "error", "message": "No metadata provided" } ``` ```json 404 - Entry not found theme={null} { "message": "No query results for model [FileEntry] 999999999" } ``` > [!TIP] > > You can also set `lastModified` **directly at upload time** by including it in the > [Upload File](/api-reference/uploads/upload-file) or [Create S3 Entry](/api-reference/uploads/create-s3-entry) > request body. Use this endpoint when the file already exists, or to fix timestamps after the fact. # Update File Entry Source: https://docs.drime.cloud/api-reference/files/update-file-entry PUT /file-entries/{entryId} Rename or update file/folder details ## Overview Updates the name or description of a file or folder. > [!NOTE] > > Updating an entry bumps its `updated_at` timestamp. To set the file's original > **modification time** (`client_last_modified`) or EXIF data without touching the content, > use [Set File Metadata](/api-reference/files/set-file-metadata) instead. ## Path Parameters **entryId** `integer` *required* The file entry ID to update ## Query Parameters **workspaceId** `integer` Workspace context ## Request Body **name** `string` New name for the entry **description** `string` New description for the entry ## Response **fileEntry** `object` The updated file entry object **status** `string` Request status (`success`) ```bash cURL theme={null} curl -X PUT https://app.drime.cloud/api/v1/file-entries/485529678 \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "name": "vacation-photo.jpg", "description": "Beach sunset from our trip" }' ``` ```javascript JavaScript theme={null} const entryId = 485529678; const response = await fetch( `https://app.drime.cloud/api/v1/file-entries/${entryId}`, { method: 'PUT', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' }, body: JSON.stringify({ name: 'vacation-photo.jpg', description: 'Beach sunset from our trip' }) } ); const { fileEntry } = await response.json(); ``` ```python Python theme={null} import requests entry_id = 485529678 response = requests.put( f'https://app.drime.cloud/api/v1/file-entries/{entry_id}', headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'}, json={ 'name': 'vacation-photo.jpg', 'description': 'Beach sunset from our trip' } ) file_entry = response.json()['fileEntry'] ``` ```json 200 - Success theme={null} { "status": "success", "fileEntry": { "id": 485529678, "name": "vacation-photo.jpg", "description": "Beach sunset from our trip", "type": "image", "updated_at": "2024-01-20T15:30:00.000000Z" } } ``` # Verify File Integrity Source: https://docs.drime.cloud/api-reference/files/verify-file-integrity POST /file-entries/{entryId}/verify-integrity Verify that the stored file content matches a SHA-256 hash ## Overview Asks the server to recompute the **SHA-256** hash of the stored file content and compare it against the hash you provide. Use this after an upload to confirm the file was stored without corruption, end to end. The server streams the stored object in 2 MB chunks, so this works for large files without loading them in memory. Once the file has been read, the computed SHA-256 is saved to the entry's `file_hash` field on that first call, whether or not it matches the hash you sent. It replaces any value stored before. > [!NOTE] > > Anyone allowed to download the file can call this endpoint: its owner, people it is shared with > when the share allows downloading, and members of the workspace it belongs to (unless a folder > restriction hides it from them). Other users receive a `403` error. ## Path Parameters **entryId** `integer` *required* The numeric file entry ID ## Request Body **sha256** `string` *required* Expected SHA-256 hex digest of the file content (exactly 64 characters, case-insensitive) ## Response **status** `string` Request status (`success`) **verified** `boolean` `true` when the stored content matches the provided hash **serverHash** `string` SHA-256 computed by the server from the stored content. Omitted when the file could not be read. **reason** `string` Only present when the file could not be read: `not_a_file` (a folder), `file_not_found` or `read_failed` ```bash cURL theme={null} curl -X POST https://app.drime.cloud/api/v1/file-entries/485529678/verify-integrity \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "sha256": "9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08" }' ``` ```javascript JavaScript theme={null} const entryId = 485529678; const response = await fetch( `https://app.drime.cloud/api/v1/file-entries/${entryId}/verify-integrity`, { method: 'POST', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' }, body: JSON.stringify({ sha256: localFileHash // computed before upload }) } ); const { verified, serverHash } = await response.json(); if (!verified) { console.error(`Integrity check failed, server has ${serverHash}`); } ``` ```python Python theme={null} import hashlib import requests entry_id = 485529678 with open('/path/to/file.pdf', 'rb') as f: local_hash = hashlib.sha256(f.read()).hexdigest() response = requests.post( f'https://app.drime.cloud/api/v1/file-entries/{entry_id}/verify-integrity', headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'}, json={'sha256': local_hash} ) result = response.json() print('OK' if result['verified'] else f"MISMATCH: server={result['serverHash']}") ``` ```json 200 - Verified theme={null} { "status": "success", "verified": true, "serverHash": "9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08" } ``` ```json 200 - Mismatch theme={null} { "status": "success", "verified": false, "serverHash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" } ``` ```json 403 - No download access theme={null} { "message": "This action is unauthorized." } ``` > [!TIP] > > For large files, computing the SHA-256 on the server means reading the whole object from storage. > Prefer calling this once after upload rather than on every sync pass; afterwards you can rely on > the `file_hash` field returned by [Get File Entry](/api-reference/files/get-file-entry). # API Reference Source: https://docs.drime.cloud/api-reference/introduction Complete reference for the Drime Cloud API ## Base URL All API endpoints are relative to: ``` https://app.drime.cloud/api/v1 ``` ## Authentication All requests require a Bearer token in the `Authorization` header: ```bash theme={null} Authorization: Bearer YOUR_ACCESS_TOKEN ``` > **[Learn more about authentication](/authentication)** > > Personal access tokens for your own tools, OAuth for applications other people use ## Response Format All responses are returned in JSON format with a consistent structure: ### Success Response ```json theme={null} { "status": "success", "data": { ... } } ``` ### Error Response ```json theme={null} { "status": "error", "message": "Description of the error", "errors": { "field_name": "Specific error message" } } ``` ## HTTP Status Codes | Code | Description | | - | - | | `200` | Success | | `201` | Created | | `400` | Bad Request | | `401` | Unauthorized - Invalid or missing token | | `403` | Forbidden - Insufficient permissions | | `404` | Not Found | | `422` | Validation Error | | `500` | Server Error | ## Pagination List endpoints support pagination with these parameters: | Parameter | Type | Default | Description | | - | - | - | - | | `page` | integer | 1 | Page number | | `perPage` | integer | 50 | Items per page | Paginated responses include: ```json theme={null} { "data": [...], "current_page": 1, "last_page": 5, "per_page": 50, "total": 234, "from": 1, "to": 50 } ``` ## Workspace Context Many endpoints accept a `workspaceId` parameter: * Use `0` for your personal/default workspace * Use a specific workspace ID for team workspaces ```bash theme={null} GET /drive/file-entries?workspaceId=0 ``` ## Rate Limiting The API implements rate limiting to ensure fair usage. If you exceed the limit, you'll receive a `429 Too Many Requests` response. > [!TIP] > > If you need higher rate limits for your application, contact our support team. ## API Categories > **[Authentication](/authentication)** > > Personal access tokens and OAuth applications > **[Files & Folders](/api-reference/files/get-file-entries)** > > Browse, create, and manage files > **[Uploads](/api-reference/uploads/upload-file)** > > Upload files to the cloud > **[Sharing](/api-reference/sharing/share-entry)** > > Share files with others > **[Vault](/api-reference/vault/get-vault)** > > Encrypted storage > **[Workspaces](/api-reference/user/get-workspaces)** > > Team collaboration # Create Shareable Link Source: https://docs.drime.cloud/api-reference/links/create-shareable-link POST /file-entries/{entryId}/shareable-link Create a shareable link for an entry ## Overview Creates a new shareable link for a file or folder. Anyone with the link can access the file based on the permissions you set. ## Path Parameters **entryId** `integer` *required* ID or hash of the file entry ## Request Body **password** `string` Optional password protection **expires\_at** `string` Optional expiration date (ISO 8601 format) **allow\_edit** `boolean` (default: false) Allow editing via the link **allow\_download** `boolean` (default: false) Allow downloading via the link ## Response **link** `object` The created shareable link object **status** `string` Request status (`success`) ```bash cURL theme={null} curl -X POST https://app.drime.cloud/api/v1/file-entries/123456/shareable-link \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "password": "secret123", "expires_at": "2024-03-01T00:00:00.000000Z", "allow_download": true, "allow_edit": false }' ``` ```javascript JavaScript theme={null} const response = await fetch('https://app.drime.cloud/api/v1/file-entries/123456/shareable-link', { method: 'POST', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' }, body: JSON.stringify({ allow_download: true, allow_edit: false }) }); const { link } = await response.json(); const shareUrl = `https://app.drime.cloud/drive/shares/${link.hash}`; console.log('Share URL:', shareUrl); ``` ```python Python theme={null} import requests from datetime import datetime, timedelta # Create link expiring in 7 days expires = (datetime.now() + timedelta(days=7)).isoformat() response = requests.post( 'https://app.drime.cloud/api/v1/file-entries/123456/shareable-link', headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'}, json={ 'expires_at': expires, 'allow_download': True, 'allow_edit': False } ) link = response.json()['link'] print(f"Share URL: https://app.drime.cloud/drive/shares/{link['hash']}") ``` ```json 200 - Success theme={null} { "status": "success", "link": { "id": 789, "hash": "3h8N1nxZq7WtyRmXDIosFupSl9MCrD", "user_id": 15843, "entry_id": 123456, "password": "$2y$10$BI8kz6zFeB0CA...", "expires_at": "2024-03-01T00:00:00.000000Z", "allow_edit": false, "allow_download": true } } ``` > [!NOTE] > > The share URL format is: `https://app.drime.cloud/drive/shares/{hash}` # Delete Shareable Link Source: https://docs.drime.cloud/api-reference/links/delete-shareable-link DELETE /file-entries/{entryId}/shareable-link Delete a shareable link ## Overview Deletes a shareable link, revoking access for anyone who had the link. ## Path Parameters **entryId** `integer` *required* ID or hash of the file entry ## Response **status** `string` Request status (`success`) ```bash cURL theme={null} curl -X DELETE https://app.drime.cloud/api/v1/file-entries/123456/shareable-link \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" ``` ```javascript JavaScript theme={null} const response = await fetch('https://app.drime.cloud/api/v1/file-entries/123456/shareable-link', { method: 'DELETE', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }); console.log('Link deleted'); ``` ```python Python theme={null} import requests response = requests.delete( 'https://app.drime.cloud/api/v1/file-entries/123456/shareable-link', headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'} ) print('Link deleted') ``` ```json 200 - Success theme={null} { "status": "success" } ``` > [!WARNING] > > Deleting a link immediately revokes access. Anyone with the old link will no longer be able to access the file. # Get Shareable Link Source: https://docs.drime.cloud/api-reference/links/get-shareable-link GET /file-entries/{entryId}/shareable-link Get the shareable link for an entry ## Overview Retrieves the shareable link for a file or folder, if one exists. ## Path Parameters **entryId** `integer` *required* ID or hash of the file entry ## Response **link** `object` The shareable link object **Link properties** **id** `integer` Link ID **hash** `string` Unique hash for the shareable URL **password** `string` Hashed password (if set) **expires\_at** `string` Expiration date (if set) **allow\_edit** `boolean` Whether editing is allowed **allow\_download** `boolean` Whether download is allowed **folderChildren** `array` If the link is for a folder, lists immediate children **status** `string` Request status (`success`) ```bash cURL theme={null} curl -X GET https://app.drime.cloud/api/v1/file-entries/123456/shareable-link \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" ``` ```javascript JavaScript theme={null} const response = await fetch('https://app.drime.cloud/api/v1/file-entries/123456/shareable-link', { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }); const { link } = await response.json(); if (link) { const shareUrl = `https://app.drime.cloud/drive/shares/${link.hash}`; console.log('Share URL:', shareUrl); } ``` ```python Python theme={null} import requests response = requests.get( 'https://app.drime.cloud/api/v1/file-entries/123456/shareable-link', headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'} ) link = response.json().get('link') if link: print(f"Share URL: https://app.drime.cloud/drive/shares/{link['hash']}") ``` ```json 200 - Success theme={null} { "status": "success", "link": { "id": 789, "hash": "3h8N1nxZq7WtyRmXDIosFupSl9MCrD", "user_id": 15843, "entry_id": 123456, "expires_at": null, "allow_edit": false, "allow_download": true }, "folderChildren": [] } ``` ```json 404 - Not Found theme={null} { "message": "Shareable link not found" } ``` # Update Shareable Link Source: https://docs.drime.cloud/api-reference/links/update-shareable-link PUT /file-entries/{entryId}/shareable-link Update shareable link settings ## Overview Updates the settings of an existing shareable link. ## Path Parameters **entryId** `integer` *required* ID or hash of the file entry ## Request Body **password** `string` New password (or remove by setting to null) **expiresAt** `string` New expiration date (ISO 8601 format) **allowEdit** `boolean` Allow editing via the link **allowDownload** `boolean` Allow downloading via the link ## Response **link** `object` The updated shareable link object **status** `string` Request status (`success`) ```bash cURL theme={null} curl -X PUT https://app.drime.cloud/api/v1/file-entries/123456/shareable-link \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "password": "newpassword", "allowDownload": true }' ``` ```javascript JavaScript theme={null} const response = await fetch('https://app.drime.cloud/api/v1/file-entries/123456/shareable-link', { method: 'PUT', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' }, body: JSON.stringify({ allowDownload: true, allowEdit: false }) }); const { link } = await response.json(); console.log('Link updated'); ``` ```python Python theme={null} import requests response = requests.put( 'https://app.drime.cloud/api/v1/file-entries/123456/shareable-link', headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'}, json={ 'allowDownload': True, 'allowEdit': False } ) print('Link updated') ``` ```json 200 - Success theme={null} { "status": "success", "link": { "id": 789, "hash": "3h8N1nxZq7WtyRmXDIosFupSl9MCrD", "user_id": 15843, "entry_id": 123456, "allow_edit": false, "allow_download": true } } ``` # Abort Multipart Upload Source: https://docs.drime.cloud/api-reference/multipart/abort-multipart POST /s3/multipart/abort Cancel an in-progress multipart upload ## Overview Cancels an in-progress multipart upload and cleans up any uploaded parts from storage. Use this when an upload fails or is cancelled by the user. ## Request Body **key** `string` *required* S3 key from `createMultipartUpload` **uploadId** `string` *required* Upload ID from `createMultipartUpload` ## Response **status** `string` Request status (`success`) ```bash cURL theme={null} curl -X POST https://app.drime.cloud/api/v1/s3/multipart/abort \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "key": "uploads/1e4cbca8.../1e4cbca8...", "uploadId": "AFNhWKh6Cn6f..." }' ``` ```javascript JavaScript theme={null} // Cancel the upload const response = await fetch('https://app.drime.cloud/api/v1/s3/multipart/abort', { method: 'POST', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' }, body: JSON.stringify({ key, uploadId }) }); console.log('Upload cancelled'); ``` ```python Python theme={null} import requests response = requests.post( 'https://app.drime.cloud/api/v1/s3/multipart/abort', headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'}, json={ 'key': key, 'uploadId': upload_id } ) print('Upload cancelled') ``` ```json 200 - Success theme={null} { "status": "success" } ``` > [!NOTE] > > Always abort failed uploads to free up storage space and avoid orphaned parts. # Complete Multipart Upload Source: https://docs.drime.cloud/api-reference/multipart/complete-multipart POST /s3/multipart/complete Finalize a multipart upload ## Overview Completes a multipart upload by assembling all uploaded parts. After this, call `/s3/entries` to register the file in Drime. ## Request Body **key** `string` *required* S3 key from `createMultipartUpload` **uploadId** `string` *required* Upload ID from `createMultipartUpload` **parts** `array` *required* Array of uploaded parts with their ETags **Part object properties** **PartNumber** `integer` *required* Part number (1-indexed) **ETag** `string` *required* ETag from S3 upload response (must include quotes) ## Response **location** `string` Final S3 location of the assembled file **status** `string` Request status (`success`) ```bash cURL theme={null} curl -X POST https://app.drime.cloud/api/v1/s3/multipart/complete \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "key": "uploads/1e4cbca8.../1e4cbca8...", "uploadId": "AFNhWKh6Cn6f...", "parts": [ {"PartNumber": 1, "ETag": "\"22b1d5721320f9da081e4987f0e0ce65\""}, {"PartNumber": 2, "ETag": "\"479df46a73824ca1a5e44efe64d3dbb7\""} ] }' ``` ```javascript JavaScript theme={null} // After uploading all parts... const response = await fetch('https://app.drime.cloud/api/v1/s3/multipart/complete', { method: 'POST', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' }, body: JSON.stringify({ key, uploadId, parts: uploadedParts // Array of { PartNumber, ETag } }) }); const { location } = await response.json(); console.log('Upload complete:', location); // Now register the file with /s3/entries ``` ```python Python theme={null} import requests response = requests.post( 'https://app.drime.cloud/api/v1/s3/multipart/complete', headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'}, json={ 'key': key, 'uploadId': upload_id, 'parts': [ {'PartNumber': 1, 'ETag': '"22b1d5721320f9da081e4987f0e0ce65"'}, {'PartNumber': 2, 'ETag': '"479df46a73824ca1a5e44efe64d3dbb7"'} ] } ) print('Upload complete:', response.json()['location']) ``` ```json 200 - Success theme={null} { "location": "https://xxx.r2.cloudflarestorage.com/drimestorage/uploads%2F1e4cbca8...%2F1e4cbca8...", "status": "success" } ``` > [!WARNING] > > ETags must include the surrounding quotes (e.g., `"abc123"`). These are returned in the S3 response headers. # Create Multipart Upload Source: https://docs.drime.cloud/api-reference/multipart/create-multipart POST /s3/multipart/create Initialize a multipart upload for large files ## Overview Initiates a multipart upload for files **≥ 5MB** (5,242,880 bytes). Returns an `uploadId` and `key` that must be used for all subsequent operations. **Multipart Upload Flow:** 1. **Create** - Initialize the upload (this endpoint) 2. **Sign** - Get presigned URLs for each part 3. **Upload** - PUT each part to its URL 4. **Complete** - Finalize the upload 5. **Register** - Create file entry with `/s3/entries` ## Request Body **filename** `string` *required* Original filename **mime** `string` *required* MIME type **size** `integer` *required* File size in bytes **extension** `string` *required* File extension without dot **workspaceId** `integer` Workspace ID **relativePath** `string` Folder path for auto-creation **parentId** `integer` Parent folder ID ## Response **key** `string` S3 key for the upload **uploadId** `string` Multipart upload ID (required for all subsequent operations) **acl** `string` Access control (`private`) **status** `string` Request status (`success`) ```bash cURL theme={null} curl -X POST https://app.drime.cloud/api/v1/s3/multipart/create \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "filename": "large-video.mp4", "mime": "video/mp4", "size": 142557981, "extension": "mp4", "workspaceId": 0 }' ``` ```javascript JavaScript theme={null} const response = await fetch('https://app.drime.cloud/api/v1/s3/multipart/create', { method: 'POST', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' }, body: JSON.stringify({ filename: file.name, mime: file.type, size: file.size, extension: file.name.split('.').pop(), workspaceId: 0 }) }); const { key, uploadId } = await response.json(); // Store these for subsequent operations console.log(`Upload initialized: ${uploadId}`); ``` ```python Python theme={null} import requests response = requests.post( 'https://app.drime.cloud/api/v1/s3/multipart/create', headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'}, json={ 'filename': 'large-video.mp4', 'mime': 'video/mp4', 'size': 142557981, 'extension': 'mp4', 'workspaceId': 0 } ) data = response.json() key = data['key'] upload_id = data['uploadId'] print(f'Upload initialized: {upload_id}') ``` ```json 200 - Success theme={null} { "key": "uploads/1e4cbca8-165f-4780-9cb7-fc4d8f2e4834/1e4cbca8-165f-4780-9cb7-fc4d8f2e4834", "uploadId": "AFNhWKh6Cn6fOryIGSCF4GFVTXB1CnOpdipc0ZHJIHwk9YBgHjLXwXhQkzQ4LmXVkW46cl1ICuQFI4KPBWXt...", "acl": "private", "status": "success" } ``` > [!NOTE] > > Each part should be \~5MB (5,242,880 bytes) except for the last part which may be smaller. # Get Uploaded Parts Source: https://docs.drime.cloud/api-reference/multipart/get-uploaded-parts POST /s3/multipart/get-uploaded-parts List already uploaded parts for resumable uploads ## Overview Lists parts that have already been uploaded for a multipart upload. Use this to resume interrupted uploads by skipping already-uploaded parts. ## Request Body **key** `string` *required* S3 key from `createMultipartUpload` **uploadId** `string` *required* Upload ID from `createMultipartUpload` ## Response **parts** `array` Array of already-uploaded parts **Part properties** **PartNumber** `integer` Part number (1-indexed) **ETag** `string` ETag of the uploaded part **Size** `integer` Size of the part in bytes **status** `string` Request status (`success`) ```bash cURL theme={null} curl -X POST https://app.drime.cloud/api/v1/s3/multipart/get-uploaded-parts \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "key": "uploads/1e4cbca8.../1e4cbca8...", "uploadId": "AFNhWKh6Cn6f..." }' ``` ```javascript JavaScript theme={null} // Check which parts are already uploaded const response = await fetch('https://app.drime.cloud/api/v1/s3/multipart/get-uploaded-parts', { method: 'POST', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' }, body: JSON.stringify({ key, uploadId }) }); const { parts } = await response.json(); const uploadedPartNumbers = new Set(parts.map(p => p.PartNumber)); // Only upload missing parts for (let i = 1; i <= totalParts; i++) { if (!uploadedPartNumbers.has(i)) { // Upload this part } } ``` ```python Python theme={null} import requests response = requests.post( 'https://app.drime.cloud/api/v1/s3/multipart/get-uploaded-parts', headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'}, json={'key': key, 'uploadId': upload_id} ) parts = response.json()['parts'] uploaded = {p['PartNumber'] for p in parts} # Only upload missing parts for i in range(1, total_parts + 1): if i not in uploaded: # Upload this part pass ``` ```json 200 - Parts uploaded theme={null} { "parts": [ { "PartNumber": 1, "ETag": "\"22b1d5721320f9da081e4987f0e0ce65\"", "Size": 5242880 }, { "PartNumber": 2, "ETag": "\"479df46a73824ca1a5e44efe64d3dbb7\"", "Size": 1405792 } ], "status": "success" } ``` ```json 200 - No parts yet theme={null} { "parts": [], "status": "success" } ``` > [!TIP] > > Use this endpoint to implement resumable uploads. When a user reconnects, check which parts are already uploaded and continue from where they left off. # Sign Part URLs Source: https://docs.drime.cloud/api-reference/multipart/sign-part-urls POST /s3/multipart/batch-sign-part-urls Get presigned URLs for uploading parts ## Overview Gets presigned URLs for uploading one or more parts of a multipart upload. Parts can be uploaded concurrently (recommended limit: 8 concurrent uploads). ## Request Body **key** `string` *required* S3 key from `createMultipartUpload` **uploadId** `string` *required* Upload ID from `createMultipartUpload` **partNumbers** `array` *required* Array of part numbers to sign (1-indexed) ## Response **urls** `array` Array of signed URL objects **URL object properties** **partNumber** `integer` Part number **url** `string` Presigned URL for PUT upload **status** `string` Request status (`success`) ```bash cURL theme={null} curl -X POST https://app.drime.cloud/api/v1/s3/multipart/batch-sign-part-urls \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "key": "uploads/1e4cbca8.../1e4cbca8...", "uploadId": "AFNhWKh6Cn6f...", "partNumbers": [1, 2, 3] }' ``` ```javascript JavaScript theme={null} const PART_SIZE = 5 * 1024 * 1024; // 5MB const totalParts = Math.ceil(file.size / PART_SIZE); // Get URLs for all parts const response = await fetch('https://app.drime.cloud/api/v1/s3/multipart/batch-sign-part-urls', { method: 'POST', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' }, body: JSON.stringify({ key, uploadId, partNumbers: Array.from({ length: totalParts }, (_, i) => i + 1) }) }); const { urls } = await response.json(); // Upload each part const uploadedParts = []; for (const { partNumber, url } of urls) { const start = (partNumber - 1) * PART_SIZE; const end = Math.min(start + PART_SIZE, file.size); const chunk = file.slice(start, end); const uploadResponse = await fetch(url, { method: 'PUT', body: chunk }); const etag = uploadResponse.headers.get('ETag'); uploadedParts.push({ PartNumber: partNumber, ETag: etag }); } ``` ```python Python theme={null} import requests import math PART_SIZE = 5 * 1024 * 1024 # 5MB file_size = 142557981 total_parts = math.ceil(file_size / PART_SIZE) # Get URLs for all parts response = requests.post( 'https://app.drime.cloud/api/v1/s3/multipart/batch-sign-part-urls', headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'}, json={ 'key': key, 'uploadId': upload_id, 'partNumbers': list(range(1, total_parts + 1)) } ) urls = response.json()['urls'] ``` ```json 200 - Success theme={null} { "urls": [ { "partNumber": 1, "url": "https://drimestorage.xxx.r2.cloudflarestorage.com/uploads/...?partNumber=1&..." }, { "partNumber": 2, "url": "https://drimestorage.xxx.r2.cloudflarestorage.com/uploads/...?partNumber=2&..." }, { "partNumber": 3, "url": "https://drimestorage.xxx.r2.cloudflarestorage.com/uploads/...?partNumber=3&..." } ], "status": "success" } ``` > [!TIP] > > After uploading each part, save the `ETag` from the response headers. You'll need it to complete the upload. # Create Note Source: https://docs.drime.cloud/api-reference/notes/create-note POST /notes/create Create a new note ## Overview Creates a new note with the specified title and content. ## Request Body **title** `string` *required* Note title **body** `string` *required* Note content ## Response **note** `object` The created note object **status** `string` Request status (`success`) ```bash cURL theme={null} curl -X POST https://app.drime.cloud/api/v1/notes/create \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "title": "My New Note", "body": "This is the content of my note..." }' ``` ```javascript JavaScript theme={null} const response = await fetch('https://app.drime.cloud/api/v1/notes/create', { method: 'POST', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' }, body: JSON.stringify({ title: 'My New Note', body: 'This is the content of my note...' }) }); const { note } = await response.json(); console.log(`Note created: ${note.id}`); ``` ```python Python theme={null} import requests response = requests.post( 'https://app.drime.cloud/api/v1/notes/create', headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'}, json={ 'title': 'My New Note', 'body': 'This is the content of my note...' } ) note = response.json()['note'] print(f'Note created: {note["id"]}') ``` ```json 201 - Created theme={null} { "status": "success", "note": { "id": 3, "title": "My New Note", "body": "This is the content of my note...", "created_at": "2024-01-20T10:00:00.000000Z", "updated_at": "2024-01-20T10:00:00.000000Z" } } ``` ```json 422 - Validation Error theme={null} { "status": "error", "message": "The given data was invalid.", "errors": { "title": "The title field is required." } } ``` # Get Note Source: https://docs.drime.cloud/api-reference/notes/get-note GET /getNote/{id} Get a single note by ID ## Overview Retrieves a specific note by its ID. ## Path Parameters **id** `integer` *required* Note ID ## Response **data** `object` The note object **Note properties** **id** `integer` Note ID **title** `string` Note title **body** `string` Note content ```bash cURL theme={null} curl -X GET https://app.drime.cloud/api/v1/getNote/1 \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" ``` ```javascript JavaScript theme={null} const noteId = 1; const response = await fetch(`https://app.drime.cloud/api/v1/getNote/${noteId}`, { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }); const { data } = await response.json(); console.log(`Note: ${data.title}`); ``` ```python Python theme={null} import requests note_id = 1 response = requests.get( f'https://app.drime.cloud/api/v1/getNote/{note_id}', headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'} ) note = response.json()['data'] print(f"Note: {note['title']}") ``` ```json 200 - Success theme={null} { "data": { "id": 1, "title": "Meeting Notes", "body": "Discussed project timeline and deliverables..." } } ``` ```json 404 - Not Found theme={null} { "message": "Note not found" } ``` # Get Notes Source: https://docs.drime.cloud/api-reference/notes/get-notes GET /notes Get all user notes ## Overview Retrieves all notes for the authenticated user. ## Response Returns an array of note objects. **id** `integer` Note ID **title** `string` Note title **body** `string` Note content **created\_at** `string` Creation timestamp **updated\_at** `string` Last update timestamp ```bash cURL theme={null} curl -X GET https://app.drime.cloud/api/v1/notes \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" ``` ```javascript JavaScript theme={null} const response = await fetch('https://app.drime.cloud/api/v1/notes', { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }); const notes = await response.json(); console.log(`Found ${notes.length} notes`); ``` ```python Python theme={null} import requests response = requests.get( 'https://app.drime.cloud/api/v1/notes', headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'} ) notes = response.json() print(f'Found {len(notes)} notes') ``` ```json 200 - Success theme={null} [ { "id": 1, "title": "Meeting Notes", "body": "Discussed project timeline and deliverables...", "created_at": "2024-01-15T10:30:00.000000Z", "updated_at": "2024-01-15T14:20:00.000000Z" }, { "id": 2, "title": "Ideas", "body": "Feature ideas for the next release...", "created_at": "2024-01-16T09:00:00.000000Z", "updated_at": "2024-01-16T09:00:00.000000Z" } ] ``` # Change Permissions Source: https://docs.drime.cloud/api-reference/sharing/change-permissions PUT /file-entries/{entryId}/change-permissions Update permissions for a shared user ## Overview Changes the permissions a user has for a shared file or folder. ## Path Parameters **entryId** `integer` *required* ID of the shared file or folder ## Request Body **userId** `integer` *required* ID of the user whose permissions to change **permissions** `array` *required* New permissions to assign * `view` - Can view the file/folder * `edit` - Can modify the file/folder * `download` - Can download the file ## Response **users** `array` Updated list of users with access **status** `string` Request status (`success`) ```bash cURL theme={null} curl -X PUT https://app.drime.cloud/api/v1/file-entries/123456/change-permissions \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "userId": 12345, "permissions": ["view"] }' ``` ```javascript JavaScript theme={null} // Downgrade user to view-only const response = await fetch('https://app.drime.cloud/api/v1/file-entries/123456/change-permissions', { method: 'PUT', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' }, body: JSON.stringify({ userId: 12345, permissions: ['view'] }) }); const { users } = await response.json(); ``` ```python Python theme={null} import requests response = requests.put( 'https://app.drime.cloud/api/v1/file-entries/123456/change-permissions', headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'}, json={ 'userId': 12345, 'permissions': ['view'] } ) users = response.json()['users'] ``` ```json 200 - Success theme={null} { "status": "success", "users": [ { "id": 12345, "email": "colleague@example.com", "display_name": "John Doe" } ] } ``` # Share Entry Source: https://docs.drime.cloud/api-reference/sharing/share-entry POST /file-entries/{entryId}/share Share a file or folder with other users ## Overview Shares a file or folder with specified users by email. You can grant different permission levels to collaborators. ## Path Parameters **entryId** `integer` *required* ID of the file or folder to share ## Request Body **emails** `array` *required* Array of email addresses to share with **permissions** `array` *required* Permissions to grant * `view` - Can view the file/folder * `edit` - Can modify the file/folder * `download` - Can download the file ## Response **users** `array` Array of users the entry is now shared with **status** `string` Request status (`success`) ```bash cURL theme={null} curl -X POST https://app.drime.cloud/api/v1/file-entries/123456/share \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "emails": ["colleague@example.com", "team@example.com"], "permissions": ["view", "download"] }' ``` ```javascript JavaScript theme={null} const response = await fetch('https://app.drime.cloud/api/v1/file-entries/123456/share', { method: 'POST', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' }, body: JSON.stringify({ emails: ['colleague@example.com'], permissions: ['view', 'edit', 'download'] }) }); const { users } = await response.json(); console.log('Shared with:', users.map(u => u.email)); ``` ```python Python theme={null} import requests response = requests.post( 'https://app.drime.cloud/api/v1/file-entries/123456/share', headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'}, json={ 'emails': ['colleague@example.com'], 'permissions': ['view', 'edit', 'download'] } ) users = response.json()['users'] print(f"Shared with: {[u['email'] for u in users]}") ``` ```json 200 - Success theme={null} { "status": "success", "users": [ { "id": 12345, "email": "colleague@example.com", "display_name": "John Doe" } ] } ``` ```json 422 - Validation Error theme={null} { "status": "error", "message": "The given data was invalid.", "errors": { "emails": "Invalid email address provided." } } ``` # Unshare Entry Source: https://docs.drime.cloud/api-reference/sharing/unshare-entry POST /file-entries/{entryId}/unshare Remove sharing access from a user ## Overview Removes a user's access to a shared file or folder. > [!NOTE] > > You can pass **multiple entry IDs separated by commas** in the path > (e.g. `/file-entries/123,456/unshare`) to unshare several entries at once. ## Path Parameters **entryId** `string` *required* ID of the shared file or folder. Accepts a single ID or several IDs separated by commas. ## Request Body **userId** `integer | string` *required* ID of the user to remove access from. Pass the string `"me"` to remove **yourself** from a share (no permission on the entry is required in that case). ## Response **users** `array` Updated list of users who still have access **status** `string` Request status (`success`) ```bash cURL theme={null} curl -X POST https://app.drime.cloud/api/v1/file-entries/123456/unshare \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "userId": 12345 }' ``` ```javascript JavaScript theme={null} const response = await fetch('https://app.drime.cloud/api/v1/file-entries/123456/unshare', { method: 'POST', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' }, body: JSON.stringify({ userId: 12345 }) }); const { users } = await response.json(); console.log('Remaining shared users:', users); ``` ```python Python theme={null} import requests response = requests.post( 'https://app.drime.cloud/api/v1/file-entries/123456/unshare', headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'}, json={'userId': 12345} ) users = response.json()['users'] print(f'Remaining shared users: {users}') ``` ```json 200 - Success theme={null} { "status": "success", "users": [] } ``` # Star Entries Source: https://docs.drime.cloud/api-reference/starring/star-entries POST /file-entries/star Mark entries as starred/favorites ## Overview Marks one or more file entries as starred (favorites) for quick access. ## Request Body **entryIds** `array` *required* Array of entry IDs to star ## Response **tag** `object` The "starred" tag object **status** `string` Request status (`success`) ```bash cURL theme={null} curl -X POST https://app.drime.cloud/api/v1/file-entries/star \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "entryIds": [123456, 789012] }' ``` ```javascript JavaScript theme={null} const response = await fetch('https://app.drime.cloud/api/v1/file-entries/star', { method: 'POST', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' }, body: JSON.stringify({ entryIds: [123456, 789012] }) }); const { status } = await response.json(); console.log('Entries starred'); ``` ```python Python theme={null} import requests response = requests.post( 'https://app.drime.cloud/api/v1/file-entries/star', headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'}, json={'entryIds': [123456, 789012]} ) print('Entries starred') ``` ```json 200 - Success theme={null} { "status": "success", "tag": { "id": 1, "name": "starred" } } ``` > [!TIP] > > Use `starredOnly=true` in the [Get File Entries](/api-reference/files/get-file-entries) endpoint to retrieve all starred items. # Unstar Entries Source: https://docs.drime.cloud/api-reference/starring/unstar-entries POST /file-entries/unstar Remove star/favorite from entries ## Overview Removes the starred status from one or more file entries. ## Request Body **entryIds** `array` *required* Array of entry IDs to unstar ## Response **tag** `object` The "starred" tag object **status** `string` Request status (`success`) ```bash cURL theme={null} curl -X POST https://app.drime.cloud/api/v1/file-entries/unstar \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "entryIds": [123456, 789012] }' ``` ```javascript JavaScript theme={null} const response = await fetch('https://app.drime.cloud/api/v1/file-entries/unstar', { method: 'POST', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' }, body: JSON.stringify({ entryIds: [123456, 789012] }) }); console.log('Entries unstarred'); ``` ```python Python theme={null} import requests response = requests.post( 'https://app.drime.cloud/api/v1/file-entries/unstar', headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'}, json={'entryIds': [123456, 789012]} ) print('Entries unstarred') ``` ```json 200 - Success theme={null} { "status": "success", "tag": { "id": 1, "name": "starred" } } ``` # Get Tracked Files Source: https://docs.drime.cloud/api-reference/tracking/get-tracked-files GET /track/all List all files with tracking enabled ## Overview Retrieves all files that have tracking enabled. Shows view counts and download statistics for each tracked file. ## Query Parameters **workspaceId** `integer` Filter by workspace ID **page** `integer` (default: 1) Page number **perPage** `integer` (default: 15) Items per page ## Response **pagination** `object` Paginated list of tracked files **Pagination properties** **data** `array` Array of tracked file objects with view/download counts **current\_page** `integer` Current page **last\_page** `integer` Total pages **total** `integer` Total tracked files **status** `string` Request status (`success`) ```bash cURL theme={null} curl -X GET "https://app.drime.cloud/api/v1/track/all?page=1" \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" ``` ```javascript JavaScript theme={null} const response = await fetch('https://app.drime.cloud/api/v1/track/all?page=1', { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }); const { pagination } = await response.json(); for (const file of pagination.data) { console.log(`${file.name}: ${file.views_number} views, ${file.dl_number} downloads`); } ``` ```python Python theme={null} import requests response = requests.get( 'https://app.drime.cloud/api/v1/track/all', params={'page': 1}, headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'} ) files = response.json()['pagination']['data'] for f in files: print(f"{f['name']}: {f['views_number']} views, {f['dl_number']} downloads") ``` ```json 200 - Success theme={null} { "status": "success", "pagination": { "data": [ { "id": 487159699, "name": "proposal.pdf", "type": "pdf", "file_size": 2048576, "views_number": 15, "dl_number": 3, "views": [ { "id": 1, "ip": "192.168.1.1", "date": "2025-12-28 06:42:58", "action": "view" } ] } ], "current_page": 1, "last_page": 1, "total": 1 } } ``` > [!TIP] > > File tracking is useful for monitoring engagement with shared documents, such as proposals or contracts. # Get Tracking Stats Source: https://docs.drime.cloud/api-reference/tracking/get-tracking-stats GET /track/infos/{entryId} Get detailed tracking statistics for a file ## Overview Retrieves detailed tracking information for a specific file, including who viewed it, when, and from where. ## Path Parameters **entryId** `integer` *required* File entry ID ## Query Parameters **workspaceId** `integer` Workspace ID ## Response **views** `array` Array of tracking events **Event properties** **id** `integer` Event ID **file\_id** `integer` File entry ID **ip** `string` Viewer's IP address **date** `string` Timestamp of the event **action** `string` Event type (`view` or `download`) **location** `string` Geographic location (if available) **email** `string` Viewer's email (if logged in) **status** `string` Request status (`success`) ```bash cURL theme={null} curl -X GET https://app.drime.cloud/api/v1/track/infos/487159699 \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" ``` ```javascript JavaScript theme={null} const entryId = 487159699; const response = await fetch(`https://app.drime.cloud/api/v1/track/infos/${entryId}`, { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }); const { views } = await response.json(); for (const view of views) { console.log(`${view.action} from ${view.location || view.ip} at ${view.date}`); } ``` ```python Python theme={null} import requests entry_id = 487159699 response = requests.get( f'https://app.drime.cloud/api/v1/track/infos/{entry_id}', headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'} ) views = response.json()['views'] for v in views: location = v.get('location') or v['ip'] print(f"{v['action']} from {location} at {v['date']}") ``` ```json 200 - Success theme={null} { "status": "success", "views": [ { "id": 1, "file_id": 487159699, "ip": "192.168.1.100", "date": "2025-12-28 06:42:58", "action": "view", "location": "Paris, France", "user_id": null, "email": null }, { "id": 2, "file_id": 487159699, "ip": "10.0.0.50", "date": "2025-12-28 10:15:30", "action": "download", "location": "London, UK", "user_id": 12345, "email": "viewer@example.com" } ] } ``` > [!NOTE] > > If the viewer was logged in, their `user_id` and `email` will be included in the event data. # Set Tracked Source: https://docs.drime.cloud/api-reference/tracking/set-tracked POST /track/setTracked Enable or disable tracking for a file ## Overview Enables or disables view/download tracking for a specific file. ## Request Body **file\_id** `integer` *required* File entry ID **tracked** `boolean` *required* `true` to enable tracking, `false` to disable ## Response **updated** `boolean` Whether the update was successful **status** `string` Request status (`success`) ```bash cURL theme={null} curl -X POST https://app.drime.cloud/api/v1/track/setTracked \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "file_id": 487159699, "tracked": true }' ``` ```javascript JavaScript theme={null} const response = await fetch('https://app.drime.cloud/api/v1/track/setTracked', { method: 'POST', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' }, body: JSON.stringify({ file_id: 487159699, tracked: true }) }); const { updated } = await response.json(); console.log('Tracking enabled:', updated); ``` ```python Python theme={null} import requests response = requests.post( 'https://app.drime.cloud/api/v1/track/setTracked', headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'}, json={ 'file_id': 487159699, 'tracked': True } ) print(f"Tracking enabled: {response.json()['updated']}") ``` ```json 200 - Success theme={null} { "updated": true, "status": "success" } ``` # Create S3 Entry Source: https://docs.drime.cloud/api-reference/uploads/create-s3-entry POST /s3/entries Register a file in Drime after S3 upload ## Overview Creates a file entry in the Drime database after successfully uploading a file to S3/R2. This is the final step in both simple and multipart upload flows. ## Request Body **filename** `string` *required* The UUID filename from the S3 key (last segment) **size** `integer` *required* File size in bytes **clientName** `string` *required* Original filename to display to users **clientMime** `string` MIME type of the file **clientExtension** `string` File extension without dot **workspaceId** `integer` Workspace ID. Use `0` for personal workspace. **parentId** `integer` Parent folder ID. Use `null` for root. **relativePath** `string` Folder path for auto-creation (overrides parentId) **lastModified** `integer` Original modification time of the file as a Unix epoch in **milliseconds**. Stored in the entry's `client_last_modified` field so the original mtime survives the upload. **fileHash** `string` SHA-256 hex digest of the file content. Stored in the entry's `file_hash` field and used for deduplication via [Check File Hash](/api-reference/files/check-file-hash). **exifData** `string` EXIF metadata as base64-encoded JSON (or a raw JSON string) to attach to the entry ## Response **fileEntry** `object` The created file entry object **status** `string` Request status (`success`) ```bash cURL theme={null} curl -X POST https://app.drime.cloud/api/v1/s3/entries \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "filename": "71ea55f2-1ba7-46ad-98b7-db487ecac2f6", "size": 87965, "clientName": "document.pdf", "clientMime": "application/pdf", "clientExtension": "pdf", "workspaceId": 0, "parentId": null }' ``` ```javascript JavaScript theme={null} // After uploading to S3... const key = 'uploads/71ea55f2-1ba7-46ad-98b7-db487ecac2f6/71ea55f2-1ba7-46ad-98b7-db487ecac2f6'; const uuid = key.split('/').pop(); // Extract UUID const response = await fetch('https://app.drime.cloud/api/v1/s3/entries', { method: 'POST', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' }, body: JSON.stringify({ filename: uuid, size: file.size, clientName: file.name, clientMime: file.type, clientExtension: file.name.split('.').pop(), workspaceId: 0, parentId: null }) }); const { fileEntry } = await response.json(); console.log(`File registered: ${fileEntry.name} (ID: ${fileEntry.id})`); ``` ```python Python theme={null} import requests # After uploading to S3... key = 'uploads/71ea55f2-1ba7-46ad-98b7-db487ecac2f6/71ea55f2-1ba7-46ad-98b7-db487ecac2f6' uuid = key.split('/')[-1] response = requests.post( 'https://app.drime.cloud/api/v1/s3/entries', headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'}, json={ 'filename': uuid, 'size': 87965, 'clientName': 'document.pdf', 'clientMime': 'application/pdf', 'clientExtension': 'pdf', 'workspaceId': 0, 'parentId': None } ) file_entry = response.json()['fileEntry'] print(f"File registered: {file_entry['name']} (ID: {file_entry['id']})") ``` ```json 200 - Success theme={null} { "fileEntry": { "name": "document.pdf", "file_name": "71ea55f2-1ba7-46ad-98b7-db487ecac2f6", "mime": "application/pdf", "file_size": 87965, "type": "pdf", "extension": "pdf", "workspace_id": 0, "owner_id": 15843, "id": 488163222, "hash": "NDg4MTYzMjIyfA", "path": "488163222", "url": "api/v1/file-entries/488163222", "created_at": "2025-12-22T13:45:07.000000Z", "updated_at": "2025-12-22T13:45:07.000000Z" }, "status": "success" } ``` > [!TIP] > > If you provide `relativePath`, folders will be automatically created and the file placed in the correct location. # Get Presigned URL Source: https://docs.drime.cloud/api-reference/uploads/presign-url POST /s3/simple/presign Get a presigned URL for direct S3 upload ## Overview Gets a presigned URL for uploading files smaller than 5MB directly to S3/R2 storage. This is more efficient than the direct upload endpoint. **Upload Flow:** 1. Call this endpoint to get a presigned URL 2. PUT your file to the presigned URL 3. Call `/s3/entries` to register the file in Drime > [!NOTE] > > For files **≥ 5MB**, use the [multipart upload](/api-reference/multipart/create-multipart) flow instead. ## Request Body **filename** `string` *required* Original filename **mime** `string` *required* MIME type of the file **size** `integer` *required* File size in bytes **extension** `string` *required* File extension without dot **workspaceId** `integer` Workspace ID. Use `0` for personal workspace. **relativePath** `string` Folder path for auto-creation **parentId** `integer` Parent folder ID ## Response **url** `string` Presigned URL for PUT upload (valid for 1 hour) **key** `string` S3 key (format: `uploads/{uuid}/{uuid}`) **acl** `string` Access control (`private`) **status** `string` Request status (`success`) ```bash cURL theme={null} # Step 1: Get presigned URL curl -X POST https://app.drime.cloud/api/v1/s3/simple/presign \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "filename": "document.pdf", "mime": "application/pdf", "size": 87965, "extension": "pdf", "workspaceId": 0 }' # Step 2: Upload to presigned URL curl -X PUT "PRESIGNED_URL" \ -H "Content-Type: application/pdf" \ --data-binary @document.pdf ``` ```javascript JavaScript theme={null} // Step 1: Get presigned URL const presignResponse = await fetch('https://app.drime.cloud/api/v1/s3/simple/presign', { method: 'POST', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' }, body: JSON.stringify({ filename: file.name, mime: file.type, size: file.size, extension: file.name.split('.').pop(), workspaceId: 0 }) }); const { url, key } = await presignResponse.json(); // Step 2: Upload to presigned URL await fetch(url, { method: 'PUT', headers: { 'Content-Type': file.type }, body: file }); // Step 3: Create file entry (see /s3/entries endpoint) ``` ```python Python theme={null} import requests # Step 1: Get presigned URL presign_response = requests.post( 'https://app.drime.cloud/api/v1/s3/simple/presign', headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'}, json={ 'filename': 'document.pdf', 'mime': 'application/pdf', 'size': 87965, 'extension': 'pdf', 'workspaceId': 0 } ) data = presign_response.json() presigned_url = data['url'] key = data['key'] # Step 2: Upload to presigned URL with open('document.pdf', 'rb') as f: requests.put( presigned_url, headers={'Content-Type': 'application/pdf'}, data=f ) # Step 3: Create file entry (see /s3/entries endpoint) ``` ```json 200 - Success theme={null} { "url": "https://drimestorage.xxx.r2.cloudflarestorage.com/uploads/71ea55f2.../71ea55f2...?X-Amz-Algorithm=AWS4-HMAC-SHA256&...", "key": "uploads/71ea55f2-1ba7-46ad-98b7-db487ecac2f6/71ea55f2-1ba7-46ad-98b7-db487ecac2f6", "acl": "private", "status": "success" } ``` # Upload File Source: https://docs.drime.cloud/api-reference/uploads/upload-file POST /uploads Upload a file directly to Drime Cloud ## Overview Uploads a file directly to Drime Cloud using multipart form data. This is the simplest upload method but recommended only for smaller files. > [!NOTE] > > For files larger than 5MB, consider using the [presigned URL](/api-reference/uploads/presign-url) or [multipart upload](/api-reference/multipart/create-multipart) flow for better reliability. ## Request Body (multipart/form-data) **file** `file` *required* The file to upload **parentId** `integer` ID of the destination folder. Use `null` for root. **workspaceId** `integer` Workspace ID. Use `0` for personal workspace. **relativePath** `string` Optional folder path. Folders will be auto-created if they don't exist. Format: `/some/folders/here/file-name.jpg` **lastModified** `integer` Original modification time of the file as a Unix epoch in **milliseconds**. Stored in the entry's `client_last_modified` field so the original mtime is preserved (like a sync client would). Can also be set later via [Set File Metadata](/api-reference/files/set-file-metadata). **fileHash** `string` SHA-256 hex digest of the file content. Stored in the entry's `file_hash` field and used for deduplication via [Check File Hash](/api-reference/files/check-file-hash). ## Response **fileEntry** `object` The created file entry object **status** `string` Request status (`success`) ```bash cURL theme={null} curl -X POST https://app.drime.cloud/api/v1/uploads \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \ -F "file=@/path/to/document.pdf" \ -F "parentId=" \ -F "workspaceId=0" ``` ```javascript JavaScript theme={null} const formData = new FormData(); formData.append('file', fileInput.files[0]); formData.append('parentId', ''); // null for root formData.append('workspaceId', '0'); const response = await fetch('https://app.drime.cloud/api/v1/uploads', { method: 'POST', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' }, body: formData }); const { fileEntry } = await response.json(); console.log(`Uploaded: ${fileEntry.name} (ID: ${fileEntry.id})`); ``` ```python Python theme={null} import requests with open('document.pdf', 'rb') as f: response = requests.post( 'https://app.drime.cloud/api/v1/uploads', headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'}, files={'file': f}, data={ 'parentId': '', 'workspaceId': 0 } ) file_entry = response.json()['fileEntry'] print(f"Uploaded: {file_entry['name']} (ID: {file_entry['id']})") ``` ```json 201 - Created theme={null} { "status": "success", "fileEntry": { "id": 123456, "name": "document.pdf", "type": "pdf", "mime": "application/pdf", "file_size": 1048576, "hash": "MTIzNDU2fA", "parent_id": null, "workspace_id": 0, "created_at": "2024-01-20T10:00:00.000000Z" } } ``` ```json 422 - Validation Error theme={null} { "status": "error", "message": "The given data was invalid.", "errors": { "file": "The file field is required." } } ``` # Validate Upload Source: https://docs.drime.cloud/api-reference/uploads/validate-upload POST /uploads/validate Check for duplicate files before uploading ## Overview Validates files before upload by checking if files with the same name already exist at the specified location. Returns a list of duplicate filenames. ## Query Parameters **workspaceId** `integer` Workspace ID ## Request Body **files** `array` *required* Array of files to validate **File object properties** **name** `string` *required* Filename to check **size** `integer` *required* File size in bytes **relativePath** `string` *required* Path where file would be uploaded ## Response **errors** `boolean` `true` if duplicates were found **duplicates** `array` Array of filenames that already exist **status** `string` Request status (`success`) ```bash cURL theme={null} curl -X POST "https://app.drime.cloud/api/v1/uploads/validate?workspaceId=0" \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "files": [ {"name": "photo1.jpg", "size": 1048576, "relativePath": "/photos"}, {"name": "photo2.jpg", "size": 2048576, "relativePath": "/photos"} ] }' ``` ```javascript JavaScript theme={null} const response = await fetch( 'https://app.drime.cloud/api/v1/uploads/validate?workspaceId=0', { method: 'POST', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' }, body: JSON.stringify({ files: [ { name: 'photo1.jpg', size: 1048576, relativePath: '/photos' }, { name: 'photo2.jpg', size: 2048576, relativePath: '/photos' } ] }) } ); const { errors, duplicates } = await response.json(); if (errors) { console.log('Duplicates found:', duplicates); // Handle duplicates - rename or skip } ``` ```python Python theme={null} import requests response = requests.post( 'https://app.drime.cloud/api/v1/uploads/validate', params={'workspaceId': 0}, headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'}, json={ 'files': [ {'name': 'photo1.jpg', 'size': 1048576, 'relativePath': '/photos'}, {'name': 'photo2.jpg', 'size': 2048576, 'relativePath': '/photos'} ] } ) data = response.json() if data['errors']: print(f"Duplicates found: {data['duplicates']}") ``` ```json 200 - No duplicates theme={null} { "errors": false, "duplicates": [], "status": "success" } ``` ```json 200 - Duplicates found theme={null} { "errors": true, "duplicates": ["photo1.jpg"], "status": "success" } ``` > [!TIP] > > Use `/entry/getAvailableName` to get an alternative filename when duplicates are found. # Create Workspace Source: https://docs.drime.cloud/api-reference/user/create-workspace POST /workspace Create a new workspace ## Overview Creates a new workspace. The authenticated user becomes the workspace owner automatically. ## Request Body **name** `string` *required* Name for the new workspace ## Response **workspace** `object` The newly created workspace object **Workspace properties** **id** `integer` Unique workspace identifier **name** `string` Workspace name **owner\_id** `integer` ID of the workspace owner **members\_count** `integer` Number of members (starts at 1) **currentUser** `object` Current user's membership details **owner** `object` Workspace owner details **status** `string` Request status (`success`) ```bash cURL theme={null} curl -X POST https://app.drime.cloud/api/v1/workspace \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "name": "My New Workspace" }' ``` ```javascript JavaScript theme={null} const response = await fetch('https://app.drime.cloud/api/v1/workspace', { method: 'POST', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' }, body: JSON.stringify({ name: 'My New Workspace' }) }); const { workspace } = await response.json(); console.log(`Created workspace: ${workspace.name} (ID: ${workspace.id})`); ``` ```python Python theme={null} import requests response = requests.post( 'https://app.drime.cloud/api/v1/workspace', headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'}, json={'name': 'My New Workspace'} ) workspace = response.json()['workspace'] print(f"Created workspace: {workspace['name']} (ID: {workspace['id']})") ``` ```json 200 - Success theme={null} { "workspace": { "owner_id": 15843, "name": "My New Workspace", "updated_at": "2025-12-18T18:39:45.000000Z", "created_at": "2025-12-18T18:39:45.000000Z", "id": 1874, "members_count": 1, "currentUser": { "role_name": "Workspace Owner", "email": "user@example.com", "workspace_id": 1874, "role_id": 3, "is_owner": true }, "owner": { "role_name": "Workspace Owner", "email": "user@example.com", "is_owner": true } }, "status": "success" } ``` ```json 422 - Validation Error theme={null} { "status": "error", "message": "The given data was invalid.", "errors": { "name": "The name field is required." } } ``` # Delete Workspace Source: https://docs.drime.cloud/api-reference/user/delete-workspace DELETE /workspace/{id} Delete a workspace permanently ## Overview Permanently deletes a workspace and all its contents. Only the workspace owner can delete a workspace. > [!WARNING] > > This action is irreversible. All files, folders, and data in the workspace will be permanently deleted. ## Path Parameters **id** `integer` *required* The workspace ID to delete ## Query Parameters **\_method** `string` *required* Must be `DELETE` (Laravel method spoofing) ## Response **status** `string` Request status (`success`) ```bash cURL theme={null} curl -X POST "https://app.drime.cloud/api/v1/workspace/1873?_method=DELETE" \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" ``` ```javascript JavaScript theme={null} const workspaceId = 1873; const response = await fetch( `https://app.drime.cloud/api/v1/workspace/${workspaceId}?_method=DELETE`, { method: 'POST', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } } ); const data = await response.json(); ``` ```python Python theme={null} import requests workspace_id = 1873 response = requests.post( f'https://app.drime.cloud/api/v1/workspace/{workspace_id}', params={'_method': 'DELETE'}, headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'} ) print(response.json()) ``` ```json 200 - Success theme={null} { "status": "success" } ``` ```json 403 - Forbidden theme={null} { "message": "This action is unauthorized." } ``` > [!NOTE] > > Due to Laravel's method spoofing, you need to send a POST request with `_method=DELETE` query parameter. # Get Logged User Source: https://docs.drime.cloud/api-reference/user/get-logged-user GET /users/me Get the account the token belongs to ## Overview Returns the account the token belongs to. Every token can call it, whatever its permissions or scopes, and an invalid or revoked token gets `401`. > [!NOTE] > > Older examples used `GET /cli/loggedUser`. Use `/users/me` instead: tokens with limited permissions are refused on the old route, and it does not answer `401` for a bad token. ## Response **user** `object` The authenticated user object **User properties** **id** `integer` Unique user identifier **email** `string` User's email address **display\_name** `string` User's display name **first\_name** `string` User's first name (may be null) **last\_name** `string` User's last name (may be null) **created\_at** `string` Account creation timestamp **updated\_at** `string` Last update timestamp **status** `string` `success` ```bash cURL theme={null} curl https://app.drime.cloud/api/v1/users/me \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" ``` ```javascript JavaScript theme={null} const response = await fetch('https://app.drime.cloud/api/v1/users/me', { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }); const data = await response.json(); console.log(data.user); ``` ```python Python theme={null} import requests response = requests.get( 'https://app.drime.cloud/api/v1/users/me', headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'} ) print(response.json()) ``` ```json 200 - Success theme={null} { "user": { "id": 15843, "email": "user@example.com", "display_name": "John Doe", "first_name": "John", "last_name": "Doe", "created_at": "2024-01-01T00:00:00.000000Z", "updated_at": "2024-01-15T10:30:00.000000Z" }, "status": "success" } ``` ```json 401 - Invalid Token theme={null} { "message": "Authentication required." } ``` # Get Notifications Source: https://docs.drime.cloud/api-reference/user/get-notifications GET /notifications Get user notifications ## Overview Returns a paginated list of notifications for the authenticated user. ## Query Parameters **per\_page** `integer` (default: 10) Number of notifications per page **page** `integer` (default: 1) Page number to retrieve ## Response **pagination** `object` Paginated list of notifications **Pagination properties** **data** `array` Array of notification objects **current\_page** `integer` Current page number **last\_page** `integer` Last page number **per\_page** `integer` Items per page **total** `integer` Total number of notifications ```bash cURL theme={null} curl "https://app.drime.cloud/api/v1/notifications?per_page=10&page=1" \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" ``` ```javascript JavaScript theme={null} const response = await fetch( 'https://app.drime.cloud/api/v1/notifications?per_page=10&page=1', { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } } ); const { pagination } = await response.json(); const notifications = pagination.data; ``` ```python Python theme={null} import requests response = requests.get( 'https://app.drime.cloud/api/v1/notifications', params={'per_page': 10, 'page': 1}, headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'} ) notifications = response.json()['pagination']['data'] ``` ```json 200 - Success theme={null} { "pagination": { "current_page": 1, "data": [ { "id": "abc123", "type": "file_shared", "data": { "file_name": "document.pdf", "shared_by": "colleague@example.com" }, "read_at": null, "created_at": "2025-01-15T10:30:00.000000Z" } ], "from": 1, "last_page": 1, "per_page": 10, "to": 1, "total": 1 } } ``` # Get Space Usage Source: https://docs.drime.cloud/api-reference/user/get-space-usage GET /user/space-usage Get storage space usage for the current user or workspace ## Overview Returns the current storage usage and available space for a user or workspace. ## Query Parameters **workspaceId** `integer` Workspace ID. Use `0` for the user's default personal workspace. ## Response **used** `integer` Total space used in bytes **available** `integer` Available space in bytes **status** `string` Request status (`success`) ```bash cURL theme={null} curl "https://app.drime.cloud/api/v1/user/space-usage?workspaceId=0" \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" ``` ```javascript JavaScript theme={null} const response = await fetch( 'https://app.drime.cloud/api/v1/user/space-usage?workspaceId=0', { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } } ); const { used, available } = await response.json(); // Convert to GB const usedGB = (used / 1024 / 1024 / 1024).toFixed(2); const availableGB = (available / 1024 / 1024 / 1024).toFixed(2); console.log(`Used: ${usedGB} GB / Available: ${availableGB} GB`); ``` ```python Python theme={null} import requests response = requests.get( 'https://app.drime.cloud/api/v1/user/space-usage', params={'workspaceId': 0}, headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'} ) data = response.json() used_gb = data['used'] / 1024 / 1024 / 1024 available_gb = data['available'] / 1024 / 1024 / 1024 print(f"Used: {used_gb:.2f} GB / Available: {available_gb:.2f} GB") ``` ```json 200 - Success theme={null} { "used": 120042057597, "available": 6597069766656, "status": "success" } ``` > [!NOTE] > > The values are in bytes. To convert to GB, divide by `1024 * 1024 * 1024`. # Get Workspace Source: https://docs.drime.cloud/api-reference/user/get-workspace GET /workspace/{id} Get details for a specific workspace ## Overview Returns detailed information about a specific workspace. ## Path Parameters **id** `integer` *required* The workspace ID ## Response **workspace** `object` The workspace object with all details **status** `string` Request status (`success`) ```bash cURL theme={null} curl https://app.drime.cloud/api/v1/workspace/1873 \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" ``` ```javascript JavaScript theme={null} const workspaceId = 1873; const response = await fetch( `https://app.drime.cloud/api/v1/workspace/${workspaceId}`, { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } } ); const { workspace } = await response.json(); ``` ```python Python theme={null} import requests workspace_id = 1873 response = requests.get( f'https://app.drime.cloud/api/v1/workspace/{workspace_id}', headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'} ) workspace = response.json()['workspace'] ``` ```json 200 - Success theme={null} { "workspace": { "id": 1873, "name": "My Workspace", "avatar": "https://www.gravatar.com/avatar/...", "owner_id": 15843, "created_at": "2025-12-18T18:39:07.000000Z", "updated_at": "2025-12-18T18:39:07.000000Z", "members_count": 3, "currentUser": { "role_name": "Workspace Owner", "email": "user@example.com", "role_id": 3, "is_owner": true } }, "status": "success" } ``` # Get Workspace File Stats Source: https://docs.drime.cloud/api-reference/user/get-workspace-files GET /workspace_files Get file count and total size for a workspace ## Overview Returns statistics about files in a workspace, including total file count and combined size. ## Query Parameters **workspaceId** `integer` Workspace ID. Use `0` for the user's default personal workspace. ## Response **files** `integer` Total number of files in the workspace **size** `integer` Total size of all files in bytes **status** `string` Request status (`success`) ```bash cURL theme={null} curl "https://app.drime.cloud/api/v1/workspace_files?workspaceId=0" \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" ``` ```javascript JavaScript theme={null} const response = await fetch( 'https://app.drime.cloud/api/v1/workspace_files?workspaceId=0', { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } } ); const { files, size } = await response.json(); console.log(`${files} files, ${(size / 1024 / 1024).toFixed(2)} MB total`); ``` ```python Python theme={null} import requests response = requests.get( 'https://app.drime.cloud/api/v1/workspace_files', params={'workspaceId': 0}, headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'} ) data = response.json() print(f"{data['files']} files, {data['size'] / 1024 / 1024:.2f} MB total") ``` ```json 200 - Success theme={null} { "files": 2, "size": 4846974, "status": "success" } ``` # Get Workspace Roles Source: https://docs.drime.cloud/api-reference/user/get-workspace-roles GET /workspace_roles Get available workspace roles ## Overview Returns a list of all available roles that can be assigned to workspace members. ## Response **pagination** `object` Paginated list of roles **Pagination properties** **data** `array` Array of role objects **current\_page** `integer` Current page number **last\_page** `integer` Last page number **per\_page** `integer` Items per page **total** `integer` Total number of roles **status** `string` Request status (`success`) ```bash cURL theme={null} curl https://app.drime.cloud/api/v1/workspace_roles \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" ``` ```javascript JavaScript theme={null} const response = await fetch('https://app.drime.cloud/api/v1/workspace_roles', { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }); const { pagination } = await response.json(); const roles = pagination.data; ``` ```python Python theme={null} import requests response = requests.get( 'https://app.drime.cloud/api/v1/workspace_roles', headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'} ) roles = response.json()['pagination']['data'] ``` ```json 200 - Success theme={null} { "pagination": { "data": [ { "id": 1, "name": "Workspace Viewer", "description": "Can view files and folders", "type": "workspace" }, { "id": 2, "name": "Workspace Editor", "description": "Can view, create, and edit files", "type": "workspace" }, { "id": 3, "name": "Workspace Owner", "description": "Full access to workspace", "type": "workspace" } ], "current_page": 1, "last_page": 1, "per_page": 15, "total": 3 }, "status": "success" } ``` # Get Workspaces Source: https://docs.drime.cloud/api-reference/user/get-workspaces GET /me/workspaces Get all workspaces the user has access to ## Overview Returns a list of all workspaces the authenticated user belongs to, including their role and permissions in each workspace. ## Query Parameters **workspaceId** `integer` Optional. When provided, the response includes detailed permissions for the user in that specific workspace. ## Response **workspaces** `array` Array of workspace objects **Workspace properties** **id** `integer` Unique workspace identifier **name** `string` Workspace name **avatar** `string` URL to workspace avatar image **owner\_id** `integer` ID of the workspace owner **members\_count** `integer` Number of members in the workspace **currentUser** `object` Current user's membership details including role **owner** `object` Workspace owner details **created\_at** `string` Workspace creation timestamp **updated\_at** `string` Last update timestamp **status** `string` Request status (`success`) ```bash cURL theme={null} curl https://app.drime.cloud/api/v1/me/workspaces \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" ``` ```javascript JavaScript theme={null} const response = await fetch('https://app.drime.cloud/api/v1/me/workspaces', { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }); const { workspaces } = await response.json(); ``` ```python Python theme={null} import requests response = requests.get( 'https://app.drime.cloud/api/v1/me/workspaces', headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'} ) workspaces = response.json()['workspaces'] ``` ```json 200 - Success theme={null} { "workspaces": [ { "id": 1873, "name": "My Workspace", "avatar": "https://www.gravatar.com/avatar/...", "owner_id": 15843, "created_at": "2025-12-18T18:39:07.000000Z", "updated_at": "2025-12-18T18:39:07.000000Z", "members_count": 1, "currentUser": { "role_name": "Workspace Owner", "email": "user@example.com", "workspace_id": 1873, "role_id": 3, "is_owner": true }, "owner": { "role_name": "Workspace Owner", "email": "user@example.com", "is_owner": true } } ], "status": "success" } ``` # Update Workspace Source: https://docs.drime.cloud/api-reference/user/update-workspace PUT /workspace/{id} Update workspace details ## Overview Updates the name or other details of an existing workspace. ## Path Parameters **id** `integer` *required* The workspace ID to update ## Request Body **name** `string` New name for the workspace ## Response **workspace** `object` The updated workspace object **status** `string` Request status (`success`) ```bash cURL theme={null} curl -X PUT https://app.drime.cloud/api/v1/workspace/1873 \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "name": "Renamed Workspace" }' ``` ```javascript JavaScript theme={null} const workspaceId = 1873; const response = await fetch( `https://app.drime.cloud/api/v1/workspace/${workspaceId}`, { method: 'PUT', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' }, body: JSON.stringify({ name: 'Renamed Workspace' }) } ); const { workspace } = await response.json(); ``` ```python Python theme={null} import requests workspace_id = 1873 response = requests.put( f'https://app.drime.cloud/api/v1/workspace/{workspace_id}', headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'}, json={'name': 'Renamed Workspace'} ) workspace = response.json()['workspace'] ``` ```json 200 - Success theme={null} { "workspace": { "id": 1873, "name": "Renamed Workspace", "owner_id": 15843, "updated_at": "2025-12-20T10:00:00.000000Z" }, "status": "success" } ``` # Upload Workspace Avatar Source: https://docs.drime.cloud/api-reference/user/upload-workspace-avatar POST /workspace/{id}/avatar Upload or update workspace avatar image ## Overview Uploads a new avatar image for a workspace. ## Path Parameters **id** `integer` *required* The workspace ID ## Request Body **avatar** `string` *required* Base64 encoded image data ## Response **workspace** `object` The updated workspace object with new avatar URL **status** `string` Request status (`success`) ```bash cURL theme={null} curl -X POST https://app.drime.cloud/api/v1/workspace/1873/avatar \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "avatar": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg==" }' ``` ```javascript JavaScript theme={null} // Convert file to base64 const file = document.querySelector('input[type="file"]').files[0]; const reader = new FileReader(); reader.onload = async () => { const base64 = reader.result; const response = await fetch( `https://app.drime.cloud/api/v1/workspace/1873/avatar`, { method: 'POST', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' }, body: JSON.stringify({ avatar: base64 }) } ); const { workspace } = await response.json(); console.log('New avatar URL:', workspace.avatar); }; reader.readAsDataURL(file); ``` ```python Python theme={null} import requests import base64 # Read and encode image with open('avatar.png', 'rb') as f: image_data = base64.b64encode(f.read()).decode() avatar_base64 = f"data:image/png;base64,{image_data}" response = requests.post( 'https://app.drime.cloud/api/v1/workspace/1873/avatar', headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'}, json={'avatar': avatar_base64} ) print(response.json()) ``` ```json 200 - Success theme={null} { "workspace": { "id": 1873, "name": "My Workspace", "avatar": "https://app.drime.cloud/storage/workspace-avatars/abc123.png", "updated_at": "2025-12-20T10:00:00.000000Z" }, "status": "success" } ``` # Create Vault Source: https://docs.drime.cloud/api-reference/vault/create-vault POST /vault/create Initialize encrypted vault storage ## Overview Creates and initializes the user's encrypted vault. This is a one-time setup operation. ## Request Body **password** `string` *required* Vault password/passphrase for encryption ## Response **vault** `object` The created vault object **status** `string` Request status (`success`) ```bash cURL theme={null} curl -X POST https://app.drime.cloud/api/v1/vault/create \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "password": "your-secure-vault-password" }' ``` ```javascript JavaScript theme={null} const response = await fetch('https://app.drime.cloud/api/v1/vault/create', { method: 'POST', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' }, body: JSON.stringify({ password: 'your-secure-vault-password' }) }); const { vault } = await response.json(); console.log('Vault created:', vault.id); ``` ```python Python theme={null} import requests response = requests.post( 'https://app.drime.cloud/api/v1/vault/create', headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'}, json={'password': 'your-secure-vault-password'} ) vault = response.json()['vault'] print(f'Vault created: {vault["id"]}') ``` ```json 200 - Success theme={null} { "status": "success", "vault": { "id": 993, "user_id": 15843, "salt": "aqtS3SdP/4pgWlGsDewDMw==", "check": "YYx1WHsVEwqROOwEzgnXU7fkoyCTVASPkVpVkg==", "iv": "VE/FW/XvPwQ2fTB5", "created_at": "2025-12-18T16:09:13.000000Z" } } ``` > [!WARNING] > > **Store your vault password securely!** There is no way to recover encrypted files if you forget the password. # Delete Vault Entries Source: https://docs.drime.cloud/api-reference/vault/delete-vault-entries POST /vault/delete-entries Delete entries from the vault ## Overview Permanently deletes file entries from the encrypted vault. ## Request Body **entryIds** `array` *required* Array of entry IDs to delete **deleteForever** `boolean` *required* Must be `true` for vault entries ## Response **status** `string` Request status (`success`) ```bash cURL theme={null} curl -X POST https://app.drime.cloud/api/v1/vault/delete-entries \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "entryIds": [111344], "deleteForever": true }' ``` ```javascript JavaScript theme={null} const response = await fetch('https://app.drime.cloud/api/v1/vault/delete-entries', { method: 'POST', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' }, body: JSON.stringify({ entryIds: [111344], deleteForever: true }) }); console.log('Vault entries deleted'); ``` ```python Python theme={null} import requests response = requests.post( 'https://app.drime.cloud/api/v1/vault/delete-entries', headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'}, json={ 'entryIds': [111344], 'deleteForever': True } ) print('Vault entries deleted') ``` ```json 200 - Success theme={null} { "status": "success" } ``` > [!WARNING] > > Vault entries are deleted permanently. There is no trash for encrypted files. # Download Vault Folder Source: https://docs.drime.cloud/api-reference/vault/download-vault-entry GET /vault/entries/download/{entryId} Get download URLs for all entries inside a vault folder ## Overview Retrieves download information for **all entries inside a vault folder**, recursively: each entry includes the download URL of its encrypted content and the initialization vector needed for client-side decryption. > [!WARNING] > > The entry must be a **folder**. Passing a file ID returns a `422` error > (`Entry is not a folder`). To download a single file, use the `download_url` > already returned for that file by [Get Vault Entries](/api-reference/vault/get-vault-entries). ## Path Parameters **entryId** `integer` *required* ID of the vault **folder** entry ## Response **entries** `array` All entries contained in the folder (recursive) **Entry properties** **id** `integer` Entry ID **name** `string` Filename **relativePath** `string` Path of the entry relative to the requested folder **download\_url** `string` URL to download the encrypted file **iv** `string` Initialization vector for decryption **status** `string` Request status (`success`) ```bash cURL theme={null} curl -X GET https://app.drime.cloud/api/v1/vault/entries/download/111346 \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" ``` ```javascript JavaScript theme={null} const response = await fetch('https://app.drime.cloud/api/v1/vault/entries/download/111346', { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }); const { entries } = await response.json(); const { download_url, iv } = entries[0]; // Download and decrypt the file client-side // using the iv and your vault password ``` ```python Python theme={null} import requests response = requests.get( 'https://app.drime.cloud/api/v1/vault/entries/download/111346', headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'} ) entry = response.json()['entries'][0] print(f"Download URL: {entry['download_url']}") print(f"IV for decryption: {entry['iv']}") ``` ```json 200 - Success theme={null} { "entries": [ { "id": 111346, "name": "IMG_5039.heic", "type": "file", "relativePath": "IMG_5039.heic", "download_url": "https://app.drime.cloud/api/v1/file-entries/download/MTExMzQ2fHBhZA", "iv": "WgMf4hizsWEJi3Wm" } ], "status": "success", "seo": null } ``` ```json 422 - Entry is a file theme={null} { "status": "error", "message": "Entry is not a folder" } ``` > [!NOTE] > > The downloaded file is encrypted. Use the `iv` and your vault password to decrypt it client-side. # Get Vault Source: https://docs.drime.cloud/api-reference/vault/get-vault GET /vault Get vault metadata and encryption info ## Overview Retrieves the user's vault information including encryption metadata. The vault is an encrypted storage area for sensitive files. ## Response **vault** `object` Vault metadata **Vault properties** **id** `integer` Vault ID **user\_id** `integer` Owner user ID **salt** `string` Encryption salt (base64 encoded) **check** `string` Encryption check value (base64 encoded) **iv** `string` Initialization vector **status** `string` Request status (`success`) ```bash cURL theme={null} curl -X GET https://app.drime.cloud/api/v1/vault \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" ``` ```javascript JavaScript theme={null} const response = await fetch('https://app.drime.cloud/api/v1/vault', { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }); const { vault } = await response.json(); console.log('Vault ID:', vault.id); ``` ```python Python theme={null} import requests response = requests.get( 'https://app.drime.cloud/api/v1/vault', headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'} ) vault = response.json()['vault'] print(f"Vault ID: {vault['id']}") ``` ```json 200 - Success theme={null} { "vault": { "id": 993, "user_id": 15843, "salt": "aqtS3SdP/4pgWlGsDewDMw==", "check": "YYx1WHsVEwqROOwEzgnXU7fkoyCTVASPkVpVkg==", "iv": "VE/FW/XvPwQ2fTB5", "created_at": "2025-12-18T16:09:13.000000Z", "updated_at": "2025-12-18T16:09:13.000000Z" }, "status": "success", "seo": null } ``` > [!NOTE] > > The vault uses client-side encryption. The `salt` and `iv` are used to derive the encryption key from the user's password. # Get Vault Entries Source: https://docs.drime.cloud/api-reference/vault/get-vault-entries GET /vault/file-entries List files in the encrypted vault ## Overview Retrieves file entries stored in the encrypted vault. ## Query Parameters **pageId** `string` (default: 0) Page/folder identifier **folderId** `string` (default: 0) Folder ID to list **backup** `integer` (default: 0) Filter by backup status (0 or 1) **orderBy** `string` (default: updated\_at) Field to sort by **orderDir** `string` (default: desc) Sort direction (`asc` or `desc`) **page** `integer` (default: 1) Page number ## Response **pagination** `object` Paginated list of vault entries **Pagination properties** **data** `array` Array of file entry objects **current\_page** `integer` Current page number **last\_page** `integer` Total number of pages **total** `integer` Total number of entries **status** `string` Request status (`success`) ```bash cURL theme={null} curl -X GET "https://app.drime.cloud/api/v1/vault/file-entries?page=1" \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" ``` ```javascript JavaScript theme={null} const response = await fetch('https://app.drime.cloud/api/v1/vault/file-entries?page=1', { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }); const { pagination } = await response.json(); console.log('Vault entries:', pagination.data); ``` ```python Python theme={null} import requests response = requests.get( 'https://app.drime.cloud/api/v1/vault/file-entries', params={'page': 1}, headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'} ) entries = response.json()['pagination']['data'] print(f'Found {len(entries)} vault entries') ``` ```json 200 - Success theme={null} { "pagination": { "current_page": 1, "data": [ { "id": 111345, "name": "confidential.pdf", "type": "file", "file_size": 371266, "is_encrypted": 1, "iv": "JLo1M0ZrXoB/M5io", "vault_id": 993, "hash": "MTExMzQ1fHBhZA" } ], "last_page": 1, "total": 1 }, "status": "success", "seo": null } ``` > [!NOTE] > > Vault entries have `is_encrypted: 1` and include an `iv` field for decryption. # Move Vault Entries Source: https://docs.drime.cloud/api-reference/vault/move-vault-entries POST /vault/file-entries/move Move entries within the vault ## Overview Moves file entries to a different folder within the encrypted vault. ## Request Body **entryIds** `array` *required* Array of entry IDs to move **destinationId** `integer` *required* Destination folder ID ## Response **entries** `array` The moved entries **destination** `object` Destination folder object **status** `string` Request status (`success`) ```bash cURL theme={null} curl -X POST https://app.drime.cloud/api/v1/vault/file-entries/move \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "entryIds": [111346], "destinationId": 111347 }' ``` ```javascript JavaScript theme={null} const response = await fetch('https://app.drime.cloud/api/v1/vault/file-entries/move', { method: 'POST', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' }, body: JSON.stringify({ entryIds: [111346], destinationId: 111347 }) }); const { destination } = await response.json(); console.log('Moved to:', destination.name); ``` ```python Python theme={null} import requests response = requests.post( 'https://app.drime.cloud/api/v1/vault/file-entries/move', headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'}, json={ 'entryIds': [111346], 'destinationId': 111347 } ) print('Entries moved') ``` ```json 200 - Success theme={null} { "entries": [], "destination": { "id": 111347, "name": "Private Folder", "type": "folder", "is_encrypted": 1, "vault_id": 993 }, "status": "success" } ``` # Update Vault Entry Source: https://docs.drime.cloud/api-reference/vault/update-vault-entry PUT /vault/{entryId} Update a vault entry (e.g., rename) ## Overview Updates a vault entry's metadata, such as renaming the file. ## Path Parameters **entryId** `integer` *required* ID of the vault entry ## Request Body **name** `string` *required* New filename **initialName** `string` *required* Original filename (for validation) ## Response **fileEntry** `object` The updated file entry **status** `string` Request status (`success`) ```bash cURL theme={null} curl -X PUT https://app.drime.cloud/api/v1/vault/111345 \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "name": "renamed-document.pdf", "initialName": "original-document.pdf" }' ``` ```javascript JavaScript theme={null} const response = await fetch('https://app.drime.cloud/api/v1/vault/111345', { method: 'PUT', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' }, body: JSON.stringify({ name: 'renamed-document.pdf', initialName: 'original-document.pdf' }) }); const { fileEntry } = await response.json(); console.log('Renamed to:', fileEntry.name); ``` ```python Python theme={null} import requests response = requests.put( 'https://app.drime.cloud/api/v1/vault/111345', headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'}, json={ 'name': 'renamed-document.pdf', 'initialName': 'original-document.pdf' } ) file_entry = response.json()['fileEntry'] print(f'Renamed to: {file_entry["name"]}') ``` ```json 200 - Success theme={null} { "fileEntry": { "id": 111345, "name": "renamed-document.pdf", "type": "file", "file_size": 371266, "is_encrypted": 1, "iv": "JLo1M0ZrXoB/M5io", "vault_id": 993, "hash": "MTExMzQ1fHBhZA" }, "status": "success" } ``` # Authentication Source: https://docs.drime.cloud/authentication Personal access tokens for your own tools, OAuth for applications other people use ## Overview Every API request carries a token in the `Authorization` header: ```bash theme={null} Authorization: Bearer YOUR_ACCESS_TOKEN ``` How you get that token depends on whose account the requests act on. > **[Personal access token](#personal-access-tokens)** > > Your own scripts, backups and tools, working on your own account. > **[OAuth application](/oauth/overview)** > > An application other Drime users connect to. They approve it on Drime, and you never see their password. > [!WARNING] > > Never ask a user for their Drime password. If your application works on other people's accounts, use [OAuth](/oauth/overview). ## Personal access tokens ### Create a token 1. Sign in to [Drime](https://app.drime.cloud). 2. Open **Settings** and go to **Developers**, or use the [direct link](https://app.drime.cloud/account-settings#developers). 3. Under **API access tokens**, click **Create token**. 4. Give it a name you will recognize later, for example the machine or the script that uses it. 5. Choose its **Permissions** (see below) and click **Create**. 6. Copy the token and store it somewhere safe. It is shown once: after you close the dialog, nobody can display it again, not even Drime. ### Permissions The dialog offers three choices: | Choice | What the token can do | | - | - | | **All** | Everything your account can do through the API. This is the default, so change it if you do not need everything. | | **Read Only** | Read every resource in the list below. It cannot create, change or delete anything. | | **Restricted** | Only what you pick, resource by resource: **No Access**, **Read** or **Write**. Write includes read. | The resources are Files, Folders, Sharing, Workspaces, Vault, Sign, Whiteboards, File requests, Send & Track, Contacts, Tags and Analytics (read only). They are the same scopes OAuth applications use, `files.read`, `files.write` and so on, and the [scopes page](/oauth/scopes) lists the routes each one opens. > [!TIP] > > Give each token the narrowest permissions that work. A token that can only read your files cannot delete them if it leaks. A token with **Read Only** or **Restricted** permissions never reaches the routes that manage the account itself, whatever you tick: API tokens, sessions, password and two-factor settings, billing and the admin area. Routes that belong to no resource are refused too, so a limited token cannot be used to create a more powerful one. Any token can read `GET /users/me`, whatever its permissions. > [!NOTE] > > Vault files stay encrypted. With Vault access, a token lists and downloads encrypted data. Only the vault password, on your side, can decrypt it. ### Lifetime and revocation A personal access token does not expire. It works until you delete it. The **API access tokens** list shows when each token was last used. Delete a token from the same list as soon as you stop using it, or straight away if it may have leaked: it stops working immediately. ## Using the token Send it in the `Authorization` header of every request: ```bash cURL theme={null} curl https://app.drime.cloud/api/v1/users/me \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" ``` ```javascript JavaScript theme={null} const response = await fetch('https://app.drime.cloud/api/v1/users/me', { headers: { 'Authorization': `Bearer ${process.env.DRIME_API_TOKEN}` } }); const { user } = await response.json(); console.log(user.email); ``` ```python Python theme={null} import os import requests response = requests.get( 'https://app.drime.cloud/api/v1/users/me', headers={'Authorization': f"Bearer {os.environ['DRIME_API_TOKEN']}"} ) print(response.json()['user']['email']) ``` ```json Response theme={null} { "user": { "id": 15843, "email": "you@example.com", "display_name": "John Doe", "first_name": "John", "last_name": "Doe", "created_at": "2024-01-01T00:00:00.000000Z", "updated_at": "2024-01-15T10:30:00.000000Z" }, "status": "success" } ``` ## Error Responses ### 401 Unauthorized The token is missing, wrong, or was deleted: ```json theme={null} { "message": "Unauthenticated." } ``` ### 403 Forbidden The token is valid but its permissions do not cover this route. The message names the missing scope: ```json theme={null} { "message": "This API key is missing the required scope: files.write" } ``` Routes a limited token can never reach answer: ```json theme={null} { "message": "This endpoint cannot be accessed with a restricted API key." } ``` And when the token is fine but your account itself may not do this, for example on a file someone shared with you read only: ```json theme={null} { "message": "This action is unauthorized." } ``` ## Keeping tokens safe > **Environment variables** > > Keep tokens out of your code and out of version control > **One token per tool** > > Delete one without breaking the others, and see which one was used last > **Narrow permissions** > > Read Only or Restricted whenever All is not needed > **Never in a shipped app** > > Anything inside a browser page or an app you distribute can be extracted. Use OAuth there ## Example: Setting Up Environment Variables **Linux/macOS** ```bash theme={null} export DRIME_API_TOKEN="your_token_here" ``` **Windows (PowerShell)** ```powershell theme={null} $env:DRIME_API_TOKEN = "your_token_here" ``` **.env File** ``` DRIME_API_TOKEN=your_token_here ``` Then use it in your code: ```javascript theme={null} const token = process.env.DRIME_API_TOKEN; fetch('https://app.drime.cloud/api/v1/users/me', { headers: { 'Authorization': `Bearer ${token}` } }); ``` # Key Concepts Source: https://docs.drime.cloud/concepts Understanding the core concepts of Drime Cloud ## File Entries A **File Entry** represents either a file or a folder in Drime Cloud. Each entry has: * A unique **ID** * A **hash** for public URLs * A **parent\_id** (null = root) * A **workspace\_id** (0 = personal space) ```json theme={null} { "id": 123456, "name": "document.pdf", "type": "pdf", "hash": "MTIzNDU2fA", "file_hash": "9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08", "parent_id": null, "workspace_id": 0, "created_at": "2024-01-14T08:20:00.000000Z", "updated_at": "2024-01-20T15:30:00.000000Z", "client_last_modified": 1712345678000 } ``` ## Identifiers: `id` vs `hash` Every entry carries two identifiers. They are **not** interchangeable everywhere: | Field | What it is | Where to use it | | - | - | - | | `id` | Numeric primary key (e.g. `485529678`) | All `/file-entries/{entryId}` endpoints, metadata, integrity checks | | `hash` | URL-safe encoded version of the ID (e.g. `NDg1NTI5Njc4fA`) | Public/share URLs, downloads (`/file-entries/download/{hash}`), folder paths | > [!WARNING] > > The `hash` field is an **encoded identifier**, not a hash of the file content. For content > hashing (integrity, deduplication), see `file_hash` below. ## Content Hash (`file_hash`) `file_hash` stores the **SHA-256 hex digest of the file content**. It is set when: * The client provides `fileHash` at upload time ([Upload File](/api-reference/uploads/upload-file), [Create S3 Entry](/api-reference/uploads/create-s3-entry)) * A successful [Verify File Integrity](/api-reference/files/verify-file-integrity) call stores the server-computed hash Use it for: * **Deduplication / instant uploads** via [Check File Hash](/api-reference/files/check-file-hash) * **End-to-end integrity checks** via [Verify File Integrity](/api-reference/files/verify-file-integrity) ## Timestamps & Modification Time File entries expose several time fields with distinct meanings: | Field | Format | Meaning | | - | - | - | | `created_at` | ISO 8601 (UTC) | When the entry was created in Drime | | `updated_at` | ISO 8601 (UTC) | Last server-side change (rename, move, content replace) | | `client_last_modified` | Unix epoch **milliseconds** | Original modification time of the file on the client machine | | `captured_at` | ISO 8601 (UTC) | EXIF capture date for photos/videos (drives the photo timeline) | To **preserve the original mtime** of files (like rclone's `SetModTime` or a sync client would): 1. Pass `lastModified` (ms epoch) in the upload request body, **or** 2. Call [Set File Metadata](/api-reference/files/set-file-metadata) on an existing entry ```bash theme={null} # Preserve mtime on an already-uploaded file curl -X POST https://app.drime.cloud/api/v1/file-entries/485529678/metadata \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \ -H "Content-Type: application/json" \ -d '{"lastModified": 1712345678000}' ``` ## Workspaces **Workspaces** allow you to organize your files and collaborate: > **Personal Space** > > `workspaceId = 0` represents your default personal space > **Shared Workspaces** > > Create workspaces to collaborate with your team ## File Types Drime Cloud automatically recognizes file types: | Type | Description | | - | - | | `folder` | Folder | | `image` | Images (jpg, png, gif, etc.) | | `video` | Videos (mp4, mov, etc.) | | `audio` | Audio files (mp3, wav, etc.) | | `pdf` | PDF documents | | `text` | Text files | | `file` | Other files | ## Permissions When sharing, you can grant different permissions: > **view** > > Allows viewing the file/folder > **edit** > > Allows modifying the file/folder > **download** > > Allows downloading the file ## Vault (Encrypted Storage) The **Vault** is a client-side encrypted storage area: > [!WARNING] > > Vault files are encrypted with your password. If you lose this password, files are **unrecoverable**. * Client-side AES encryption * Keys never leave your device * Ideal for sensitive documents # Error Handling Source: https://docs.drime.cloud/errors Understanding and handling API errors ## HTTP Status Codes The Drime Cloud API uses standard HTTP codes: | Code | Meaning | | - | - | | `200` | Success | | `201` | Created successfully | | `400` | Bad request | | `401` | Unauthenticated | | `403` | Access denied | | `404` | Resource not found | | `422` | Validation error | | `429` | Too many requests | | `500` | Server error | ## Error Formats ### Authentication Error (401) ```json theme={null} { "message": "Unauthenticated." } ``` > [!TIP] > > Verify that your token is valid and sent in the `Authorization: Bearer TOKEN` header ### Permission Error (403) ```json theme={null} { "message": "This action is unauthorized." } ``` ### Validation Error (422) ```json theme={null} { "status": "error", "message": "The given data was invalid.", "errors": { "email": ["The email field is required."], "password": ["The password must be at least 8 characters."] } } ``` ### Resource Not Found (404) ```json theme={null} { "message": "No query results for model [App\\FileEntry] 123456" } ``` ## Best Practices > **Always check the status** > > ```javascript theme={null} > const response = await fetch(url, options); > > if (!response.ok) { > const error = await response.json(); > throw new Error(error.message || 'Request failed'); > } > ``` > **Handle validation errors** > > ```javascript theme={null} > if (response.status === 422) { > const { errors } = await response.json(); > // Display errors per field > Object.entries(errors).forEach(([field, messages]) => { > console.error(`${field}: ${messages.join(', ')}`); > }); > } > ``` > **Refresh token if expired** > > ```javascript theme={null} > if (response.status === 401) { > // Token expired, reconnect the user > await refreshToken(); > // Retry the request > } > ``` ## Rate Limiting The API limits request rates to ensure stability: > [!WARNING] > > If you receive a **429** error, wait a few seconds before retrying. ```javascript theme={null} async function fetchWithRetry(url, options, retries = 3) { for (let i = 0; i < retries; i++) { const response = await fetch(url, options); if (response.status === 429) { const waitTime = Math.pow(2, i) * 1000; // Exponential backoff await new Promise(r => setTimeout(r, waitTime)); continue; } return response; } throw new Error('Max retries exceeded'); } ``` # Introduction Source: https://docs.drime.cloud/introduction Welcome to Drime Cloud API documentation ## Welcome to Drime Cloud Drime Cloud is a powerful cloud storage platform that enables you to securely store, manage, and share your files. Our API provides programmatic access to all Drime Cloud features. > **[Quick Start](/quickstart)** > > Get up and running with the Drime Cloud API in minutes > **[Authentication](/authentication)** > > Personal access tokens for your own tools, OAuth for applications other people use > **[API Reference](/api-reference/introduction)** > > Explore all available endpoints > **[Dashboard](https://app.drime.cloud)** > > Access your Drime Cloud dashboard ## Features > **File Storage** > > Upload, download, and manage files of any type. Support for simple uploads (\< 5MB) and multipart uploads for larger files. > **Workspaces** > > Organize your files into workspaces. Collaborate with team members and manage permissions. > **Sharing** > > Share files and folders with specific users or create shareable links with customizable permissions. > **Vault** > > Secure your sensitive files with end-to-end encryption using the Vault feature. > **Tracking** > > Track file access and downloads with detailed analytics. ## Base URL All API requests should be made to: ``` https://app.drime.cloud/api/v1 ``` ## Need Help? > **[Support](mailto:contact@drime.cloud)** > > Contact our support team > **[Discord](https://discord.gg/SZYu6A3vth)** > > Join our Discord community # The Application Folder Source: https://docs.drime.cloud/oauth/app-folder Working inside one folder of each user's Drive An application created with **A folder of its own** never sees the rest of the Drive. When a user authorizes it, Drime creates a folder for it in their personal Drive: ``` Their Drive └── Applications └── Your application name (everything your application can see) ``` Several applications get several folders under the same `Applications` folder. ## Find your folder ```bash theme={null} curl https://app.drime.cloud/api/v1/drive/app-folder \ -H "Authorization: Bearer $ACCESS_TOKEN" ``` ```json theme={null} { "app_folder": { "id": 84213, "name": "Lumo", "type": "folder", "hash": "ODQyMTN8cGFkZA" }, "status": "success" } ``` The real object carries more fields; `id` is the one to keep. An application that works on the whole Drive gets `{"app_folder": null}` from the same route, so one code path serves both kinds. An invalid token gets `401`. ## Inside and outside Inside the folder, your application uses the API like any other client. Outside it, nothing exists for your application: | | | | - | - | | An id or a hash from elsewhere in the Drive | `404`, on every endpoint | | A listing with no `folderId` | Lists your folder | | An upload, or a new folder or document, with no `parentId` | Lands in your folder, not at the top of the Drive | | `workspaceId` other than `0` | `403`: your folder lives in the personal Drive, team workspaces are out of reach | | The sync API (`/sync/…`) | `403`: it works on the whole Drive | | `workspaces.*` and `vault.*` scopes | Cannot be selected for this kind of application | ## What the user can do with the folder * **Rename it or move it.** Your application keeps working: it is tied to the folder itself, not to its name or its place. * **Delete it.** A new, empty one is created on a later call. Treat "my files are gone" as a state you can recover from. * **Disconnect your application.** If they authorize it again later, Drime reuses the folder if it is still called exactly like your application, directly inside `Applications`. Otherwise it creates a new, empty one. After the user moves or deletes the folder, allow up to a minute before your application sees the change. Revoking your own tokens with [`/oauth/revoke`](/oauth/authorization-flow) does not lose the folder: when the user authorizes again, you find the same one, with its contents. ## Storage The folder uses the account's storage quota. It limits what your application can reach, not how much it can store. ## Notifications [Webhooks](/oauth/webhooks) name the account that changed, not the folder: your application can be notified of a change made elsewhere in the user's Drive. List your folder to see whether anything changed in it. # Authorization Flow Source: https://docs.drime.cloud/oauth/authorization-flow Send the user to Drime, receive a code, exchange it for tokens ## 1. Prepare PKCE For every authorization, generate a random `code_verifier` (43 to 128 characters from `A-Z`, `a-z`, `0-9`, `-`, `.`, `_`, `~`) and its S256 challenge: ```bash theme={null} code_verifier=$(openssl rand 48 | openssl base64 -A | tr '+/' '-_' | tr -d '=') code_challenge=$(printf '%s' "$code_verifier" \ | openssl dgst -binary -sha256 \ | openssl base64 -A | tr '+/' '-_' | tr -d '=') ``` Keep the `-A` flags: without them `openssl base64` breaks long output into lines, and a verifier with a line break in it fails the exchange with `invalid_grant`. PKCE is required for desktop, mobile and script applications. Server applications may leave it out, but should not: it costs nothing and protects the code. Only `S256` is accepted; `plain` is refused. ## 2. Send the user to Drime ``` https://app.drime.cloud/oauth/authorize ?client_id=lumo_8f3a6c21d4e77b90 &redirect_uri=https%3A%2F%2Fyour-app.com%2Foauth%2Fcallback &response_type=code &scope=files.read%20files.write &state=STATE &code_challenge=CODE_CHALLENGE &code_challenge_method=S256 ``` | Parameter | Value | | - | - | | `client_id` | Your application's client ID, from the console | | `redirect_uri` | One of your registered redirect URLs, character for character | | `response_type` | Always `code` | | `scope` | The [scopes](/oauth/scopes) you ask for, separated by spaces. At least one | | `state` | A random value, new for each request, that you check when the user comes back. It is your protection against CSRF | | `code_challenge` | The challenge from step 1 | | `code_challenge_method` | `S256` | The user signs in to Drime if they are not signed in yet (password, two-factor, passkey or Google: you implement none of it). Then they see the authorization screen: your application's name and what it asks for. They can untick permissions before approving. The screen shows every time, including to someone who already approved your application. If `client_id` or `redirect_uri` is wrong, Drime shows the error on its own page and sends nobody to the URL: an address you did not register never receives anything. ## 3. Drime sends the user back ``` https://your-app.com/oauth/callback?code=CODE&state=STATE ``` Check that `state` is the value you sent, and refuse the request otherwise. If the user declines, you get `?error=access_denied`, with `error_description` and your `state`, and no code. The code is valid for **60 seconds** and works **once**. A failed exchange uses it up as well: start a new authorization. ## 4. Exchange the code for tokens ```bash Server application theme={null} curl -X POST https://app.drime.cloud/oauth/token \ -d grant_type=authorization_code \ -d code="$CODE" \ -d redirect_uri=https://your-app.com/oauth/callback \ -d client_id="$CLIENT_ID" \ -d client_secret="$CLIENT_SECRET" \ -d code_verifier="$CODE_VERIFIER" ``` ```bash Desktop, mobile or script theme={null} curl -X POST https://app.drime.cloud/oauth/token \ -d grant_type=authorization_code \ -d code="$CODE" \ -d redirect_uri=http://127.0.0.1:53682/callback \ -d client_id="$CLIENT_ID" \ -d code_verifier="$CODE_VERIFIER" ``` * `redirect_uri` must be the one used in step 2. * A server application may send its credentials with HTTP Basic instead of the body (RFC 6749, section 2.3.1). If it sends both, Basic is used. * A desktop, mobile or script application sends no secret. Sending one is refused. ```json theme={null} { "access_token": "554|wbB1NbhiyX8hpNdZZakHaKMEeHEkPOsLts3LG3b4VeJEwJBd", "token_type": "Bearer", "expires_in": 3600, "refresh_token": "Jx2kq2aB6JHgGHaPRGNveeELUprYX0IBDYac31IZygRXEEwvY6ISpEqVKNFlrOKFvY4EEhPiha2lJhZ5", "scope": "files.read files.write" } ``` Read `scope` instead of assuming it. It holds what you were actually given: * **sometimes more** than you asked for, because a `.write` scope always brings its `.read`; * **sometimes less**, because the user may have unticked a permission; * **never** anything the user did not approve. The response does not say who the user is. Call [`GET /api/v1/users/me`](/api-reference/user/get-logged-user) once and store `user.id` with the tokens: [webhooks](/oauth/webhooks) name accounts by this id. ## 5. Call the API ```bash theme={null} curl https://app.drime.cloud/api/v1/drive/file-entries \ -H "Authorization: Bearer $ACCESS_TOKEN" ``` ## 6. Refresh Access tokens last **one hour**. Refresh tokens last **90 days** and **rotate**: each refresh returns a new refresh token, valid 90 days again, and retires the one you sent. The access token you had stops working at the same time. ```bash Server application theme={null} curl -X POST https://app.drime.cloud/oauth/token \ -d grant_type=refresh_token \ -d refresh_token="$REFRESH_TOKEN" \ -d client_id="$CLIENT_ID" \ -d client_secret="$CLIENT_SECRET" ``` ```bash Desktop, mobile or script theme={null} curl -X POST https://app.drime.cloud/oauth/token \ -d grant_type=refresh_token \ -d refresh_token="$REFRESH_TOKEN" \ -d client_id="$CLIENT_ID" ``` > [!WARNING] > > Store the new refresh token before you use it. A refresh token presented twice is treated as stolen: Drime revokes every token your application holds for that user, and the user has to authorize again. If several processes share the tokens, refresh behind a lock. You may pass `scope` to narrow the new access token to part of what you were granted. Scopes you were not granted are never added, and a request for nothing but those answers `invalid_scope`. ## 7. Revoke When a user disconnects Drime from inside your application, revoke the refresh token: ```bash Server application theme={null} curl -X POST https://app.drime.cloud/oauth/revoke \ -d token="$REFRESH_TOKEN" \ -d client_id="$CLIENT_ID" \ -d client_secret="$CLIENT_SECRET" ``` ```bash Desktop, mobile or script theme={null} curl -X POST https://app.drime.cloud/oauth/revoke \ -d token="$REFRESH_TOKEN" \ -d client_id="$CLIENT_ID" ``` * **A refresh token** ends the authorization: every token your application holds for that user stops working. * **An access token** ends only that token. The refresh token keeps working. * A token that is unknown or already revoked answers `200` too, as RFC 7009 requires. Wrong client credentials answer `401` with `invalid_client`. Users can also disconnect your application themselves, at any time, from **Devices & apps** in their Drime settings. ## Redirect URLs * Compared **exactly**, after normalizing the case of the scheme and host. No prefix, no wildcard, no subdomain matching. * `https://` only, except `http://127.0.0.1`, `http://[::1]` and `http://localhost` for applications running on the user's own machine. * On `127.0.0.1` and `[::1]` the **port is ignored** (RFC 8252, section 7.3), so a desktop application can listen on whatever port is free. `localhost` keeps its port. * No fragment, no wildcard, no credentials in the URL, no `..`. * Custom schemes such as `myapp://callback` are refused: any other application on the same machine can register the same scheme and catch the code. Use the loopback address instead. * Up to 10 redirect URLs per application, 2,000 characters each. > [!TIP] > > A desktop application opens the authorization URL in the system browser, not in a web view inside the app, and listens on `http://127.0.0.1:/callback` for the code. The user sees the real Drime page and can check the address bar. # Errors and Limits Source: https://docs.drime.cloud/oauth/errors-and-limits What each OAuth error means, when tokens stop working, and the rate limits ## OAuth errors The token and revocation endpoints answer errors as JSON: ```json theme={null} { "error": "invalid_grant", "error_description": "This authorization code is invalid or has expired." } ``` Errors on the authorization screen come back to your redirect URL as `?error=...&error_description=...&state=...`, except when `client_id` or `redirect_uri` is wrong: those stay on a Drime page. | `error` | What happened | What to do | | - | - | - | | `invalid_request` | A parameter is missing or malformed: most often `redirect_uri`, the PKCE challenge of a desktop, mobile or script application, or `code_challenge_method=plain` | Fix the request | | `invalid_client` | Unknown `client_id`, wrong secret, a desktop, mobile or script application that sent a secret, or an application suspended by Drime | Check your credentials | | `invalid_grant` | The code expired (60 seconds), was already used, belongs to another application, or was issued for another `redirect_uri`; the `code_verifier` does not match; or the refresh token is unknown, expired or was already used | Start a new authorization | | `invalid_scope` | A scope that does not exist, is not available to applications, or is not ticked under **Permissions**; no `scope` at all; or a refresh that asked only for scopes you were not granted | Fix the `scope` parameter or your **Permissions** | | `unsupported_grant_type` | `grant_type` missing, or something other than `authorization_code` and `refresh_token` | Use one of the two | | `unsupported_response_type` | `response_type` other than `code`. The implicit grant does not exist here | Use `code` | | `access_denied` | The user declined, or your application has reached its limit of 25 users in Development | Let the user try again, or [go to production](/oauth/going-to-production) | | `server_error` | Something failed on Drime's side | Try again later | ## API errors | Status | Message | Meaning | | - | - | - | | `401` | `Unauthenticated.` | The access token expired or was revoked. Refresh it; if the refresh fails with `invalid_grant`, authorize again | | `403` | `This API key is missing the required scope: x` | Your token does not have scope `x`. See [Scopes](/oauth/scopes) | | `403` | `This endpoint cannot be accessed with a restricted API key.` | This route is never open to applications | | `403` | `This endpoint works on the whole Drive, so it is not available to an application that works inside its own folder.` | The sync API, for an [application folder](/oauth/app-folder) | | `403` | `This application works inside its own folder, which lives in your personal Drive. It cannot be used in a team workspace.` | A `workspaceId` other than `0`, for an application folder | | `404` | `No such entry inside this application's folder.` | An id or hash outside your application folder | | `503` | `This application's folder could not be opened. Try again in a moment.` | Try again in a moment | ## Checking that a token still works Call `GET /api/v1/users/me`. Every token can read it, whatever its scopes, and it answers `401` as soon as the token stops working. ```bash theme={null} curl -o /dev/null -w '%{http_code}\n' \ https://app.drime.cloud/api/v1/users/me \ -H "Authorization: Bearer $ACCESS_TOKEN" # 200: the token works. 401: refresh it. ``` ## When tokens stop working early An access token lasts one hour, but it can stop working sooner, without warning: * you refreshed it: each refresh retires the access token you had; * the user disconnected your application from **Devices & apps** in their Drime settings; * you called [`/oauth/revoke`](/oauth/authorization-flow); * a refresh token was presented twice. Drime treats it as stolen and revokes every token your application holds for that user; * an authorization code was used twice, and the tokens it produced are revoked; * Drime suspended your application, or you deleted it. Handle `401` by refreshing once. If the refresh answers `invalid_grant`, the user has to authorize your application again. ## Rate limits | | | | - | - | | `/oauth/token` and `/oauth/revoke`, together | 60 requests a minute per `client_id`, and 120 a minute per IP address | | Data API | A much higher, general limit | Beyond a limit, Drime answers `429`. Wait, then retry with an increasing delay. # Going to Production Source: https://docs.drime.cloud/oauth/going-to-production Lift the 25 users limit of a new application A new application is in **Development**: it works fully, for up to **25 connected users**. That is enough to build it, test it and show it to your first users. To open it to everyone, send it for review. ## Send it for review Open your application in the [developer console](https://app.drime.cloud/developers) and fill in **Open it to everyone**: | Field | What to write | | - | - | | **Your name or your company** | The publisher, as your users will see it | | **What does it do?** | One or two sentences, as your users would read them (20 characters at least) | | **What does it do with Drime?** | Which files it reads or writes, and why it needs the permissions you ticked (20 characters at least) | | **Website** | An `https://` address | | **Privacy policy** | An `https://` address | Your application also needs at least one redirect URL and at least one permission. Then click **Send for review**. Drime answers within 24 hours. Until then, your application keeps working with up to 25 users. ## What gets refused So that you do not lose a round trip: * a privacy policy link that does not open, or opens a blank page; * no website, or a website that does not mention the integration; * a name or a logo that could be mistaken for Drime itself; * redirect URLs on a link shortener, or on an IP address other than the loopback addresses (`127.0.0.1`, `[::1]`, `localhost`) a desktop application uses; * permissions that the description does not explain. ## If changes are requested Your application shows **Changes requested**, with the reason. It is not a ban: it keeps its users and its 25 users limit, and you can fix what was asked and send it again. ## Before you ship * `state` is generated for each authorization and checked when the user comes back. * A new `code_verifier` is generated for each authorization, with `S256`. * The secret key stays on your server: never in an app you distribute, never in version control. * Each new refresh token is stored before it is used, and only one refresh runs at a time. * `401` is handled by refreshing, and `invalid_grant` on a refresh by authorizing again. * Your application asks only for the scopes it calls. * If you use webhooks, the signature of every notification is checked. # OAuth Overview Source: https://docs.drime.cloud/oauth/overview Let other Drime users connect your application to their account Use OAuth when your application works on **other people's** Drime accounts. The user signs in on Drime, sees what your application asks for and approves it. Your application receives a token limited to what they approved, and never sees their password. > [!TIP] > > For scripts and tools that only use your own account, a [personal access token](/authentication#personal-access-tokens) is simpler. ## The standard Drime implements OAuth 2.0 with the authorization code grant and PKCE (RFC 6749, RFC 7636, and RFC 8252 for native apps). A standard OAuth 2 client library works as is. | Endpoint | URL | | - | - | | Authorization | `GET https://app.drime.cloud/oauth/authorize` | | Token | `POST https://app.drime.cloud/oauth/token` | | Revocation (RFC 7009) | `POST https://app.drime.cloud/oauth/revoke` | | API | `https://app.drime.cloud/api/v1/...` | These URLs carry no version number: only the data API is versioned (`/api/v1`). Give them to your OAuth client library as they are. Drime does not implement OpenID Connect: there is no ID token and no userinfo endpoint. To know who authorized your application, call [`GET /users/me`](/api-reference/user/get-logged-user) with their token. ## Create an application Open the [developer console](https://app.drime.cloud/developers), click **Create application** and answer: 1. **Name**: what your users see on the authorization screen. A name with the word "Drime" or "official" in it is refused, so that nobody can pass for Drime itself. 2. **What are you building?** * **A website or a server**: a confidential client. You get a secret key, to keep on your server. * **A desktop or mobile app**: a public client. No secret key, and PKCE is required. * **A script, just for me**: a public client too, PKCE required. 3. **What does it need to reach?** * **A folder of its own**: your application only ever sees one folder in each user's Drive. Pick this unless you are building a file manager or a sync tool. See [The application folder](/oauth/app-folder). * **The whole Drive**: for file managers and sync tools. 4. Tick **I accept the Drime API terms**. > [!WARNING] > > What your application can reach cannot change once someone has connected it. Widening it would give an application approved for one folder access to the whole Drive, behind a screen the user already saw. While nobody is connected you can still change it; after that, create a new application. Your application exists right away, in **Development**, limited to **25 connected users**. Build and test against it straight away, and [send it for review](/oauth/going-to-production) when you want to lift the limit. Then, in your application: * under **Settings**, add your redirect URLs (up to 10, see the [rules](/oauth/authorization-flow#redirect-urls)); * under **Permissions**, tick the scopes your application needs, and nothing more. > [!NOTE] > > The secret key is shown once, when it is created. Drime keeps only a fingerprint of it. If you lose it, create a new one from **Settings**: the old one stops working immediately. ## Next steps > **[Authorization flow](/oauth/authorization-flow)** > > Send the user to Drime, get a code, exchange it for tokens > **[Scopes](/oauth/scopes)** > > What each permission opens, and what no application can have > **[The application folder](/oauth/app-folder)** > > Working inside one folder of each user's Drive > **[Webhooks](/oauth/webhooks)** > > Get told when a connected account changes > **[Errors and limits](/oauth/errors-and-limits)** > > What each error means and what to do about it > **[Going to production](/oauth/going-to-production)** > > Lift the 25 users limit # Scopes Source: https://docs.drime.cloud/oauth/scopes What each permission opens, and what no application can have A scope is written `{resource}.{read|write}`, and a `.write` scope always includes its `.read`. A `GET` or `HEAD` request needs the `.read` scope of its resource, any other method needs the `.write` one. Ask only for what your application calls. Users see every scope on the authorization screen, in the words of the second column, and they can untick them. ## Available scopes | Scope | On the authorization screen | Routes under `/api/v1` | | - | - | - | | `files.read` / `files.write` | See your files / Create and edit files | `file-entries…`, `drive/…`, `uploads…`, `s3/…`, `tus/…`, `file-versions…`, `file-versioning…`, `file-backup…`, `backups/…`, `entry/…`, `videos/…`, `stream/…`, `albums…`, `playlists…`, `comments/…`, `file-activities…`, `devices…`, `device-backups…`, `getEditor/…`, `createDoc`, `createSheet`, `createSlide`, `createWebShortcut` | | `folders.read` / `folders.write` | See your folders / Create and organise folders | `folders…`, `folder/…`, `drive/folders/…`, `users/{id}/folders` | | `sharing.read` / `sharing.write` | See your shared links / Share on your behalf | `file-entries/{id}/share`, `file-entries/{id}/unshare`, `file-entries/{id}/change-permissions`, `file-entries/{id}/shareable-link`, `file-entries/{id}/restrictions…`, `shareable-links…`, `drive/file-entries/{id}/email-recipients…` | | `file_requests.read` / `file_requests.write` | See your file requests / Manage your file requests | `file-requests…` | | `tags.read` / `tags.write` | See your tags / Manage your tags | `tags…`, `file-entry-tags…`, `file-entries/{id}/sync-tags` | | `workspaces.read` / `workspaces.write` | See your workspaces / Manage your workspaces | `workspace…`, `me/workspaces`, `me/workspace-permissions`, `me/workspace/personal…` | | `sign.read` / `sign.write` | See your signature requests / Manage signature requests | `sign/…` | | `whiteboards.read` / `whiteboards.write` | See your whiteboards / Edit your whiteboards | `whiteboards…`, `whiteboard/…` | | `track.read` / `track.write` | See your tracked sends / Manage tracked sends | `track/…` | | `contacts.read` / `contacts.write` | See your contacts / Manage your contacts | `contacts…` | | `analytics.read` | See your usage statistics | `user/space-usage…`, `user/storage-breakdown` | | `notifications.read` | See your notifications | `notifications…` | A route written with `…` covers everything that starts with it. The sharing and tag routes on a file entry are matched before the broad `file-entries…` line, so sharing a file needs `sharing.write`, not `files.write`. ## Exceptions to the method rule * `POST /file-entries/download-urls`, `POST /file-entries/sync-info` and `POST /file-entries/hash/check` only read: `files.read` is enough. * `GET /workspace/join/…` joins a workspace: it needs `workspaces.write`. * `analytics.read` and `notifications.read` have no `.write` counterpart. Marking notifications as read or deleting them is not available to applications. ## The sync API The sync API (`/api/v1/sync/…`) mirrors the whole Drive tree, files and folders together, so it asks for both: | Route | Scopes needed | | - | - | | `POST /sync/batch` | `files.write` **and** `folders.write` | | Every other `/sync/…` route | `files.read` **and** `folders.read` | It is not available to an application that works in [its own folder](/oauth/app-folder), whatever its scopes. ## Every token can read `GET /users/me`, whatever its scopes. Use it to learn which account authorized you, and to check that a token still works. ## What no application can have * **`*`.** There is no "everything" scope. Ask for what you use. * **`vault.read` and `vault.write`.** The Drime Vault is end-to-end encrypted and only Drime's own apps can access it. This includes the Vault's folder tree, `users/{id}/folders?vault=1`. * **`workspaces.*`**, for an application that works in [its own folder](/oauth/app-folder): that folder lives in the user's personal Drive. ## Always refused Whatever its scopes, a token never reaches the routes that manage the account itself: API tokens and sessions, e-mail address, password and two-factor settings, the sign-in routes, billing, settings, the admin area, the developer console and the OAuth endpoints. An application cannot create another token or widen its own access. A route that belongs to no resource above is refused too. ## When a scope is missing ```json theme={null} { "message": "This API key is missing the required scope: folders.write" } ``` The status is `403`. Tick the scope under **Permissions** in the console, then send your users through the [authorization flow](/oauth/authorization-flow) again: a token never gains a scope after it was issued. The **Analytics** tab of your application counts these refusals by scope. A route that is always refused answers `403` with: ```json theme={null} { "message": "This endpoint cannot be accessed with a restricted API key." } ``` # Webhooks Source: https://docs.drime.cloud/oauth/webhooks Get told when a connected account changes, instead of asking If you have integrated Dropbox webhooks, this is the same design: a challenge when you set the endpoint, then signed `POST` requests that name the accounts that changed, and nothing else. Webhooks are available to applications created as **A website or a server**. Drime has to reach a server of yours, and a desktop, mobile or script application has none. ## 1. Set the endpoint In the [developer console](https://app.drime.cloud/developers), open your application, then **Webhooks**. Paste an `https://` address and click **Verify and save**. Drime calls it straight away with a challenge: ``` GET https://your-app.com/drime/webhook?challenge=Xq4vB8sLm2NcT6yRw1Ke9JdFh3Pz7UaG ``` Answer `200` with the challenge as the whole body: ``` HTTP/1.1 200 OK Content-Type: text/plain X-Content-Type-Options: nosniff Xq4vB8sLm2NcT6yRw1Ke9JdFh3Pz7UaG ``` You have 10 seconds, and redirects are not followed. Nothing is saved until the challenge comes back, and nothing is ever sent to an endpoint that has not answered one. That is what stops someone from typing your address into their own application. The address must: * start with `https://`; * use a hostname, not an IP address; * resolve to public addresses only, which Drime checks again before every delivery, not only when you save; * carry no credentials and no `#fragment`; * be 500 characters at most. ## 2. Copy the signing secret Once the endpoint is saved, the **Webhooks** tab shows its **signing secret**, starting with `whsec_`. Keep it on your server, like a password: it is what proves a notification comes from Drime. To get a new one, remove the endpoint and save it again. The old secret stops working at once. ## 3. Receive notifications ``` POST https://your-app.com/drime/webhook Content-Type: application/json User-Agent: Drime-Webhook/1.0 X-Drime-Signature: 285215da10359586d6d7380abad6e81e6979a32da3f54b0a37a1910c7c789826 {"list_folder":{"accounts":["1042","2099"]}} ``` The body names **who** changed, never **what**. Each entry is a Drime account id, as a string: the `user.id` that [`GET /users/me`](/api-reference/user/get-logged-user) returned when that user authorized you. For each account, ask the API what is new, with the token you hold for that user. Answer `200` within **10 seconds**, then do the work in a queue. Drime does not wait and does not resend: whatever you miss will show up the next time you look, because a notification never carries the data. ## 4. Check the signature `X-Drime-Signature` is the hexadecimal HMAC-SHA256 of the **raw** request body, keyed with your signing secret. Compute it on the exact bytes you received, before parsing anything, and compare in constant time. Your endpoint is public: anyone can send it a request. ```javascript Node.js (Express) theme={null} const crypto = require('crypto'); const express = require('express'); const app = express(); app.get('/drime/webhook', (req, res) => { res.set('Content-Type', 'text/plain'); res.set('X-Content-Type-Options', 'nosniff'); res.send(String(req.query.challenge || '')); }); // express.raw, not express.json: the signature covers the raw bytes. app.post('/drime/webhook', express.raw({ type: '*/*' }), (req, res) => { const expected = Buffer.from( crypto .createHmac('sha256', process.env.DRIME_WEBHOOK_SECRET) .update(req.body) .digest('hex'), ); const given = Buffer.from(req.get('X-Drime-Signature') || ''); if (given.length !== expected.length || !crypto.timingSafeEqual(given, expected)) { return res.sendStatus(403); } res.sendStatus(200); const { accounts } = JSON.parse(req.body).list_folder; queue.push(accounts); // your own job queue }); ``` ```php PHP theme={null} [!TIP] > > To test your code: with the secret `whsec_example`, the body `{"list_folder":{"accounts":["1042","2099"]}}` signs to `285215da10359586d6d7380abad6e81e6979a32da3f54b0a37a1910c7c789826`. ## What sends a notification * Something is **created** in the account: an upload, a new folder or document, a copy. * Something is **deleted**: moved to the trash, or deleted for good. Renames, moves, edits and restores do not send one. Neither does anything in the Vault, which is end-to-end encrypted. A change notifies every application that the **owner** of the changed item has connected, as long as its endpoint works. The notification names the account, not a folder or a workspace: an application that works in [its own folder](/oauth/app-folder) can be told about a change made elsewhere in the Drive. List your folder to see whether anything changed in it. ## Frequency and limits | | | | - | - | | Frequency | At most one round of notifications a minute per application, however much changed. A user dropping four hundred photos produces one notification. | | Batching | One request names up to 500 accounts. More accounts in the same minute means more requests, 500 at a time. | | Timeout | 10 seconds. | | Retries | None. If a request fails, the rest of that minute's requests to your endpoint are dropped too. | | Redirects | Not followed. Give the final address. | | Failures | After 20 failures in a row the endpoint is switched off, and the **Webhooks** tab says so. Save it again to switch it back on. | Drime only notifies an application about accounts that have connected it, and stops as soon as the user disconnects it. ## Checklist * The challenge handler answers with the challenge only, as `text/plain`. * The signature is checked on the raw body, in constant time, with the signing secret. * `200` goes out before the work starts. * The work can run twice for the same account without harm, and does not depend on every notification arriving. * The endpoint resolves to a public address and is not behind a redirect. # Quick Start Source: https://docs.drime.cloud/quickstart Start using the Drime Cloud API in under 5 minutes ## Get Your API Token Before making API requests, you need an access token. For your own account, create a personal access token: 1. Sign in to [Drime](https://app.drime.cloud) 2. Open **Settings** and go to **Developers**, or use the [direct link](https://app.drime.cloud/account-settings#developers) 3. Click **Create token**, name it, choose its permissions and click **Create** 4. Copy the token and store it somewhere safe: it is shown once > [!TIP] > > Building an application that other Drime users will connect? Use [OAuth](/oauth/overview) instead. Your users approve it on Drime, and you never handle their password. ## Make Your First Request Use your token in the `Authorization` header: ```bash cURL theme={null} curl https://app.drime.cloud/api/v1/users/me \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" ``` ```javascript JavaScript theme={null} const response = await fetch('https://app.drime.cloud/api/v1/users/me', { headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }); const data = await response.json(); console.log(data.user); ``` ```python Python theme={null} import requests headers = { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } response = requests.get( 'https://app.drime.cloud/api/v1/users/me', headers=headers ) print(response.json()) ``` ## Upload Your First File **1. Get a presigned URL** For files under 5MB, use the simple upload flow: ```bash theme={null} curl -X POST https://app.drime.cloud/api/v1/s3/simple/presign \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "filename": "document.pdf", "mime": "application/pdf", "size": 1048576, "extension": "pdf", "workspaceId": 0 }' ``` **2. Upload to S3** Upload the file to the presigned URL: ```bash theme={null} curl -X PUT "PRESIGNED_URL_FROM_STEP_1" \ -H "Content-Type: application/pdf" \ --data-binary @document.pdf ``` **3. Create the file entry** Register the file in Drime Cloud: ```bash theme={null} curl -X POST https://app.drime.cloud/api/v1/s3/entries \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "filename": "UUID_FROM_KEY", "size": 1048576, "clientName": "document.pdf", "clientMime": "application/pdf", "clientExtension": "pdf", "workspaceId": 0 }' ``` ## List Your Files ```bash theme={null} curl https://app.drime.cloud/api/v1/drive/file-entries?workspaceId=0 \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" ``` Response: ```json theme={null} { "data": [ { "id": 123456, "name": "document.pdf", "type": "pdf", "file_size": 1048576, "hash": "MTIzNDU2fA", "created_at": "2024-01-15T10:30:00.000000Z" } ], "current_page": 1, "total": 1 } ``` ## Next Steps > **[Authentication](/authentication)** > > Learn more about authentication methods > **[API Reference](/api-reference/introduction)** > > Explore all available endpoints > **[Multipart Uploads](/api-reference/multipart/create-multipart)** > > Upload large files with multipart > **[Sharing](/api-reference/sharing/share-entry)** > > Share files with others # Uploads Guide Source: https://docs.drime.cloud/uploads-guide How to upload files to Drime Cloud ## Choosing the Right Method Drime Cloud offers several upload methods depending on your file size: > **[Direct Upload](/api-reference/uploads/upload-file)** > > **\< 5 MB** - Simple and fast via multipart/form-data > **[Presigned URL](/api-reference/uploads/presign-url)** > > **\< 5 MB** - Direct upload to S3 with presigned URL > **[Multipart Upload](/api-reference/multipart/create-multipart)** > > **≥ 5 MB** - For large files, upload in chunks ## Simple Upload (\< 5 MB) For small files, use direct upload: ```javascript theme={null} const formData = new FormData(); formData.append('file', file); formData.append('workspaceId', '0'); const response = await fetch('https://app.drime.cloud/api/v1/uploads', { method: 'POST', headers: { 'Authorization': 'Bearer TOKEN' }, body: formData }); ``` ## Presigned URL Upload (\< 5 MB) More performant, as it uploads directly to storage: **1. Get the presigned URL** ```javascript theme={null} const { url, key } = await fetch('/s3/simple/presign', { method: 'POST', body: JSON.stringify({ filename, mime, size, extension }) }).then(r => r.json()); ``` **2. Upload to S3** ```javascript theme={null} await fetch(url, { method: 'PUT', body: file }); ``` **3. Register the file** ```javascript theme={null} await fetch('/s3/entries', { method: 'POST', body: JSON.stringify({ filename: key.split('/').pop(), size, clientName }) }); ``` ## Multipart Upload (≥ 5 MB) For large files, split into 5 MB chunks: **1. Initialize** Call `/s3/multipart/create` to get an `uploadId` **2. Sign URLs** Call `/s3/multipart/batch-sign-part-urls` for each part **3. Upload parts** PUT each chunk to its URL, collect the ETags **4. Complete** Call `/s3/multipart/complete` with all ETags **5. Register** Call `/s3/entries` to create the file entry > [!TIP] > > If interrupted, use `/s3/multipart/get-uploaded-parts` to resume the upload where it left off. ## Duplicate Validation Before uploading, check if the file already exists: ```javascript theme={null} const { duplicates } = await fetch('/uploads/validate', { method: 'POST', body: JSON.stringify({ files: [{ name: 'photo.jpg', size: 1024, relativePath: '/photos' }] }) }).then(r => r.json()); if (duplicates.length > 0) { // Ask the user or auto-rename const { name } = await fetch('/entry/getAvailableName', { method: 'POST', body: JSON.stringify({ name: 'photo.jpg', parentId: null }) }).then(r => r.json()); } ```