Amarsia
API Reference

Authentication

API key usage across SDK, React, and REST API tracks.

One rule for all tracks

For authenticated workflows, send a valid API key from the API Keys dashboard.

For public workflows (authentication turned off), x-api-key is not required. Access is controlled by the workflow allowlist using request Origin / Referer.

amarsia.init(options)

import { amarsia } from "@amarsia/sdk"const client = amarsia.init({apiKey: process.env.AMARSIA_API_KEY!,deploymentId: "dep_123",})await client.run({content: [{ type: "text", text: "Hello" }],})

Pass apiKey in amarsia.init(...). The SDK adds the auth header on every request automatically — you never touch it again.

OptionTypeRequired
apiKeystringNo (required only for authenticated workflows)
deploymentIdstringNo
baseUrlstringNo
dangerouslyAllowBrowserApiKeybooleanNo
fetchfunctionNo

Public workflows (allowlist auth)

If a workflow has Authentication disabled in the dashboard:

  • You can omit apiKey in SDK and omit x-api-key in REST.
  • Access is checked against the workflow allowlist (origin/referrer).
  • Requests from disallowed origins return 403.

Common auth errors

StatusMeaningFix
401Missing or invalid key for authenticated workflowPass a valid key
403Origin or key not allowedCheck allowlist / project permissions

Security basics

  • Keep keys server-side only
  • Never commit keys to git
  • Rotate immediately if leaked