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/upload

Upload a file using multipart/form-data.

Send the request as multipart/form-data, not JSON. Maximum file size is 10MB.

Body Parameters

NameTypeDescription
file
FilerequiredThe file to upload (multipart/form-data).
entityType
stringEntity type to link the file to (e.g. expense, product).
entityId
numberEntity 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/files

List files with optional entity filtering.

Query Parameters

NameTypeDescription
entityType
stringFilter by entity type.
entityId
numberFilter by entity ID.
page
numberPage number (default 1).
limit
numberItems 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/:visibleId

Get a single file by visible ID.

Path Parameters

NameTypeDescription
visibleId
numberrequiredThe 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"
  }
}