Skip to main content
PUT
/
context
/
files
/
content
Write file content
curl --request PUT \
  --url https://api.getcargo.io/v1/context/files/content \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "path": "<string>",
  "content": "<string>",
  "commitMessage": "<string>",
  "sha": "<string>"
}
'
{
  "sha": "<string>"
}

Authorizations

Authorization
string
header
required

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

Body

application/json

Request body schema for writing a file to the repository.

path
string
required

Full path to the file to write in the repository.

content
string
required

The content to write to the file.

commitMessage
string

Optional commit message. Defaults to 'Update ' if not provided.

sha
string

SHA of the existing file to update. If omitted, the current SHA is fetched automatically.

Response

Successful response

sha
string
required

The SHA of the file after writing.