Skip to main content

API Overview

The Administrative Application exposes a REST API for managing all platform resources. All endpoints follow consistent patterns for CRUD operations, pagination, and error handling.

Base URL

https://your-admin-domain.com/api

Authentication & Authorization

API requests require authentication via Auth0. The session is managed through cookies set during the OAuth flow.

For programmatic access, use the session endpoint to verify authentication:

GET /api/auth/session

Role-Based Access Control (RBAC)

All API endpoints enforce permission checks based on the user's role within the organization:

RoleDescriptionTypical Permissions
SystemPlatform administratorsFull access to all resources
AdminOrganization administratorsFull access to organization resources
UserStandard usersWorkflows (full), entities (read-only)
GuestRead-only accessView all resources, no modifications

API requests will return 403 Forbidden if the user lacks the required permission:

{
"error": "Forbidden: You do not have permission to create entities"
}

See RBAC Documentation for the complete permission matrix.

Common Patterns

Pagination

List endpoints support pagination with these query parameters:

ParameterTypeDefaultDescription
pageinteger1Page number (1-indexed)
limitinteger10Items per page

Response format:

{
"data": [...],
"pagination": {
"page": 1,
"limit": 10,
"total": 42,
"totalPages": 5
}
}

Error Responses

All errors follow this format:

{
"error": "Human-readable error message",
"details": "Optional additional details"
}

Common HTTP Status Codes:

CodeMeaning
200Success
201Created
400Bad Request - Invalid input
401Unauthorized - Not authenticated
404Not Found
409Conflict - Duplicate resource
500Internal Server Error

Filtering

Most list endpoints support filtering by organization:

GET /api/environments?organizationId={uuid}

Some endpoints support additional filters:

GET /api/variables?organizationId={uuid}&environmentId={uuid}
GET /api/workflow-entities?organizationId={uuid}&search={term}

API Endpoints

Organizations

Manage organizations (top-level tenant).

MethodEndpointDescription
GET/api/organizationsList all organizations
POST/api/organizationsCreate organization
GET/api/organizations/{id}Get organization by ID
PUT/api/organizations/{id}Update organization
DELETE/api/organizations/{id}Delete organization

Environments

Manage environments within an organization.

MethodEndpointDescription
GET/api/environmentsList environments
POST/api/environmentsCreate environment
GET/api/environments/{id}Get environment by ID
PUT/api/environments/{id}Update environment
DELETE/api/environments/{id}Delete environment

Query Parameters:

  • organizationId - Filter by organization (required for list)

Variables

Manage environment-scoped variables (write-only values).

MethodEndpointDescription
GET/api/variablesList variables
POST/api/variablesCreate variable
GET/api/variables/{id}Get variable by ID
PUT/api/variables/{id}Update variable
DELETE/api/variables/{id}Delete variable

Query Parameters:

  • organizationId - Filter by organization
  • environmentId - Filter by environment
note

Variable values are write-only for security. The API never returns the value field.

Models

Manage AI/LLM model configurations.

MethodEndpointDescriptionPermission
GET/api/modelsList modelsentities:read
POST/api/modelsCreate modelentities:create
GET/api/models/{id}Get model by IDentities:read
PUT/api/models/{id}Update modelentities:update
DELETE/api/models/{id}Delete modelentities:delete

Query Parameters:

  • organizationId - Filter by organization (required)
note

Model credentials (token, clientKey, secretKey) are write-only. The API returns hasToken and hasClientKey boolean flags instead.

System Models

Platform-wide AI/LLM configurations managed by system administrators.

MethodEndpointDescriptionPermission
GET/api/system-models/visibleList visible system modelsAny authenticated
GET/api/system-modelsList all system modelsSystem only
POST/api/system-modelsCreate system modelSystem only
PUT/api/system-models/{id}Update system modelSystem only
DELETE/api/system-models/{id}Delete system modelSystem only

Roles

List available roles for user management.

MethodEndpointDescriptionPermission
GET/api/rolesList assignable rolesAny authenticated

Response:

{
"data": [
{ "id": "uuid", "name": "admin", "description": "Organization administrator" },
{ "id": "uuid", "name": "user", "description": "Standard user" },
{ "id": "uuid", "name": "guest", "description": "Read-only access" }
]
}

Workflows

Manage workflow definitions and canvas data.

MethodEndpointDescription
GET/api/workflowsList workflows
POST/api/workflowsCreate workflow
GET/api/workflows/{id}Get workflow by ID
PUT/api/workflows/{id}Update workflow
DELETE/api/workflows/{id}Delete workflow

Query Parameters:

  • organizationId - Filter by organization
  • environmentId - Filter by environment

Workflow Entities

Manage reusable workflow entity definitions.

MethodEndpointDescriptionPermission
GET/api/workflow-entitiesList entitiesentities:read
POST/api/workflow-entitiesCreate entityentities:create
GET/api/workflow-entities/{id}Get entity by IDentities:read
PUT/api/workflow-entities/{id}Update entityentities:update
DELETE/api/workflow-entities/{id}Delete entityentities:delete
GET/api/workflow-entities/{id}/usage-countCount workflow usageentities:read

Query Parameters:

  • organizationId - Filter by organization
  • environmentId - Filter by environment
  • search - Search by name (case-insensitive)

Workflow Entity Types

Manage entity type definitions (Event, Prompt, Action, Result).

MethodEndpointDescription
GET/api/workflow-entity-typesList all types
POST/api/workflow-entity-typesCreate type
GET/api/workflow-entity-types/{id}Get type by ID
PUT/api/workflow-entity-types/{id}Update type
DELETE/api/workflow-entity-types/{id}Delete type

Prompt Templates

Manage prompt templates for the Prompt Builder with version history and sentiment analysis.

MethodEndpointDescriptionPermission
GET/api/prompt-templatesList templatesentities:read
POST/api/prompt-templatesCreate templateentities:create
GET/api/prompt-templates/{id}Get template by IDentities:read
PUT/api/prompt-templates/{id}Update templateentities:update
DELETE/api/prompt-templates/{id}Delete templateentities:delete
POST/api/prompt-templates/{id}/executeExecute with modelentities:read
POST/api/prompt-templates/{id}/analyze-sentimentRun sentiment analysisentities:read
GET/api/prompt-templates/{id}/versionsList version historyentities:read
GET/api/prompt-templates/{id}/versions/{version}Get specific versionentities:read

Query Parameters:

  • organizationId - Filter by organization (required)
  • environmentId - Filter by environment
  • search - Search by name (case-insensitive)

See Prompt Builder for detailed request/response examples.

Prompts

Manage standalone prompts (separate from Prompt Templates).

MethodEndpointDescription
GET/api/promptsList prompts
POST/api/promptsCreate prompt
GET/api/prompts/{id}Get prompt by ID
PUT/api/prompts/{id}Update prompt
DELETE/api/prompts/{id}Delete prompt

Query Parameters:

  • organizationId - Filter by organization

Processed Queue

Access processed messages stored in S3.

MethodEndpointDescription
GET/api/processed-queueList processed messages
GET/api/processed-queue/{key}Get message by S3 key
DELETE/api/processed-queue/{key}Delete single message
DELETE/api/processed-queue?keys={k1,k2}Bulk delete messages
GET/api/processed-queue/countsGet counts by status

Query Parameters:

  • organizationId - Filter by organization (required)
  • environmentId - Filter by environment
  • status - Filter by status: success, fail, ignore

Request/Response Examples

Create Organization

POST /api/organizations
Content-Type: application/json

{
"name": "Acme Corp",
"description": "Main production organization"
}

Response (201):

{
"id": "550e8400-e29b-41d4-a716-446655440000",
"name": "Acme Corp",
"description": "Main production organization",
"createdAt": "2024-01-15T10:30:00.000Z",
"updatedAt": "2024-01-15T10:30:00.000Z"
}

Create Environment

POST /api/environments
Content-Type: application/json

{
"name": "Production",
"description": "Live production environment",
"organizationId": "550e8400-e29b-41d4-a716-446655440000"
}

Create Variable

POST /api/variables
Content-Type: application/json

{
"organizationId": "550e8400-e29b-41d4-a716-446655440000",
"environmentId": "660e8400-e29b-41d4-a716-446655440001",
"name": "OPENAI_API_KEY",
"value": "sk-proj-xxxxxxxxxxxx"
}

Response (201):

{
"id": "770e8400-e29b-41d4-a716-446655440002",
"organizationId": "550e8400-e29b-41d4-a716-446655440000",
"environmentId": "660e8400-e29b-41d4-a716-446655440001",
"name": "OPENAI_API_KEY",
"createdAt": "2024-01-15T10:30:00.000Z",
"updatedAt": "2024-01-15T10:30:00.000Z"
}

Note: value is not returned.

Create Model

POST /api/models
Content-Type: application/json

{
"organizationId": "550e8400-e29b-41d4-a716-446655440000",
"name": "GPT-4 Turbo",
"description": "Production model",
"modelUrl": "https://api.openai.com/v1/chat/completions",
"token": "sk-proj-xxxxxxxxxxxx"
}

Response (201):

{
"id": "880e8400-e29b-41d4-a716-446655440003",
"organizationId": "550e8400-e29b-41d4-a716-446655440000",
"name": "GPT-4 Turbo",
"description": "Production model",
"modelUrl": "https://api.openai.com/v1/chat/completions",
"hasToken": true,
"hasClientKey": false,
"createdAt": "2024-01-15T10:30:00.000Z",
"updatedAt": "2024-01-15T10:30:00.000Z"
}

Create Workflow Entity

POST /api/workflow-entities
Content-Type: application/json

{
"organizationId": "550e8400-e29b-41d4-a716-446655440000",
"name": "Check User Type",
"description": "Evaluates if user is premium",
"workflowEntityTypeId": "event-type-uuid",
"condition": {
"type": "group",
"operator": "AND",
"conditions": [
{
"type": "rule",
"field": "message.type",
"comparison": "equals",
"value": "user.signup"
}
]
},
"script": "// Optional post-condition script",
"tfCondition": "True/False",
"arguments": [
{
"argumentName": "userId",
"argumentValue": "{{message.user.id}}",
"argumentDescription": "The user's unique identifier"
}
]
}

Create Workflow

POST /api/workflows
Content-Type: application/json

{
"organizationId": "550e8400-e29b-41d4-a716-446655440000",
"environmentId": "660e8400-e29b-41d4-a716-446655440001",
"name": "New User Welcome",
"description": "Welcome flow for new signups",
"workflowData": {
"root": {
"name": "Check User",
"entityId": "entity-uuid",
"entityType": "event",
"presentation": {
"type": "circle",
"position": { "x": 100, "y": 200 }
},
"children": []
}
}
}

Create Prompt Template

POST /api/prompt-templates
Content-Type: application/json

{
"organizationId": "550e8400-e29b-41d4-a716-446655440000",
"environmentId": "660e8400-e29b-41d4-a716-446655440001",
"name": "Welcome Message Generator",
"description": "Generates personalized welcome messages",
"promptText": "You are a friendly assistant. Write a warm welcome message for {{userName}} who just joined {{productName}}. Keep it under 280 characters.",
"modelId": "880e8400-e29b-41d4-a716-446655440003",
"variables": {
"userName": "string",
"productName": "string"
},
"variableSets": [
{
"name": "Happy User",
"values": { "userName": "Sarah", "productName": "Pulse" }
}
]
}

Response (201):

{
"id": "990e8400-e29b-41d4-a716-446655440004",
"name": "Welcome Message Generator",
"description": "Generates personalized welcome messages",
"promptText": "You are a friendly assistant...",
"version": 1,
"modelId": "880e8400-e29b-41d4-a716-446655440003",
"model": { "id": "880e8400...", "name": "GPT-4 Turbo" },
"organization": { "name": "Acme Corp" },
"environment": { "name": "Production" },
"variables": { "userName": "string", "productName": "string" },
"variableSets": [...],
"rawSentimentAnalysis": null,
"resultSentimentAnalysis": null,
"createdAt": "2025-01-27T10:00:00Z",
"updatedAt": "2025-01-27T10:00:00Z"
}

Update Prompt Template

PUT /api/prompt-templates/990e8400-e29b-41d4-a716-446655440004
Content-Type: application/json

{
"name": "Welcome Message v2",
"promptText": "Create an exciting welcome for {{userName}}!",
"variableSets": [
{ "name": "Test 1", "values": { "userName": "Alex" } }
]
}

Note: Updates automatically increment the version and save previous state to history.

Create Prompt

POST /api/prompts
Content-Type: application/json

{
"organizationId": "550e8400-e29b-41d4-a716-446655440000",
"modelId": "880e8400-e29b-41d4-a716-446655440003",
"title": "Customer Support Response",
"content": "You are a helpful customer support agent. Respond to: {{customerMessage}}",
"outputFormat": "text",
"outputTemplate": null
}

Response (201):

{
"id": "aa0e8400-e29b-41d4-a716-446655440005",
"organizationId": "550e8400-e29b-41d4-a716-446655440000",
"modelId": "880e8400-e29b-41d4-a716-446655440003",
"model": { "name": "GPT-4 Turbo" },
"organization": { "name": "Acme Corp" },
"title": "Customer Support Response",
"content": "You are a helpful customer support agent...",
"outputFormat": "text",
"outputTemplate": null,
"createdAt": "2025-01-27T10:00:00Z",
"updatedAt": "2025-01-27T10:00:00Z"
}

Update Prompt

PUT /api/prompts/aa0e8400-e29b-41d4-a716-446655440005
Content-Type: application/json

{
"title": "Customer Support Response v2",
"content": "You are an empathetic support agent. Address: {{customerMessage}}",
"outputFormat": "json",
"outputTemplate": "{ \"response\": \"{{response}}\", \"sentiment\": \"{{sentiment}}\" }"
}

Delete Prompt

DELETE /api/prompts/aa0e8400-e29b-41d4-a716-446655440005

Response:

{
"success": true,
"id": "aa0e8400-e29b-41d4-a716-446655440005"
}

OpenAPI Specification

For the complete OpenAPI 3.0 specification, see openapi.yaml.

MCP (Model Context Protocol)

For AI agent integration, the platform also exposes an MCP-compatible API that allows tools like Claude Desktop and Cursor IDE to interact with the platform programmatically.

See MCP API Documentation for details.