Path Parameters
Request Body
Optional source for updating the repo content
Update type: "git"
for Git sync, "files"
to replace all repo content, or
"diff"
for specific operations
Git repo URL to sync from
Specific branch to sync (optional)
Optional object containing any key-value pairs, which overwrites any existing
metadata.
If neither source
nor metadata
is provided, you’ll receive a 422 error.
Response
Commit hash for the updated repo head
curl -X POST https://api.relace.run/v1/repo/123e4567-e89b-12d3-a456-426614174000/update \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"source": {
"type": "diff",
"operations": [
{
"type": "write",
"filename": "src/search.ts",
"content": "function findItem(array: Item[], targetId: string): Item | undefined {\n for (let i = 0; i < array.length; i++) {\n const item = array[i];\n if (item.id === targetId) {\n return item;\n }\n }\n return undefined;\n}"
},
{
"type": "rename",
"old_filename": "src/utils.ts",
"new_filename": "src/helpers.ts"
},
{
"type": "delete",
"filename": "old-file.js"
}
]
},
"metadata": {
"version": "2.1.0",
"updated_by": "user123"
}
}'
{
"repo_head": "abc123def456"
}