---
title: "Upload files"
method: PUT
path: "/api/repos/{namespace}/{repo_name}/file/{resource}"
tags: ["Files"]
---

# Upload files

`PUT /api/repos/{namespace}/{repo_name}/file/{resource}`

## Request

- Base URL: `https://hub.oxen.ai`
- URL: `https://hub.oxen.ai/api/repos/{namespace}/{repo_name}/file/{resource}`
- Auth: HTTP bearer
- TypeScript: <https://skmtc.dev/oxen/apis/oxen-server/docs/api/repos/:namespace/:repo_name/file/:resource/put.ts> (a function with typed inputs; its response is checked against the schema)

Upload files via multipart form and commit them. Use `files[]` for directory uploads, or `file` for a single full-path upload. For backward compatibility, `file` also uploads into the target directory when `{resource}` already resolves to a directory.

## Path parameters

- `namespace` string, required
- `repo_name` string, required
- `resource` string, required

## Request body `multipart/form-data`

- FileUploadBody: Multipart form for uploading files. Use `file` for a single full-path upload, or `files[]` for uploading one or more files into a directory.
  - `email` string, nullable
  - `file` string, binary, nullable: Deprecated: use `files[]` instead.
  - `files` string[], required
  - `message` string, nullable
  - `name` string, nullable

## Response `200`

Files committed successfully

- CommitResponse
  - `oxen_version` string, nullable
  - `status` string, required
  - `status_message` string, required
  - `commit` Commit, required
    - `author` string, required
    - `email` string, required
    - `id` string, required
    - `message` string, required
    - `parent_ids` string[], required
    - `timestamp` string, date-time, required

## Other responses

- `400`: Bad Request
- `404`: Branch or path not found

---

[API](https://skmtc.dev/oxen/apis/oxen-server.md) - [All operations](https://skmtc.dev/oxen/apis/oxen-server/llms.txt) - [OpenAPI document](https://skmtc.dev/oxen/apis/oxen-server/revisions/2ae578129949?raw)
