Skip to main content
GET
https://macaly.com/
/
api
/
chat
/
{chatId}
/
subscribe
Subscribe to Stream
curl --request GET \
  --url https://macaly.com/api/chat/{chatId}/subscribe \
  --header 'Authorization: Bearer <token>'
Subscribe to an active chat stream to receive real-time AI responses. This is an alternative to polling the status endpoint.

Request

GET /api/chat/{chatId}/subscribe

Headers

HeaderRequiredDescription
AuthorizationYesBearer macaly_...

Path Parameters

ParameterTypeDescription
chatIdstringThe chat ID returned from POST /api/chat

Example Request

curl -N https://www.macaly.com/api/chat/abc123/subscribe \
  -H "Authorization: Bearer macaly_abc123..."

Response

Returns a Server-Sent Events (SSE) stream with workflow progress and AI responses.

Stream Format

The stream uses the Vercel AI SDK v4 data stream protocol. Each chunk is prefixed with a type indicator:
PrefixDescription
0:Text content
2:Data objects (like { chatId })
8:Annotations and metadata

Example Stream

2:[{"chatId":"abc123"}]
0:"I'll create a landing page for you."
0:" Let me start by setting up the project structure."
8:{"type":"tool-call","toolName":"WriteFile",...}
0:" Done! Your landing page is ready."

Status Codes

StatusDescription
200Success (streaming response)
204No active stream (workflow completed or not started)
401Invalid or missing API key
403Chat does not belong to your team
404Chat not found
429Rate limited

Notes

  • The stream will end when the workflow completes
  • If you call this endpoint after the workflow has finished, you’ll get a 204 No Content response
  • For simpler implementations, consider using the status endpoint with polling instead