> ## 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 GitHub Repositories

> Retrieve repositories for a specific GitHub user or organization.

This endpoint returns a list of repositories belonging to a specified GitHub user or organization, including repository metadata such as name, description, language, and clone URL.

## 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>

## Query Parameters

<ParamField query="owner" type="string" required>
  The GitHub username or organization name whose repositories you want to retrieve.

  Example: `example-user` or `example-org`
</ParamField>

## Response

The endpoint returns an array of repository objects.

<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="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>

<RequestExample>
  ```bash cURL theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
  curl --location 'https://cloud.blackbox.ai/api/github/repos?owner=example-user' \
  --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 owner = "example-user";
  const API_URL = `https://cloud.blackbox.ai/api/github/repos?owner=${owner}`;

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

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

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

  API_KEY = "YOUR_API_KEY"
  owner = "example-user"
  API_URL = f"https://cloud.blackbox.ai/api/github/repos?owner={owner}"

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

  response = requests.get(API_URL, headers=headers)
  repositories = response.json()
  print(repositories)
  ```
</RequestExample>

<ResponseExample>
  ```json Success Response theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
  [
      {
          "name": "example-repo",
          "full_name": "example-user/example-repo",
          "description": "An example repository",
          "private": false,
          "clone_url": "https://github.com/example-user/example-repo.git",
          "updated_at": "2025-11-15T10:30:00Z",
          "language": "JavaScript"
      },
      {
          "name": "another-repo",
          "full_name": "example-user/another-repo",
          "description": null,
          "private": false,
          "clone_url": "https://github.com/example-user/another-repo.git",
          "updated_at": "2025-10-20T14:22:15Z",
          "language": "Python"
      }
  ]
  ```

  ```json Error Response theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
  {
    "error": "Bad Request",
    "message": "Missing required parameter: owner",
    "status": 400
  }
  ```
</ResponseExample>

## Error Codes

| Status Code | Error                 | Description                         |
| ----------- | --------------------- | ----------------------------------- |
| 200         | Success               | Repositories retrieved successfully |
| 400         | Bad Request           | Missing required parameter: owner   |
| 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   |
