Embed limits and errors
This page covers customer sign-in, Kit, iframe and Hosted. The source column distinguishes fixed validation, Dashboard policy and component behavior. Policy values come from the configuration saved for your agent.
Limits
| Item | Value and unit | Source |
|---|---|---|
customer_id | 1–256 bytes (UTF-8); the anon_ prefix is reserved for anonymous visitors | Issuance validation |
expires_in | 60–900 seconds; omitted means 900 | Issuance validation |
max_session_seconds | 300–2592000 seconds; omitted means 604800 (7 days) | Issuance validation |
resources | 1–50 entries; each params serializes to ≤4096 bytes | Issuance validation |
Issuance origin | One of the allowed origins in the embed settings, matched exactly | Issuance validation |
| Policy origins | ≤50 HTTPS origins; wildcards match one subdomain level without a port | Embed settings |
allow_localhost | false by default; allows HTTP localhost / 127.0.0.1, with optional port, when enabled | Embed settings |
max_active_sessions_per_user | 1–100 active sessions per user; idle history is excluded | Embed settings |
per_user_rate_per_min | 1–600 requests/minute/user | Embed settings |
| Monthly cap | Set on the Dashboard Usage (用量) tab; null means uncapped; UTC calendar month | Dashboard and monthly accounting |
anon_rate_per_min (publishable key) | Integer exchanges per minute; null means unlimited; counts every exchange of the key per UTC minute | Publishable key settings |
daily_session_cap (publishable key) | Integer new visitors per UTC day; null means unlimited; returning visitors are not counted | Publishable key settings |
daily_spend_cap (publishable key) | {"amount":"5.00","currency":"USD"}, two decimals; null means unlimited; "0.00" closes the key; per UTC day | Publishable key settings |
| Page context | ≤32 items; complete JSON ≤4096 UTF-8 bytes | API validation; Kit trims oldest entries |
| Session title / initial events | Title ≤500 characters; ≤50 initial plain-text user messages | Embedded session validation |
| Attachment picker | ≤5 files/message; each ≤10 MiB (10,485,760 bytes); PNG, JPEG, GIF, WebP, PDF, TXT, MD | Kit input validation; the first message of a new session still accepts only plain text |
startScreen.prompts | First 4 displayed | Kit component |
| Hosted grant code | Usable within 15 minutes of issuance (expires_in 60–900 seconds), exchangeable once | Hosted exchange validation |
The monthly action stop_new_sessions rejects new sessions; alert_only does not block them. Dashboard monetary inputs use the account currency. An exhausted session budget stops new work while retaining tool confirmation and interruption.
Sign-in errors
Grant-code exchange and renewal return these codes; see Customer sign-in for fields and handling.
| Code | HTTP | Meaning and action |
|---|---|---|
GRANT_CODE_INVALID | 401 | The grant code is invalid, already used or expired; have your backend issue a new one |
SIGN_IN_REVOKED | 401 | The sign-in ended (sign-out, revocation or merge); the page fetches a code and signs in again |
SIGN_IN_EXPIRED | 401 | The sign-in reached its limit; the page fetches a code and signs in again |
CUSTOMER_BLOCKED | 403 | The customer is blocked; an administrator handles it |
ORIGIN_NOT_ALLOWED | 403 | The page origin is not allowed, or differs from the origin bound to the grant code; fix the configuration |
PUBLISHABLE_KEY_DAILY_SPEND_CAP_REACHED | 429 | The publishable key’s spend for the current UTC day reached its daily_spend_cap; exchange again after Retry-After seconds (the next 00:00 UTC), or have an administrator raise the cap |
Session-stage errors
Sign-in (grant-code exchange and renewal) is handled by the customer service and uses the codes in the previous section. After sign-in, session creation and chat requests are admitted by the agent service, and the same causes come back as the EMBED_* codes below: a revoked sign-in returns EMBED_TOKEN_REVOKED, an expired one EMBED_TOKEN_EXPIRED, and a blocked customer EMBED_USER_BLOCKED.
These statuses apply to ordinary HTTP failures. Once a stream opens, errors arrive inside the stream and cannot change its HTTP status. Retryability refers to the original request, before changing configuration or credentials.
EMBED_TOKEN_EXPIRED
401 · Access · No direct retry. The token expired. Refreshable Kit access obtains another token and replays an expiry-failed request at most once. Hosted requires a new host-issued link.
EMBED_TOKEN_REVOKED
401 · Access/stream · Not retryable. Kit stops refreshing. End old access and have the host recheck eligibility. Do not automatically issue tokens to bypass revocation.
EMBED_ORIGIN_NOT_ALLOWED
403 · Origin check · Not retryable. Check scheme, host and port against the policy and any narrower issuance allowlist. After correction, issue again and verify.
EMBED_USER_BLOCKED
403 · Issuance/session creation · Not retryable. An administrator must review the user under the Customers (客户) tab. If access should resume, unblock and issue a new token.
EMBED_RATE_LIMITED
429 · Requests/session creation/anonymous issuance · Retry later. Request frequency, active sessions or daily anonymous sessions reached their limit. Wait for the rate window, running sessions or next UTC day respectively.
PUBLISHABLE_KEY_DAILY_SPEND_CAP_REACHED
429 · Anonymous exchange/next turn of a session · Retry after the next UTC day starts. This publishable key’s spend for the current UTC day reached its daily_spend_cap. The exchange answers with Retry-After (seconds until the next 00:00 UTC); a running session refuses the visitor’s next turn with no Retry-After, and the turn already in flight completes. An administrator raises or removes the cap, or you wait for the next day; do not retry in a loop.
EMBED_BUDGET_EXHAUSTED
402 · Session work · Not retryable. The session budget is exhausted. Review the budget; continue with a new token and session only when authorized. Do not loop issuance to bypass limits.
EMBED_MONTHLY_CAP_REACHED
402 · Session creation · Not retryable. The monthly cap requires stopping new sessions. An administrator decides whether to change the cap or action, or wait for the next UTC month.
EMBED_FIELD_NOT_ALLOWED
400 · Issuance/session creation · Not retryable. Remove unauthorized agent_override. Embedded session creation accepts only title, time_zone and initial_events. Initial events are plain-text user.message events with optional page context.
Other refusals
| Code | HTTP / stage | Recovery | Retryable |
|---|---|---|---|
INVALID_PARAMS | 400 / validation | Correct the reported type, range or size | No |
UNAUTHENTICATED | 401 / authentication | Check missing/invalid credentials or a disabled publishable key | No |
NOT_FOUND | 404 / resource or Hosted exchange | Verify organization, public ID and policy; obtain a fresh Hosted link if expired or consumed | No |
UPSTREAM_UNAVAILABLE | 502 / upstream call | Retry later; check management writes for partial completion first | Yes |
For session permissions, archiving and event-content errors, see Agent limits and errors.
Kit errors and retries
praxis.error detail can be a KitError with code, status, retryable and message, or only { message }. Status 0 means no HTTP response.
| Code | Status / stage | Recovery and retryability |
|---|---|---|
network_error, stream_disconnected | 0 / network or stream | Retry after restoring connectivity |
http_error | Response status / HTTP | Inspect response; without explicit retryable, 429 and 5xx permit retry |
invalid_grant_code | 0 / sign-in | The page session received an empty grant code; take a new code, retryable |
invalid_response | Response status / JSON or history | Check format and pagination progress; no automatic retry |
invalid_stream | Response status / stream | Check SSE content and JSON; no automatic retry |
event_cursor_not_found | 200 / history recovery | Reload history to locate the session; no automatic retry |
callback_error | 0 / callback | Fix the host exception; not retryable |
aborted, disposed | 0 / lifecycle | Cancelled request or destroyed component; do not retry the old instance |
Non-Hosted token retrieval retries retryable failures up to 3 times at 1, 2 and 4 seconds. Revocation or budget refusal stops that retry loop. Transport-owned stream recovery reconnects at most 5 times; the interface may own recovery instead. Do not add an unlimited retry loop.
Diagnose failures
Retain time, environment, public agent_… ID, HTTP status, error code and X-Request-Id without credentials. Check the customer under the Customers (客户) tab and the session under Sessions (会话), then replay the session. Repeat embed tests after recovery. See the Agent API for field definitions.