# API Endpoints

Complete reference for all TeamDay API endpoints including agents, tasks, executions, and spaces

# API Endpoints

Complete reference for all TeamDay API endpoints. All endpoints require authentication via Personal Access Token.

## Base URL

```
https://cc.teamday.ai/api/v1
```

## Authentication

All requests must include your Personal Access Token in the `Authorization` header:

```http
Authorization: Bearer td_your-token-here
```

---

## Agents

Manage AI agents in your organization.

### List Agents

Get all agents accessible to your account.

```http
GET /api/v1/agents
```

**Response:**
```json
{
  "success": true,
  "agents": [
    {
      "id": "abc123def456",
      "name": "Code Reviewer",
      "role": "Senior Developer",
      "systemPrompt": "You review code for quality...",
      "visibility": "organization",
      "model": "claude-sonnet-4-6",
      "createdAt": "2024-12-09T10:00:00Z"
    }
  ],
  "total": 1
}
```

### Create Agent

Create a new AI agent.

```http
POST /api/v1/agents
```

**Request Body:**
```json
{
  "name": "Research Assistant",
  "role": "Researcher",
  "systemPrompt": "You are a helpful research assistant.",
  "visibility": "organization",
  "model": "claude-sonnet-4-6"
}
```

### Execute Agent

Run an agent to process a message.

```http
POST /api/v1/agents/{agentId}/execute
```

**Request Body:**
```json
{
  "message": "Analyze this repository",
  "spaceId": "space_abc123",
  "stream": false
}
```

---

## Tasks

Create and manage coordinated work across agents.

### List Tasks

```http
GET /api/v1/tasks
```

### Create Task

```http
POST /api/v1/tasks
```

**Request Body:**
```json
{
  "title": "Deploy to production",
  "priority": "high",
  "assignTo": "abc123def456"
}
```

---

## Executions

Track agent execution history.

### List Executions

```http
GET /api/v1/executions?agentId={agentId}
```

### Get Execution Details

```http
GET /api/v1/executions/{executionId}
```

### Get Execution Tree

```http
GET /api/v1/executions/{executionId}/tree
```

### Cancel Execution

```http
POST /api/v1/executions/{executionId}/cancel
```

---

## Spaces

Manage workspace environments.

### List Spaces

```http
GET /api/v1/spaces
```

### Get Space

```http
GET /api/v1/spaces/{id}
```

### Create Space

```http
POST /api/v1/spaces
```

### Update Space

```http
PATCH /api/v1/spaces/{id}
```

### Delete Space

```http
DELETE /api/v1/spaces/{id}
```

---

## Additional Endpoint Groups

The v1 API also includes endpoints for the following resources. See individual documentation pages for details.

- **Missions** - Create and manage long-running autonomous tasks
- **MCPs** - Manage MCP server instances
- **Skills** - Manage reusable prompt packages
- **Keys** - Manage Personal Access Tokens
- **Media** - Upload and manage media assets
- **Profile** - User profile management

---

## Error Responses

```json
{
  "error": true,
  "statusCode": 400,
  "message": "Validation error"
}
```

For complete endpoint details, examples, and parameters, see our [interactive API documentation](https://docs.teamday.ai/api/examples).
