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

> ## Agent Instructions
> Krun API base URL: https://api.krun.ai. Authenticate server-side with `Authorization: Bearer $KRUN_API_KEY`; never put a Krun API key in browser code.
> Prefer the Python SDK in examples: `pip install krun-ai`, `from krun import Krun`. The TypeScript SDK `@krun-ai/sdk` is not published on npm yet: do not tell users to `npm install` it.
> The only question type is `choice`. `confidence` is the top-1 minus top-2 probability margin, not the probability that the answer is correct. `choice` is null when `abstain` is true.
> Usage reports `input_tokens` only. There are no output tokens.

# Assets

> Upcoming in Krun One V1: upload images, documents and audio for use in decision contexts. Not yet available on api.krun.ai.

<Warning>
  **Upcoming.** Krun One V1 multimodal inputs, including the `/v1/assets` endpoints, are not yet available on
  api.krun.ai. This page describes the planned interface. Details can still change before release.
</Warning>

An asset is a file you upload once and then reference by id in a [multimodal `context`](/concepts/multimodal-inputs).

| Method | Path | Description |
| - | - | - |
| `POST` | `/v1/assets` | Upload a file. |
| `GET` | `/v1/assets/{asset_id}` | Get an asset's metadata. |
| `DELETE` | `/v1/assets/{asset_id}` | Delete an asset. |

All three require an API key. See [Authentication](/api-reference/authentication).

## Upload an asset

`POST /v1/assets`. The request body is the raw file, not JSON or multipart form data. Set `Content-Type` to the file's
MIME type.

<CodeGroup>
  ```bash cURL theme={null}
  curl https://api.krun.ai/v1/assets \
    -H "Authorization: Bearer $KRUN_API_KEY" \
    -H "Content-Type: application/pdf" \
    --data-binary @invoice.pdf
  ```

  ```python Python theme={null}
  from krun import Krun

  client = Krun()  # reads KRUN_API_KEY

  with open("invoice.pdf", "rb") as f:
      asset = client.assets.create(f.read(), mime_type="application/pdf")

  print(asset.id, asset.expires_at)
  ```

  ```ts TypeScript theme={null}
  import { readFile } from "node:fs/promises";
  import { Krun } from "@krun-ai/sdk";

  const krun = new Krun(); // reads KRUN_API_KEY

  const asset = await krun.assets.create(await readFile("invoice.pdf"), { mimeType: "application/pdf" });
  ```
</CodeGroup>

Response `201 Created` (values are illustrative):

```json theme={null}
{
  "id": "asset_7fQ2mZkP0aLxAAAAAAAAAAAA",
  "object": "asset",
  "mime_type": "application/pdf",
  "size_bytes": 184233,
  "sha256": "3f8a1c...",
  "created_at": "2026-10-01T12:00:00Z",
  "expires_at": "2026-10-02T12:00:00Z"
}
```

| Field | Description |
| - | - |
| `id` | Asset id, `asset_` followed by 8 to 64 letters, digits, `_` or `-`. Use it as `asset_id` in a content part. |
| `object` | Always `"asset"`. |
| `mime_type` | The file's MIME type. |
| `size_bytes` | File size in bytes. |
| `sha256` | SHA-256 hash of the file. |
| `created_at` | Upload time, ISO 8601. |
| `expires_at` | Time after which the asset can no longer be referenced, ISO 8601. 24 hours after upload by default. |

The content is checked against `Content-Type`. An unsupported type, or content that doesn't match it (a PNG sent as
`audio/wav`), fails with `415 UNSUPPORTED_MIME_TYPE`. A file over its size limit fails with `413 ASSET_TOO_LARGE`. See
[supported types and limits](/concepts/multimodal-inputs#limits-and-supported-types).

## Get an asset

`GET /v1/assets/{asset_id}` returns the same object as the upload. It never returns the file's content.

```bash theme={null}
curl https://api.krun.ai/v1/assets/asset_7fQ2mZkP0aLxAAAAAAAAAAAA \
  -H "Authorization: Bearer $KRUN_API_KEY"
```

## Delete an asset

`DELETE /v1/assets/{asset_id}` deletes the asset before it expires.

```bash theme={null}
curl -X DELETE https://api.krun.ai/v1/assets/asset_7fQ2mZkP0aLxAAAAAAAAAAAA \
  -H "Authorization: Bearer $KRUN_API_KEY"
```

```json theme={null}
{"id": "asset_7fQ2mZkP0aLxAAAAAAAAAAAA", "object": "asset", "deleted": true}
```

## Retention and access

* Assets are kept for **24 hours** by default, then expire. Referencing an expired asset fails with `410 ASSET_EXPIRED`.
* Assets are **project-scoped**: only the project that uploaded an asset can read, use or delete it. Other projects get
  `403 ASSET_FORBIDDEN`.
* An unknown id fails with `404 ASSET_NOT_FOUND`.

See [Multimodal inputs](/concepts/multimodal-inputs#privacy) for how media content is handled.
