Skip to main content
POST
/
api
/
generate-letter
cURL
curl --request POST \
  --url https://forecaster.cairhealth.com/api/generate-letter \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "file_content": "<Base64 encoded file content here>",
  "patient_identifier": "PAT-12345",
  "patient_name": "John Doe",
  "patient_age": "45",
  "facility_name": "Medical Center",
  "visit_cost": "500.00",
  "provider_email": "contact@medicalcenter.com",
  "provider_phone": "+1-555-123-4567",
  "provider_signature": "Dr. Jane Smith",
  "provider_name": "Dr. Jane Smith, MD",
  "output_format": "pdf"
}'
{
"letter": "<Letter Content Here>",
"timestamp": "2025-10-16T14:30:45Z",
"invoice_cost": "500.00",
"patient_identifier": "PAT-12345"
}

Overview

This endpoint generates a Letter of Medical Necessity (LMN) from uploaded procedure notes using AI analysis. The letter can be returned in two formats:
  • Text format (default): Returns the letter content as plain text markdown
  • PDF format: Returns a professionally formatted PDF document with proper letter layout, including header, patient information, body content, signature, and footer

Output Formats

Text Format (output_format: "text" or omitted)

When requesting text format, the response includes a letter field containing the markdown-formatted letter content.

PDF Format (output_format: "pdf")

When requesting PDF format, the response includes a fileContent field containing a base64-encoded PDF document. The PDF includes:
  • Professional letter header with center name, contact information, and date
  • Patient information section
  • Formatted letter body with proper text wrapping
  • Signature section with expert name
  • Footer with generation timestamp

Authorizations

Authorization
string
header
required

Body

application/json
file_content
string
required
patient_identifier
string
required
patient_name
string
required
patient_age
string
required
facility_name
string
required
visit_cost
string
required
provider_email
string<email>
required
provider_phone
string
required
Example:
provider_signature
string
required
provider_name
string
required
Example:
output_format
enum<string>
default:text
Available options:
text,
pdf

Response

letter
string
fileContent
string
timestamp
string<date-time>
invoice_cost
string
patient_identifier
string