Disconnect Repository
Repositories
Disconnect Repository
Disconnect a repository by removing the webhook and deactivating the installation
DELETE
Disconnect Repository
Overview
Disconnects a repository from Nectr AI by removing the GitHub webhook and marking the installation as inactive. After disconnection, PR events from this repository will no longer trigger AI reviews.Authentication
Requires a valid JWT token in theAuthorization header.
Path Parameters
string
required
Repository owner (user or organization)
string
required
Repository name
Request
Response
string
Always returns
"disconnected" on successstring
Full repository name in
owner/repo formatExample Response
What Happens During Disconnection
1. Webhook Removal
If the installation has awebhook_id, the endpoint attempts to delete the webhook from GitHub using:
2. Installation Deactivation
TheInstallation record is marked as inactive:
3. Data Retention
Preserved:- Installation record (marked
is_active = False) - Neo4j code graph (Repository, File, PullRequest, Developer nodes)
- Historical PR review data
- No new webhook events will be processed
- Repository will show as disconnected in
/api/v1/repos - User can reconnect later without data loss
Error Responses
JWT token is invalid, expired, or missing
GitHub OAuth token cannot be decrypted (SECRET_KEY changed)
No active installation found for this repository and userThis can occur if:
- The repository was never connected
- The repository is already disconnected
- The repository belongs to a different user
Webhook Removal Failure Scenarios
The endpoint handles webhook deletion gracefully:
In all cases, the installation is marked inactive, preventing future webhook events from being processed.
Permissions Required
GitHub OAuth Scopes
repo- Required to delete webhooks
Repository Access
The authenticated user must have admin permissions on the repository to remove webhooks. If permissions are lost, webhook removal will fail gracefully.Reconnection
After disconnection, you can reconnect the same repository using the Connect Repository endpoint. The previous installation record will remain inactive, and a new active installation will be created.Related Endpoints
- List Repositories - View connection status
- Connect Repository - Reconnect a disconnected repository
- Rescan Repository - Rebuild the code graph for an active connection