Documentation

Everything you need to integrate and use TeamLead AI.

Getting Started

1. Create your account

Sign up at teamlead.ai/signup and choose between Solo Builder or Team Leader mode. Solo mode gives you a personal AI manager; Team mode adds the leadership dashboard.

2. Connect GitHub

Link your repositories so the AI agent can read your codebase, track commits, monitor PRs, and detect conflicts. Go to Settings and click "Connect" on the GitHub card.

3. Set up your team

Navigate to Team and invite members by email. Assign roles (admin, lead, member), skills, and timezones. The AI uses this context for intelligent task assignment.

4. Create your first goal

Go to Goals and create a high-level objective. The AI can automatically decompose it into sub-goals and assign them to team members based on their skills.

API Reference

All endpoints require a Bearer token in the Authorization header (Supabase JWT).

GET /api/organizations List user organizations
POST /api/organizations Create a new organization
PUT /api/organizations/:orgId Update organization settings
DELETE /api/organizations/:orgId Delete an organization
GET /api/dashboard/:orgId Get dashboard data
GET /api/goals/:orgId List goals for organization
POST /api/goals/:orgId Create a new goal
PUT /api/goals/:goalId Update a goal
DELETE /api/goals/:goalId Delete a goal
POST /api/goals/:goalId/decompose AI-decompose a goal into sub-goals
GET /api/members/:orgId List team members
POST /api/members/:orgId Add a team member
PUT /api/members/:memberId Update member details
DELETE /api/members/:memberId Remove a member
GET /api/activities/:orgId List activities with filters
GET /api/health/:orgId Get team health score and history
GET /api/conflicts/:orgId List active conflicts
POST /api/chat Send a message to the AI agent (streaming)
GET /api/chat/history Get chat history for an org
GET /api/integrations/:orgId List integrations
POST /api/integrations/:orgId/connect Get OAuth URL for a provider
GET /api/notifications/:orgId List notifications
GET /api/reports/:orgId Get weekly reports
POST /api/contact Submit a contact form message

Integration Guides

GitHub Webhooks

TeamLead AI listens for push, pull_request, pull_request_review, and issues events. Configure your webhook URL as:

POST https://api.teamlead.ai/webhooks/github

Set the webhook secret in your GitHub App settings and configure GITHUB_WEBHOOK_SECRET in your environment.

Slack Bot

The Slack integration provides /teamlead commands (status, blockers, next) and monitors team channels for activity. Configure:

Events URL: https://api.teamlead.ai/webhooks/slack/events Commands URL: https://api.teamlead.ai/webhooks/slack/commands

Discord

Chat-based team communication. The agent sends task assignments, briefs, and alerts via Discord DMs. Set up your bot:

DISCORD_BOT_TOKEN=your_bot_token

Telegram

Direct messaging for task updates and daily briefs. Create a bot via @BotFather and configure:

TELEGRAM_BOT_TOKEN=your_bot_token

Setting up GitHub Integration

To create a GitHub App for TeamLead AI:

  1. Go to GitHub Settings > Developer Settings > GitHub Apps > New GitHub App
  2. Set the app name to "TeamLead AI" (or your preferred name)
  3. Set the Homepage URL to your TeamLead AI instance URL
  4. Set the Webhook URL to https://api.teamlead.ai/webhooks/github
  5. Generate a webhook secret and save it as GITHUB_WEBHOOK_SECRET
  6. Under Permissions, grant: Repository contents (read), Pull requests (read/write), Issues (read), Metadata (read)
  7. Subscribe to events: Push, Pull request, Pull request review, Issues
  8. Create the app and install it on your organization's repositories
  9. Save the App ID and generate a private key for API authentication

Chat API Examples

Send a message (streaming response)

const response = await fetch('https://api.teamlead.ai/api/chat', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'Authorization': 'Bearer YOUR_TOKEN',
  },
  body: JSON.stringify({
    message: 'What should I work on today?',
    org_id: 'your-org-id',
  }),
});

const reader = response.body.getReader();
const decoder = new TextDecoder();

while (true) {
  const { done, value } = await reader.read();
  if (done) break;
  const chunk = decoder.decode(value);
  // Parse SSE data lines
}
            

Fetch chat history

const response = await fetch(
  'https://api.teamlead.ai/api/chat/history?org_id=your-org-id',
  { headers: { 'Authorization': 'Bearer YOUR_TOKEN' } }
);
const { messages } = await response.json();