Skip to main content
CodeGraph exposes a REST API for all operations. The API server runs on http://localhost:5050 by default.

Base URL

http://localhost:5050/api
For production deployments, replace with your API server URL.

Authentication

Currently, CodeGraph runs locally without authentication. For production deployments, configure authentication in the API server settings.

Response Format

All responses are JSON:
{
  "data": { ... },
  "meta": {
    "timestamp": "2024-01-15T10:30:00Z"
  }
}

Error Responses

{
  "error": {
    "code": "NOT_FOUND",
    "message": "Node with ID 'xyz' not found"
  }
}
Status CodeMeaning
200Success
400Bad request (invalid parameters)
404Resource not found
500Server error

Endpoints Overview

Graph Data

MethodEndpointDescription
GET/api/graphGet all nodes and edges
GET/api/graph/nodes/{id}Get single node
POST/api/graph/layoutSave layout positions
DELETE/api/graph/layoutClear layout positions

Layout Compute

MethodEndpointDescription
POST/api/graph/layout/computeStart GPU layout
GET/api/graph/layout/compute/statusGet computation progress
POST/api/graph/layout/compute/cancelCancel computation
GET/api/graph/layout/compute/availableCheck GPU availability

Overlays

MethodEndpointDescription
GET/api/overlaysList available plugins
POST/api/overlays/{id}/applyApply overlay data
DELETE/api/overlays/{id}/applyRemove overlay data

Quick Examples

Get the entire graph

curl http://localhost:5050/api/graph

Trigger GPU layout

curl -X POST http://localhost:5050/api/graph/layout/compute \
  -H "Content-Type: application/json" \
  -d '{"iterations": 1000}'

Apply git overlay

curl -X POST http://localhost:5050/api/overlays/git-activity/apply

SDK / Client Libraries

Currently, CodeGraph provides a REST API. Client libraries for popular languages are planned. For now, you can use any HTTP client:
const response = await fetch('http://localhost:5050/api/graph');
const graph = await response.json();

Rate Limiting

No rate limiting is applied by default. For production deployments, consider adding rate limiting at the API gateway level.

What’s Next?