Skip to main content

How generation works

Generation is a backend-run flow. Templates can contain prompt nodes, static content, or a mix of both. If the selected template contains prompt nodes, Everbility generates those sections from the supplied note content. If the template contains no prompt nodes, the job still completes and saves the template content directly as a report without invoking generation.
  1. List templates with GET /templates.
  2. Fetch the template you want with GET /templates/{template_id}.
  3. Collect the note_id values you want to use.
  4. Call POST /clients/{client_id}/reports/generate and store the returned job_id.
  5. Poll GET /jobs/{job_id} until the job completes.
  6. Fetch the saved report from /clients/{client_id}/documents/{report_id}.

Request body

{
  "template_id": "<template_id>",
  "note_ids": ["<note_id_1>", "<note_id_2>"],
  "title": "Optional custom report title"
}
All note_ids must belong to the same client and be visible to the API key you used.

Job lifecycle

The generation endpoint returns JSON immediately:
{
  "job_id": "7f3f5a92-0e5d-4c54-bc7b-1d3f5d2c5a4f"
}
Poll GET /jobs/{job_id} until the job reaches a terminal state. Possible statuses are:
  • queued
  • in_progress
  • completed
  • failed
Completed jobs include the saved report metadata:
{
  "job_id": "7f3f5a92-0e5d-4c54-bc7b-1d3f5d2c5a4f",
  "task_type": "report_generation",
  "status": "completed",
  "result": {
    "report_id": "67d6...",
    "client_id": 864,
    "title": "Functional capacity report"
  }
}
When the template contains prompt nodes, result may also include fields such as total_nodes and completed_nodes.

Fetch the generated report

After the job is completed, fetch the report by ID:
curl -s \
  -H "Authorization: Bearer <api_key>" \
  "https://api.everbility.com/v1/public/clients/864/documents/<report_id>?format=markdown"
Use format=markdown or format=html.