Documentation
System Prompts
Dashboard

API Documentation

Scoped instruction management across project/subject/chat with priority composition and integration-bound template variable support.

System Prompts
GETpromptsPOSTpromptsPATCH:idDELETE:idGETresolve

Overview

System prompts are managed instructions automatically injected into LLM requests. They support scoping at project, subject, or chat level.

project
scope
Applies to all requests in the project (default).
subject
scope
Applies only to requests with a matching subject_id.
chat
scope
Applies only to requests with a matching chat_id.

Prompts are layered: project → subject → chat. Multiple prompts are concatenated.

Dynamic Context is supported with {{var_name}} tokens via thetemplate object. Integration resolution is controlled byMNX_PROMPT_TEMPLATE_RENDER_ENABLED.

See Integrations for connector setup, test/sync flows, and Request Trace observability fields.

GET/api/v1/prompts

List all system prompts for your project.

Scope:prompts:read
Request
bash
curl "https://www.mnexium.com/api/v1/prompts" \
  -H "x-mnexium-key: $MNX_KEY"
Response
json
{
  "prompts": [
    {
      "id": "sp_abc123",
      "name": "Default Assistant",
      "prompt_text": "You are a helpful assistant.",
      "scope": "project",
      "is_default": true,
      "priority": 100
    }
  ]
}
POST/api/v1/prompts

Create a new system prompt. Set is_default: true for auto-injection.

Scope:prompts:write
namerequired
string
Display name for the prompt.
prompt_textrequired
string
The system prompt content.
scope
string
One of: project, subject, chat. Default: project
scope_id
string
Required if scope is subject or chat.
is_default
boolean
Set as default for auto-injection.
priority
number
Lower = injected first. Default: 100
template
object
Optional template config for integration-backed {{var}} tokens.
Request
bash
curl -X POST "https://www.mnexium.com/api/v1/prompts" \
  -H "x-mnexium-key: $MNX_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Default Assistant",
    "prompt_text": "You are a helpful assistant for {{customer_name}}.",
    "scope": "project",
    "is_default": true,
    "template": {
      "enabled": true,
      "variables": {
        "customer_name": {
          "source": "integration",
          "integration_id": "int_crm",
          "key": "customer_name",
          "live_fetch": false,
          "default": "customer"
        }
      }
    }
  }'
Response
json
{
  "ok": true,
  "prompt": {
    "id": "sp_abc123",
    "name": "Default Assistant",
    "scope": "project"
  }
}
PATCH/api/v1/prompts/:id

Update an existing system prompt. Only provided fields are updated.

Scope:prompts:write
idrequired
path
The prompt ID to update.
name
string
New display name.
prompt_text
string
New prompt content.
is_default
boolean
Set/unset as default.
is_active
boolean
Enable/disable the prompt.
priority
number
New priority value.
template
object
Update template variable mappings.
Request
bash
curl -X PATCH "https://www.mnexium.com/api/v1/prompts/sp_abc123" \
  -H "x-mnexium-key: $MNX_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "prompt_text": "You are a friendly assistant.",
    "is_default": true
  }'
Response
json
{
  "ok": true,
  "id": "sp_abc123",
  "updated": true
}
DELETE/api/v1/prompts/:id

Soft-delete a system prompt. The prompt is deactivated but retained for audit purposes.

Scope:prompts:delete
idrequired
path
The prompt ID to delete.
Request
bash
curl -X DELETE "https://www.mnexium.com/api/v1/prompts/sp_abc123" \
  -H "x-mnexium-key: $MNX_KEY"
Response
json
{
  "ok": true,
  "id": "sp_abc123",
  "deleted": true
}
GET/api/v1/prompts/resolve

Preview which prompts will be injected for a given context.

Scope:prompts:read
subject_id
string
Include subject-scoped prompts.
chat_id
string
Include chat-scoped prompts.
combined
boolean
Return single concatenated string.
Request
bash
curl -G "https://www.mnexium.com/api/v1/prompts/resolve" \
  -H "x-mnexium-key: $MNX_KEY" \
  --data-urlencode "subject_id=user_123" \
  --data-urlencode "combined=true"
Response
json
// When combined=true:
{
  "prompt_text": "You are a helpful assistant.\n\nThis user prefers concise responses.",
  "has_prompt": true
}

// When combined=false (default):
{
  "prompts": [
    { "id": "sp_abc123", "scope": "project", ... },
    { "id": "sp_def456", "scope": "subject", ... }
  ],
  "count": 2
}

Using system_prompt and memory_policy in Requests

Control system prompt injection and memory extraction policy via mnx.system_prompt and mnx.memory_policy:

// Auto-resolve based on context (default)
"mnx": { "subject_id": "user_123" }

// Skip system prompt injection
"mnx": { "system_prompt": false }

// Use a specific prompt by ID
"mnx": { "system_prompt": "sp_sales_assistant" }

// Use a specific memory policy by ID
"mnx": { "memory_policy": "mp_support_assistant" }

// Disable memory policy for this request
"mnx": { "memory_policy": false }