Overview
There are two ways to access CodeAlive programmatically:| Method | Best for | How it works |
|---|---|---|
| MCP (recommended) | AI agent integrations | Your agent connects to CodeAlive as an MCP server and uses tools like codebase_search automatically |
| REST API | Custom integrations, scripts, CI/CD | Direct HTTP requests to CodeAlive endpoints |
Authentication
All API requests require a Bearer token in theAuthorization header:
You can create an API key after adding at least one repository to your organization. You do not need to wait for indexing to finish to create the key, but search and chat calls become useful only after indexing completes.
Base URLs
| Endpoint | URL | Use case |
|---|---|---|
| REST API | https://app.codealive.ai/api | Direct API calls, scripts, CI/CD |
| MCP (Remote) | https://mcp.codealive.ai/api/ | AI agent integrations |
| MCP (Local Docker) | http://localhost:8000/api | Self-hosted, lower latency |
Quick Start Examples
1. List your data sources
Check which repositories are indexed and available:2. Semantic search
Search across your codebase by meaning, not just keywords:3. Chat with your codebase
Ask questions and get answers with full codebase context:Error Handling
The API uses standard HTTP status codes:| Status | Meaning | Common cause |
|---|---|---|
200 | Success | Request completed |
400 | Bad Request | Invalid parameters, missing required fields |
401 | Unauthorized | Missing or invalid API key |
403 | Forbidden | Valid key but insufficient permissions |
404 | Not Found | Endpoint or resource doesn’t exist |
429 | Rate Limited | Too many requests — back off and retry |
500 | Server Error | Internal issue — retry or contact support |
Handling rate limits
When you receive a429 response, use exponential backoff:
Best Practices
Search before chat
codebase_search is fast and cheap. Use it to find relevant code first, then use codebase_consultant for synthesis and analysis.Scope your queries
Pass specific
datasource_ids to limit searches to relevant repositories. Avoid searching everything when you know which repo you need.Use conversation IDs
For multi-turn chats, pass the
conversation_id from previous responses. This maintains context and produces better follow-up answers.Cache data source lists
The list of data sources changes rarely. Cache the result of
/datasources/all instead of calling it before every search.Next Steps
API Reference
Full endpoint documentation
MCP Integration
Set up CodeAlive with your AI agent