BETA

Streaming variant of POST /chat: same authentication, same input parameters, same processing (AI + search + conversation persistence) — the difference is that the response is delivered as a sequence of Server-Sent Events (SSE) as the model generates it, instead of a single JSON at the end.

This endpoint consumes AI tokens from the customer's account, same as /chat.

This endpoint is subject to a server-side enablement flag (chatai.streaming). If it's disabled, the endpoint responds with an error JSON (STREAMING_DISABLED) instead of opening the stream — your integration must be able to fall back to POST /chat in that case.

Resource information
AuthenticationRequired (API Token, Bearer)
Scopemapaprop-chat-ai
HTTP MethodPOST
Responsetext/event-stream (SSE). If streaming is disabled or input validation fails, application/json
Version1

Resource URL

https://mapaprop.app/api/action/mapaprop-chat-ai-v1/chat/stream

Parameters

Identical to those of POST /chat: message (required), questionId, leadName, leadEmail, leadPhone, sessionId, mode, propertyIds, useVectorSearch, searchCriteria, propertyActive, searchContext, customerSearch, sourceUrl. See that page for the full detail of each one.

Sample code

POST /api/action/mapaprop-chat-ai-v1/chat/stream HTTP/1.1
Host: mapaprop.app
Content-Type: application/json
Authorization: Bearer {access_token}
Accept: text/event-stream

{
    "message": "¿Tenés departamentos de 2 ambientes en Palermo?",
    "questionId": 481203
}

Response

The response is a stream of SSE events. Each event is a data: {json}\n\n line. The type field of each event indicates how to interpret it:

typeWhen it appearsPayload fields
text-deltaFree chat turn (no active search context). One or several per turn, as the model generates text.text (string): the text fragment to concatenate.
bridgeFree chat turn: the model decided to offer searching properties or handing off to human contact, instead of continuing the conversation.bridgeType (string): switch_to_property_search or offer_human_contact. message (string): suggested text to display.
search-resultSearch/property/no-results turn (when you sent propertyIds, useVectorSearch or propertyActive). Emitted once, right before the done event.payload (object): the full response, with the SAME shape as the POST /chat JSON (response, action, success, propertyIds, buttons, allPropertyIds, hasMoreResults, focusedPropertyId, focusedPropertyCode, searchCriteria, tokensUsed, error). This payload is the authoritative version: if you displayed text incrementally with the text-delta events, replace it with payload.response when you receive this event.
doneAlways the last event of the stream.questionId (int): the conversation ID (can be -1 if saving failed). inputTokens (int), outputTokens (int).
errorStream-level error. Do not retry automatically.errorCode (string), message (string).

Unlike POST /chat, here the done event does include questionId. It's the simplest way to get the conversation ID if you're using streaming mode.

A free chat turn is: zero or more text-delta, optionally a bridge, and always ends in done. A search/property/no-results turn is: a single search-result followed by done (does not emit text-delta or bridge).

Validation gate before the stream

If the message field is missing, or if streaming is disabled on the server side, the endpoint responds with a regular JSON (not SSE) before opening the stream — your HTTP client can treat it as a common error response.

ErrorCause
STREAMING_DISABLEDStreaming mode is not enabled in this environment. Fall back to POST /chat.
REQUIRED_INPUT — "message is required"The message field is missing from the body.

Sample response

Free chat turn:

data: {"type":"text-delta","text":"Hola! "}

data: {"type":"text-delta","text":"En qué puedo ayudarte hoy?"}

data: {"type":"done","questionId":481203,"inputTokens":410,"outputTokens":38}

Search turn:

data: {"type":"search-result","payload":{"response":"Encontré 3 departamentos de 2 ambientes en Palermo.","action":"show_properties","success":true,"propertyIds":[2601234,2601987,2602111],"hasMoreResults":false,"tokensUsed":{"input":812,"output":143,"total":955}}}

data: {"type":"done","questionId":481203,"inputTokens":812,"outputTokens":143}

Response when streaming is disabled (JSON, not SSE):

{
    "error": "STREAMING_DISABLED",
    "message": "El modo streaming no está habilitado en este entorno."
}