Repos is now in Public Beta! Reach out to us at
info@relace.ai if you have any questions or need help with the integration.
Request Body
Optional object to initialize the repo from existing source
The source type: "files" for direct file upload, "git" for GitHub repo, or "relace" for Relace repo
From Files
From Git Repo
From Relace Repo
Array of file objects to include in the repo
The path and filename for the file
Optional object containing any key-value pairs for custom metadata about the
repo
Optional flag to enable automatic code indexing/embedding after repo creation and updates.This parameter must be enabled for semantic retrieval to work.
Response
Unique identifier for the newly created repo
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"
}