GET
/
alpha
/
note-templates
/
{id}
curl -X GET "https://api.sully.ai/alpha/note-templates/template_abc123def456" \
  -H "Authorization: Bearer YOUR_API_KEY"
{
  "data": {
    "id": "template_abc123def456",
    "status": "completed",
    "created_at": "2024-01-15T10:30:00Z",
    "updated_at": "2024-01-15T10:35:00Z",
    "result": {
      "template": {
        "id": "template_xyz789",
        "title": "Cardiology Consultation Template",
        "globalPrompt": "Create a comprehensive cardiology consultation note following standard clinical documentation practices.",
        "sections": [
          {
            "id": "chief_complaint",
            "title": "Chief Complaint",
            "type": "text",
            "prompt": "Document the patient's primary concern in their own words."
          },
          {
            "id": "hpi",
            "title": "History of Present Illness",
            "type": "text",
            "prompt": "Provide detailed chronological account of the current illness including onset, duration, character, and associated symptoms."
          },
          {
            "id": "physical_exam",
            "title": "Physical Examination",
            "type": "structured",
            "prompt": "Document vital signs and focused cardiovascular examination findings."
          },
          {
            "id": "assessment",
            "title": "Assessment",
            "type": "text",
            "prompt": "Provide clinical impression and differential diagnosis."
          },
          {
            "id": "plan",
            "title": "Plan",
            "type": "list",
            "prompt": "Outline diagnostic tests, treatments, and follow-up recommendations."
          }
        ]
      },
      "insights": {
        "commonHeadings": [
          {
            "text": "Chief Complaint",
            "frequency": 2,
            "level": 1
          },
          {
            "text": "History of Present Illness",
            "frequency": 2,
            "level": 1
          },
          {
            "text": "Physical Exam",
            "frequency": 2,
            "level": 1
          }
        ],
        "styleAnalysis": {
          "predominantTone": "formal",
          "detailLevel": "detailed",
          "commonPhrases": [
            "presents with",
            "vital signs stable",
            "follow-up in"
          ],
          "writingStyle": "Structured clinical documentation with systematic approach to patient assessment"
        },
        "statistics": {
          "totalNotes": 2,
          "averageNoteLength": 245,
          "mostCommonWords": [
            {
              "word": "patient",
              "count": 4
            },
            {
              "word": "chest",
              "count": 3
            }
          ]
        }
      }
    }
  }
}

Overview

Retrieve the details and results of a specific note template generation job using its unique identifier. This endpoint returns the current status of the job and any available template results.

Path Parameters

id
string
required
The unique identifier of the note template generation job to retrieve

Response

data
object
The note template generation job object with current status and results
curl -X GET "https://api.sully.ai/alpha/note-templates/template_abc123def456" \
  -H "Authorization: Bearer YOUR_API_KEY"
{
  "data": {
    "id": "template_abc123def456",
    "status": "completed",
    "created_at": "2024-01-15T10:30:00Z",
    "updated_at": "2024-01-15T10:35:00Z",
    "result": {
      "template": {
        "id": "template_xyz789",
        "title": "Cardiology Consultation Template",
        "globalPrompt": "Create a comprehensive cardiology consultation note following standard clinical documentation practices.",
        "sections": [
          {
            "id": "chief_complaint",
            "title": "Chief Complaint",
            "type": "text",
            "prompt": "Document the patient's primary concern in their own words."
          },
          {
            "id": "hpi",
            "title": "History of Present Illness",
            "type": "text",
            "prompt": "Provide detailed chronological account of the current illness including onset, duration, character, and associated symptoms."
          },
          {
            "id": "physical_exam",
            "title": "Physical Examination",
            "type": "structured",
            "prompt": "Document vital signs and focused cardiovascular examination findings."
          },
          {
            "id": "assessment",
            "title": "Assessment",
            "type": "text",
            "prompt": "Provide clinical impression and differential diagnosis."
          },
          {
            "id": "plan",
            "title": "Plan",
            "type": "list",
            "prompt": "Outline diagnostic tests, treatments, and follow-up recommendations."
          }
        ]
      },
      "insights": {
        "commonHeadings": [
          {
            "text": "Chief Complaint",
            "frequency": 2,
            "level": 1
          },
          {
            "text": "History of Present Illness",
            "frequency": 2,
            "level": 1
          },
          {
            "text": "Physical Exam",
            "frequency": 2,
            "level": 1
          }
        ],
        "styleAnalysis": {
          "predominantTone": "formal",
          "detailLevel": "detailed",
          "commonPhrases": [
            "presents with",
            "vital signs stable",
            "follow-up in"
          ],
          "writingStyle": "Structured clinical documentation with systematic approach to patient assessment"
        },
        "statistics": {
          "totalNotes": 2,
          "averageNoteLength": 245,
          "mostCommonWords": [
            {
              "word": "patient",
              "count": 4
            },
            {
              "word": "chest",
              "count": 3
            }
          ]
        }
      }
    }
  }
}

Status Codes

200
OK
Note template generation job retrieved successfully
401
Unauthorized
Invalid or missing API key
404
Not Found
Note template generation job with the specified ID was not found
500
Internal Server Error
Server error occurred while retrieving the job

Polling for Results

Since note template generation is processed asynchronously, you may need to poll this endpoint periodically to check for completion:
async function waitForTemplate(jobId) {
  let status = 'pending';
  
  while (status === 'pending' || status === 'processing') {
    const response = await fetch(`https://api.sully.ai/alpha/note-templates/${jobId}`, {
      headers: { 'Authorization': 'Bearer YOUR_API_KEY' }
    });
    
    const data = await response.json();
    status = data.data.status;
    
    if (status === 'completed') {
      return data.data;
    }
    
    if (status === 'failed') {
      throw new Error(`Template generation failed: ${data.data.error}`);
    }
    
    // Wait 10 seconds before polling again
    await new Promise(resolve => setTimeout(resolve, 10000));
  }
}

Understanding the Results

Template Structure

The generated template includes:
  • Sections: Organized structure based on your notes
  • Prompts: AI-generated prompts for each section
  • Types: Section types (text, list, structured) based on content patterns

Analysis Insights

The insights provide valuable information about your documentation patterns:
  • Common Headings: Most frequently used section headers
  • Style Analysis: Your writing tone and detail preferences
  • Statistics: Quantitative analysis of your notes

Using the Template

Once generated, you can:
  1. Import the template into your documentation system
  2. Customize sections and prompts as needed
  3. Use it as a starting point for similar note types

Webhook Integration

For production use, consider setting up webhooks instead of polling:
// Webhook handler example
app.post('/webhook/note-template', (req, res) => {
  const { jobId, status, result } = req.body;
  
  if (status === 'completed') {
    // Process the completed template
    console.log('Template ready:', result.template);
  } else if (status === 'failed') {
    // Handle the error
    console.error('Template generation failed:', req.body.error);
  }
  
  res.status(200).send('OK');
});