Skip to main content

How generation works

Generation is a backend-run flow.
  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 generated report metadata:
{
  "job_id": "7f3f5a92-0e5d-4c54-bc7b-1d3f5d2c5a4f",
  "type": "report_generation",
  "status": "completed",
  "result": {
    "report_id": "67d6...",
    "client_id": 864,
    "title": "Functional capacity report"
  }
}

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.