Skip to main content
PATCH
Edit runtime sandbox file

Authorizations

Authorization
string
header
required

API token from cargo-ai login. Send as Authorization: Bearer <token>.

Headers

Idempotency-Key
string

Client-generated key that makes this write safe to retry. Reusing the same key with the same request returns the original response instead of creating a second record. Reusing it with a different request returns 422. A concurrent retry while the first request is still running returns 409. Keys expire after 24 hours. Not accepted on multipart file uploads. Optional: a request without one is processed as it always was.

Maximum string length: 255
Example:

"8e03978e-40d5-43e8-bc93-6894a57f9324"

Body

application/json

Edit a file in the workspace runtime sandbox via string replacement, then push the change to the default branch.

path
string
required

Path of the file to edit, relative to the workspace working directory.

Minimum string length: 1
oldString
string
required

The exact substring to replace. Must occur exactly once unless replaceAll is true.

Minimum string length: 1
newString
string
required

Replacement string. May be empty to delete the match. Must differ from oldString.

replaceAll
boolean

When true, replace every occurrence of oldString instead of requiring a single match.

commitMessage
string

Optional commit message override. Defaults to 'context(runtime): edit '.

Minimum string length: 1

Response

Edit runtime sandbox file

commit
Commit · object
required