REST /api/v1/bufdir-aggregations 7 endpoints
GET /api/v1/bufdir-aggregations/api/v1/bufdir-aggregations

List aggregation snapshots for an organization

Public

Response Example

{
  "data": [
    {
      "id": "agg-snap-001",
      "org_id": "org-bufdir-42",
      "range_start": "2026-01-01T00:00:00Z",
      "range_end": "2026-03-31T23:59:59Z",
      "activity_count": 312,
      "snapshot_at": "2026-03-26T08:00:00Z"
    }
  ],
  "pagination": {
    "page": 1,
    "limit": 20,
    "total": 1
  }
}
GET /api/v1/bufdir-aggregations/api/v1/bufdir-aggregations/:id

Get a specific aggregation snapshot by ID

Public

Response Example

{
  "id": "agg-snap-001",
  "org_id": "org-bufdir-42",
  "range_start": "2026-01-01T00:00:00Z",
  "range_end": "2026-03-31T23:59:59Z",
  "activity_count": 312,
  "snapshot_at": "2026-03-26T08:00:00Z"
}
POST /api/v1/bufdir-aggregations/api/v1/bufdir-aggregations

Compute and persist an activity count aggregation for a DateTimeRange (countActivitiesInRange)

Public

Request Example

{
  "org_id": "org-bufdir-42",
  "range": {
    "start": "2026-01-01T00:00:00Z",
    "end": "2026-03-31T23:59:59Z"
  }
}

Response Example

{
  "id": "agg-snap-002",
  "org_id": "org-bufdir-42",
  "range_start": "2026-01-01T00:00:00Z",
  "range_end": "2026-03-31T23:59:59Z",
  "activity_count": 318,
  "snapshot_at": "2026-03-26T11:10:00Z"
}
PUT /api/v1/bufdir-aggregations/api/v1/bufdir-aggregations/:id

Re-aggregate and update an existing snapshot

Public

Request Example

{
  "range": {
    "start": "2026-01-01T00:00:00Z",
    "end": "2026-03-31T23:59:59Z"
  }
}

Response Example

{
  "id": "agg-snap-001",
  "org_id": "org-bufdir-42",
  "range_start": "2026-01-01T00:00:00Z",
  "range_end": "2026-03-31T23:59:59Z",
  "activity_count": 320,
  "snapshot_at": "2026-03-26T11:15:00Z"
}
DELETE /api/v1/bufdir-aggregations/api/v1/bufdir-aggregations/:id

Delete an aggregation snapshot

Public

Response Example

{
  "deleted": true,
  "id": "agg-snap-001"
}
GET /api/v1/bufdir-aggregations/api/v1/bufdir-aggregations/activities

Retrieve individual activity records within a DateTimeRange (getActivitiesInRange)

Public

Response Example

{
  "data": [
    {
      "activity_id": "act-10021",
      "org_id": "org-bufdir-42",
      "activity_type": "family_guidance",
      "recorded_at": "2026-01-15T10:30:00Z",
      "participant_count": 4,
      "location": "Oslo",
      "status": "completed"
    },
    {
      "activity_id": "act-10022",
      "org_id": "org-bufdir-42",
      "activity_type": "individual_counseling",
      "recorded_at": "2026-01-15T13:00:00Z",
      "participant_count": 1,
      "location": "Bergen",
      "status": "completed"
    }
  ],
  "pagination": {
    "page": 1,
    "limit": 20,
    "total": 318
  }
}
GET /api/v1/bufdir-aggregations/api/v1/bufdir-aggregations/last-submitted-period

Get the most recently submitted report period for an organization (getLastSubmittedPeriod)

Public

Response Example

{
  "org_id": "org-bufdir-42",
  "submitted_period_id": "sub-period-009",
  "period_start": "2025-10-01",
  "period_end": "2026-02-28",
  "submitted_at": "2026-02-28T16:00:00Z",
  "submitted_by": "user-coordinator-07",
  "activity_count": 1203
}

Additional Metadata

{
  "contract_summary": {
    "total_contracts": 410,
    "total_endpoints": 2416,
    "api_styles_used": [
      "rest"
    ]
  },
  "generated_at": "2026-03-26T06:55:53.316Z"
}