---
title: "Create or overwrite file"
method: PUT
path: "/v2/files/{path}"
tags: ["files"]
---

# Create or overwrite file

`PUT /v2/files/{path}`

Create a non-empty file or overwrite an existing file.

If the parent folder of the `path` parameter doesn't exist, the file system creates it before creating the file.

<Info>This acts on files in the AI Hub filesystem, not your local filesystem.</Info>

<Note>Ensure the path is accessible within the context defined by the `IB-Context` header.</Note>

Not all filesystem types support this operation.

| Filesystem           | Supported |
|----------------------|-----------|
| Instabase            | ✓         |
| Amazon S3            | ✓         |
| Azure Blob Storage   | ✓         |
| Google Cloud Storage | ✓         |
| Google Drive         | -         |

## Path parameters

- `path` string, required

## Headers

- `Authorization` string, required
- `IB-Context` string

## Response `201`

The request succeeded and a new file was created at the target location. AI Hub returns this status code only when the request includes an `If-None-Match` header with a value of `*`.

- FilesWriteFileResponse201 — Empty response body

## Other responses

- `412` — The request failed because a file exists at the target location that matches the `If-None-Match` header.

---

[API](https://skmtc.net/instabase/apis/api-reference.md) · [All operations](https://skmtc.net/instabase/apis/api-reference/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/instabase/api-reference/revisions/3a4f46d48141/schema)
