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",
"repo_id": "123e4567-e89b-12d3-a456-426614174000",
"changed_files": ["src/search.ts", "src/helpers.ts", "old-file.js"]
}
Source Control
Update Repo
Update repo content with files or sync from Git.
POST
/
v1
/
repo
/
{repo_id}
/
update
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",
"repo_id": "123e4567-e89b-12d3-a456-426614174000",
"changed_files": ["src/search.ts", "src/helpers.ts", "old-file.js"]
}
Path Parameters
Repo ID
Request Body
Optional source for updating the repo content
Show properties
Show properties
Update type:
"git" for Git sync, "files" to replace all repo content, or
"diff" for specific operations- Git
- Files
- Diff
Array of file operations to perform
Show properties
Show properties
Operation type:
"write" to create/update, "rename" to change filename, or "delete" to removeShow operation-specific properties
Show operation-specific properties
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
The repository ID that was updated
Commit hash for the updated repo head
Array of file paths that were modified
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",
"repo_id": "123e4567-e89b-12d3-a456-426614174000",
"changed_files": ["src/search.ts", "src/helpers.ts", "old-file.js"]
}
⌘I