POST
/
v1
/
repo
/
{repo_id}
/
update
curl -X POST https://api.relace.ai/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"
        }
      ]
    }
  }'
{
  "repo_head": "abc123def456"
}

Path Parameters

repo_id
string
required
Repo ID

Request Body

source
object
required
Source for updating the repo content

Response

repo_head
string
Commit hash for the updated repo head
curl -X POST https://api.relace.ai/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"
        }
      ]
    }
  }'
{
  "repo_head": "abc123def456"
}