POST
/
v1
/
repo
curl -X POST https://api.relace.ai/v1/repo \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
    -d '{
    "source": {
      "type": "files",
      "files": [
        {
          "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}"
        },
        {
          "filename": "src/types.ts",
          "content": "interface Item {\n  id: string;\n  value: string;\n  metadata?: Record<string, unknown>;\n}"
        }
        // ... more files
      ]
    },
    "metadata": {
      "name": "my-codebase",
      "id": "my-internal-id"
    }
  }'
{
  "repo_id": "123e4567-e89b-12d3-a456-426614174000",
  "repo_head": "a1b2c3d4e5f6789012345678901234567890abcdef"
}

Request Body

source
object
Optional object to initialize the repo from existing source
metadata
object
Optional object containing any key-value pairs for custom metadata about the repo

Response

repo_id
string
Unique identifier for the newly created repo
repo_head
string
Commit hash for the current repo head
curl -X POST https://api.relace.ai/v1/repo \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
    -d '{
    "source": {
      "type": "files",
      "files": [
        {
          "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}"
        },
        {
          "filename": "src/types.ts",
          "content": "interface Item {\n  id: string;\n  value: string;\n  metadata?: Record<string, unknown>;\n}"
        }
        // ... more files
      ]
    },
    "metadata": {
      "name": "my-codebase",
      "id": "my-internal-id"
    }
  }'
{
  "repo_id": "123e4567-e89b-12d3-a456-426614174000",
  "repo_head": "a1b2c3d4e5f6789012345678901234567890abcdef"
}