REST API Reference
Base URL: https://api.iraa.ai
All request and response bodies are JSON. Pass API keys via Authorization: Bearer <key> header.
Authentication
/api/v1/auth/registerAuth: None
Create a new organization with initial user and API keys.
Request body:
{
"orgName": "string (required)",
"email": "string (required)",
"password": "string (required, min 8 chars)"
}Response (200):
{
"organization": { "id": "uuid", "name": "string", "slug": "string" },
"keys": {
"publicKey": "pk_live_...",
"secretKey": "sk_live_...",
"testPublicKey": "pk_test_...",
"testSecretKey": "sk_test_..."
}
}/api/v1/auth/loginAuth: None
Authenticate with email/password. Sets an httpOnly cookie (da_session).
Request body:
{ "email": "string", "password": "string" }Response (200):
{
"user": { "id": "uuid", "email": "string", "name": "string", "role": "owner|admin|user" },
"organization": { "id": "uuid", "name": "string", "slug": "string", "plan": "string" }
}/api/v1/auth/logoutAuth: None
Clear the auth cookie.
Response (200):
{ "success": true }/api/v1/auth/meAuth: Cookie (da_session)
Get the current authenticated user.
Response (200):
{
"user": { "id": "uuid", "email": "string", "role": "string" },
"organization": { "id": "uuid", "name": "string", "slug": "string", "plan": "string" }
}/api/v1/auth/keysAuth: Secret key (sk_live_* or sk_test_*)
List API keys for the organization.
Response (200):
{
"keys": [{
"id": "uuid",
"type": "public|secret",
"keyPrefix": "pk_live_abc...",
"name": "string",
"allowedDomains": ["string"],
"lastUsedAt": "ISO8601|null",
"isActive": true,
"createdAt": "ISO8601"
}]
}/api/v1/auth/keys/rotateAuth: Secret key
Rotate an API key (deactivates old, creates new).
Request body:
{ "keyId": "uuid" }Response (200):
{ "key": "pk_live_new...", "id": "uuid", "prefix": "pk_live_new..." }Sessions
/api/v1/sessionAuth: Public key (pk_live_* or pk_test_*)
Create a new demo session. Returns session token, greeting, and branding.
Request body:
{
"productId": "string|'default' (required)",
"visitorMeta": {
"referrer": "string (optional)",
"url": "string (optional)",
"language": "string (optional)"
}
}Response (200):
{
"sessionId": "uuid",
"token": "JWT session token",
"greeting": {
"text": "string",
"speech": "string",
"suggestions": ["string"]
},
"agent": { "name": "string", "tone": "string" },
"branding": {
"primaryColor": "#hex",
"widgetPosition": "bottom-right|bottom-left",
"agentName": "string",
"logoUrl": "string|null"
}
}/api/v1/session/:sessionId/chatAuth: Session token (JWT)
Send a visitor message and get the agent's response.
Request body:
{ "message": "string (required)" }Response (200):
{
"text": "Agent's text response",
"speech": "TTS-optimized text",
"iframeCommands": [
{ "action": "navigate|click|type|highlight|scroll|wait", "selector": "string", "value": "string" }
],
"suggestions": ["Suggested reply 1", "Suggested reply 2"],
"agentId": "demo|qa|discovery|docs",
"usage": { "inputTokens": 0, "outputTokens": 0 }
}/api/v1/session/:sessionId/leadAuth: Session token
Capture lead information from the visitor.
Request body:
{
"email": "string (optional)",
"company": "string (optional)",
"name": "string (optional)",
"phone": "string (optional)"
}Response (200):
{ "leadId": "uuid", "captured": true }/api/v1/session/:sessionId/endAuth: Session token
End a demo session.
Response (200):
{ "ended": true }PDP Configuration
/api/v1/pdpAuth: Secret key (sk_live_*)
Upload and validate a PDP YAML file. Creates or updates the product and sets the config as active.
Request body:
{
"yaml": "string (PDP YAML content, required)",
"productId": "uuid (optional, auto-resolved by product name)"
}Response (200):
{
"id": "uuid",
"productId": "uuid",
"version": 1,
"product": "Product Name",
"screens": 5,
"flows": 2,
"warnings": ["string"]
}Response (422) — Validation failed:
{
"error": "PDP validation failed",
"details": [{ "path": "string", "message": "string" }],
"warnings": ["string"]
}/api/v1/pdp/validateAuth: None
Validate PDP YAML without storing it.
Request body:
{ "yaml": "string" }Response (200):
{
"valid": true,
"errors": [],
"warnings": [],
"summary": { "product": "string", "screens": 5, "flows": 2, "demoAccounts": 1, "faqs": 3 }
}/api/v1/pdp/:idAuth: Secret key
Retrieve a PDP config by ID.
/api/v1/pdp/product/:productId/activeAuth: None (public)
Get the active PDP config for a product.
Discovery
Auto-generate a PDP by crawling your product's website with the discovery agent.
/api/v1/discover/startAuth: Cookie (dashboard user)
Start a discovery session. Returns a token URL to begin crawling.
Request body:
{ "productId": "uuid" }Response (200):
{
"sessionId": "uuid",
"token": "JWT",
"discoveryUrl": "https://yourapp.com?da_discover=TOKEN",
"expiresAt": "ISO8601",
"product": { "id": "uuid", "name": "string", "baseUrl": "string" }
}/api/v1/discover/validate-tokenAuth: None (token-based)
Validate a discovery token.
Request body:
{ "token": "JWT" }Response (200):
{ "valid": true, "sessionId": "uuid", "productId": "uuid" }/api/v1/discover/snapshotAuth: Discovery token
Submit a page snapshot during discovery.
Request body:
{
"sessionId": "uuid",
"token": "JWT",
"snapshot": {
"urlPath": "/dashboard",
"pageTitle": "Dashboard",
"headings": ["string"],
"elements": [{}],
"navigation": [{}],
"forms": [{}],
"viewport": { "width": 1920, "height": 1080 }
}
}Response (200):
{ "status": "saved", "id": "uuid", "uniquePages": 5 }/api/v1/discover/agent-chatAuth: Discovery token
Chat with the discovery agent during exploration.
Request body:
{
"sessionId": "uuid",
"token": "JWT",
"message": "This page is our main analytics dashboard",
"currentSnapshot": {}
}Response (200):
{ "reply": "Agent's response text" }/api/v1/discover/finalizeAuth: Discovery token
End discovery and generate a PDP YAML from collected snapshots.
Request body:
{ "sessionId": "uuid", "token": "JWT" }Response (200):
{ "status": "complete", "pdpYaml": "YAML string" }/api/v1/discover/status?productId=uuidAuth: Cookie (dashboard user)
Check discovery progress.
Response (200):
{
"hasSession": true,
"status": "active|finalizing|complete|expired",
"uniquePages": 8,
"totalElements": 142,
"generatedPdp": "YAML string|null",
"sessionId": "uuid"
}Dashboard
All dashboard endpoints require cookie authentication (dashboard login).
| Method | Endpoint | Description |
|---|---|---|
GET | /api/v1/dashboard/overview | Product, session, and lead counts |
GET | /api/v1/dashboard/products | List products for the organization |
POST | /api/v1/dashboard/products | Create a new product |
GET | /api/v1/dashboard/keys | List active API keys |
POST | /api/v1/dashboard/keys/:id/rotate | Rotate an API key |
GET | /api/v1/dashboard/org | Get organization details |
PUT | /api/v1/dashboard/org | Update organization |
POST | /api/v1/dashboard/pdp | Upload PDP via dashboard |
GET | /api/v1/dashboard/analytics | Session analytics and recent sessions |
Health & Meta
/Auth: None
API info.
{ "name": "DemoAgent API", "version": "1.0.0" }/healthAuth: None
Health check.
{ "status": "ok" }