diff --git a/openapi.yaml b/openapi.yaml
index b667307..c853187 100644
--- a/openapi.yaml
+++ b/openapi.yaml
@@ -3947,6 +3947,79 @@ paths:
"422":
$ref: '#/components/responses/UnprocessableEntity'
+ /sessions_and_attendance:
+ get:
+ tags: [Events]
+ summary: Get sessions run and attendance
+ description: |
+ Delivery figures from Scheduling for the Projects you can view (Editor, Reporter or Observer of the
+ Project or its Organisation): how many **Events** (sessions) were run, the hours delivered, and how well
+ they were attended. An Event counts when its start falls between `start_date` and `end_date`.
+
+ `totals` holds:
+ - `events_scheduled`: every Event in the dates; `events_held`: those that have already started.
+ - `hours_delivered`: the length (start to end) of the Events held, in hours.
+ - `invited_contacts`: distinct Contacts added to the Events as guests.
+ - `attending_contacts`: distinct Contacts with attendance recorded on an Event's attendance form, whether
+ or not they were invited.
+ - `attendance_rates`: one entry per Engagement tracker on the Events' attendance forms.
+ `attendance_rate` is `attendances` (attendance records) divided by `invitations` (each time a Contact
+ was added to an Event), as the **Event Attendance** page's "Total across all guests" row shows it. It
+ counts records, not distinct Events, so it can exceed 100% when an Event has duplicate attendance
+ Stories. It is `null` when nobody was invited.
+
+ Deleted Contacts are left out. Makerble doesn't record cancelled Events. With `group_by`, `data` holds one
+ row per group (every month in the dates, Projects, or Event formats), each with the same figures as
+ `totals`; without it `data` is empty. `last_synced_datetime` doesn't apply, as the figures are totals.
+ These are the figures ReportMaker uses to answer delivery questions.
+ operationId: getSessionsAndAttendance
+ security: [{tokenAuth: []}]
+ parameters:
+ - $ref: '#/components/parameters/Page'
+ - $ref: '#/components/parameters/PerPage'
+ - name: project_ids
+ in: query
+ schema:
+ type: array
+ items:
+ type: integer
+ style: form
+ explode: true
+ example: [619, 620]
+ description: Projects to include, as project_ids[]=619&project_ids[]=620 or a JSON array string ("[619,620]"). Defaults to every Project you can view; Projects you can't view are left out.
+ - name: start_date
+ in: query
+ schema:
+ type: string
+ format: date
+ example: "2026-04-01"
+ description: First Event start date to include (YYYY-MM-DD). Omit start_date and end_date for all time.
+ - name: end_date
+ in: query
+ schema:
+ type: string
+ format: date
+ example: "2027-03-31"
+ description: Last Event start date to include (YYYY-MM-DD)
+ - name: group_by
+ in: query
+ schema:
+ type: string
+ enum: [project, event_format, month]
+ example: month
+ description: Split the figures by Project, by Event format (Event Category) or by month. Omit for totals only.
+ responses:
+ "200":
+ description: The totals, and one page of groups when group_by is given
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/PaginatedSessionsAndAttendance'
+ "401":
+ $ref: '#/components/responses/Unauthorized'
+ "422":
+ $ref: '#/components/responses/UnprocessableEntity'
+
/projects/bulk_status_change:
post:
tags: [Projects]
@@ -21909,6 +21982,99 @@ components:
type: string
example: No success direction is set, so there is no better or worse answer
+ PaginatedSessionsAndAttendance:
+ allOf:
+ - $ref: '#/components/schemas/PaginationEnvelope'
+ - type: object
+ properties:
+ start_date:
+ type: string
+ format: date
+ nullable: true
+ example: "2026-04-01"
+ end_date:
+ type: string
+ format: date
+ nullable: true
+ example: "2027-03-31"
+ project_ids:
+ type: array
+ items:
+ type: integer
+ example: [619]
+ group_by:
+ type: string
+ nullable: true
+ enum: [project, event_format, month]
+ example: month
+ totals:
+ $ref: '#/components/schemas/SessionsAndAttendanceFigures'
+ data:
+ type: array
+ description: One row per group; empty without group_by.
+ items:
+ allOf:
+ - type: object
+ properties:
+ group:
+ description: The month (YYYY-MM), or the Project's or Event format's id and name.
+ oneOf:
+ - type: string
+ example: "2026-04"
+ - type: object
+ properties:
+ id:
+ type: integer
+ example: 619
+ name:
+ type: string
+ example: Youth club
+ - $ref: '#/components/schemas/SessionsAndAttendanceFigures'
+
+ SessionsAndAttendanceFigures:
+ type: object
+ description: Events run and attendance for a set of Events.
+ properties:
+ events_scheduled:
+ type: integer
+ example: 24
+ events_held:
+ type: integer
+ example: 20
+ hours_delivered:
+ type: number
+ example: 40.5
+ invited_contacts:
+ type: integer
+ example: 61
+ attending_contacts:
+ type: integer
+ example: 48
+ attendance_rates:
+ type: array
+ items:
+ type: object
+ properties:
+ tracker_id:
+ type: integer
+ example: 1204
+ tracker_name:
+ type: string
+ example: Session attendance
+ invited_contacts:
+ type: integer
+ example: 61
+ attendances:
+ type: integer
+ example: 9
+ invitations:
+ type: integer
+ example: 21
+ attendance_rate:
+ type: number
+ nullable: true
+ example: 42.9
+
DistanceTravelledTracker:
type: object
description: Distance travelled on one Choice tracker.
diff --git a/server.js b/server.js
index 18a4352..5111d26 100644
--- a/server.js
+++ b/server.js
@@ -4047,6 +4047,18 @@ function buildDocsPage() {
{ code: "200", cls: "response-2xx", desc: "The event" },
{ code: "422", cls: "response-4xx", desc: "The last Event Manager, or not on the event's staff" }
])}
+ ${endpointCard("GET", "/sessions_and_attendance", "Get sessions run and attendance", true, [
+ { name: "project_ids", type: "integer[]", required: false, desc: "Projects to include, as project_ids[]=619 or a JSON array string. Defaults to every Project you can view" },
+ { name: "start_date", type: "string", required: false, desc: "First Event start date to include, YYYY-MM-DD. Omit both dates for all time" },
+ { name: "end_date", type: "string", required: false, desc: "Last Event start date to include, YYYY-MM-DD" },
+ { name: "group_by", type: "string", required: false, desc: "project, event_format or month: data then holds one row per group (every month in the dates, empty ones included)" },
+ { name: "page", type: "integer", required: false, desc: "Page number (default 1)" },
+ { name: "per_page", type: "integer", required: false, desc: "Groups per page (default 10, max 200)" }
+ ], [
+ { code: "200", cls: "response-2xx", desc: "totals, plus start_date, end_date, project_ids, group_by and the paginated groups in data" },
+ { code: "401", cls: "response-4xx", desc: "Not authenticated" },
+ { code: "422", cls: "response-4xx", desc: "Invalid project_ids, date, group_by or per_page" }
+ ], "How many Events (sessions) the Projects you can view ran, and how well they were attended, for Events starting in the dates. events_scheduled counts every Event; events_held those already started; hours_delivered adds up the Events held. invited_contacts counts distinct guests; attending_contacts distinct Contacts with attendance recorded on an attendance form. attendance_rates gives, per Engagement tracker on the attendance forms, attendance_rate: attendances divided by invitations, as the Event Attendance page's Total across all guests row shows it. It counts attendance records, so it can exceed 100% when an Event has duplicate attendance Stories. Deleted Contacts are left out; Makerble doesn't record cancelled Events.")}