Repositories API
Connect and manage Git repositories for your projects.
Endpoints
| Method | Endpoint | Description |
|---|---|---|
POST | /repositories | Connect a repository |
GET | /repositories?projectId= | List repositories |
GET | /repositories/:id | Get a repository |
PATCH | /repositories/:id | Update a repository |
DELETE | /repositories/:id | Disconnect a repository |
GET | /repositories/primary/:projectId | Get primary repository |
GET | /repositories/docs/:projectId | Get docs repository |
POST | /repositories/:id/validate | Validate connectivity |
Repository Object
{
"id": "repo_xxx",
"projectId": "proj_xxx",
"name": "backend-api",
"url": "https://github.com/myorg/backend-api",
"defaultBranch": "main",
"isPrimary": true,
"isDocsRepo": false,
"createdAt": "2024-01-10T08:00:00Z"
}
Connect a Repository
curl -X POST https://api.team6.ai/repositories \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{
"projectId": "proj_xxx",
"name": "backend-api",
"url": "https://github.com/myorg/backend-api",
"defaultBranch": "main",
"isPrimary": true
}'
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
projectId | string | Yes | Project to add repo to |
name | string | Yes | Display name |
url | string | Yes | Git repository URL |
defaultBranch | string | No | Default branch (default: main) |
isPrimary | boolean | No | Mark as primary repo |
isDocsRepo | boolean | No | Mark as documentation repo |
Response
{
"id": "repo_xxx",
"projectId": "proj_xxx",
"name": "backend-api",
"url": "https://github.com/myorg/backend-api",
"defaultBranch": "main",
"isPrimary": true,
"createdAt": "2024-01-10T08:00:00Z"
}
List Repositories
curl "https://api.team6.ai/repositories?projectId=proj_xxx" \
-H "Authorization: Bearer $TOKEN"
Response
[
{
"id": "repo_backend",
"name": "backend-api",
"url": "https://github.com/myorg/backend-api",
"isPrimary": true
},
{
"id": "repo_frontend",
"name": "frontend-app",
"url": "https://github.com/myorg/frontend-app",
"isPrimary": false
}
]
Get Primary Repository
Each project has one primary repository:
curl https://api.team6.ai/repositories/primary/proj_xxx \
-H "Authorization: Bearer $TOKEN"
Get Documentation Repository
Optional docs repository for the project:
curl https://api.team6.ai/repositories/docs/proj_xxx \
-H "Authorization: Bearer $TOKEN"
Update Repository
curl -X PATCH https://api.team6.ai/repositories/repo_xxx \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{
"defaultBranch": "develop",
"isPrimary": true
}'
Validate Repository
Test that Team6 can access the repository:
curl -X POST https://api.team6.ai/repositories/repo_xxx/validate \
-H "Authorization: Bearer $TOKEN"
Response
{
"valid": true,
"message": "Repository is accessible",
"branches": ["main", "develop", "feature/auth"]
}
Error Response
{
"valid": false,
"message": "Authentication failed",
"error": "Permission denied (publickey)"
}
Delete Repository
Disconnect a repository from the project:
curl -X DELETE https://api.team6.ai/repositories/repo_xxx \
-H "Authorization: Bearer $TOKEN"
warning
This doesn't delete the repository from GitHub, only disconnects it from Team6.
Multi-Repository Setup
For projects spanning multiple repositories:
# Connect backend repo as primary
curl -X POST https://api.team6.ai/repositories \
-d '{
"projectId": "proj_xxx",
"name": "backend",
"url": "https://github.com/myorg/backend",
"isPrimary": true
}'
# Connect frontend repo
curl -X POST https://api.team6.ai/repositories \
-d '{
"projectId": "proj_xxx",
"name": "frontend",
"url": "https://github.com/myorg/frontend",
"isPrimary": false
}'
# Connect docs repo
curl -X POST https://api.team6.ai/repositories \
-d '{
"projectId": "proj_xxx",
"name": "docs",
"url": "https://github.com/myorg/docs",
"isDocsRepo": true
}'
Tasks can then create PRs across all connected repositories.
Authentication
Repository access uses the project's GitHub token:
# Set project GitHub token first
curl -X POST https://api.team6.ai/projects/proj_xxx/github-token \
-H "Authorization: Bearer $TOKEN" \
-d '{"token": "ghp_xxxxxxxxxxxx"}'
# Then connect repositories
curl -X POST https://api.team6.ai/repositories \
-d '{"projectId": "proj_xxx", "url": "https://github.com/..."}'
The GitHub token must have:
reposcope for private repositoriespublic_reposcope for public repositories only