Fetch Files
Fetch all files from the authenticated user's Drive. Returns file metadata, categories, storage usage vs plan quota, and supports pagination.
POST
/files/fetch
Description
This endpoint fetches all files stored in the user's Drive. It returns the file list with full metadata, file categories, current storage usage compared to the plan quota, and supports pagination for large file collections.
Authentication
This endpoint requires Bearer token authentication via the Authorization header.
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
Page |
Number | No | Page number (default: 1) |
Limit |
Number | No | Files per page (default: 50, max: 200) |
Code Examples
curl -X POST "https://api-v3.sweeppea.com/files/fetch" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"Page": 1,
"Limit": 50
}'
Response
200 OK
{
"Response": true,
"Telemetry": {
"DataConsumed": 0,
"APICalls": 42,
"MaxAPICalls": 1500000
},
"Data": {
"Files": [
{
"FileToken": "uuid-v4-string",
"CategoryToken": "uuid-v4-string",
"CreationDate": "2024-01-23T21:58:05.468Z",
"FileInfo": {
"Filename": "report.pdf",
"Path": "userToken/documents",
"Size": 34980,
"MimeType": "application/pdf",
"Encoding": "7bit",
"UploadByAdmin": false,
"Opened": false,
"Private": true
},
"SharedTo": [],
"VisibleToAdmins": false
}
],
"Categories": [
{
"CategoryToken": "uuid-v4-string",
"Category": "General",
"Color": "#A51400",
"Primary": true
}
],
"Storage": {
"UsedMB": 20.05,
"MaxMB": 5000,
"RemainingMB": 4979.95
},
"Pagination": {
"Page": 1,
"Limit": 50,
"TotalFiles": 7,
"TotalPages": 1
}
},
"Message": "(OK) Files fetched successfully."
}
Error Responses
401 Unauthorized
{
"Response": false,
"Message": "Invalid or Missing Bearer Token",
"Code": 401
}
403 Forbidden
{
"Response": false,
"Message": "Invalid API Token",
"Code": 403
}
500 Internal Server Error
{
"Response": false,
"Message": "Internal Server Error",
"Code": 500
}
Important Notes
- 📦 Storage Info: The response includes current storage usage, plan quota, and remaining space in MB
- 📂 Categories: File categories are returned alongside the files for easy filtering
- 📄 Pagination: Default 50 files per page, maximum 200. Use Page and Limit parameters to paginate
- 🔄 Sort Order: Files are sorted by creation date (newest first)