Fetch Files
Fetch all files from the authenticated user's Drive. Returns file metadata, categories, storage usage vs plan quota, and supports pagination.
POST
https://api-v3.sweeppea.com/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
}'
const response = await fetch('https://api-v3.sweeppea.com/files/fetch', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
Page: 1,
Limit: 50
})
});
const data = await response.json();
console.log(data);
import requests
url = "https://api-v3.sweeppea.com/files/fetch"
headers = {
"Authorization": "Bearer YOUR_API_KEY",
"Content-Type": "application/json"
}
payload = {
"Page": 1,
"Limit": 50
}
response = requests.post(url, headers=headers, json=payload)
print(response.json())
Response
{
"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": "Files fetched successfully."
}
Error Responses
{
"Response": false,
"Message": "Missing or invalid Bearer token. Send your API token in the Authorization header as: Authorization: Bearer YOUR_API_TOKEN",
"Code": 401
}
{
"Response": false,
"Message": "Invalid API token. It does not match any account.",
"Code": 403
}
{
"Response": false,
"Message": "Internal server error. Please try again; if it persists, contact support with the time of this request.",
"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)