Repositories API

Access repository information. List repositories, branches, and merge requests through the REST API.

Endpoints

MethodPathScopeDescription
GET/repositoriesrepos:readList repositories
GET/repositories/:idrepos:readGet repository details
GET/repositories/:id/branchesrepos:readList branches
GET/repositories/:id/merge-requestsrepos:readList merge requests

Endpoint Details

GET /repositories

Retrieve a list of all repositories connected to the organization.

Response Example

{
  "repositories": [
    {
      "id": 1,
      "name": "agentsmesh",
      "full_name": "org/agentsmesh",
      "provider": "gitlab",
      "url": "https://gitlab.com/org/agentsmesh",
      "default_branch": "main",
      "created_at": "2025-01-01T00:00:00Z"
    }
  ]
}

GET /repositories/:id

Retrieve detailed information about a specific repository.

Path Parameters

ParameterTypeRequiredDescription
idintegerRequiredThe numeric ID of the repository

Response Example

{
  "repository": {
    "id": 1,
    "name": "agentsmesh",
    "full_name": "org/agentsmesh",
    "provider": "gitlab",
    "url": "https://gitlab.com/org/agentsmesh",
    "default_branch": "main",
    "created_at": "2025-01-01T00:00:00Z"
  }
}

GET /repositories/:id/branches

Retrieve a list of branches for a specific repository. Requires an access token.

Path Parameters

ParameterTypeRequiredDescription
idintegerRequiredThe numeric ID of the repository

Query Parameters

ParameterTypeRequiredDescription
access_tokenstringRequiredGit provider access token for authentication

Response Example

{
  "branches": [
    "main",
    "develop",
    "feature/auth",
    "fix/login-bug"
  ]
}

GET /repositories/:id/merge-requests

Retrieve merge requests (or pull requests) for a specific repository.

Path Parameters

ParameterTypeRequiredDescription
idintegerRequiredThe numeric ID of the repository

Query Parameters

ParameterTypeRequiredDescription
branchstringOptionalFilter by source branch name
statestringOptionalFilter by state: opened, merged, closed, or all

Response Example

{
  "merge_requests": [
    {
      "id": 101,
      "title": "Add JWT authentication",
      "state": "opened",
      "source_branch": "feature/auth",
      "target_branch": "main",
      "author": "john.doe",
      "url": "https://gitlab.com/org/repo/-/merge_requests/101",
      "created_at": "2025-01-14T09:00:00Z"
    }
  ]
}