Store REST API
Complete reference for all Store wire REST endpoints. All endpoints require authentication.
File Uploads
POST /store/upload
Upload a file using multipart form data.
curl -X POST http://localhost:3000/store/upload \
-H "Authorization: Bearer eyJhbGci..." \
-F "file=@document.pdf" \
-F "metadata={\"category\":\"invoices\"}"
Response (201):
{
"_id": "65a1b2c3d4e5f6a7b8c9d0e1",
"filename": "abc123-document.pdf",
"originalName": "document.pdf",
"contentType": "application/pdf",
"size": 245760,
"url": "https://bucket.s3.amazonaws.com/uploads/abc123-document.pdf",
"metadata": { "category": "invoices" },
"createdAt": "2025-01-15T10:30:00.000Z"
}
GET /store/files
List uploaded files.
curl "http://localhost:3000/store/files?limit=10&contentType=image/*" \
-H "Authorization: Bearer eyJhbGci..."
GET /store/files/:id
Get file metadata by ID.
curl http://localhost:3000/store/files/65a1b2c3d4e5f6a7b8c9d0e1 \
-H "Authorization: Bearer eyJhbGci..."
DELETE /store/files/:id
Delete a file.
curl -X DELETE http://localhost:3000/store/files/65a1b2c3d4e5f6a7b8c9d0e1 \
-H "Authorization: Bearer eyJhbGci..."
CRUD Operations
POST /store/:collection
Create a document in a collection.
curl -X POST http://localhost:3000/store/products \
-H "Content-Type: application/json" \
-H "Authorization: Bearer eyJhbGci..." \
-d '{"name": "Widget", "price": 9.99}'
Response (201):
{
"_id": "65a1b2c3d4e5f6a7b8c9d0e1",
"name": "Widget",
"price": 9.99,
"createdAt": "2025-01-15T10:30:00.000Z"
}
GET /store/:collection
List documents in a collection.
curl "http://localhost:3000/store/products?limit=10&sort=-createdAt&filter=%7B%22price%22%3A%7B%22%24lte%22%3A20%7D%7D" \
-H "Authorization: Bearer eyJhbGci..."
| Param | Type | Default | Description |
|---|---|---|---|
limit | number | 20 | Results per page |
offset | number | 0 | Pagination offset |
sort | string | -createdAt | Sort field |
filter | string | -- | URL-encoded JSON MongoDB filter |
Response (200):
{
"data": [ ... ],
"total": 42,
"limit": 10,
"offset": 0
}
GET /store/:collection/:id
Get a single document by ID.
curl http://localhost:3000/store/products/65a1b2c3d4e5f6a7b8c9d0e1 \
-H "Authorization: Bearer eyJhbGci..."
PUT /store/:collection/:id
Update a document.
curl -X PUT http://localhost:3000/store/products/65a1b2c3d4e5f6a7b8c9d0e1 \
-H "Content-Type: application/json" \
-H "Authorization: Bearer eyJhbGci..." \
-d '{"price": 14.99}'
DELETE /store/:collection/:id
Delete a document.
curl -X DELETE http://localhost:3000/store/products/65a1b2c3d4e5f6a7b8c9d0e1 \
-H "Authorization: Bearer eyJhbGci..."
Backups
POST /store/backup
Trigger a manual backup.
curl -X POST http://localhost:3000/store/backup \
-H "Authorization: Bearer eyJhbGci..."
GET /store/backups
List all backups.
curl http://localhost:3000/store/backups \
-H "Authorization: Bearer eyJhbGci..."
POST /store/backup/:id/restore
Restore from a backup.
curl -X POST http://localhost:3000/store/backup/65a1b2c3d4e5f6a7b8c9d0e1/restore \
-H "Authorization: Bearer eyJhbGci..."
Health
GET /store/health
curl http://localhost:3000/store/health
Response (200):
{
"status": "healthy",
"uploads": { "provider": "s3", "status": "connected" },
"backup": { "enabled": true, "lastBackup": "2025-01-15T02:00:00.000Z" }
}