> ## Documentation Index
> Fetch the complete documentation index at: https://docs.blackbox.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Get All GitHub Repositories

> Retrieve all repositories accessible to the authenticated user, including personal and organization repositories.

This endpoint returns a comprehensive list of all repositories that the authenticated user has access to, including both personal repositories and repositories from organizations they belong to. Each repository includes detailed metadata such as owner information, language, visibility, and timestamps.

## Authentication

To use this API, you need a BLACKBOX API Key. Follow these steps to get your API key:

1. **Click on your Profile Image** in the top right corner at [cloud.blackbox.ai](https://cloud.blackbox.ai)
2. **Click on "BLACKBOX API Token"** from the dropdown menu
3. **Copy the existing token** or **click "Generate"** if you don't have one yet

Your API key will be in the format: `bb_xxxxxxxxxxxxxxxxxxxxxx`

## Headers

<ParamField header="Authorization" type="string" required>
  API Key of the form `Bearer <api_key>`.

  Example: `Bearer bb_b41b647ffbfed27f61656049d3eaeef3d903cc503345d9eb80080d98bc0`
</ParamField>

## Response

The endpoint returns an object containing an array of repository objects with comprehensive metadata.

<ResponseField name="repos" type="array">
  Array of repository objects with the following fields:

  <Expandable title="Repository Object Fields">
    <ResponseField name="id" type="number">
      The unique GitHub repository ID.
    </ResponseField>

    <ResponseField name="name" type="string">
      The repository name.
    </ResponseField>

    <ResponseField name="full_name" type="string">
      The full repository name including owner (format: `owner/repo-name`).
    </ResponseField>

    <ResponseField name="description" type="string">
      The repository description. Can be `null` if no description is set.
    </ResponseField>

    <ResponseField name="private" type="boolean">
      Whether the repository is private (`true`) or public (`false`).
    </ResponseField>

    <ResponseField name="clone_url" type="string">
      The HTTPS URL for cloning the repository.
    </ResponseField>

    <ResponseField name="html_url" type="string">
      The URL to view the repository on GitHub.
    </ResponseField>

    <ResponseField name="updated_at" type="string">
      ISO 8601 timestamp of the last update to the repository.
    </ResponseField>

    <ResponseField name="language" type="string">
      The primary programming language of the repository. Can be `null` if not detected.
    </ResponseField>

    <ResponseField name="owner" type="object">
      Owner information object containing:

      * `login` (string): The owner's GitHub username
      * `avatar_url` (string): URL to the owner's avatar image
      * `type` (string): Owner type (`User` or `Organization`)
    </ResponseField>

    <ResponseField name="is_org_repo" type="boolean">
      Whether the repository belongs to an organization (`true`) or a personal account (`false`).
    </ResponseField>
  </Expandable>
</ResponseField>

<RequestExample>
  ```bash cURL theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
  curl --location 'https://cloud.blackbox.ai/api/github/all-repos' \
  --header 'Authorization: Bearer YOUR_API_KEY'
  ```

  ```javascript Node.js theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
  const API_KEY = "YOUR_API_KEY";
  const API_URL = "https://cloud.blackbox.ai/api/github/all-repos";

  const response = await fetch(API_URL, {
      method: "GET",
      headers: {
          Authorization: `Bearer ${API_KEY}`,
      },
  });

  const data = await response.json();
  console.log(data.repos);
  ```

  ```python Python theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
  import requests

  API_KEY = "YOUR_API_KEY"
  API_URL = "https://cloud.blackbox.ai/api/github/all-repos"

  headers = {
      "Authorization": f"Bearer {API_KEY}"
  }

  response = requests.get(API_URL, headers=headers)
  data = response.json()
  print(data["repos"])
  ```
</RequestExample>

<ResponseExample>
  ```json Success Response theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
  {
      "repos": [
          {
              "id": 123456789,
              "name": "example-project",
              "full_name": "example-user/example-project",
              "description": "A sample project demonstrating API integration",
              "private": false,
              "clone_url": "https://github.com/example-user/example-project.git",
              "html_url": "https://github.com/example-user/example-project",
              "updated_at": "2025-11-15T10:30:00Z",
              "language": "TypeScript",
              "owner": {
                  "login": "example-user",
                  "avatar_url": "https://avatars.githubusercontent.com/u/7654321?v=4",
                  "type": "User"
              },
              "is_org_repo": false
          },
          {
              "id": 987654321,
              "name": "company-backend",
              "full_name": "example-org/company-backend",
              "description": "Backend services for the company platform",
              "private": true,
              "clone_url": "https://github.com/example-org/company-backend.git",
              "html_url": "https://github.com/example-org/company-backend",
              "updated_at": "2025-11-20T14:22:15Z",
              "language": "Python",
              "owner": {
                  "login": "example-org",
                  "avatar_url": "https://avatars.githubusercontent.com/u/1234567?v=4",
                  "type": "Organization"
              },
              "is_org_repo": true
          }
      ]
  }
  ```

  ```json Error Response theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
  {
    "error": "Unauthorized",
    "message": "Invalid or missing API key",
    "status": 401
  }
  ```
</ResponseExample>

## Use Cases

This endpoint is particularly useful for:

* Building repository selection interfaces
* Syncing repository lists for dashboards
* Analyzing repository metadata across all accessible repos
* Creating backup or migration tools
* Generating reports on repository activity and languages

## Error Codes

| Status Code | Error                 | Description                             |
| ----------- | --------------------- | --------------------------------------- |
| 200         | Success               | All repositories retrieved successfully |
| 401         | Unauthorized          | Invalid or missing API key              |
| 404         | Not Found             | GitHub token not found or expired       |
| 502         | Bad Gateway           | GitHub API error occurred               |
| 500         | Internal Server Error | Database or server error occurred       |
