> ## Documentation Index
> Fetch the complete documentation index at: https://ekso.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# DataFile

> File attachment on an item or annotation.

File attachment on an item or annotation. Files are uploaded as multipart form-data via the `POST /api/file/upload` endpoint and downloaded as binary streams. The `DataFile` shape is the metadata record returned alongside the uploaded file — the file content itself isn't part of this JSON.

## Sample JSON

Copy, edit, paste. Server-set fields (`id`, `created`, `tenantId`, …) are omitted from the example — they're populated by the server on response.

```json theme={null}
{
  "owner": "Item",
  "ownerId": "item_01HITEM_LOGIN_BUG",
  "fileName": "screenshot-of-error.png",
  "mimeType": "image/png",
  "sizeBytes": 184320
}
```

## What Ekso fills in

These fields are managed by the server. You don't pass them on writes — they appear on the response.

* **`sizeBytes`** — Captured by the upload pipeline once the byte stream finishes streaming to storage.

## Fields

| Field       | Type                                                  | Required     | Notes                                                                                                                |
| ----------- | ----------------------------------------------------- | ------------ | -------------------------------------------------------------------------------------------------------------------- |
| `entity`    | string • nullable                                     | Server-set   | Set by the server. Read-only on writes.                                                                              |
| `owner`     | [`ContentOwner`](/data-model/constants#content-owner) | Optional     | Type of the entity this file is attached to. `Item` or `Annotation` only — the controller hard-rejects other owners. |
| `ownerId`   | string                                                | **Required** | Id of the owning entity.                                                                                             |
| `uid`       | string                                                | Optional     |                                                                                                                      |
| `filename`  | string                                                | Optional     |                                                                                                                      |
| `mimeType`  | string                                                | Optional     | MIME type, detected from the upload's content-type header.                                                           |
| `length`    | integer                                               | Optional     |                                                                                                                      |
| `tenantId`  | string                                                | Server-set   | Set by the server. Read-only on writes.                                                                              |
| `id`        | string                                                | Server-set   | Set by the server. Read-only on writes.                                                                              |
| `created`   | string (date-time)                                    | Server-set   | Set by the server. Read-only on writes.                                                                              |
| `createdBy` | string                                                | Server-set   | Set by the server. Read-only on writes.                                                                              |
| `updated`   | string (date-time)                                    | Server-set   | Set by the server. Read-only on writes.                                                                              |
| `updatedBy` | string                                                | Server-set   | Set by the server. Read-only on writes.                                                                              |
| `deleted`   | boolean                                               | Server-set   | Set by the server. Read-only on writes.                                                                              |

## Used by

### Response body

* `GET /api/file/{id}`
* `GET /api/file/{ownerType}/{ownerId}`

### CLI

`ekso file` — see the [command branches](/cli/branches) page for available verbs. Body for create / update verbs typically passed via `--data @file.json` matching the [sample JSON](#sample-json) above.
