Skip to main content
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 the Authorization header.

Path Parameters

string
required
Repository owner (user or organization)
string
required
Repository name

Request

Response

string
Always returns "disconnected" on success
string
Full repository name in owner/repo format

Example Response

What Happens During Disconnection

1. Webhook Removal

If the installation has a webhook_id, the endpoint attempts to delete the webhook from GitHub using:
Graceful Degradation: If webhook removal fails (e.g., webhook already deleted manually on GitHub, or user lost admin access), a warning is logged but the disconnection proceeds.

2. Installation Deactivation

The Installation record is marked as inactive:
The record is not deleted from the database, preserving historical data.

3. Data Retention

Preserved:
  • Installation record (marked is_active = False)
  • Neo4j code graph (Repository, File, PullRequest, Developer nodes)
  • Historical PR review data
Effect:
  • 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 user
This 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.