Skip to main content
PATCH
https://api.app.shinzo.ai
/
v1
/
agent
/
{agentId}
/
filesystem
/
files
/
{path}
Patch File
curl --request PATCH \
  --url https://api.app.shinzo.ai/v1/agent/{agentId}/filesystem/files/{path} \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "operation": "<string>",
  "content": "<string>",
  "position": 123,
  "length": 123
}
'

Authentication

Requires JWT token or Platform API key.
agentId
string
required
Agent UUID
path
string
required
File path within the agent workspace (wildcard segment)
operation
string
required
Patch operation: append, prepend, or replace
content
string
required
Content to apply
position
number
Byte offset for replace operations
length
number
Length for replace operations

Example Request

Append content to the end of a file:
curl -X PATCH "https://api.app.shinzo.ai/v1/agent/agt_abc123/filesystem/files/workspace/logs/app.log" \
  -H "Authorization: Bearer <jwt_token>" \
  -H "Content-Type: application/json" \
  -d '{
    "operation": "append",
    "content": "\n2025-01-20 12:30:00 INFO Task completed"
  }'
Replace content at a specific byte offset:
curl -X PATCH "https://api.app.shinzo.ai/v1/agent/agt_abc123/filesystem/files/workspace/data/config.txt" \
  -H "Authorization: Bearer <jwt_token>" \
  -H "Content-Type: application/json" \
  -d '{
    "operation": "replace",
    "content": "new_value",
    "position": 128
  }'

Response

{
  "path": "/workspace/logs/app.log",
  "size": 2048,
  "updated_at": "2025-01-20T12:30:00Z"
}

Response Fields

FieldTypeDescription
pathstringAbsolute path of the patched file
sizenumberNew file size in bytes
updated_atstringUpdate timestamp (ISO 8601)

Status Codes

CodeDescription
200File patched successfully
400Invalid request body or operation
401Invalid authentication
403Access denied
404Agent or file not found