Skip to content
中文

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

ItemValue and unitSource
customer_id1–256 bytes (UTF-8); the anon_ prefix is reserved for anonymous visitorsIssuance validation
expires_in60–900 seconds; omitted means 900Issuance validation
max_session_seconds300–2592000 seconds; omitted means 604800 (7 days)Issuance validation
resources1–50 entries; each params serializes to ≤4096 bytesIssuance validation
Issuance originOne of the allowed origins in the embed settings, matched exactlyIssuance validation
Policy origins≤50 HTTPS origins; wildcards match one subdomain level without a portEmbed settings
allow_localhostfalse by default; allows HTTP localhost / 127.0.0.1, with optional port, when enabledEmbed settings
max_active_sessions_per_user1–100 active sessions per user; idle history is excludedEmbed settings
per_user_rate_per_min1–600 requests/minute/userEmbed settings
Monthly capSet on the Dashboard Usage (用量) tab; null means uncapped; UTC calendar monthDashboard and monthly accounting
anon_rate_per_min (publishable key)Integer exchanges per minute; null means unlimited; counts every exchange of the key per UTC minutePublishable key settings
daily_session_cap (publishable key)Integer new visitors per UTC day; null means unlimited; returning visitors are not countedPublishable key settings
daily_spend_cap (publishable key){"amount":"5.00","currency":"USD"}, two decimals; null means unlimited; "0.00" closes the key; per UTC dayPublishable key settings
Page context≤32 items; complete JSON ≤4096 UTF-8 bytesAPI validation; Kit trims oldest entries
Session title / initial eventsTitle ≤500 characters; ≤50 initial plain-text user messagesEmbedded session validation
Attachment picker≤5 files/message; each ≤10 MiB (10,485,760 bytes); PNG, JPEG, GIF, WebP, PDF, TXT, MDKit input validation; the first message of a new session still accepts only plain text
startScreen.promptsFirst 4 displayedKit component
Hosted grant codeUsable within 15 minutes of issuance (expires_in 60–900 seconds), exchangeable onceHosted 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.

CodeHTTPMeaning and action
GRANT_CODE_INVALID401The grant code is invalid, already used or expired; have your backend issue a new one
SIGN_IN_REVOKED401The sign-in ended (sign-out, revocation or merge); the page fetches a code and signs in again
SIGN_IN_EXPIRED401The sign-in reached its limit; the page fetches a code and signs in again
CUSTOMER_BLOCKED403The customer is blocked; an administrator handles it
ORIGIN_NOT_ALLOWED403The page origin is not allowed, or differs from the origin bound to the grant code; fix the configuration
PUBLISHABLE_KEY_DAILY_SPEND_CAP_REACHED429The 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

CodeHTTP / stageRecoveryRetryable
INVALID_PARAMS400 / validationCorrect the reported type, range or sizeNo
UNAUTHENTICATED401 / authenticationCheck missing/invalid credentials or a disabled publishable keyNo
NOT_FOUND404 / resource or Hosted exchangeVerify organization, public ID and policy; obtain a fresh Hosted link if expired or consumedNo
UPSTREAM_UNAVAILABLE502 / upstream callRetry later; check management writes for partial completion firstYes

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.

CodeStatus / stageRecovery and retryability
network_error, stream_disconnected0 / network or streamRetry after restoring connectivity
http_errorResponse status / HTTPInspect response; without explicit retryable, 429 and 5xx permit retry
invalid_grant_code0 / sign-inThe page session received an empty grant code; take a new code, retryable
invalid_responseResponse status / JSON or historyCheck format and pagination progress; no automatic retry
invalid_streamResponse status / streamCheck SSE content and JSON; no automatic retry
event_cursor_not_found200 / history recoveryReload history to locate the session; no automatic retry
callback_error0 / callbackFix the host exception; not retryable
aborted, disposed0 / lifecycleCancelled 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.