Skip to main content
POST
https://macaly.com/
/
api
/
chat
/
{chatId}
/
publish
Publish Message
curl --request POST \
  --url https://macaly.com/api/chat/{chatId}/publish \
  --header 'Authorization: Bearer <token>'
Sends a new message to an existing chat, continuing the conversation.

Request

POST /api/chat/{chatId}/publish

Headers

HeaderRequiredDescription
AuthorizationYesBearer macaly_...
Content-TypeYesapplication/json

Path Parameters

ParameterTypeDescription
chatIdstringThe chat ID

Body Parameters

FieldTypeRequiredDefaultDescription
contentstringYes-The user’s message
streambooleanNotrueIf false, returns JSON instead of stream
agentModestringNo-"auto", "fast", or "smart"
executionModestringNo-"auto", "planning", or "build"

Example Request

curl -X POST "https://www.macaly.com/api/chat/abc123def456/publish" \
  -H "Authorization: Bearer macaly_abc123..." \
  -H "Content-Type: application/json" \
  -d '{
    "content": "Add a dark mode toggle to the header",
    "stream": false
  }'

Response

JSON Response (when stream: false)

{
  "chatId": "abc123def456",
  "streamId": "stream_xyz789",
  "assistantMessageId": "msg_123"
}
You can then poll the status endpoint to wait for completion.

Streaming Response (when stream: true, default)

2:[{"chatId":"abc123def456"}]
0:"Analyzing your request..."
...

Status Codes

StatusDescription
200Success - Message sent
400Invalid request body
401Invalid or missing API key
402Insufficient credits
403Chat does not belong to this team
404Chat not found
429Rate limited
500Server error

Workflow

For non-streaming usage, the typical workflow is:
  1. Send message with stream: false
  2. Poll status using GET /api/chat/{chatId}/status until completed
  3. Repeat for additional messages