---
title: "Create or replace a knowledge file"
method: PUT
path: "/v1/knowledge/files/{file_path}"
tags: ["External API"]
---

# Create or replace a knowledge file

`PUT /v1/knowledge/files/{file_path}`

Send the file bytes as the request body. Set Content-Type to match the file extension, or use application/octet-stream to infer it. The maximum file size is 10 MB.

## Path parameters

- `file_path` string, required

## Headers

- `If-Match` string, nullable
- `If-None-Match` string, nullable

## Request body

- string, binary

## Response `200`

The existing file was replaced.

- UpsertKnowledgeFileResponse
  - `path` string, required — POSIX path under `user_generated/` or `skills/`.
  - `content_type` string, required — Stored content type.
  - `size_bytes` integer, required — File size in bytes.
  - `sha256` string, required — Hex SHA-256 of the file bytes.
  - `etag` string, required — Opaque version token for conditional requests.
  - `created_at` string, date-time, required
  - `updated_at` string, date-time, required
  - `created` boolean, required — True when the path did not already exist.

## Other responses

- `201` — Successful Response
- `400` — Bad Request
- `401` — Unauthorized
- `403` — Forbidden
- `404` — Not Found
- `409` — Conflict
- `412` — Precondition Failed
- `413` — Request Entity Too Large
- `415` — Unsupported Media Type
- `500` — Internal Server Error
- `503` — Service Unavailable
- `4XX` — Client error returned in the V1 error envelope.

## Changes

> 23 revisions in range; 6 not diffed.

- **2026-08-26** `6ee9e975dda2` — 1 info
  - endpoint added

[Change history](https://skmtc.dev/traversal/apis/fastapi/changes/v1/knowledge/files/:file_path/put.md)

---

[API](https://skmtc.dev/traversal/apis/fastapi.md) · [All operations](https://skmtc.dev/traversal/apis/fastapi/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/traversal/fastapi/revisions/8e5040513836/schema)
