Skip to main content

Repositories API

Repositories are linked to projects for analysis. Octokraft connects to repositories via the GitHub App installation or can add public repositories directly.

List Repositories

Returns all repositories linked to a project.
curl "https://app.octokraft.com/api/v1/projects/b3d7f1a2-4e5c-6d8a-9b0c-1e2f3a4b5c6d/repos" \
  -H "Authorization: Bearer ok_live_a1b2c3d4e5f6..."

Response Fields

FieldTypeDescription
idstringOctokraft repository ID (UUID)
github_idintegerGitHub repository ID
installation_idintegerGitHub App installation ID
ownerstringRepository owner (user or organization)
namestringRepository name
full_namestringFull repository name (owner/name)
urlstringGitHub repository URL
default_branchstringDefault branch name
analyzersarrayDetected static analyzers for this repository
privatebooleanWhether the repository is private

Links one or more repositories to a project. Repositories must already be synced from a GitHub App installation.
curl -X POST "https://app.octokraft.com/api/v1/projects/b3d7f1a2-4e5c-6d8a-9b0c-1e2f3a4b5c6d/repos" \
  -H "Authorization: Bearer ok_live_a1b2c3d4e5f6..." \
  -H "Content-Type: application/json" \
  -d '{
    "repository_id": "f1a2b3c4-5678-9abc-def0-aabbccddeeff"
  }'

Request Body

FieldTypeRequiredDescription
repository_idstringyes (if repository_ids not set)Single repository ID to link
repository_idsarray of stringsyes (if repository_id not set)Multiple repository IDs to link
skip_onboardingbooleannoIf true, skip the automatic onboarding analysis. Defaults to false.
When repositories are linked, Octokraft automatically starts an onboarding workflow that clones the repository, detects analyzers, runs initial analysis, and generates architecture documentation. The onboarding_session_id can be used to track progress via the SSE event stream.

Add Public Repository

Adds a public GitHub repository to a project without requiring the GitHub App installation.
curl -X POST "https://app.octokraft.com/api/v1/projects/b3d7f1a2-4e5c-6d8a-9b0c-1e2f3a4b5c6d/repos/add-public" \
  -H "Authorization: Bearer ok_live_a1b2c3d4e5f6..." \
  -H "Content-Type: application/json" \
  -d '{
    "owner": "BurntSushi",
    "name": "ripgrep"
  }'

Request Body

FieldTypeRequiredDescription
urlstringyes (if owner/name not set)GitHub repository URL
ownerstringyes (if url not set)Repository owner
namestringyes (if url not set)Repository name
skip_onboardingbooleannoIf true, skip automatic onboarding. Defaults to false.

Removes a repository from a project. This does not delete analysis data.
curl -X DELETE "https://app.octokraft.com/api/v1/projects/b3d7f1a2-4e5c-6d8a-9b0c-1e2f3a4b5c6d/repos/f1a2b3c4-5678-9abc-def0-aabbccddeeff" \
  -H "Authorization: Bearer ok_live_a1b2c3d4e5f6..."
Returns 204 No Content on success.

List Available Repositories

Returns repositories accessible via the GitHub App installation that are not yet linked to the project. Use this to present a selection UI when adding repositories.
curl "https://app.octokraft.com/api/v1/projects/b3d7f1a2-4e5c-6d8a-9b0c-1e2f3a4b5c6d/repos/available" \
  -H "Authorization: Bearer ok_live_a1b2c3d4e5f6..."

Sync GitHub Installations

Syncs GitHub App installations and their repositories. Call this after installing or reconfiguring the GitHub App to update the available repositories.
curl -X POST "https://app.octokraft.com/api/v1/github/installations/sync" \
  -H "Authorization: Bearer ok_live_a1b2c3d4e5f6..." \
  -H "Content-Type: application/json" \
  -d '{
    "installation_ids": [42000001]
  }'

Request Body

FieldTypeRequiredDescription
installation_idsarray of integersnoSpecific installation IDs to sync. If omitted, syncs all installations associated with the authenticated user.