---
title: "Upload a file"
method: POST
path: "/v1/files"
tags: ["Files"]
---

# Upload a file

`POST /v1/files`

Upload a file into the session's uploads directory. The file is stored under `uploads/{filename}` within the session scope and its relative path is returned as the file ID. Uploading a file with the same name overwrites the existing one.

## Query parameters

- `scope_id` string, required — Session / container identifier (matches the `container` field in chat requests).

## Response `200`

Successful Response

- FileMetadata — Metadata for a file stored in a session (upload or sandbox output).
  - `id` string, required — Relative path of the file within the session, e.g. 'uploads/data.csv' or 'outputs/result.png'. Use this value as `file_id` in subsequent requests.
  - `created_at` string, date-time, required — ISO-8601 timestamp when the file was created or last modified.
  - `filename` string, required — Filename derived from the path.
  - `mime_type` string, required — MIME type detected from the file content.
  - `size_bytes` integer, required — File size in bytes.
  - `type` 'file' — Object type discriminator, always 'file'.
  - `downloadable` boolean, required — True for sandbox output files; False for uploaded input files.
  - `scope` FileScope, required — Scope that a file belongs to (always a session).
    - `id` string, required — Session / container identifier that owns this file.
    - `type` 'session' — Object type discriminator, always 'session'.

## Other responses

- `401` — Unauthorized
- `422` — Validation Error

---

[API](https://skmtc.net/zylon-ai/apis/private-gpt-api.md) · [All operations](https://skmtc.net/zylon-ai/apis/private-gpt-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/zylon-ai/private-gpt-api/versions/594fa71dfb90/schema)
