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
}
]
}
}
}
}
}
Retrieve a note template generation job by its unique identifier.
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
}
]
}
}
}
}
}
Show Note Template Job Object
pending
: Job is queued for processingprocessing
: Currently analyzing notes and generating templatecompleted
: Template generation complete, results availablefailed
: Processing failedShow Template Result Object
Show Analysis Insights
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
}
]
}
}
}
}
}
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));
}
}
// 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');
});