Repositories API – GET /api/repositories

This endpoint retrieves all Git repositories connected to the authenticated user. It returns a simple list of usable repositories with key metadata for each.

🔒 Authentication

Every request to /api/repositories must be authenticated using API Tokens:

  • Include a valid Bearer token in the Authorization header.
  • Unauthenticated requests receive a 401 Unauthorized response.
GET /api/repositories HTTP/1.1
Host: api.docuwriter.ai
Authorization: Bearer <your_token_here>

🚀 Endpoint

{
    "title": "List Repositories",
    "description": "Fetch all Git repositories the current user has connected and that are available for documentation generation.",
    "method": "GET",
    "baseUrl": "https://app.docuwriter.ai",
    "endpoint": "/api/repositories",
    "headers": [
        {
            "key": "Authorization",
            "value": "Bearer <token>",
            "required": true
        }
    ],
    "queryParams": [],
    "pathParams": [],
    "bodyType": "none",
    "requestBody": "",
    "formData": [],
    "rawBody": "",
    "responses": {
        "200": {
            "description": "A list of repositories.",
            "body": "{\n  \"success\": true,\n  \"data\": [\n    {\n      \"id\": 1,\n      \"name\": \"owner/project-name\",\n      \"branch\": \"main\",\n      \"network\": \"GitHub\",\n      \"status\": \"Code Imported\",\n      \"created_at\": \"2024-01-15T10:12:34.000000Z\"\n    }\n  ]\n}"
        },
        "401": {
            "description": "Unauthorized. Missing or invalid token.",
            "body": "{\n  \"message\": \"Unauthenticated.\"\n}"
        },
        "500": {
            "description": "Internal server error.",
            "body": "{\n  \"success\": false,\n  \"message\": \"Internal server error\"\n}"
        }
    }
}

🗂️ Response Fields

On success, the JSON response has two top-level keys:

Field Type Description
success boolean Always true for this endpoint
data array List of repository objects

Each repository object contains:

Field Type Description
id integer Internal identifier for the connection
name string Repository slug (owner/project-name)
branch string Branch used for code analysis (e.g. main, develop)
network string Git provider (GitHub, Bitbucket, GitLab, or manual)
status string Import status (Pending, Code Imported, Error)
created_at string ISO8601 timestamp when the repository was added