Skip to content
Write a mount file

Write a mount file

Create or replace one file of a mount, creating any missing parent folders.

PUT/api/v1/mounts/:mountId/files/content

Request#

TypeScript
const response = await fetch("https://api.smallworld.sh/api/v1/mounts/0199a1c4-5b6e-7a10-9c2d-3e4f5a6b7c8d/files/content?path=/faq.md", {
  method: "PUT",
  headers: { Authorization: `Bearer ${apiKey}`, "Content-Type": "application/json" },
  body: JSON.stringify({
  "content": "# FAQ\n\nRefunds take 3 business days.\n"
}),
});
if (!response.ok) throw new Error(`HTTP ${response.status}: ${await response.text()}`);
const result = await response.json();

Use your server-side apiKey. Replace the example IDs.

Path parameters#

mountIdUUIDrequired

The mount's ID, returned as id when the mount was created.

Query parameters#

pathstringrequired

A path inside the mount, such as /guides/refunds.md for /workspace/docs/guides/refunds.md in a mount at /workspace/docs. guides/refunds.md names the same file. No empty, . or .. segments and no trailing slash. URL-encode it.

Request body#

contentstringrequired

The file's content: text for utf8, or base64 for any bytes.

encodingstring

utf8 (the default) or base64.

Responses#

The file existed with other content and was replaced.

200 response
{
  "status": "updated",
  "entry": {
    "path": "/faq.md",
    "type": "file",
    "size": 37,
    "hash": "e08222b5163270229c47f385e4d0e8a9de482f71d0364a66de787c09b3b63b0a",
    "modifiedAt": "2026-10-10T12:00:01.000Z"
  }
}
More about this endpoint

This write is direct: it skips the mount's settings, tool call hooks, and approvals, and takes effect at once. It appears in the mount's change log in the dashboard. It always overwrites, without a version check.

A command that first saw this file before your write and changes it, also one waiting for approval, has its changes to the mount discarded, with a notice in stderr. Commands that change other files of the mount are unaffected.

A file can be at most 64 MiB, and the mount at most 64 MiB and 10,000 files and folders. A JSON request body is at most 12 MiB, base64 included.