GitHub Connection Status

GEThttps://agent.blackbox.ai/api/v1/git/status

Check whether your GitHub account is connected and verify that your stored token is valid.

This endpoint validates the stored GitHub token by calling the GitHub API and returns the connected account's profile information. Use this to confirm your GitHub integration is active before creating tasks that work with repositories.

This endpoint requires a Pro subscription. Ensure your BLACKBOX account is on the Pro plan before calling GitHub integration endpoints.

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 and click Get an API Key (requires a Pro subscription)
  2. Once provisioning completes, you will be redirected to your 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

Authorizationstringrequired

API Key of the form Bearer <api_key>.

Example: Bearer sk_b41b647ffbfed27f616560

Response Fields

Connected

connectedboolean

true when a valid GitHub token is stored.

loginstring

GitHub username of the connected account.

namestring | null

Display name of the GitHub user.

emailstring | null

Primary email address of the GitHub user (if public).

avatarUrlstring

URL of the GitHub user's avatar image.

scopesstring

Comma-separated list of OAuth scopes granted by the token (e.g. "repo,user").

publicReposnumber

Number of public repositories owned by the user.

privateReposnumber

Number of private repositories owned by the user.

tokenValidboolean

Whether the stored token successfully authenticated with GitHub.

Not Connected

connectedboolean

false when no token is stored or the token is invalid.

messagestring

Human-readable explanation (e.g. "No GitHub token found").

Request Example
curl 'https://agent.blackbox.ai/api/v1/git/status' \
  -H 'Authorization: Bearer YOUR_API_KEY'
const API_KEY = "YOUR_API_KEY";

const response = await fetch(
  "https://agent.blackbox.ai/api/v1/git/status",
  { headers: { Authorization: `Bearer ${API_KEY}` } }
);

const data = await response.json();
if (data.connected) {
  console.log(`Connected as: ${data.login}`);
  console.log(`Scopes: ${data.scopes}`);
} else {
  console.log("GitHub not connected:", data.message);
}
import requests

API_KEY = "YOUR_API_KEY"

response = requests.get(
    "https://agent.blackbox.ai/api/v1/git/status",
    headers={"Authorization": f"Bearer {API_KEY}"},
)
data = response.json()
if data["connected"]:
    print(f"Connected as: {data['login']}")
    print(f"Scopes: {data['scopes']}")
else:
    print(f"Not connected: {data['message']}")
package main

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

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

    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)

    if result["connected"] == true {
        fmt.Printf("Connected as: %s\n", result["login"])
    } else {
        fmt.Printf("Not connected: %s\n", result["message"])
    }
}
Response Example
{
  "connected": true,
  "login": "octocat",
  "name": "The Octocat",
  "email": "octocat@github.com",
  "avatarUrl": "https://avatars.githubusercontent.com/u/583231",
  "scopes": "repo,user",
  "publicRepos": 8,
  "privateRepos": 3,
  "tokenValid": true
}
{
  "connected": false,
  "message": "No GitHub token found"
}

Error Codes

Status Code Error Description
200 Success Status returned (connected or not)
401 Unauthorized Invalid or missing API key
403 Forbidden Pro subscription required
500 Internal Server Error Failed to validate token