GitHub
The GitHub integration connects a user's GitHub account with a personal access token, so agents can work with the repositories that account can reach. The connection is scoped to the user who created it. To index repository content for agent search, see Vectorise GitHub data on the knowledge index page.
- POST /github/connect Connect GitHub
- GET /github/status Check GitHub status
- GET /github/repositories List repositories
- POST /github/disconnect Disconnect GitHub
Paths are relative to /api
Connect GitHub
POST /api/github/connect
Connects GitHub with a personal access token after validating it.
Validates the personal access token against GitHub, then stores it against the caller. After connecting, choose a repository to index with Vectorise GitHub data.
- Authentication
- Bearer token How it works
Body parameters application/json
-
tokenstring RequiredGitHub personal access token.
Returns
Returns success: true and a confirmation message.
Errors
- 400 No token was provided.
- 401 GitHub rejected the token.
curl -X POST "$VDF_BASE_URL/api/github/connect" \
-H "Authorization: Bearer $VDF_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"token": "<ACCESS_TOKEN>"
}' const response = await fetch(`${process.env.VDF_BASE_URL}/api/github/connect`, {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.VDF_ACCESS_TOKEN}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
token: '<ACCESS_TOKEN>',
}),
});
if (!response.ok) throw new Error(`Request failed with status ${response.status}`);
const data = await response.json(); import os
import requests
response = requests.post(
f"{os.environ['VDF_BASE_URL']}/api/github/connect",
headers={"Authorization": f"Bearer {os.environ['VDF_ACCESS_TOKEN']}"},
json={
"token": "<ACCESS_TOKEN>",
},
timeout=30,
)
response.raise_for_status()
data = response.json() {
"success": true,
"message": "Successfully connected to GitHub. Please select a repository to vectorize."
} Check GitHub status
GET /api/github/status
Returns whether the caller has connected GitHub.
Reports whether the caller has a stored GitHub connection. The token is never returned.
- Authentication
- Bearer token How it works
Parameters
No parameters.
Returns
Returns isConnected, which is true when a GitHub token is stored for you.
curl "$VDF_BASE_URL/api/github/status" \
-H "Authorization: Bearer $VDF_ACCESS_TOKEN" const response = await fetch(`${process.env.VDF_BASE_URL}/api/github/status`, {
headers: {
Authorization: `Bearer ${process.env.VDF_ACCESS_TOKEN}`,
},
});
if (!response.ok) throw new Error(`Request failed with status ${response.status}`);
const data = await response.json(); import os
import requests
response = requests.get(
f"{os.environ['VDF_BASE_URL']}/api/github/status",
headers={"Authorization": f"Bearer {os.environ['VDF_ACCESS_TOKEN']}"},
timeout=30,
)
response.raise_for_status()
data = response.json() {
"success": true,
"isConnected": true
} List repositories
GET /api/github/repositories
Returns the repositories the connected GitHub token can access, including private and organisation repositories, most recently updated first.
- Authentication
- Bearer token How it works
Parameters
No parameters.
Returns
Returns an array of repositories.
Errors
- 401 GitHub is not connected for the caller.
curl "$VDF_BASE_URL/api/github/repositories" \
-H "Authorization: Bearer $VDF_ACCESS_TOKEN" const response = await fetch(`${process.env.VDF_BASE_URL}/api/github/repositories`, {
headers: {
Authorization: `Bearer ${process.env.VDF_ACCESS_TOKEN}`,
},
});
if (!response.ok) throw new Error(`Request failed with status ${response.status}`);
const data = await response.json(); import os
import requests
response = requests.get(
f"{os.environ['VDF_BASE_URL']}/api/github/repositories",
headers={"Authorization": f"Bearer {os.environ['VDF_ACCESS_TOKEN']}"},
timeout=30,
)
response.raise_for_status()
data = response.json() [
{
"id": 123456789,
"name": "api",
"full_name": "acme/api",
"private": true,
"description": "Public API service",
"url": "https://github.example.com/acme/api"
}
] Disconnect GitHub
POST /api/github/disconnect
Removes the caller's stored GitHub connection.
- Authentication
- Bearer token How it works
Parameters
No parameters.
Returns
Returns success: true and a confirmation message.
curl -X POST "$VDF_BASE_URL/api/github/disconnect" \
-H "Authorization: Bearer $VDF_ACCESS_TOKEN" const response = await fetch(`${process.env.VDF_BASE_URL}/api/github/disconnect`, {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.VDF_ACCESS_TOKEN}`,
},
});
if (!response.ok) throw new Error(`Request failed with status ${response.status}`);
const data = await response.json(); import os
import requests
response = requests.post(
f"{os.environ['VDF_BASE_URL']}/api/github/disconnect",
headers={"Authorization": f"Bearer {os.environ['VDF_ACCESS_TOKEN']}"},
timeout=30,
)
response.raise_for_status()
data = response.json() {
"success": true,
"message": "Successfully disconnected from GitHub"
}