Skip to main content

Repositories API

Connect and manage Git repositories for your projects.

Endpoints

MethodEndpointDescription
POST/repositoriesConnect a repository
GET/repositories?projectId=List repositories
GET/repositories/:idGet a repository
PATCH/repositories/:idUpdate a repository
DELETE/repositories/:idDisconnect a repository
GET/repositories/primary/:projectIdGet primary repository
GET/repositories/docs/:projectIdGet docs repository
POST/repositories/:id/validateValidate 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

FieldTypeRequiredDescription
projectIdstringYesProject to add repo to
namestringYesDisplay name
urlstringYesGit repository URL
defaultBranchstringNoDefault branch (default: main)
isPrimarybooleanNoMark as primary repo
isDocsRepobooleanNoMark 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:

  • repo scope for private repositories
  • public_repo scope for public repositories only