Agent Embed

View as Markdown

Embed Context Read

GET/api/v1/embed/context

Service-to-service read for the 1.2 gateway plugin. Auth is ``X-Admin-Key`` (the plugin, like skills-meta). ``flow_id`` + ``url`` are supplied server-side by the plugin from ``ctx`` — never the LLM for ``flow_id``.

Errors

CodeWhenWhat to do
422Validation Error—
Request
curl "https://app.opvs.ai/api/v1/embed/context" \
  -H "Authorization: Bearer $OPVS_TOKEN"

Embed Context Upload

POST/api/v1/embed/context

Store the visitor's current page content for scoped-pull by the agent.

Errors

CodeWhenWhat to do
422Validation Error—
Request
curl -X POST "https://app.opvs.ai/api/v1/embed/context" \
  -H "Authorization: Bearer $OPVS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{}'

Embed Preflight

OPTIONS/api/v1/embed/context

Scoped-CORS preflight responder. (The global CORSMiddleware intercepts preflights for origins outside CORS_ORIGINS before this runs — same as embed_mock; an external origin's browser POST still needs CORS_ORIGINS at deploy, while the SSE GET is a simple request served by reflection alone.)

Request
curl -X OPTIONS "https://app.opvs.ai/api/v1/embed/context" \
  -H "Authorization: Bearer $OPVS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{}'

Embed Sse

GET/api/v1/embed/sse

Open the AI SDK response stream for a validated session token. When a ``message`` is supplied the agent's reply to it streams; otherwise just an open frame so the EventSource handshake completes. ``page_url`` (optional) grounds the turn to the visitor's current page (M2.1).

Errors

CodeWhenWhat to do
422Validation Error—
Request
curl "https://app.opvs.ai/api/v1/embed/sse" \
  -H "Authorization: Bearer $OPVS_TOKEN"

Embed Preflight

OPTIONS/api/v1/embed/sse

Scoped-CORS preflight responder. (The global CORSMiddleware intercepts preflights for origins outside CORS_ORIGINS before this runs — same as embed_mock; an external origin's browser POST still needs CORS_ORIGINS at deploy, while the SSE GET is a simple request served by reflection alone.)

Request
curl -X OPTIONS "https://app.opvs.ai/api/v1/embed/sse" \
  -H "Authorization: Bearer $OPVS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{}'

Embed Turn

POST/api/v1/embed/turn

Run a user/widget turn and stream the agent's reply as AI SDK frames.

Errors

CodeWhenWhat to do
422Validation Error—
Request
curl -X POST "https://app.opvs.ai/api/v1/embed/turn" \
  -H "Authorization: Bearer $OPVS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{}'

Embed Preflight

OPTIONS/api/v1/embed/turn

Scoped-CORS preflight responder. (The global CORSMiddleware intercepts preflights for origins outside CORS_ORIGINS before this runs — same as embed_mock; an external origin's browser POST still needs CORS_ORIGINS at deploy, while the SSE GET is a simple request served by reflection alone.)

Request
curl -X OPTIONS "https://app.opvs.ai/api/v1/embed/turn" \
  -H "Authorization: Bearer $OPVS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{}'

Embed Session

POST/api/v1/embed/session

Mint a public embed session token for a registered flow + origin.

Errors

CodeWhenWhat to do
422Validation Error—
Request
curl -X POST "https://app.opvs.ai/api/v1/embed/session" \
  -H "Authorization: Bearer $OPVS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{}'

Embed Preflight

OPTIONS/api/v1/embed/session

Scoped-CORS preflight responder. (The global CORSMiddleware intercepts preflights for origins outside CORS_ORIGINS before this runs — same as embed_mock; an external origin's browser POST still needs CORS_ORIGINS at deploy, while the SSE GET is a simple request served by reflection alone.)

Request
curl -X OPTIONS "https://app.opvs.ai/api/v1/embed/session" \
  -H "Authorization: Bearer $OPVS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{}'

Embed Bind

POST/api/v1/embed/bind

Client-facing hire→bind: turn a catalog pick into a live bound flow.

Errors

CodeWhenWhat to do
422Validation Error—
Request
curl -X POST "https://app.opvs.ai/api/v1/embed/bind" \
  -H "Authorization: Bearer $OPVS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{}'

Embed Bind Update Origins

PATCH/api/v1/embed/bind/{flow_id}

Update a binding's origin allowlist (PAT-auth, brand-scoped).

Errors

CodeWhenWhat to do
422Validation Error—
Request
curl -X PATCH "https://app.opvs.ai/api/v1/embed/bind/{flow_id}" \
  -H "Authorization: Bearer $OPVS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{}'

Embed Unbind

DELETE/api/v1/embed/bind/{flow_id}

Unbind a flow — soft-disable the binding (PAT-auth, brand-scoped).

Errors

CodeWhenWhat to do
422Validation Error—
Request
curl -X DELETE "https://app.opvs.ai/api/v1/embed/bind/{flow_id}" \
  -H "Authorization: Bearer $OPVS_TOKEN"

Embed Catalog Bind

POST/api/v1/embed/catalog/bind

Provision (or reuse) the platform-owned demo hire for a catalog product.

Errors

CodeWhenWhat to do
422Validation Error—
Request
curl -X POST "https://app.opvs.ai/api/v1/embed/catalog/bind" \
  -H "Authorization: Bearer $OPVS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{}'

Embed Catalog Session

POST/api/v1/embed/catalog/session

PUBLIC. Mint a demo session token for a profile that already has a binding.

Errors

CodeWhenWhat to do
422Validation Error—
Request
curl -X POST "https://app.opvs.ai/api/v1/embed/catalog/session" \
  -H "Authorization: Bearer $OPVS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{}'
Did this answer your question?