Skip to main content
POST
/
v1
/
repo
curl -X POST https://api.relace.run/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"
}

Documentation Index

Fetch the complete documentation index at: https://docs.relace.ai/llms.txt

Use this file to discover all available pages before exploring further.

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
auto_index
boolean
default:false
Optional flag to enable automatic code indexing/embedding after repo creation and updates.
This parameter must be enabled for semantic retrieval to work.

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.run/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"
}