Creating a Custom Domain
Create and configure a custom domain via the dashboard API.
1. Create the domain
POST https://api.liyaengine.ai/dashboard/custom-domains
Authorization: Bearer <dashboard_jwt>
Content-Type: application/json
{
"domainKey": "legal-ops",
"displayName": "Legal Operations",
"description": "AI intelligence for legal operations and contract management",
"icon": "⚖",
"color": "#6366f1",
"systemPrompt": "You are a senior legal analyst at a commercial law firm. Provide precise, well-reasoned legal analysis. Always cite applicable law or standard practice when relevant."
}Response:
{
"success": true,
"data": {
"domain": {
"domain_key": "legal-ops",
"display_name": "Legal Operations",
"is_active": true,
"created_at": "2026-03-15T10:00:00Z"
}
}
}Creating a domain automatically adds its key to your tenant's enabled_domains.
Domain key rules
- Lowercase letters, numbers, and hyphens only:
^[a-z0-9-]+$ - Must be unique within your tenant
- Used as the URL path segment:
POST /v1/{domainKey}/{intentKey}
System prompt
The systemPrompt is injected at the top of every intent call within the domain. It sets the AI's role and context for all operations in this domain. Individual intents can add intent-specific instructions on top of it via their promptTemplate.
2. Verify in dashboard
After creation, the domain appears on your Domains page. You can manage intents and source types from there or continue via the API. Sample domains remain available for testing, but your production workflows should use domains you create and configure.
Listing your domains
GET /dashboard/custom-domains
Authorization: Bearer <dashboard_jwt>{
"success": true,
"data": {
"domains": [
{
"domain_key": "legal-ops",
"display_name": "Legal Operations",
"intents": [],
"source_types": []
}
]
}
}Archiving and deleting a domain
There are three ways to take a domain out of use, and they are not the same.
| What it does | Can you undo it? | |
|---|---|---|
| Archive (Dashboard: Archive domain) | Marks the domain archived. Nothing is deleted. | Yes: make the domain active again. |
Delete (DELETE /v1/domains/{key}) | Switches the domain off and removes it from your domains. Its row is kept for 30 days. | Not from the Dashboard or API. After 30 days a nightly cleanup removes it for good. |
Delete permanently (DELETE /v1/domains/{key}?permanent=true, or Delete domain permanently in the Dashboard) | Removes it now. | No. |
Archived domains are never removed automatically.
Delete permanently
curl -s -X DELETE "https://api.liyaengine.ai/v1/domains/legal-ops?permanent=true" \
-H "Authorization: Bearer $LIYA_API_KEY"{ "success": true, "data": { "deleted": "legal-ops", "permanent": true } }It needs a full-access API key. In the Dashboard, open the domain, choose Delete domain permanently, and type the domain key to confirm; only an owner sees it. You can delete a domain permanently whether or not it was deleted before.
What goes, and what stays:
- Removed: the domain, its intents and their version history, and its stored credentials.
- Collections: one that only this domain uses is removed with it. One that another domain also uses is kept, and handed to that other domain.
- Never deleted: your uploaded documents. Traces, usage and audit history keep the domain key as text.
- Refused while it is in use: a domain that still has agents or workflows returns
409 DOMAIN_HAS_RESOURCES. Move or delete them first.
The key is free afterwards. Creating a domain with the key of one that was deleted works, and starts clean.
Intents are different
Archiving an intent is not deleting it, so archived intents are never removed automatically. See Archiving and deleting an intent.