AstrBot HTTP API
Starting from v4.18.0, AstrBot provides API Key based HTTP APIs for programmatic access.
Quick Start
- Create an API key in WebUI - Settings.
- Include the API key in request headers:
http
Authorization: Bearer abk_xxxAlso supported:
http
X-API-Key: abk_xxx- For chat endpoints,
usernameis required:
POST /api/v1/chat: request body must includeusernameGET /api/v1/chat/sessions: query params must includeusername
Common Endpoints
POST /api/v1/chat: send chat message (SSE stream, server generates UUID whensession_idis omitted)GET /api/v1/chat/sessions: list sessions for a specificusernamewith paginationGET /api/v1/configs: list available config filesPOST /api/v1/file: upload attachmentPOST /api/v1/im/message: proactive message via UMOGET /api/v1/im/bots: list bot/platform IDs
Example
bash
curl -N 'http://localhost:6185/api/v1/chat' \
-H 'Authorization: Bearer abk_xxx' \
-H 'Content-Type: application/json' \
-d '{"message":"Hello","username":"alice"}'Full API Reference
Use the interactive docs:
