> ## Documentation Index
> Fetch the complete documentation index at: https://docs.telepatia.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Smart Templates

> Define how Telepatia generates the medical record for your consultations

A **Smart Template** (`medicalRecordConfiguration`) defines the medical record your consultation produces: a map of **sections**, where each section has an output schema and a prompt strategy.

<Tip>
  **Prefer Smart Templates with Telepatia Sections.** This is the recommended path: you control the EMR-shaped output, Telepatia maintains the curated medical prompts behind each section. Session Templates (`scribeSessionConfigurationId`) remain supported for legacy integrations.
</Tip>

## Lifecycle

1. **Define** the sections you need — see [Sections](/scribe-api/smart-templates-nodes).
2. **Create** it via `POST /v1/medical-record-configurations`. Telepatia hashes the content; identical configurations return the same `id` with `created: false` (idempotent).
3. **Reference** it on `POST /v1/set-consultation-context` using one of the two fields below.

## Three ways to attach a template to a session

| Mode                      | Field on `set-consultation-context` | When to use                                                                                                                        |
| ------------------------- | ----------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------- |
| Smart Template **inline** | `medicalRecordConfiguration`        | Ship the full JSON with each session. Telepatia auto-persists and dedups by content hash. **Recommended for client-driven flows.** |
| Smart Template **by id**  | `medicalRecordConfigurationId`      | You already created it via `POST /v1/medical-record-configurations` and want to reuse the id.                                      |
| Session Template          | `scribeSessionConfigurationId`      | Legacy curated flows.                                                                                                              |

<Note>
  Pass **exactly one** of the three. A future `scribeTemplates` field will accept either kind of template id — no breaking change is planned for the current variants.
</Note>

## Create a Smart Template

```bash theme={null}
curl -X POST https://scribe-api.telepatia.ai/v1/medical-record-configurations \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "General Consultation",
    "configuration": {
      "chiefComplaint": {
        "instructionSet": { "telepatiaPromptId": "CHIEF_COMPLAINT" },
        "schema": {
          "type": "object",
          "instructions": "Chief complaint",
          "properties": {
            "chiefComplaint": { "type": "string", "instructions": "Patient words" }
          }
        }
      }
    }
  }'
```

**Response:**

```json theme={null}
{
  "id": "mrc_a1b2c3d4e5f6g7h8",
  "name": "General Consultation",
  "hash": "sha256:…",
  "createdAt": "2026-06-02T10:00:00Z",
  "created": true
}
```

## List Smart Templates

```bash theme={null}
curl https://scribe-api.telepatia.ai/v1/medical-record-configurations \
  -H "Authorization: Bearer YOUR_API_KEY"
```

## Get a Smart Template by id

```bash theme={null}
curl https://scribe-api.telepatia.ai/v1/medical-record-configurations/mrc_a1b2c3d4e5f6g7h8 \
  -H "Authorization: Bearer YOUR_API_KEY"
```

## Delete a Smart Template

Soft-deletes a template by its public id. It returns `204 No Content` and drops out of the default list; historical consultations that referenced it are unaffected. Deletion is blocked with `409` while a linked session is still processing, and returns `404` if the id is not found.

```bash theme={null}
curl -X DELETE https://scribe-api.telepatia.ai/v1/medical-record-configurations/mrc_a1b2c3d4e5f6g7h8 \
  -H "Authorization: Bearer YOUR_API_KEY"
```

## Template status

List and detail responses expose a `status` per template:

| Status     | Meaning                                           |
| ---------- | ------------------------------------------------- |
| `active`   | Live and usable in a consultation.                |
| `inactive` | Archived — not offered by default.                |
| `deleted`  | Soft-deleted; kept only for historical reference. |

Deleted templates drop from the default list. Use the `?status` query parameter to change the view:

| `?status`   | Returns                                   |
| ----------- | ----------------------------------------- |
| *(omitted)* | Non-deleted templates only (default).     |
| `deleted`   | Only soft-deleted templates (audit view). |
| `all`       | Non-deleted and deleted templates.        |

```bash theme={null}
curl "https://scribe-api.telepatia.ai/v1/medical-record-configurations?status=all" \
  -H "Authorization: Bearer YOUR_API_KEY"
```

**Response:**

```json theme={null}
{
  "items": [
    {
      "id": "mrc_a1b2c3d4e5f6g7h8",
      "name": "General Consultation",
      "hash": "sha256:…",
      "createdAt": "2026-06-02T10:00:00Z",
      "specialties": [],
      "status": "active"
    }
  ],
  "total": 1,
  "page": 1,
  "limit": 20,
  "totalPages": 1
}
```

## Next steps

* [Sections](/scribe-api/smart-templates-nodes) — how prompts are resolved per section.
* [Telepatia Prompts catalog](/scribe-api/telepatia-nodes) — curated `telepatiaPromptId` reference.
* [OutputSchema reference](/scribe-api/smart-templates-output-schema) — types, examples, limits.
