---
title: API Reference
---

CTM serves all APIs on port 3456. Wall-E APIs are proxied through CTM at `/api/wall-e/*`.

## Service Management

| Method | Path | Description |
|---|---|---|
| GET | `/api/services/status` | Returns running status and PIDs of CTM and Wall-E |
| POST | `/api/restart/ctm` | Restart the CTM server |
| POST | `/api/restart/walle` | Restart the Wall-E daemon |
| POST | `/api/start/walle` | Start the Wall-E daemon |
| POST | `/api/stop/walle` | Stop the Wall-E daemon |

### Example

```bash
curl -s http://localhost:3456/api/services/status
# {"ctm":{"running":true,"pid":1234,"uptime":3600},"walle":{"running":true,"pid":5678}}
```

---

## Wall-E Brain

### GET /api/wall-e/status

Returns brain stats, owner info, and memory counts.

### GET /api/wall-e/memories

List memories with optional filters.

**Query params:**
- `source` — filter by source (`slack`, `calendar`, `email`, `ctm`)
- `since` — ISO 8601 timestamp, return memories after this time
- `limit` — max results (default: 50)
- `offset` — pagination offset

### GET /api/wall-e/knowledge

List knowledge entries.

**Query params:**
- `category` — filter by category; omit or use `all` for every category
- `subject` — exact subject filter
- `q` / `search` — server-side search across subject, predicate, and object
- `status` — filter by status; defaults to `active`; use `all` to include `superseded`, `disputed`, and `retracted`
- `sort` — `recent` (default), `confidence`, `subject`, or `oldest`
- `include_evidence` — `1` to include source memory snippets from `source_memory_ids`
- `limit`, `offset` — pagination; limit is capped at 500

### PUT /api/wall-e/knowledge/:id

Update a knowledge entry.

**Body:**
```json
{ "status": "disputed" }
```

Use `{ "action": "confirm" }` to restore the fact to `active`, refresh `last_confirmed`, and increment `times_confirmed`.

### GET /api/wall-e/people

List known people with relationship and trust info.

### GET /api/wall-e/timeline

Memory timeline ordered by timestamp DESC.

**Query params:**
- `limit` (default: 50)
- `offset`

### GET /api/wall-e/questions

List pending questions.

**Query params:**
- `status` — `pending`, `answered`, `inferred`
- `limit`

### GET /api/wall-e/brief

Get the latest daily briefing summary.

### POST /api/wall-e/chat

Send a message to Wall-E and get a response.

**Body:**
```json
{
  "message": "What meetings do I have tomorrow?",
  "channel": "ctm"
}
```

**Response:**
```json
{
  "reply": "You have 3 meetings tomorrow...",
  "tool_calls": []
}
```

### GET /api/wall-e/stats

Brain statistics — memory counts by source, knowledge counts, people count.

---

## Sessions

### GET /api/sessions

List active terminal sessions.

### WebSocket: ws://localhost:2001

Real-time terminal I/O for sessions. Messages:

- `{"type":"create","id":"uuid","cmd":"claude","label":"My Session"}` — create session
- `{"type":"input","id":"uuid","data":"text"}` — send input
- `{"type":"resize","id":"uuid","cols":80,"rows":24}` — resize terminal
- `{"type":"kill","id":"uuid"}` — kill session

---

## Prompts

### GET /api/prompts

List all prompts. Supports query params: `folder`, `starred`, `tag`, `search`.

### GET /api/prompts/:id

Get a single prompt with content, tags, and metadata.

### POST /api/prompts

Create a new prompt.

**Body:**
```json
{
  "title": "My Prompt",
  "content": "Prompt content here",
  "content_html": "<p>Prompt content here</p>",
  "tags": "[\"tag1\",\"tag2\"]",
  "context_type": "general"
}
```

### PUT /api/prompts/:id

Update a prompt.

### DELETE /api/prompts/:id

Delete a prompt.

### GET /api/prompts/:id/children

Get child prompts of a group/composite prompt.

### POST /api/prompts/:id/versions

Create a version snapshot of a prompt.

---

## Tasks

### GET /api/tasks

List tasks. Supports query params: `status`, `type`, `skill`.

### POST /api/tasks

Create a task.

**Body:**
```json
{
  "title": "Sync Calendar",
  "type": "recurring",
  "schedule": "every 30m",
  "skill": "google-calendar",
  "skill_config": "{\"days_back\":1,\"days_ahead\":14}"
}
```

### PUT /api/tasks/:id

Update a task (status, schedule, config).

### DELETE /api/tasks/:id

Delete a task.
