scientific-skills/protocolsio-integration/references/file_manager.md
The File Manager API enables file operations within protocols.io workspaces, including uploading files, organizing folders, searching content, and managing file lifecycle. This is useful for attaching data files, images, documents, and other resources to protocols.
All file manager endpoints use the base URL: https://protocols.io/api/v3
Search for files and folders within a workspace.
Endpoint: GET /workspaces/{workspace_id}/files/search
Path Parameters:
workspace_id: The workspace's unique identifierQuery Parameters:
query: Search keywords (searches filenames and metadata)type: Filter by type
file: Files onlyfolder: Folders onlyall: Both files and folders (default)folder_id: Limit search to specific folderpage_size: Number of results per page (default: 20, max: 100)page_id: Page number for pagination (starts at 0)Response includes:
Example Request:
curl -H "Authorization: Bearer YOUR_TOKEN" \
"https://protocols.io/api/v3/workspaces/12345/files/search?query=microscopy&type=file"
Browse files and folders within a specific folder.
Endpoint: GET /workspaces/{workspace_id}/folders/{folder_id}
Path Parameters:
workspace_id: The workspace's unique identifierfolder_id: The folder's unique identifier (use root for workspace root)Query Parameters:
order_by: Sort field (name, size, created, modified)order_dir: Sort direction (asc, desc)page_size: Number of results per pagepage_id: Page number for paginationExample Request:
curl -H "Authorization: Bearer YOUR_TOKEN" \
"https://protocols.io/api/v3/workspaces/12345/folders/root?order_by=modified&order_dir=desc"
Upload a file to a workspace folder.
Endpoint: POST /workspaces/{workspace_id}/files/upload
Request Format: multipart/form-data
Form Parameters:
file (required): The file to uploadfolder_id: Target folder ID (omit or use root for workspace root)name: Custom filename (optional, uses original filename if omitted)description: File descriptiontags: Comma-separated tagsExample Request:
curl -X POST \
-H "Authorization: Bearer YOUR_TOKEN" \
-F "file=@/path/to/local/data.xlsx" \
-F "folder_id=67890" \
-F "description=Experimental results from trial #3" \
-F "tags=experiment,data,2025" \
"https://protocols.io/api/v3/workspaces/12345/files/upload"
After upload, verify the file was processed correctly.
Endpoint: GET /workspaces/{workspace_id}/files/{file_id}/status
Response includes:
processing, complete, failed)Download a file from the workspace.
Endpoint: GET /workspaces/{workspace_id}/files/{file_id}/download
Path Parameters:
workspace_id: The workspace's unique identifierfile_id: The file's unique identifierResponse: Binary file data with appropriate Content-Type header
Example Request:
curl -H "Authorization: Bearer YOUR_TOKEN" \
-o "downloaded_file.xlsx" \
"https://protocols.io/api/v3/workspaces/12345/files/67890/download"
Retrieve file information without downloading.
Endpoint: GET /workspaces/{workspace_id}/files/{file_id}
Response includes:
Update file description, tags, or other metadata.
Endpoint: PATCH /workspaces/{workspace_id}/files/{file_id}
Request Body:
name: New filenamedescription: Updated descriptiontags: Updated tags (comma-separated)folder_id: Move to different folderExample Request:
curl -X PATCH \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"description": "Experimental results from trial #3 - REVISED",
"tags": "experiment,data,2025,revised"
}' \
"https://protocols.io/api/v3/workspaces/12345/files/67890"
Move a file to trash (soft delete).
Endpoint: DELETE /workspaces/{workspace_id}/files/{file_id}
Note: Deleted files may be recoverable from trash for a limited time
Restore a deleted file from trash.
Endpoint: POST /workspaces/{workspace_id}/files/{file_id}/restore
Create a new folder in the workspace.
Endpoint: POST /workspaces/{workspace_id}/folders
Request Body:
name (required): Folder nameparent_folder_id: Parent folder ID (omit for workspace root)description: Folder descriptionExample Request:
curl -X POST \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "2025 Experiments",
"parent_folder_id": "root",
"description": "All experimental data from 2025"
}' \
"https://protocols.io/api/v3/workspaces/12345/folders"
Endpoint: PATCH /workspaces/{workspace_id}/folders/{folder_id}
Request Body:
name: New folder namedescription: Updated descriptionDelete a folder and optionally its contents.
Endpoint: DELETE /workspaces/{workspace_id}/folders/{folder_id}
Query Parameters:
recursive: Set to true to delete folder and all contents (default: false)Warning: Recursive deletion cannot be easily undone
Attach experimental data files to protocols:
POST /workspaces/{id}/files/uploadExample Workflow:
# Upload the data file
curl -X POST \
-H "Authorization: Bearer YOUR_TOKEN" \
-F "[email protected]" \
-F "description=Results from protocol execution" \
"https://protocols.io/api/v3/workspaces/12345/files/upload"
# Note the file_id from response, then reference in protocol
Organize files into logical folder structures:
POST /workspaces/{id}/foldersExample Structure:
Workspace Root
├── Protocols
│ ├── Published
│ └── Drafts
├── Data
│ ├── Raw
│ └── Processed
├── Images
│ ├── Microscopy
│ └── Gels
└── Documents
├── Papers
└── Presentations
Find files across workspace:
GET /workspaces/{id}/files/search?query=keywordsUpload multiple related files:
Export workspace files for backup:
GET /workspaces/{id}/folders/rootGET /workspaces/{id}/files/{file_id}/downloadManage file versions manually:
data_v2.csv)Protocols.io supports various file types:
Data Files:
.xlsx, .xls, .csv, .tsv.rds, .rdata, .sav, .dta.txt, .log, .json, .xmlImages:
.jpg, .jpeg, .png, .gif, .bmp, .tif, .tiff.czi, .nd2, .lsm (may require special handling)Documents:
.pdf.docx, .doc.pptx, .pptCode and Scripts:
.py, .ipynb.r, .rmd.sh, .bashMultimedia:
.mp4, .avi, .mov.mp3, .wavArchives:
.zip, .tar.gz, .7zFile Size Limits:
File Naming
experiment_results_2025-10-26.csvOrganization
Metadata
Storage Management
Collaboration
Security
Common error responses:
400 Bad Request: Invalid file format or parameters401 Unauthorized: Missing or invalid access token403 Forbidden: Insufficient workspace permissions404 Not Found: File or folder not found413 Payload Too Large: File exceeds size limit422 Unprocessable Entity: File validation failed429 Too Many Requests: Rate limit exceeded507 Insufficient Storage: Workspace storage limit reachedLarge Files
Batch Operations
Download Optimization