Platform & agents

HTTP API and streaming chat for FlexyAgents

Call POST /api/agents/{id}/chat with bearer keys—stream tokens when your UI needs a ChatGPT-style experience inside your product.

December 12, 202410 min read
ai agent rest apistreaming chat api llmembed ai chat in productbearer token ai chat api

Product teams often outgrow iframes: they want chat inside authenticated dashboards, mobile apps, or partner portals with their own navigation and analytics. FlexyAgents exposes an HTTP API aligned with the same agents, knowledge scopes, and rate limits as the hosted widget. Streaming responses let you render tokens progressively like consumer chat apps.

This guide frames authentication, scoping, and operational concerns so engineering and security can sign off together.

Authentication and keys

Bearer tokens should live in secret managers, rotate on a schedule, and map to environments—sandbox versus production.

Separate keys per integration partner when contracts require revocation without impacting your core app.

Never embed long-lived secrets in mobile binaries; use your backend to proxy chat calls.

Streaming UX and client responsibilities

Clients must handle partial JSON, reconnects, and cancellation when users navigate away.

Show typing indicators only when tokens are actually flowing; false positives erode trust.

Truncate extremely long assistant messages in UI while storing full text server-side for audit.

Rate limits and abuse protection

Align client retry policies with documented limits; exponential backoff reduces thundering herds.

Per-user throttles complement per-key limits for public-ish surfaces.

Monitor anomaly spikes that might indicate scraping or prompt injection attempts.

Parity with dashboard testing

Golden conversations should run against API and widget channels to catch divergence early.

Version prompts deliberately when mobile releases lag web.

Scoped knowledge bases apply identically—API is not a bypass.

Next step

Put this playbook on your own knowledge

Start a trial, book a walkthrough, or talk to us about governance and rollout—same workspace for pilots and production.