Prompt Templates
Template CRUD, variable injection, and versioning.
Prompt templates standardize inference requests across teams with versioned, auditable prompt definitions. Templates decouple prompt engineering from application code and ensure every production call references an immutable, reviewable artifact.
Create a Template
POST /v1/templates
Authorization: Bearer eridian_sk_...
Content-Type: application/json
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
name | string | Yes | Human-readable template name |
content | string | Yes | Prompt body with {{variable}} placeholders |
variables | array | Yes | Declared variable names used in content |
version | string | Yes | Semantic version (e.g. 3.2.1) |
project_id | string | Yes | Owning project |
description | string | No | Change summary for reviewers |
{
"name": "contract_summary_v3",
"content": "Summarize the following contract, focusing on {{focus_area}}:\n\n{{document}}",
"variables": ["focus_area", "document"],
"version": "3.2.1",
"project_id": "prj_legal_001"
}
Response
{
"id": "tpl_contract_summary_v3",
"object": "eridian.template",
"name": "contract_summary_v3",
"version": "3.2.1",
"status": "draft",
"created_at": 1718400000
}
Required scope: templates:manage
Publish and Versioning
Templates are immutable once published. To modify content, create a new version:
POST /v1/templates/tpl_contract_summary_v3/versions
{
"version": "3.3.0",
"content": "Summarize the following contract, focusing on {{focus_area}}:\n\n{{document}}",
"changelog": "Require explicit termination-cap language in the output."
}
Published versions cannot be edited in place. Inference responses include eridian.template_id and eridian.template_version for audit trails and cache fingerprinting.
GET /v1/templates/tpl_contract_summary_v3/versions
POST /v1/templates/tpl_contract_summary_v3/publish
Publish moves a draft to published. On Enterprise projects with evals_required, publish is blocked until an evaluation run is attached and dual control approves.
| Status | Behavior |
|---|---|
draft | Editable; not callable from inference |
published | Immutable; callable from inference |
deprecated | Callable but flagged in audit logs |
archived | Not callable; retained for compliance |
Diff two versions:
GET /v1/templates/tpl_contract_summary_v3/versions/compare?from=3.2.1&to=3.3.0
Variable Injection
Pass template variables at inference time instead of embedding raw prompts:
{
"template_id": "tpl_contract_summary_v3",
"template_variables": {
"focus_area": "termination clauses",
"document": "..."
},
"project_id": "prj_legal_001",
"model": "auto"
}
Missing required variables return HTTP 400 with error.code: template_variable_missing. Unknown variables are rejected unless allow_extra_variables: true is set on the template.
List and Retrieve
GET /v1/templates?project_id=prj_legal_001
GET /v1/templates/tpl_contract_summary_v3
List responses paginate with starting_after cursors. Each entry includes latest published version and draft status if one exists.
Governance Integration
Template publishes emit audit events (template.publish) visible in the governance audit log. Budget and rate-limit policies apply to template-backed inference identically to free-form prompts. Semantic cache keys include template_version so prompt refactors do not serve stale policy language.
Error Codes
| HTTP | Code | Meaning |
|---|---|---|
| 400 | template_variable_missing | Required variable not supplied |
| 404 | template_not_found | Unknown template ID |
| 409 | template_version_conflict | Version already published |
| 403 | insufficient_scope | Missing templates:manage |
See Inference for calling templates from the core endpoint, Evaluations for promotion gates, and Semantic Caching for cache interaction with template versions.
Production API credentials are issued with an institution workspace. Contact sales if you need access.