Templates API
List Templates
GET /api/templatesQuery Parameters
| Parameter | Type | Description |
|---|---|---|
industry | string | Filter by industry: legal, finance, devops, custom |
tags | string | Filter by tags (comma-separated) |
search | string | Search by name or description |
visibility | string | private, organization, public |
limit | number | Max results (default: 20) |
offset | number | Pagination offset |
Example
curl "https://devteam.marsala.dev/api/templates?industry=legal&search=contract" \
-H "Authorization: Bearer $API_KEY"Response
{
"success": true,
"data": [
{
"id": "contract-review-v1",
"name": "Contract Review",
"description": "Multi-step contract analysis pipeline...",
"version": "1.0.0",
"industry": "legal",
"tags": ["contract", "risk-analysis", "compliance"],
"author": "Matwal Legal Team",
"stepsCount": 4,
"estimatedCost": 0.034,
"estimatedDurationMs": 45000,
"hitlSteps": ["analyze-risk"],
"visibility": "public",
"createdAt": "2026-02-15T10:00:00Z"
}
],
"pagination": {
"total": 4,
"limit": 20,
"offset": 0,
"hasMore": false
}
}Get Template
GET /api/templates/:idReturns full template details including all steps and input schema.
Response
{
"success": true,
"data": {
"id": "contract-review-v1",
"name": "Contract Review",
"description": "Multi-step contract analysis pipeline...",
"version": "1.0.0",
"industry": "legal",
"tags": ["contract", "risk-analysis"],
"steps": [
{
"id": "extract",
"prompt": "Extract key clauses from: {{input.contract}}",
"model": "sonnet",
"maxTokens": 4096
},
{
"id": "analyze-risk",
"prompt": "Analyze risks in: {{extract.output}}",
"model": "opus",
"dependsOn": ["extract"],
"requiresApproval": true
}
],
"inputSchema": {
"type": "object",
"required": ["contract"],
"properties": {
"contract": { "type": "string", "description": "Full contract text" },
"jurisdiction": { "type": "string", "default": "United States" }
}
},
"estimatedCost": 0.034,
"estimatedDurationMs": 45000
}
}Create Template
POST /api/templatesPublish a custom template.
Request Body
{
"name": "Weekly Report Generator",
"description": "Generates weekly project status reports",
"version": "1.0.0",
"industry": "custom",
"tags": ["reporting", "project-management"],
"visibility": "organization",
"inputSchema": {
"type": "object",
"required": ["projectName", "tasks"],
"properties": {
"projectName": { "type": "string" },
"tasks": { "type": "array" }
}
},
"steps": [
{
"id": "categorize",
"prompt": "Categorize tasks: {{input.tasks}}",
"model": "haiku"
},
{
"id": "report",
"prompt": "Generate report for {{input.projectName}}: {{categorize.output}}",
"model": "sonnet",
"dependsOn": ["categorize"]
}
]
}Status Code: 201 Created
Deploy Template
POST /api/templates/:id/deployDeploy a template as a plan and execute it.
Request Body
{
"input": {
"contract": "Full text of the contract...",
"jurisdiction": "Delaware"
},
"modelOverrides": {
"analyze-risk": "opus"
},
"queueOverrides": {
"analyze-risk": "gpu-queue"
},
"hitl": {
"requiredFor": ["analyze-risk"],
"confidenceThreshold": 0.90
}
}Response
Returns a plan execution object (same as POST /api/plans/:id/execute response).
{
"success": true,
"data": {
"id": "dt_exec_def456",
"planId": "dt_plan_auto_001",
"templateId": "contract-review-v1",
"status": "running",
"progress": { "total": 4, "completed": 0, "running": 1, "pending": 3 }
}
}Next Steps
- HITL API -- Approval management endpoints
- WebSocket API -- Real-time event subscriptions