Appearance
Files
Run-input files. See the Files guide for supported types, limits and how files reach the model.
FileObject
| Field | Type | Description |
|---|---|---|
id | uuid | pass it in files of a run or message |
name | string | the uploaded file name |
mimeType | string | detected from the content |
size | integer | bytes |
pages | integer | null | PDFs |
sha256 | string | hex digest of the content |
purpose | input | datasource | uploads through /v1/files are input |
expiresAt | string | null | input files are deleted after this time |
createdAt | string |
Upload a file
http
POST /v1/files
Content-Type: multipart/form-dataScope: files:write. One file in the multipart field file.
bash
curl "$HEVKAR_BASE_URL/v1/files" \
-H "Authorization: Bearer $HEVKAR_API_KEY" \
-F "file=@invoice.pdf"ts
const file = await hevkar.files.upload(await readFile('invoice.pdf'), { name: 'invoice.pdf' });ts
const form = new FormData();
form.append('file', blob, 'invoice.pdf');
const file = await fetch(`${baseUrl}/v1/files`, {
method: 'POST',
headers: { Authorization: `Bearer ${apiKey}` },
body: form,
}).then((r) => r.json());Response 201: FileObject.
json
{
"id": "0b8f9a43-6f55-4a8e-8f43-0d1b1c7e2a11",
"name": "invoice.pdf",
"mimeType": "application/pdf",
"size": 48213,
"pages": 2,
"sha256": "9f2c4e…",
"purpose": "input",
"expiresAt": "2026-11-28T10:15:00.000Z",
"createdAt": "2026-11-21T10:15:00.000Z"
}| Status | Code | When |
|---|---|---|
| 400 | FILE_REQUIRED | no file field |
| 413 | FILE_TOO_LARGE | larger than the platform upload limit |
| 415 | FILE_TYPE_NOT_SUPPORTED | the content is not a supported type |
| 402 | STORAGE_LIMIT_REACHED | the organization's storage is full |
Get a file
http
GET /v1/files/{id}Scope: files:write. Returns the FileObject plus a short-lived signed download URL:
| Field | Description |
|---|---|
url | signed URL to download the content |
urlExpiresAt | when url stops working (minutes from now) |
ts
const { url } = await hevkar.files.get(fileId);Errors: 404 FILE_NOT_FOUND.
Delete a file
http
DELETE /v1/files/{id}Scope: files:write. Response 200: { "deleted": true }.
| Status | Code | When |
|---|---|---|
| 409 | FILE_IN_USE | the file belongs to a data source document; delete the document instead |
| 404 | FILE_NOT_FOUND | unknown file |