Rescan Repository
Repositories
Rescan Repository
Rebuild the Neo4j code knowledge graph for a connected repository
POST
Rescan Repository
Overview
Rescans a connected repository to rebuild its Neo4j code graph. This operation fetches the latest file tree from GitHub and updates the graph database with current repository structure. Unlike the initial connection scan (which runs in the background), rescan runs synchronously and returns the file count immediately.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
"scan_complete" on successstring
Full repository name in
owner/repo formatinteger
Number of files successfully indexed in the Neo4j graph
Example Response
Graph Rebuild Process
1. Fetch Repository Tree
Retrieves the complete file tree from GitHub using the recursive Git tree API:2. Filter Files
Excludes binary and generated directories:node_modules.gitdistbuild__pycache__.nextvendor
3. Update Neo4j Graph
Upsert Repository Node:4. Language Detection
File language is inferred from extension:Error Responses
JWT token is invalid, expired, or missing
GitHub OAuth token cannot be decrypted (SECRET_KEY changed)
Repository is not connected
Rescan operation failedOr:Or:
Neo4j is not configured on the server
When to Rescan
Consider rescanning when:- Major refactoring changed file structure
- Large number of files added/renamed/deleted
- PR reviews seem to lack context on new files
- Initial scan was truncated (large monorepo)
- Repository was migrated or restructured
Performance Considerations
Large Repositories
For repositories with >500 MB or >100k files:- GitHub may truncate the tree API response (logged as warning)
- Scan continues with partial file set
- Consider using a sparse checkout or monorepo tool
Request Timeout
Rescan is synchronous and may take 10-60 seconds for large repos. Ensure your HTTP client has an appropriate timeout:Graph Consistency
Preserved Data
Rescan does not affect:PullRequestnodesDevelopernodesIssuenodes- Historical
TOUCHES,AUTHORED_BY,CLOSESedges
Updated Data
Filenodes (added/updated/removed)Repository.scanned_attimestampCONTAINSedges
Related Endpoints
- Connect Repository - Initial connection triggers background scan
- List Repositories - View connected repositories
- Disconnect Repository - Disconnect without deleting graph data