curl -X GET "https://api.sully.ai/alpha/note-templates/template_abc123def456" \
-H "Authorization: Bearer YOUR_API_KEY"
const response = await fetch('https://api.sully.ai/alpha/note-templates/template_abc123def456', {
method: 'GET',
headers: {
'Authorization': 'Bearer YOUR_API_KEY'
}
});
const data = await response.json();
console.log(data);
import requests
url = "https://api.sully.ai/alpha/note-templates/template_abc123def456"
headers = {
"Authorization": "Bearer YOUR_API_KEY"
}
response = requests.get(url, headers=headers)
result = response.json()
print(result)
{
"data": {
"id": "template_abc123def456",
"mode": "generate",
"status": "completed",
"created_at": "2024-01-15T10:30:00Z",
"updated_at": "2024-01-15T10:35:00Z",
"result": {
"template": {
"id": "generated-template-xyz789",
"title": "Cardiology Consultation Template",
"global_prompt": "Create a comprehensive cardiology consultation note following standard clinical documentation practices.",
"sections": [
{
"id": "chief_complaint",
"type": "heading",
"properties": {
"level": 1,
"text": "Chief Complaint"
},
"children": [
{
"id": "chief_complaint_text",
"type": "text",
"prompt": "Document the patient's primary concern in their own words.",
"properties": {
"formatting_style": "markdown",
"detail_level": "standard",
"tone": "formal"
}
}
]
},
{
"id": "assessment",
"type": "heading",
"properties": {
"level": 1,
"text": "Assessment"
},
"children": [
{
"id": "assessment_text",
"type": "text",
"prompt": "Provide clinical impression and differential diagnosis.",
"properties": {
"formatting_style": "markdown",
"detail_level": "detailed",
"tone": "technical"
}
}
]
}
]
}
}
}
}
{
"data": {
"id": "template_xyz789ghi012",
"status": "completed",
"mode": "refine",
"created_at": "2024-01-15T10:30:00Z",
"updated_at": "2024-01-15T10:37:00Z",
"result": {
"template": {
"id": "refined-template-xyz789",
"title": "Enhanced Cardiology Consultation Template",
"global_prompt": "Create a comprehensive cardiology consultation note with enhanced assessment detail and differential diagnosis.",
"sections": [
{
"id": "chief_complaint",
"type": "heading",
"properties": {
"level": 1,
"text": "Chief Complaint"
},
"children": [
{
"id": "chief_complaint_text",
"type": "text",
"prompt": "Document the patient's primary concern in their own words, including severity (1-10) and duration.",
"properties": {
"formatting_style": "markdown",
"detail_level": "detailed",
"tone": "formal"
}
}
]
},
{
"id": "assessment",
"type": "heading",
"properties": {
"level": 1,
"text": "Assessment"
},
"children": [
{
"id": "assessment_text",
"type": "text",
"prompt": "Provide clinical impression with severity scoring, differential diagnosis (minimum 3 options), and risk stratification.",
"properties": {
"formatting_style": "markdown",
"detail_level": "detailed",
"tone": "technical"
}
}
]
}
]
}
}
}
}
{
"data": {
"id": "template_abc123def456",
"status": "pending",
"mode": "generate",
"created_at": "2024-01-15T10:30:00Z",
"updated_at": "2024-01-15T10:30:00Z"
}
}
{
"data": {
"id": "template_abc123def456",
"status": "failed",
"mode": "generate",
"created_at": "2024-01-15T10:30:00Z",
"updated_at": "2024-01-15T10:35:00Z",
"result": {
"error": "Failed to generate note template"
}
}
}
Alpha API Reference
Get Note Template Job
Retrieve a note template job (generation or refinement) by its unique identifier.
GET
/
alpha
/
note-templates
/
{id}
curl -X GET "https://api.sully.ai/alpha/note-templates/template_abc123def456" \
-H "Authorization: Bearer YOUR_API_KEY"
const response = await fetch('https://api.sully.ai/alpha/note-templates/template_abc123def456', {
method: 'GET',
headers: {
'Authorization': 'Bearer YOUR_API_KEY'
}
});
const data = await response.json();
console.log(data);
import requests
url = "https://api.sully.ai/alpha/note-templates/template_abc123def456"
headers = {
"Authorization": "Bearer YOUR_API_KEY"
}
response = requests.get(url, headers=headers)
result = response.json()
print(result)
{
"data": {
"id": "template_abc123def456",
"mode": "generate",
"status": "completed",
"created_at": "2024-01-15T10:30:00Z",
"updated_at": "2024-01-15T10:35:00Z",
"result": {
"template": {
"id": "generated-template-xyz789",
"title": "Cardiology Consultation Template",
"global_prompt": "Create a comprehensive cardiology consultation note following standard clinical documentation practices.",
"sections": [
{
"id": "chief_complaint",
"type": "heading",
"properties": {
"level": 1,
"text": "Chief Complaint"
},
"children": [
{
"id": "chief_complaint_text",
"type": "text",
"prompt": "Document the patient's primary concern in their own words.",
"properties": {
"formatting_style": "markdown",
"detail_level": "standard",
"tone": "formal"
}
}
]
},
{
"id": "assessment",
"type": "heading",
"properties": {
"level": 1,
"text": "Assessment"
},
"children": [
{
"id": "assessment_text",
"type": "text",
"prompt": "Provide clinical impression and differential diagnosis.",
"properties": {
"formatting_style": "markdown",
"detail_level": "detailed",
"tone": "technical"
}
}
]
}
]
}
}
}
}
{
"data": {
"id": "template_xyz789ghi012",
"status": "completed",
"mode": "refine",
"created_at": "2024-01-15T10:30:00Z",
"updated_at": "2024-01-15T10:37:00Z",
"result": {
"template": {
"id": "refined-template-xyz789",
"title": "Enhanced Cardiology Consultation Template",
"global_prompt": "Create a comprehensive cardiology consultation note with enhanced assessment detail and differential diagnosis.",
"sections": [
{
"id": "chief_complaint",
"type": "heading",
"properties": {
"level": 1,
"text": "Chief Complaint"
},
"children": [
{
"id": "chief_complaint_text",
"type": "text",
"prompt": "Document the patient's primary concern in their own words, including severity (1-10) and duration.",
"properties": {
"formatting_style": "markdown",
"detail_level": "detailed",
"tone": "formal"
}
}
]
},
{
"id": "assessment",
"type": "heading",
"properties": {
"level": 1,
"text": "Assessment"
},
"children": [
{
"id": "assessment_text",
"type": "text",
"prompt": "Provide clinical impression with severity scoring, differential diagnosis (minimum 3 options), and risk stratification.",
"properties": {
"formatting_style": "markdown",
"detail_level": "detailed",
"tone": "technical"
}
}
]
}
]
}
}
}
}
{
"data": {
"id": "template_abc123def456",
"status": "pending",
"mode": "generate",
"created_at": "2024-01-15T10:30:00Z",
"updated_at": "2024-01-15T10:30:00Z"
}
}
{
"data": {
"id": "template_abc123def456",
"status": "failed",
"mode": "generate",
"created_at": "2024-01-15T10:30:00Z",
"updated_at": "2024-01-15T10:35:00Z",
"result": {
"error": "Failed to generate note template"
}
}
}
Overview
Retrieve the details and results of a specific note template job using its unique identifier. This endpoint returns the current status of the job and any available results, supporting both generation and refinement jobs.Path Parameters
string
required
The unique identifier of the note template job to retrieve
Response
object
The note template job object with current status and results
Show Note Template Job Object
Show Note Template Job Object
string
Unique identifier for the template job
string
Current status of the job
pending: Job is queued for processingprocessing: Currently processing the requestcompleted: Processing complete, results availablefailed: Processing failed
string
The operation mode for this job
generate: Creating a template from provider notesrefine: Improving an existing template
string
Timestamp when the job was created (ISO 8601 format)
string
Timestamp when the job was last updated (ISO 8601 format)
object
Available when status is “completed” - contains the generated/refined template
object
string
Error message if processing failed
curl -X GET "https://api.sully.ai/alpha/note-templates/template_abc123def456" \
-H "Authorization: Bearer YOUR_API_KEY"
const response = await fetch('https://api.sully.ai/alpha/note-templates/template_abc123def456', {
method: 'GET',
headers: {
'Authorization': 'Bearer YOUR_API_KEY'
}
});
const data = await response.json();
console.log(data);
import requests
url = "https://api.sully.ai/alpha/note-templates/template_abc123def456"
headers = {
"Authorization": "Bearer YOUR_API_KEY"
}
response = requests.get(url, headers=headers)
result = response.json()
print(result)
{
"data": {
"id": "template_abc123def456",
"mode": "generate",
"status": "completed",
"created_at": "2024-01-15T10:30:00Z",
"updated_at": "2024-01-15T10:35:00Z",
"result": {
"template": {
"id": "generated-template-xyz789",
"title": "Cardiology Consultation Template",
"global_prompt": "Create a comprehensive cardiology consultation note following standard clinical documentation practices.",
"sections": [
{
"id": "chief_complaint",
"type": "heading",
"properties": {
"level": 1,
"text": "Chief Complaint"
},
"children": [
{
"id": "chief_complaint_text",
"type": "text",
"prompt": "Document the patient's primary concern in their own words.",
"properties": {
"formatting_style": "markdown",
"detail_level": "standard",
"tone": "formal"
}
}
]
},
{
"id": "assessment",
"type": "heading",
"properties": {
"level": 1,
"text": "Assessment"
},
"children": [
{
"id": "assessment_text",
"type": "text",
"prompt": "Provide clinical impression and differential diagnosis.",
"properties": {
"formatting_style": "markdown",
"detail_level": "detailed",
"tone": "technical"
}
}
]
}
]
}
}
}
}
{
"data": {
"id": "template_xyz789ghi012",
"status": "completed",
"mode": "refine",
"created_at": "2024-01-15T10:30:00Z",
"updated_at": "2024-01-15T10:37:00Z",
"result": {
"template": {
"id": "refined-template-xyz789",
"title": "Enhanced Cardiology Consultation Template",
"global_prompt": "Create a comprehensive cardiology consultation note with enhanced assessment detail and differential diagnosis.",
"sections": [
{
"id": "chief_complaint",
"type": "heading",
"properties": {
"level": 1,
"text": "Chief Complaint"
},
"children": [
{
"id": "chief_complaint_text",
"type": "text",
"prompt": "Document the patient's primary concern in their own words, including severity (1-10) and duration.",
"properties": {
"formatting_style": "markdown",
"detail_level": "detailed",
"tone": "formal"
}
}
]
},
{
"id": "assessment",
"type": "heading",
"properties": {
"level": 1,
"text": "Assessment"
},
"children": [
{
"id": "assessment_text",
"type": "text",
"prompt": "Provide clinical impression with severity scoring, differential diagnosis (minimum 3 options), and risk stratification.",
"properties": {
"formatting_style": "markdown",
"detail_level": "detailed",
"tone": "technical"
}
}
]
}
]
}
}
}
}
{
"data": {
"id": "template_abc123def456",
"status": "pending",
"mode": "generate",
"created_at": "2024-01-15T10:30:00Z",
"updated_at": "2024-01-15T10:30:00Z"
}
}
{
"data": {
"id": "template_abc123def456",
"status": "failed",
"mode": "generate",
"created_at": "2024-01-15T10:30:00Z",
"updated_at": "2024-01-15T10:35:00Z",
"result": {
"error": "Failed to generate note template"
}
}
}
Status Codes
OK
Note template job retrieved successfully
Unauthorized
Invalid or missing API key
Not Found
Note template job with the specified ID was not found
Internal Server Error
Server error occurred while retrieving the job
Polling for Results
Since note template jobs are 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 job failed: ${data.data.result?.error || data.data.error || 'Unknown 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 Results
Generation Jobs: Once a template is generated, you can:- Import the template into your documentation system
- Customize sections and prompts as needed
- Use it as a starting point for similar note types
- Analyze the insights to understand your documentation patterns
- Replace your existing template with the refined version
- Review the refinement analysis to understand what changed
- Use the quality metrics to assess improvement
- Further refine if needed based on the analysis
Webhook Integration
For production use, consider setting up webhooks instead of polling:// Webhook handler example
app.post('/webhook/note-template', (req, res) => {
const { id, mode, status, result } = req.body.data;
if (status === 'completed') {
if (mode === 'generation') {
// Process the completed generation
console.log('Template generated:', result.template);
console.log('Analysis insights:', result.insights);
} else if (mode === 'refinement') {
// Process the completed refinement
console.log('Template refined:', result.refined_template);
console.log('Changes applied:', result.refinement_analysis.changes_applied);
}
} else if (status === 'failed') {
// Handle the error
console.error('Template job failed:', result?.error || 'Unknown error');
}
res.status(200).send('OK');
});
Related Endpoints
- Create Note Template - Create a new template job
- Delete Note Template - Delete a template job
⌘I