Files
Files
File metadata management.
Upload and manage files (logos, signatures, attachments) associated with entities and documents.
Upload a file
/filesUpload a file (logo, signature, or attachment) to cloud storage.
Files are automatically optimized and stored in entity-specific folders.
Logos and signatures are entity-level (one per entity), while attachments can be associated with specific documents.
Header parameters
Entity ID on which the request is made. Optional - defaults to the first created entity if not provided.
Body parameters
File to upload
curl -X POST "https://eu.spaceinvoices.com/files" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "x-entity-id: YOUR_ENTITY_ID" \
-F "file=@/path/to/image.png"{
"id": "file_6595a27b5d35015c3ef0c3fd",
"entity_id": "ent_507f1f77bcf86cd799439011",
"invoice_id": null,
"estimate_id": null,
"credit_note_id": null,
"advance_invoice_id": null,
"category": "logo",
"url": "http://res.cloudinary.com/demo/image/upload/v1234567890/si/entities/ent_507f1f77bcf86cd799439011/logos/logo_ent_507f1f77bcf86cd799439011.png",
"secureUrl": "https://res.cloudinary.com/demo/image/upload/v1234567890/si/entities/ent_507f1f77bcf86cd799439011/logos/logo_ent_507f1f77bcf86cd799439011.png",
"publicId": "si/entities/ent_507f1f77bcf86cd799439011/logos/logo_ent_507f1f77bcf86cd799439011",
"format": "png",
"width": 576,
"height": 192,
"bytes": 45678,
"filename": "company-logo.png",
"mime_type": "image/png",
"metadata": {},
"created_at": "2024-01-01T00:00:00.000Z",
"updated_at": "2024-01-01T00:00:00.000Z"
}List all files
/filesRetrieve a paginated list of files for an entity.
Supports filtering by category and optional document association.
Header parameters
Entity ID on which the request is made. Optional - defaults to the first created entity if not provided.
Query parameters
Number of results per request.
Default: 10
Cursor to fetch the next page of results. Use the value from pagination.next_cursor in the previous response.
Cursor to fetch the previous page of results. Use the value from pagination.prev_cursor in the previous response.
Whether to include the total count of items in pagination.total.
Default is true.
When false, pagination.total returns -1 for better performance.
Filter by file category
Possible values: "logo", "signature", "attachment"
Filter by account payable ID (for attachments)
curl "https://eu.spaceinvoices.com/files" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "x-entity-id: YOUR_ENTITY_ID"Returns
{
"data": [
{
"id": "file_6595a27b5d35015c3ef0c3fd",
"entity_id": "ent_507f1f77bcf86cd799439011",
"invoice_id": null,
"estimate_id": null,
"credit_note_id": null,
"advance_invoice_id": null,
"category": "logo",
"url": "http://res.cloudinary.com/demo/image/upload/v1234567890/si/entities/ent_507f1f77bcf86cd799439011/logos/logo_ent_507f1f77bcf86cd799439011.png",
"secureUrl": "https://res.cloudinary.com/demo/image/upload/v1234567890/si/entities/ent_507f1f77bcf86cd799439011/logos/logo_ent_507f1f77bcf86cd799439011.png",
"publicId": "si/entities/ent_507f1f77bcf86cd799439011/logos/logo_ent_507f1f77bcf86cd799439011",
"format": "png",
"width": 576,
"height": 192,
"bytes": 45678,
"filename": "company-logo.png",
"mime_type": "image/png",
"metadata": {},
"created_at": "2024-01-01T00:00:00.000Z",
"updated_at": "2024-01-01T00:00:00.000Z"
}
],
"pagination": {
"total": 1,
"next_cursor": null,
"prev_cursor": null,
"has_more": false
}
}Get file metadata by ID
/files/{id}Retrieve file metadata by its unique identifier.
Header parameters
Entity ID on which the request is made. Optional - defaults to the first created entity if not provided.
Path parameters
Unique resource identifier
curl "https://eu.spaceinvoices.com/files/{id}" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "x-entity-id: YOUR_ENTITY_ID"{
"id": "file_6595a27b5d35015c3ef0c3fd",
"entity_id": "ent_507f1f77bcf86cd799439011",
"invoice_id": null,
"estimate_id": null,
"credit_note_id": null,
"advance_invoice_id": null,
"category": "logo",
"url": "http://res.cloudinary.com/demo/image/upload/v1234567890/si/entities/ent_507f1f77bcf86cd799439011/logos/logo_ent_507f1f77bcf86cd799439011.png",
"secureUrl": "https://res.cloudinary.com/demo/image/upload/v1234567890/si/entities/ent_507f1f77bcf86cd799439011/logos/logo_ent_507f1f77bcf86cd799439011.png",
"publicId": "si/entities/ent_507f1f77bcf86cd799439011/logos/logo_ent_507f1f77bcf86cd799439011",
"format": "png",
"width": 576,
"height": 192,
"bytes": 45678,
"filename": "company-logo.png",
"mime_type": "image/png",
"metadata": {},
"created_at": "2024-01-01T00:00:00.000Z",
"updated_at": "2024-01-01T00:00:00.000Z"
}Delete a file
/files/{id}Delete a file and its metadata.
The file is removed from cloud storage and the database.
Header parameters
Entity ID on which the request is made. Optional - defaults to the first created entity if not provided.
Path parameters
Unique resource identifier
curl -X DELETE "https://eu.spaceinvoices.com/files/{id}" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "x-entity-id: YOUR_ENTITY_ID"