Skip to main content

Overview

The High IQ API uses Server-Sent Events (SSE) for real-time streaming of AI-generated notebook sections. Notebooks are generated section-by-section, with each section streamed as a series of events: start, partial, complete, or error. This allows the client to render content progressively as it is generated. The streaming service is built on Hono SSE with AI SDK 7 streamText() and Output.object() for structured output with partial updates.

Endpoints

Single Section Streaming

Stream a single notebook section by its key. Returns an SSE stream with progressive updates.

Request

Request Body Schema

SSE Event Stream

The server sends events in the standard SSE format. Each event has a type, sectionKey, and optional data:

Batch Section Streaming

Stream multiple sections in sequence. Each section is generated one after another, with overall progress tracking. Previously generated sections are passed as context to dependent sections.

Request

Batch Request Schema

Batch Event Stream

Batch streaming adds batch_start and batch_complete events, plus overall progress tracking on each section event:

Event Types

Batch-Enriched Fields

In batch mode, every section event includes additional fields for overall progress:

StreamEvent Interface

Available Sections

Fetch the list of available section keys and their metadata:
Sections with strategy: "computed" are handled client-side and cannot be streamed. The API returns a message indicating the section should be computed locally.

Client Integration

JavaScript / TypeScript (EventSource)

React Native (High IQ Mobile)

The mobile app uses custom hooks for SSE consumption:

Error Handling

If a section fails during streaming, an error event is sent for that section and the batch continues to the next section. The batch_complete event includes the count of successfully completed sections.
If the streaming service itself is unavailable, the API returns a 503 response before streaming begins:

Health Check

Verify the streaming service is available before initiating a stream:
Check available: true before starting a notebook generation flow. If false, AI models may not be configured or the service is temporarily unavailable.