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

> Returns the GitHub account linked to your BLACKBOX API key, or { connected: false } if no token is stored.

This endpoint returns the GitHub account connected to your BLACKBOX API key. Use it to check which GitHub user is linked before creating tasks that work with repositories.

<Note>
  This endpoint requires a **Pro subscription**.
</Note>

## Authentication

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

1. Go to [app.blackbox.ai/agent-api](https://app.blackbox.ai/agent-api) and click **Get an API Key** (requires a Pro subscription)
2. Once provisioning completes, you will be redirected to your [Dashboard](https://app.blackbox.ai/dashboard)
3. From the Dashboard, create an API key to use with all Agent API requests

Your API key will be in the format: `sk-xxxxxxxxxxxxxxxxxxxxxx`

## Headers

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

  Example: `Bearer sk_b41b647ffbfed27f616560`
</ParamField>

## Response Fields

<ResponseField name="connected" type="boolean">
  `true` if a valid GitHub token is stored, `false` otherwise.
</ResponseField>

<ResponseField name="login" type="string">
  GitHub username. Present when `connected: true`.
</ResponseField>

<ResponseField name="name" type="string | null">
  Display name of the GitHub user.
</ResponseField>

<ResponseField name="email" type="string | null">
  Primary email of the GitHub user.
</ResponseField>

<ResponseField name="avatarUrl" type="string">
  GitHub avatar URL.
</ResponseField>

<ResponseField name="scopes" type="string">
  OAuth scopes granted by the token (e.g. `"repo,user"`).
</ResponseField>

<ResponseField name="tokenCreatedAt" type="string | null">
  ISO 8601 timestamp when the token was stored. `null` if not recorded.
</ResponseField>

<RequestExample>
  ```bash cURL theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
  curl 'https://agent.blackbox.ai/api/v1/git/config' \
    -H '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 response = await fetch(
    "https://agent.blackbox.ai/api/v1/git/config",
    { headers: { Authorization: `Bearer ${API_KEY}` } }
  );
  const data = await response.json();
  console.log(data.connected ? `Connected as ${data.login}` : "Not connected");
  ```

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

  API_KEY = "YOUR_API_KEY"

  response = requests.get(
      "https://agent.blackbox.ai/api/v1/git/config",
      headers={"Authorization": f"Bearer {API_KEY}"},
  )
  data = response.json()
  print(f"Connected: {data['connected']}")
  if data["connected"]:
      print(f"Login: {data['login']}")
  ```

  ```go Go theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
  package main

  import (
      "encoding/json"
      "fmt"
      "io"
      "net/http"
  )

  func main() {
      apiKey := "YOUR_API_KEY"
      url := "https://agent.blackbox.ai/api/v1/git/config"

      req, _ := http.NewRequest("GET", url, nil)
      req.Header.Set("Authorization", "Bearer "+apiKey)

      client := &http.Client{}
      resp, _ := client.Do(req)
      defer resp.Body.Close()

      body, _ := io.ReadAll(resp.Body)
      var result map[string]interface{}
      json.Unmarshal(body, &result)
      fmt.Printf("Connected: %v\n", result["connected"])
  }
  ```
</RequestExample>

<ResponseExample>
  ```json Connected theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
  {
    "connected": true,
    "login": "octocat",
    "name": "The Octocat",
    "email": "octocat@github.com",
    "avatarUrl": "https://avatars.githubusercontent.com/u/583231",
    "scopes": "repo,user",
    "tokenCreatedAt": "2026-05-01T12:00:00.000Z"
  }
  ```

  ```json Not Connected theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
  {
    "connected": false
  }
  ```
</ResponseExample>

## Error Codes

| Status Code | Error                 | Description                |
| ----------- | --------------------- | -------------------------- |
| 200         | Success               | Config returned            |
| 401         | Unauthorized          | Invalid or missing API key |
| 403         | Forbidden             | Pro subscription required  |
| 500         | Internal Server Error | Failed to retrieve config  |
