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

# Upload a file

`POST /v2/files`

Files are used to upload documents that can be used with features like Deployments.

## Request body

- CreateFileRequest
  - `filename` string, required — Name to store for the uploaded file, including extension when available.
  - `content` string, bytes, required — Base64-encoded file contents.
  - `purpose` 'FILE_PURPOSE_UNSPECIFIED' | 'FILE_PURPOSE_RETRIEVAL' | 'FILE_PURPOSE_KNOWLEDGE_DATASOURCE' | 'FILE_PURPOSE_BATCH' | 'FILE_PURPOSE_CODE_INTERPRETER'
  - `content_type` string — MIME type of the uploaded content, for example `application/pdf`.
  - `project_id` string — Project the file is created in. Optional: project-scoped API keys default to the key's bound project; workspace-scoped callers default to the workspace's default project.

## Response `200`

OK

- CreateFileResponse
  - `file` File, required
    - `file_id` string, required — Unique file identifier assigned by ORQ.
    - `purpose` 'FILE_PURPOSE_UNSPECIFIED' | 'FILE_PURPOSE_RETRIEVAL' | 'FILE_PURPOSE_KNOWLEDGE_DATASOURCE' | 'FILE_PURPOSE_BATCH' | 'FILE_PURPOSE_CODE_INTERPRETER', required
    - `file_name` string, required — Display file name, including extension when available.
    - `bytes` string, required — Size of the uploaded file in bytes.
    - `created_at` string, date-time, required — Time when the file was created.
    - `project_id` string, required — Identifier of the project the file belongs to. Files are project-scoped; an API key may only access files in projects it is authorized for.

---

[API](https://skmtc.net/orq-ai/apis/orq-ai-api.md) · [All operations](https://skmtc.net/orq-ai/apis/orq-ai-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/orq-ai/orq-ai-api/revisions/41c02aedc7c0/schema)
