Getting Started
API v2 Overview
Introduction to the MuChat API v2 — a structured, modern REST API for chatting with AI agents and managing conversations.
What is the MuChat API v2?
The MuChat API v2 is a redesigned REST API that provides a clean, consistent interface for interacting with your AI agents. It features structured error codes, cursor-based pagination, streaming support via Server-Sent Events, and a predictable response format.
Base URL:
https://api.mu.chat/api/v2Quick Start
Get your API key
- Go to the MuChat Dashboard
- Go to Workspace settings → API keys
- Click Create API Key and copy the generated key
Get your Agent ID
- Select your AI Agent in the dashboard
- Go to the AI agent’s Settings → General
- Copy the Agent ID from the Agent details card
Send your first message
curl -X POST 'https://api.mu.chat/api/v2/agents/YOUR_AGENT_ID/chat' \
-H 'Authorization: Bearer YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"message": "Hello! How can you help me?"
}'Response:
{
"data": {
"id": "msg_abc123",
"role": "assistant",
"parts": [
{ "type": "text", "text": "Hello! I'm here to help. What can I assist you with today?" }
],
"metadata": {
"userMessageId": "msg_xyz789",
"conversationId": "a1b2c3d4-e5f6-4a7b-8c9d-0e1f2a3b4c5d",
"userId": null,
"finishReason": "stop",
"usage": { "credits": 2 }
}
}
}Endpoints
Base URL: https://api.mu.chat/api/v2
| Method | Endpoint | Notes |
|---|---|---|
GET | /api/v2/health | |
GET | /api/v2/agents | |
POST | /api/v2/agents | |
GET | /api/v2/agents/{agentId} | |
PUT | /api/v2/agents/{agentId} | |
DELETE | /api/v2/agents/{agentId} | |
PUT | /api/v2/agents/{agentId}/styles | |
PUT | /api/v2/agents/{agentId}/auto-retrain | (auto-resync schedule) |
POST | /api/v2/agents/{agentId}/clone | |
POST | /api/v2/agents/{agentId}/train | (deprecated, no-op) |
POST | /api/v2/agents/{agentId}/chat | |
POST | /api/v2/agents/{agentId}/conversations/{conversationId}/retry | |
GET | /api/v2/agents/{agentId}/conversations | |
GET | /api/v2/agents/{agentId}/conversations/export | |
GET | /api/v2/agents/{agentId}/conversations/search | |
GET | /api/v2/agents/{agentId}/conversations/{conversationId} | |
GET | /api/v2/agents/{agentId}/conversations/{conversationId}/messages | |
GET | /api/v2/agents/{agentId}/users/{userId}/conversations | |
POST | /api/v2/agents/{agentId}/conversations/{conversationId}/tool-result | |
PATCH | /api/v2/agents/{agentId}/conversations/{conversationId}/messages/{messageId}/feedback | |
GET | /api/v2/agents/{agentId}/sources/summary | |
GET | /api/v2/agents/{agentId}/sources | |
POST | /api/v2/agents/{agentId}/sources | |
GET | /api/v2/agents/{agentId}/sources/{sourceId} | |
PUT | /api/v2/agents/{agentId}/sources/{sourceId} | |
DELETE | /api/v2/agents/{agentId}/sources/{sourceId} | |
POST | /api/v2/agents/{agentId}/sources/{sourceId}/restore | (deprecated, no-op) |
File upload base URL: https://api.mu.chat/api/v2
| Method | Endpoint | Notes |
|---|---|---|
POST | /api/v2/agents/{agentId}/sources | |
PUT | /api/v2/agents/{agentId}/sources/{sourceId} |
Response Headers
Every response includes these headers:
| Header | Description |
|---|---|
x-request-id | Unique request identifier. Include this when contacting support. |
X-RateLimit-Limit | Maximum requests allowed in the current window. |
X-RateLimit-Remaining | Requests remaining in the current window. |
X-RateLimit-Reset | Unix timestamp (seconds) when the rate limit window resets. |