Skip to content

Files ​

Run-input files. See the Files guide for supported types, limits and how files reach the model.

FileObject ​

FieldTypeDescription
iduuidpass it in files of a run or message
namestringthe uploaded file name
mimeTypestringdetected from the content
sizeintegerbytes
pagesinteger | nullPDFs
sha256stringhex digest of the content
purposeinput | datasourceuploads through /v1/files are input
expiresAtstring | nullinput files are deleted after this time
createdAtstring

Upload a file ​

http
POST /v1/files
Content-Type: multipart/form-data

Scope: 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"
}
StatusCodeWhen
400FILE_REQUIREDno file field
413FILE_TOO_LARGElarger than the platform upload limit
415FILE_TYPE_NOT_SUPPORTEDthe content is not a supported type
402STORAGE_LIMIT_REACHEDthe 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:

FieldDescription
urlsigned URL to download the content
urlExpiresAtwhen 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 }.

StatusCodeWhen
409FILE_IN_USEthe file belongs to a data source document; delete the document instead
404FILE_NOT_FOUNDunknown file

Hevkar public API v1