Skip to main content
Create a patient and session, submit a short transcript, and stream your first consult note. No audio is needed.

Before you begin

  • Complete sandbox onboarding and authentication.
  • Load the returned Partner JWT into CORTEXA_JWT. It needs scribe:read, scribe:write, and scribe:generate.
  • The authorized clinician needs an available consult-note template and generation entitlement.
  • Run the commands in the same Bash shell with cURL and jq available.
The examples use synthetic data and capture returned IDs for subsequent requests.
Keep the demo ID and operation keys unchanged when retrying this run.

1. Create a synthetic patient

The response returns a Cortexa patient ID. Reusing the external ID returns the same patient within this grant.

2. Create the consultation

The session keeps this consultation’s inputs and outputs together. See Sessions for optional language and template settings.

3. Submit the conversation

The response includes the combined full_text and transcript status. For a longer conversation, submit multiple transcript batches.

4. Choose an available template

Choose an ID from the returned items. Load it into CORTEXA_TEMPLATE_ID:
If the list is empty, ask your integration contact to enable a template.

5. Stream the note

The 200 response stays open while generation runs. You will see generation.started, followed by text in output.delta events, and then an output.ready event containing the saved document. No polling is needed. Completed output may be returned immediately without deltas. The command saves the synthetic response to cortexa-note-events.txt.

6. Read the completed note

This example requested one template. Extract its final document from the saved SSE events:
If no ready document was returned, handle the failure event or reconnect using the same request and key. A closed stream alone is not success. The Streaming guide explains failures, reconnects, and the optional ?stream=false JSON mode for background integrations. The final document includes rendered_text, structured content, status, and current_version. Present the text for clinician review. To retain edits in Cortexa, save a versioned document update. Use your own EHR API to save the reviewed text into the mapped encounter.

Next steps

Use audio

Replace transcript submission with a complete recording upload.

Add background reports

Include relevant clinical context before generation.

Create additional outputs

Generate a referral or other document from the same session.

Handle real-world requests

Add retries, rate-limit handling, and version-conflict recovery.