Skip to main content
Two endpoints let you manage the structure of a capsule’s filesystem: one for creating directories and one for removing files or directories. Both require the capsule to be in the running state.

Create a directory

POST https://app.wrenn.dev/api/v1/capsules/{id}/files/mkdir
Creates a directory at the specified path inside the capsule. Intermediate directories are created as needed (equivalent to mkdir -p).

Authentication

X-API-Key
string
required
Your team’s API key. Pass the full wrn_... key value.

Path parameters

id
string
required
The ID of the capsule. The capsule must be in the running state.

Request body

path
string
required
Absolute path of the directory to create inside the capsule, e.g. "/app/data".

Example request

curl -X POST https://app.wrenn.dev/api/v1/capsules/cl-abc123/files/mkdir \
  -H "X-API-Key: wrn_your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{"path": "/app/data"}'
{"path": "/app/data"}

Response

Returns 200 OK with a FileEntry object describing the created directory.
entry
object
The created directory entry.

Example response

{
  "entry": {
    "name": "data",
    "path": "/app/data",
    "type": "directory",
    "size": 4096,
    "permissions": "drwxr-xr-x",
    "owner": "user",
    "group": "user",
    "modified_at": 1730000000,
    "symlink_target": null
  }
}

Remove a file or directory

POST https://app.wrenn.dev/api/v1/capsules/{id}/files/remove
Removes a file or directory at the specified path inside the capsule. Removal is recursive for directories — all contents are deleted.
This operation is irreversible. Entire directory trees are removed without confirmation. Make sure you have a copy of any data you need before calling this endpoint.

Authentication

X-API-Key
string
required
Your team’s API key. Pass the full wrn_... key value.

Path parameters

id
string
required
The ID of the capsule. The capsule must be in the running state.

Request body

path
string
required
Absolute path to the file or directory to remove, e.g. "/app/old".

Example request

curl -X POST https://app.wrenn.dev/api/v1/capsules/cl-abc123/files/remove \
  -H "X-API-Key: wrn_your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{"path": "/app/old"}'
{"path": "/app/old"}

Response

Returns 204 No Content on success. No body is returned.

Python SDK

from wrenn import Capsule

with Capsule(wait=True) as capsule:
    # Create a directory (and any needed parents)
    capsule.files.make_dir("/app/data")

    # Remove a file
    capsule.files.remove("/app/old-script.py")

    # Remove an entire directory tree
    capsule.files.remove("/app/old")
remove works recursively for directories. There is no rmdir-style safe guard — it behaves like rm -rf.

Error responses

StatusMeaning
404 Not FoundThe capsule does not exist, or the specified path does not exist inside the capsule.
409 ConflictThe capsule is not in the running state. Resume or start the capsule first.