API Reference
API reference
Reference the JavaScript SDK, React hooks, and v1 and v2 REST endpoints.
Overview
Amarsia supports ordinary v1 runner and conversation calls plus the v2 durable agent conversation protocol. Authenticated workflows require x-api-key; public browser workflows use their configured origin allowlist.
SDK and React
npm install @amarsia/sdk @amarsia/reactimport { amarsia } from "@amarsia/sdk"
const client = amarsia.init({
apiKey: process.env.AMARSIA_API_KEY!,
deploymentId: process.env.AMARSIA_DEPLOYMENT_ID!,
})React hooks are thin subscriptions over the same controllers:
import {
useRun,
useStream,
useConversation,
useAgent,
} from "@amarsia/react"Reference pages
Authentication
API keys and secure usage.
Runner API
One-shot and streaming generation.
Conversation API
Unchanged v1 stateful chat and history.
Agent conversation REST API
v2 pause, resume, reconnect, and completion.
Trigger API
Prepare stable hosted sessions.
Errors
Error shapes, status codes, conflicts, and retry rules.
Choose an API
| Requirement | API |
|---|---|
| One complete response | v1 Runner |
| Token streaming | v1 Runner or v1 Conversation stream |
| Ordinary multi-turn chat | v1 Conversation |
| Durable tools and reconnect | v2 Agent conversation |
| Prepared emailed link | Trigger API plus hosted agent |