Liya Engine

Custom Domains

Create, configure, and manage custom domain packs via the Dashboard API.

Custom domain packs let you define your own AI domains with custom intents, prompt templates, and knowledge sources. All custom domain management is done through the /dashboard/custom-domains endpoints.

For a guided walkthrough see Custom Domain Walkthrough.


GET /dashboard/custom-domains

List all custom domain packs for your tenant.

GET https://api.liyaengine.ai/dashboard/custom-domains
Authorization: Bearer <jwt>

Response:

{
  "success": true,
  "data": {
    "domains": [
      {
        "id": "cdom_01HZ...",
        "domainKey": "legal_contracts",
        "displayName": "Legal Contracts",
        "description": "AI assistant for contract review and clause extraction",
        "systemPrompt": "You are a legal assistant specialised in contract analysis...",
        "isActive": true,
        "intentCount": 3,
        "createdAt": "2026-01-20T09:00:00Z",
        "updatedAt": "2026-02-10T14:30:00Z"
      }
    ]
  }
}

POST /dashboard/custom-domains

Create a new custom domain pack.

POST https://api.liyaengine.ai/dashboard/custom-domains
Authorization: Bearer <jwt>
Content-Type: application/json
 
{
  "domainKey": "legal_contracts",
  "displayName": "Legal Contracts",
  "description": "AI assistant for contract review and clause extraction",
  "systemPrompt": "You are a legal assistant specialised in contract analysis. You help users review, summarise, and extract key clauses from contracts."
}

Request body:

FieldTypeRequiredDescription
domainKeystringYesUnique identifier used in API calls — lowercase letters, numbers, underscores only
displayNamestringYesHuman-readable name shown in the dashboard
descriptionstringNoShort description of the domain's purpose
systemPromptstringYesBase system prompt applied to all intents in this domain

domainKey rules:

  • Lowercase letters, numbers, and underscores only
  • Must be unique within your tenant
  • Cannot conflict with built-in domain names (hiring, fintech, healthcare, ehs)
  • Cannot be changed after creation

Response:

{
  "success": true,
  "data": {
    "domain": {
      "id": "cdom_01HZ...",
      "domainKey": "legal_contracts",
      "displayName": "Legal Contracts",
      "isActive": true,
      "createdAt": "2026-03-15T10:00:00Z"
    }
  }
}

PATCH /dashboard/custom-domains/:domainKey

Update a custom domain's display name, description, or system prompt.

PATCH https://api.liyaengine.ai/dashboard/custom-domains/legal_contracts
Authorization: Bearer <jwt>
Content-Type: application/json
 
{
  "displayName": "Legal Contract Review",
  "systemPrompt": "Updated system prompt..."
}

DELETE /dashboard/custom-domains/:domainKey

Permanently deletes a custom domain pack, all its intents, and any associated knowledge sources. This is irreversible.

DELETE https://api.liyaengine.ai/dashboard/custom-domains/legal_contracts
Authorization: Bearer <jwt>

Intents

GET /dashboard/custom-domains/:domainKey/intents

GET https://api.liyaengine.ai/dashboard/custom-domains/legal_contracts/intents
Authorization: Bearer <jwt>

Response:

{
  "success": true,
  "data": {
    "intents": [
      {
        "id": "cint_01HZ...",
        "intentKey": "clause_extraction",
        "displayName": "Clause Extraction",
        "promptTemplate": "Extract all {{clause_type}} clauses from the following contract:\n\n{{contract_text}}",
        "outputSchema": null,
        "isActive": true
      }
    ]
  }
}

POST /dashboard/custom-domains/:domainKey/intents

POST https://api.liyaengine.ai/dashboard/custom-domains/legal_contracts/intents
Authorization: Bearer <jwt>
Content-Type: application/json
 
{
  "intentKey": "clause_extraction",
  "displayName": "Clause Extraction",
  "promptTemplate": "Extract all {{clause_type}} clauses from the following contract:\n\n{{contract_text}}",
  "outputSchema": {
    "clauses": "array of extracted clause objects",
    "summary": "brief summary of findings"
  }
}
FieldTypeRequiredDescription
intentKeystringYesLowercase, underscores — used in API path
displayNamestringYesHuman-readable name
promptTemplatestringYesPrompt with {{variable}} placeholders for input fields
outputSchemaobjectNoDescribes expected output structure — used for documentation only

Variables in promptTemplate (e.g. {{contract_text}}) become required input fields when calling the intent via the v1 API.


Calling a custom domain intent

Once created, custom intents are called exactly like built-in intents:

POST https://api.liyaengine.ai/v1/legal_contracts/clause_extraction
X-API-Key: liya_prod_...
Content-Type: application/json
 
{
  "input": {
    "clause_type": "termination",
    "contract_text": "This Agreement may be terminated by either party..."
  },
  "options": {
    "session_id": "sess_01HZ..."
  }
}

See Defining Intents for full details on prompt templates and variable mapping.

On this page