Skip to content

REST API

The agent-wechat server exposes a REST API on port 6174. API requests require a Bearer token in the Authorization header. The /health probe does not require authentication.

Authentication

Authorization: Bearer <token>

Endpoints

Chats

MethodPathDescription
GET/api/chatsList chats (with unread counts)
GET/api/chats/:idGet a specific chat
POST/api/chats/:id/openOpen a chat in the WeChat UI

Messages

MethodPathDescription
GET/api/messages/:chatIdList messages in a chat
POST/api/messages/sendSend a message (text, image, or file)
GET/api/messages/:chatId/media/:localIdRetrieve media; may return pending while the server requests a local copy
POST/api/messages/voiceStart a voice-note job (multipart audio; requires Idempotency-Key)
GET/api/messages/voice/:jobIdCheck voice-job status
POST/api/messages/voice/:jobId/cancelRequest voice-job cancellation

For image media, ?quality=full requires the original-resolution copy, ?quality=standard requires the mid-size copy, and ?quality=thumbnail requests the preview. ?quality=best returns the best valid local copy. When the message advertises an Original image, it requests the native full-size transfer and waits up to 20 seconds before returning the best cached fallback. Its quality response field is full, standard, or thumbnail. A regular phone send may advertise only a standard image; opening its chat can make WeChat cache that copy. The media endpoint does not open chats itself. Without the standard copy, best returns a thumbnail and strict standard has no image data yet. Omitting quality now uses best; pass quality=full to require the original-resolution copy.

Auth

MethodPathDescription
GET/api/status/authCheck login status
POST/api/status/logoutLog out of WeChat
WS/api/ws/loginWebSocket for login flow (QR code events)

Contacts

MethodPathDescription
GET/api/contactsList all contacts

Sessions

MethodPathDescription
GET/api/sessionsList sessions
POST/api/sessionsCreate a session
POST/api/sessions/:id/startStart a session
POST/api/sessions/:id/stopStop a session
DELETE/api/sessions/:idDelete a session

Debug

MethodPathDescription
GET/api/debug/screenshotTake a screenshot
GET/api/debug/a11yDump the accessibility tree

VNC

PathDescription
/vnc/Read-only browser-based VNC viewer (noVNC)