Skip to main content

Overview

The HTTP API allows you to communicate with your deployed Lua AI agents directly via HTTP requests. This is useful for building custom integrations, mobile apps, backend services, or any application that needs to interact with your agent programmatically.

Stream Endpoint

Real-time streaming responses via SSE

Generate Endpoint

Single response generation

Base URL

Authentication

All requests require authentication via Bearer token in the Authorization header. You can use your API key as the token:
You can find your API key in the Admin Dashboard under the API Keys section.

Endpoints

Stream Chat Response

Stream a chat response using Server-Sent Events (SSE).

Generate Chat Response

Generate a complete chat response (non-streaming).
PostProcessors: Only the /generate endpoint supports PostProcessors. Streaming responses (/stream) bypass post-processing because text is sent incrementally before the full response is available.

Path Parameters

Query Parameters


Request Body

The request body follows the AI SDK 5 UserContent format for messages.

Required Fields

Optional Fields

These options are for advanced use cases and typically not needed for standard integrations:

Message Content Types

Messages follow the AI SDK 5 UserContent format:

Text Message

Image Message

File Message


Examples

Basic Text Request

Streaming Request

With Image Attachment

With System Prompt Override

Use systemPrompt to temporarily override the agent’s persona for a specific request:

With Runtime Context

Use runtimeContext to inject additional context into the agent’s prompt:

With Timezone

Use clientContext.timezone to tell the agent the user’s local IANA timezone for date/time-aware responses. When omitted, the agent falls back to the user’s stored profile, country, or UTC:

With Reasoning Options

Use options.reasoning to control how much the model reasons for this specific request. It works on both /chat/generate and /chat/stream, and overrides the agent’s modelSettings.reasoning default — the request always wins, field by field (setting only effort doesn’t clear an agent-level show: false):
Leaving options.reasoning unset falls back to the agent’s modelSettings.reasoning, then to the platform default — adaptive reasoning where the model supports it, low effort otherwise. See Model Selection → Reasoning Effort.

With Channel Context

Specify the channel for channel-specific behavior:

Response Format

Generate Response

The generate endpoint returns a complete response object:

Stream Response

The stream endpoint returns Server-Sent Events (SSE) with JSON chunks:
Reasoning visibility. The default stream format above never carries the model’s reasoning trace. Reasoning is only streamed on the AI SDK UI message stream — opt in with ?protocol=ui on /chat/stream, where it arrives as reasoning parts. Setting reasoning.show: false (per request via options.reasoning, or per agent via modelSettings.reasoning) suppresses reasoning everywhere: from the UI message stream and from the generate response.

Error Responses

Error Response Format:

The navigate option is specifically for web widget integrations. When enabled, it allows the agent to send navigation commands that direct users to specific pages on your website.
When navigate is true, the agent can include navigation components in its response that trigger the onNavigate callback in the LuaPop widget.

Learn More About Navigation

See the Navigate Component documentation for details on how navigation works with the web widget.

Best Practices

For user-facing applications, use the /chat/stream endpoint to provide real-time feedback as the response is generated.
When building integrations, specify the channel parameter to help the agent format responses appropriately for the platform.
The runtimeContext field is great for injecting user-specific information or session context without modifying the agent’s core persona.
When using the stream endpoint, ensure you properly handle the SSE format and parse each JSON chunk separately.

Use Cases

Mobile Apps

Build native mobile experiences with your Lua agent

Custom Integrations

Integrate with internal tools and systems

Voice Assistants

Power voice interfaces with AI responses

Automation

Trigger agent responses from workflows

Channels

Pre-built channel integrations

Chat Widget

Embeddable web widget

Navigate Component

Web navigation feature

LuaAgent

Agent configuration