Streaming support

UnifAPI streaming support for agent workflows

Unif API supports streaming where agents need progress feedback: Streamable HTTP MCP for live tool sessions and Server-Sent Events on the public ask endpoint. Direct REST API calls keep the predictable one-response JSON envelope.

MCP Streamable HTTP

Use the hosted UnifAPI MCP server when an agent needs progress-aware tool discovery and tool calls. Connector URL: https://mcp.unifapi.com.

Open surface

NLWeb ask SSE

Use Server-Sent Events on /ask for lightweight discovery answers that emit start, result, and complete events.

Open surface

Direct REST JSON

Use direct HTTP API routes for product code that wants one normalized JSON envelope per public-data call.

Open surface
SSE quick start

Stream discovery answers from /ask

Send Accept: text/event-stream or set prefer.streaming to receive progressive events. This endpoint is for UnifAPI discovery answers; use https://mcp.unifapi.com when an agent needs live public-data tool calls.

curl -N https://unifapi.com/ask \
  -H "Content-Type: application/json" \
  -H "Accept: text/event-stream" \
  -d '{"query":{"text":"Where is the UnifAPI OpenAPI spec?"},"prefer":{"streaming":true}}'
Event contract

Events agents should expect

start

Confirms the stream has opened and includes UnifAPI NLWeb-style metadata.

result

Carries one answer result with title, URL, snippet, and source metadata.

complete

Marks the end of the stream so an agent can stop waiting and summarize.

Direct REST behavior

Direct REST API operations at https://api.unifapi.com currently return one normalized JSON envelope per call. For long-running REST workflows, agents should use pagination, request ids, retries, and documented errors. Use MCP when the task benefits from an agent-held session and progressive tool work.