Files
Upload and manage files (images, PDFs, receipts). Files can be linked to entities like expenses or products.
Use cases: Upload receipt images before creating expenses, or attach product photos.
POST
/files/uploadUpload a file using multipart/form-data.
Send the request as multipart/form-data, not JSON. Maximum file size is 10MB.
Body Parameters
| Name | Type | Description | |
|---|---|---|---|
file | File | required | The file to upload (multipart/form-data). |
entityType | string | Entity type to link the file to (e.g. expense, product). | |
entityId | number | Entity ID to link the file to. |
Request
curl -X POST "https://api.glance.co.il/files/upload" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"file": "example_file",
"entityType": "example_entityType",
"entityId": 0
}'Response
Response
{
"data": {
"visibleId": 25,
"filename": "receipt-march.pdf",
"mimeType": "application/pdf",
"size": 245678,
"url": "https://files.glance.app/25/receipt-march.pdf",
"createdAt": "2024-03-20T14:30:00Z"
}
}GET
/filesList files with optional entity filtering.
Query Parameters
| Name | Type | Description | |
|---|---|---|---|
entityType | string | Filter by entity type. | |
entityId | number | Filter by entity ID. | |
page | number | Page number (default 1). | |
limit | number | Items per page (default 50). |
Request
curl -X GET "https://api.glance.co.il/files" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json"Response
Response
{
"data": [
{
"visibleId": 25,
"filename": "receipt-march.pdf",
"mimeType": "application/pdf",
"size": 245678,
"url": "https://files.glance.app/25/receipt-march.pdf",
"createdAt": "2024-03-20T14:30:00Z"
}
],
"pagination": {
"total": 150,
"limit": 50,
"offset": 0,
"hasMore": true
}
}GET
/files/file/:visibleIdGet a single file by visible ID.
Path Parameters
| Name | Type | Description | |
|---|---|---|---|
visibleId | number | required | The file visible ID. |
Request
curl -X GET "https://api.glance.co.il/files/file/:visibleId" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json"Response
Response
{
"data": {
"visibleId": 25,
"filename": "receipt-march.pdf",
"mimeType": "application/pdf",
"size": 245678,
"url": "https://files.glance.app/25/receipt-march.pdf",
"entityType": "expense",
"entityId": 15,
"createdAt": "2024-03-20T14:30:00Z"
}
}