Integration

Quick Reference (API usage)

Auth, endpoints, payloads, and copy-paste examples for common integrations.

Idioma:ESENFRPTDE
Última actualización: Apr 8, 2026quickreferenceendpoints

Quick Reference — Integrations (copy/paste)

This page is a developer cheat-sheet for integrating CLIA quickly.

If you are embedding CLIA into a B2C product, start here:

  • text
    /docs/b2c-agent-embedding-guide

Base URL

  • Production:
    text
    https://clia-backend.frontiercodes.com

Authentication (choose the right one)

1) JWT (tenant dashboard user)

Used for:

text
/chat
,
text
/agent-config
,
text
/billing/*
,
text
/users/*
.

Header:

text
Authorization: Bearer <jwt>

2) API key (tenant secret)

Used for:

text
/public/session
,
text
/rag-config
,
text
/prompt-templates
,
text
/public/*
.

Header:

text
x-api-key: <tenant_api_key>

Rule: Never ship

text
x-api-key
to the browser/mobile app.

3) executionToken (runtime, short-lived)

Used for: tools/MCP calls in end-user runtime (when applicable).

Header:

text
Authorization: Bearer <executionToken>

B2C Embed flow (recommended)

A) Mint a session (server-side)

text
POST /public/session
(x-api-key)

bash
curl -X POST "https://clia-backend.frontiercodes.com/public/session" \
  -H "Content-Type: application/json" \
  -H "x-api-key: $CLIA_TENANT_API_KEY" \
  -d '{
    "agentId": "AGENT_ID",
    "channel": "chat",
    "externalCustomerId": "enduser_123",
    "scopes": ["mcp:access", "tool:http_request"]
  }'

Response includes:

  • text
    agentEndpoint
  • text
    executionToken
  • text
    sessionId
  • text
    workspaceId

B) Send a message (frontend → agentEndpoint)

bash
curl -X POST "https://<your-agent-endpoint>/webhook/chat" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $EXECUTION_TOKEN" \
  -d '{
    "agentId": "AGENT_ID",
    "query": "Hello!",
    "sessionId": "sess_...",
    "workspaceId": "WORKSPACE_ID",
    "externalCustomerId": "enduser_123"
  }'

Tenant Chat (dashboard user) — JWT

text
POST /chat

bash
curl -X POST "https://clia-backend.frontiercodes.com/chat" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $CLIA_JWT" \
  -d '{
    "agentId": "AGENT_ID",
    "query": "Hola, ¿cómo ayudas?",
    "sessionId": "session-123",
    "context": {}
  }'

Agent personalization (Prompts + Model) — JWT

text
GET /agent-config?agentId=...

text
PUT /agent-config

bash
curl -X PUT "https://clia-backend.frontiercodes.com/agent-config" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $CLIA_JWT" \
  -d '{
    "agentId": "AGENT_ID",
    "systemPrompt": "You are a helpful assistant...",
    "temperature": 0.8,
    "maxTokens": 3000,
    "model": "gpt-4o-mini"
  }'

Knowledge Base (RAG) config — x-api-key (server-side)

text
PUT /rag-config

bash
curl -X PUT "https://clia-backend.frontiercodes.com/rag-config" \
  -H "Content-Type: application/json" \
  -H "x-api-key: $CLIA_TENANT_API_KEY" \
  -d '{
    "agentId": "AGENT_ID",
    "dataEndpoint": "https://api.yourcompany.com/kb",
    "dataEndpointMethod": "GET",
    "isPaginated": false
  }'