Skip to main content
PATCH
/
context
/
runtime
/
content
Edit runtime sandbox file
curl --request PATCH \
  --url https://api.getcargo.io/v1/context/runtime/content \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "path": "<string>",
  "oldString": "<string>",
  "newString": "<string>",
  "replaceAll": true,
  "commitMessage": "<string>"
}
'
{
  "commit": {
    "sha": "<string>",
    "message": "<string>"
  }
}

Documentation Index

Fetch the complete documentation index at: https://docs.getcargo.ai/llms.txt

Use this file to discover all available pages before exploring further.

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

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

Successful response

commit
Commit · object
required