Skip to main content
Beta ← Back to Guided Synthesis overview Use this when 90% of the base template is right but you want to patch a section title, swap a section’s writing style, or replace its output schema — for a single call, without changing the underlying template. A new auto-generated template aggregate is persisted with inheritedFromId pointing at the base template. The aggregate is fully resolved and drift-proof — but retained for 30 days only (see Auto-generated template aggregates — 30-day retention).
// Replace these with your values
const INTERACTION_ID = "<your-interaction-id>";
const SECTION_ID = "<your-section-id>";
const TEMPLATE_ID = "<your-template-id>";

const result = await client.documents.generate({
  outputLanguage: "en-US",
  interactionId: INTERACTION_ID,
  templateRef: {
    templateId: TEMPLATE_ID,
    overrides: {
      instructions: {
        prompt: "Produce a pediatric consultation note. Refer to the patient as the child.",
      },
      sections: [
        {
          sectionId: SECTION_ID,
          generation: {
            heading: "Anamnesis",
            instructions: {
              writingStylePrompt: "Family-centred language; use second person sparingly.",
            },
          },
        },
      ],
    },
  },
});
using Corti;

// Replace these with your values
const string InteractionId = "<your-interaction-id>";
const string SectionId = "<your-section-id>";
const string TemplateId = "<your-template-id>";

var result = await client.Documents.GenerateAsync(
    new GuidedDocumentsGenerateByTemplateRef
    {
        OutputLanguage = "en-US",
        InteractionId = InteractionId,
        TemplateRef = new GuidedTemplateRef
        {
            TemplateId = TemplateId,
            Overrides = new GuidedTemplateOverrides
            {
                Instructions = new GuidedTemplateInstructions
                {
                    Prompt = "Produce a pediatric consultation note. Refer to the patient as the child.",
                },
                Sections = new[]
                {
                    new GuidedSectionOverride
                    {
                        SectionId = SectionId,
                        Generation = new GuidedSectionOverrides
                        {
                            Heading = "Anamnesis",
                            Instructions = new GuidedSectionInstructionsOverride
                            {
                                WritingStylePrompt = "Family-centred language; use second person sparingly.",
                            },
                        },
                    },
                },
            },
        },
    });
import requests

# Replace these with your values
ENVIRONMENT = "<eu-or-us>"
INTERACTION_ID = "<your-interaction-id>"
SECTION_ID = "<your-section-id>"
TEMPLATE_ID = "<your-template-id>"
TENANT = "<your-tenant-name>"
TOKEN = "<your-access-token>"

response = requests.post(
    f"https://api.{ENVIRONMENT}.corti.app/v2/documents",
    headers={
        "Authorization": f"Bearer {TOKEN}",
        "Tenant-Name": TENANT,
        "Content-Type": "application/json",
    },
    json={
        "outputLanguage": "en-US",
        "interactionId": INTERACTION_ID,
        "templateRef": {
            "templateId": TEMPLATE_ID,
            "overrides": {
                "instructions": {
                    "prompt": "Produce a pediatric consultation note. Refer to the patient as the child.",
                },
                "sections": [
                    {
                        "sectionId": SECTION_ID,
                        "generation": {
                            "heading": "Anamnesis",
                            "instructions": {
                                "writingStylePrompt": "Family-centred language; use second person sparingly.",
                            },
                        },
                    },
                ],
            },
        },
    },
)
response.raise_for_status()
result = response.json()
# Replace these with your values
ENVIRONMENT="<eu-or-us>"
INTERACTION_ID="<your-interaction-id>"
SECTION_ID="<your-section-id>"
TEMPLATE_ID="<your-template-id>"
TENANT="<your-tenant-name>"
TOKEN="<your-access-token>"

curl --request POST \
  --url "https://api.${ENVIRONMENT}.corti.app/v2/documents" \
  --header "Authorization: Bearer ${TOKEN}" \
  --header "Tenant-Name: ${TENANT}" \
  --header "Content-Type: application/json" \
  --data "{
    \"outputLanguage\": \"en-US\",
    \"interactionId\": \"${INTERACTION_ID}\",
    \"templateRef\": {
      \"templateId\": \"${TEMPLATE_ID}\",
      \"overrides\": {
        \"instructions\": {
          \"prompt\": \"Produce a pediatric consultation note. Refer to the patient as the child.\"
        },
        \"sections\": [
          {
            \"sectionId\": \"${SECTION_ID}\",
            \"generation\": {
              \"heading\": \"Anamnesis\",
              \"instructions\": {
                \"writingStylePrompt\": \"Family-centred language; use second person sparingly.\"
              }
            }
          }
        ]
      }
    }
  }"

Override semantics — important

The override patches obey different merge rules per field:
  • instructions (template- or section-level) is per-field partial. Any field you omit is inherited from the parent’s published version.
  • outputSchema is wholesale. Whatever you submit fully replaces the parent schema. Partial schemas are not merged.
The same rules apply when you create an inheriting section via inheritFromId on POST /documents/sections.
Each section entry under overrides.sections must reference a section that is already linked to the base template version. You cannot add new sections via overrides — use Path 3 (assembly) for that.

When to use this path

ScenarioWhy Path 2
Per-user UI customization on top of a stable templateDrop the user-collected tweak straight into templateRef.overrides. No new resource per user.
One-off adjustment to a Corti Standard or your own templateThe base stays untouched; the auto-generated aggregate records exactly what was used.
You need traceability of what produced each documentThe response’s templateId / templateVersionId point at the persisted aggregate; reference it for 30 days.

Guided Synthesis overview

Shared concepts: input context, response shape, errors, 30-day retention.

Customization Cookbook — Recipe 3

The end-user-driven pattern that maps directly onto Path 2 (presets vs. free-prompt).