This guide explains how to use the exposed API endpoints in the Pulse Server. The server provides REST endpoints for repository analysis, issue summarization, and AI-powered insights powered by OpenRouter.
http://localhost:3000
Currently, authentication is handled via GitHub token in the backend environment (.env.local). No client-side authentication is required for API calls.
Check if the server is running and healthy.
Endpoint: GET /health
Response:
{
"status": "ok",
"timestamp": "2025-11-06T12:34:56.789Z"
}Example:
curl http://localhost:3000/healthGet server information and welcome message.
Endpoint: GET /
Response:
{
"message": "Welcome to Pulse Server",
"version": "1.0.0",
"endpoints": {
"health": "/health",
"api": "/api",
"enrichment": "/api/enrichment"
}
}Get list of all available API routes.
Endpoint: GET /api
Response:
{
"message": "Pulse Server API",
"availableRoutes": [
"/ai/llm - AI Chat endpoint",
"/ai/models - Get available AI models",
"/enrichment - Repository enrichment (analyze, summarize issues)",
"/github - GitHub data endpoints"
]
}Analyze repositories or summarize issues using AI. This is the main endpoint for the frontend.
Endpoint: POST /api/enrichment
Required Parameters:
| Field | Type | Description |
|---|---|---|
owner |
string | GitHub repository owner username |
name |
string | GitHub repository name |
scope |
string | Scope of analysis (currently only "repo" supported) |
task |
string | Task to perform: "analyze" or "summarize-issues" |
question |
string | (Optional) Custom question for analyze task. If not provided, uses default analysis |
Fetch GitHub repository data and provide AI analysis with insights.
Request Example:
curl -X POST http://localhost:3000/api/enrichment \
-H "Content-Type: application/json" \
-d '{
"owner": "octocat",
"name": "Hello-World",
"scope": "repo",
"task": "analyze",
"question": "What is the code quality of this repository?"
}'Response:
{
"success": true,
"data": {
"repository": {
"name": "Hello-World",
"owner": "octocat",
"url": "https://github.com/octocat/Hello-World",
"stars": 2023,
"language": "Python"
},
"analysis": "Based on the repository data...",
"metadata": {
"totalIssues": 42,
"lastUpdated": "2025-11-06T10:00:00Z"
}
}
}What Happens:
- Fetches repository details from GitHub (stars, forks, language, description, etc.)
- Fetches recent issues for context
- Sends combined data to OpenRouter AI for analysis
- Returns AI-generated insights
Fetch and summarize repository issues with AI analysis.
Request Example:
curl -X POST http://localhost:3000/api/enrichment \
-H "Content-Type: application/json" \
-d '{
"owner": "octocat",
"name": "Hello-World",
"scope": "repo",
"task": "summarize-issues"
}'Response:
{
"success": true,
"data": {
"repository": "octocat/Hello-World",
"totalIssues": 156,
"analyzedIssues": 10,
"summary": "The repository has various issues across categories...",
"issues": [
{
"number": 123,
"title": "Bug: Login fails on Safari",
"state": "OPEN",
"author": "developer1",
"labels": ["bug", "priority-high"]
},
...
]
}
}What Happens:
- Fetches up to 10 most recent issues from the repository
- Sends issues to OpenRouter AI for analysis
- AI identifies themes, patterns, and priority areas
- Returns summary with individual issue details
Direct access to AI chat completions.
Endpoint: POST /api/ai/llm
Parameters:
| Field | Type | Description |
|---|---|---|
message |
string | Your message to the AI |
model |
string | (Optional) AI model to use. Defaults to deepseek/deepseek-chat-v3.1:free |
Request Example:
curl -X POST http://localhost:3000/api/ai/llm \
-H "Content-Type: application/json" \
-d '{
"message": "Explain what DevOps is in simple terms"
}'Response:
{
"success": true,
"data": {
"role": "assistant",
"content": "DevOps is a set of practices that combines software development..."
},
"usage": {
"prompt_tokens": 25,
"completion_tokens": 150,
"total_tokens": 175
}
}Get list of available AI models from OpenRouter.
Endpoint: GET /api/ai/models
Response:
{
"success": true,
"data": {
"data": [
{
"id": "anthropic/claude-3-haiku",
"name": "Claude 3 Haiku",
"pricing": {...}
},
{
"id": "deepseek/deepseek-chat-v3.1:free",
"name": "DeepSeek Chat v3.1 (Free)",
"pricing": {...}
},
...
]
}
}Access raw GitHub data without AI enrichment.
Endpoint: POST /api/github/repository
Get repository details.
Request:
curl -X POST http://localhost:3000/api/github/repository \
-H "Content-Type: application/json" \
-d '{
"owner": "octocat",
"name": "Hello-World"
}'Response:
{
"success": true,
"data": {
"id": "MDEwOlJlcG9zaXRvcnkxMjk2MjY5",
"name": "Hello-World",
"description": "Example repository",
"url": "https://github.com/octocat/Hello-World",
"stargazerCount": 2023,
"forkCount": 523,
"createdAt": "2011-01-26T19:01:12Z",
"updatedAt": "2025-11-06T10:00:00Z",
"primaryLanguage": {
"name": "Python",
"color": "#3572A5"
}
}
}// Analyze a repository
async function analyzeRepository(owner, name, question) {
const response = await fetch("http://localhost:3000/api/enrichment", {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({
owner,
name,
scope: "repo",
task: "analyze",
question,
}),
});
const data = await response.json();
return data;
}
// Usage
const result = await analyzeRepository(
"octocat",
"Hello-World",
"What is the overall health of this repository?"
);
console.log(result.data.analysis);// Summarize issues
async function summarizeIssues(owner, name) {
const response = await fetch("http://localhost:3000/api/enrichment", {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({
owner,
name,
scope: "repo",
task: "summarize-issues",
}),
});
const data = await response.json();
return data;
}
// Usage
const result = await summarizeIssues("octocat", "Hello-World");
console.log(result.data.summary);# Analyze repository
$body = @{
owner = "octocat"
name = "Hello-World"
scope = "repo"
task = "analyze"
question = "What programming language is this repository built with?"
} | ConvertTo-Json
$response = Invoke-WebRequest -Uri "http://localhost:3000/api/enrichment" `
-Method POST `
-Headers @{'Content-Type'='application/json'} `
-Body $body
$response.Content | ConvertFrom-Jsonimport requests
def analyze_repository(owner, name, question=None):
payload = {
"owner": owner,
"name": name,
"scope": "repo",
"task": "analyze",
"question": question
}
response = requests.post(
'http://localhost:3000/api/enrichment',
json=payload,
headers={'Content-Type': 'application/json'}
)
return response.json()
# Usage
result = analyze_repository('octocat', 'Hello-World', 'Is this a well-maintained repository?')
print(result['data']['analysis'])All endpoints return error responses in this format:
{
"success": false,
"error": "Description of the error"
}| Status | Error | Cause |
|---|---|---|
| 400 | Missing required fields | owner, name, scope, or task not provided |
| 400 | Unknown task | task value not recognized |
| 400 | Repository not found | GitHub repository doesn't exist |
| 401 | GitHub token not configured | GITHUB_API_TOKEN env var missing |
| 500 | AI analysis failed | OpenRouter API error |
| 500 | Internal server error | Server-side error |
All API requests are logged with timestamps and request details. Enable debug logging by setting LOG_LEVEL=debug in .env.local:
LOG_LEVEL=debug
Check the server console for:
- ✅
[INFO]- Successful operations ⚠️ [WARN]- Warnings (e.g., issue fetch failed but continuing)- ❌
[ERROR]- Errors with details - 🔧
[DEBUG]- Detailed debugging info (dev mode only)
Ensure these are set in .env.local:
# Server
PORT=3000
NODE_ENV=development
# GitHub
GITHUB_API_TOKEN=your_github_token_here
GITHUB_GRAPHQL_API_BASE_URL=https://api.github.com/graphql
# OpenRouter AI
OPENROUTER_API_KEY=your_openrouter_key_here
OPENROUTER_BASE_URL=https://openrouter.ai/api/v1
DEFAULT_AI_MODEL=deepseek/deepseek-chat-v3.1:free
- GitHub API: ~5000 requests/hour (handled by GitHub token)
- OpenRouter AI: Depends on your plan
- Server rate limiting: 100 requests per 15 minutes per IP
✅ DO:
- Always provide
owner,name,scope, andtask - Use specific questions for better analyze results
- Cache results to reduce API calls
- Check
successfield before accessingdata
❌ DON'T:
- Make requests without proper error handling
- Ignore the
errorfield in responses - Send the same request multiple times immediately
- Store sensitive data in response logs
For issues or questions about the API:
- Check the server logs for detailed error messages
- Verify GitHub and OpenRouter credentials in
.env.local - Test endpoints with curl or Postman first
- Review this guide for correct payload structure
| Version | Date | Changes |
|---|---|---|
| 1.0.0 | 2025-11-06 | Initial release with unified enrichment endpoint |