REST /api/v1/report-sections 7 endpoints
GET /api/v1/report-sections/api/v1/report-sections

List all section definitions for the Bufdir report structure

Public

Response Example

{
  "data": [
    {
      "section_id": "barn-under-omsorg",
      "section_title": "Barn under omsorg",
      "section_order": 1,
      "description": "Registreringer knyttet til barn plassert utenfor hjemmet.",
      "required_field_count": 6,
      "total_field_count": 12,
      "is_active": true
    },
    {
      "section_id": "undersokelser",
      "section_title": "Undersøkelser",
      "section_order": 2,
      "description": "Undersøkelser etter meldinger til barnevernet.",
      "required_field_count": 5,
      "total_field_count": 9,
      "is_active": true
    },
    {
      "section_id": "hjelpetiltak",
      "section_title": "Hjelpetiltak",
      "section_order": 3,
      "description": "Frivillige hjelpetiltak for barn og familier.",
      "required_field_count": 4,
      "total_field_count": 8,
      "is_active": true
    }
  ],
  "pagination": {
    "page": 1,
    "limit": 20,
    "total": 7
  }
}
GET /api/v1/report-sections/api/v1/report-sections/:id

Get a single section definition including all field definitions and required fields

Public

Response Example

{
  "section_id": "barn-under-omsorg",
  "section_title": "Barn under omsorg",
  "section_order": 1,
  "description": "Registreringer knyttet til barn plassert utenfor hjemmet.",
  "is_active": true,
  "fields": [
    {
      "field_key": "antall_barn_plassert_utenfor_hjemmet",
      "label": "Antall barn plassert utenfor hjemmet",
      "data_type": "integer",
      "required": true,
      "min_value": 0,
      "max_value": 99999
    },
    {
      "field_key": "antall_akuttplasseringer",
      "label": "Antall akuttplasseringer",
      "data_type": "integer",
      "required": true,
      "min_value": 0,
      "max_value": 99999
    },
    {
      "field_key": "andel_barn_i_fosterhjem",
      "label": "Andel barn i fosterhjem (%)",
      "data_type": "decimal",
      "required": false,
      "min_value": 0,
      "max_value": 100
    }
  ],
  "required_fields": [
    "antall_barn_plassert_utenfor_hjemmet",
    "antall_akuttplasseringer",
    "antall_omsorgsovertakelser",
    "antall_tilbakeforing_til_hjemmet",
    "antall_barn_i_fosterhjem",
    "antall_barn_i_institusjon"
  ]
}
POST /api/v1/report-sections/api/v1/report-sections

Create a new section definition (admin only)

Public

Request Example

{
  "section_id": "familievernkontor",
  "section_title": "Familievernkontor",
  "section_order": 8,
  "description": "Tjenester levert av familievernkontorer.",
  "is_active": true,
  "fields": [
    {
      "field_key": "antall_saker_behandlet",
      "label": "Antall saker behandlet",
      "data_type": "integer",
      "required": true
    },
    {
      "field_key": "antall_meglinger",
      "label": "Antall meglinger gjennomført",
      "data_type": "integer",
      "required": true
    }
  ]
}

Response Example

{
  "section_id": "familievernkontor",
  "section_title": "Familievernkontor",
  "section_order": 8,
  "is_active": true,
  "required_field_count": 2,
  "total_field_count": 2,
  "created_at": "2026-03-26T09:00:00Z"
}
PUT /api/v1/report-sections/api/v1/report-sections/:id

Update a section definition, including field list and ordering

Public

Request Example

{
  "section_title": "Familievern og megling",
  "section_order": 8,
  "is_active": true,
  "fields": [
    {
      "field_key": "antall_saker_behandlet",
      "label": "Antall saker behandlet",
      "data_type": "integer",
      "required": true
    },
    {
      "field_key": "antall_meglinger",
      "label": "Antall meglinger gjennomført",
      "data_type": "integer",
      "required": true
    },
    {
      "field_key": "antall_barn_involvert",
      "label": "Antall barn involvert i saker",
      "data_type": "integer",
      "required": false
    }
  ]
}

Response Example

{
  "section_id": "familievernkontor",
  "section_title": "Familievern og megling",
  "section_order": 8,
  "is_active": true,
  "required_field_count": 2,
  "total_field_count": 3,
  "updated_at": "2026-03-26T09:10:00Z"
}
DELETE /api/v1/report-sections/api/v1/report-sections/:id

Deactivate a section definition (soft delete — retained for historical reports)

Public

Response Example

{
  "deleted": true,
  "section_id": "familievernkontor",
  "soft_delete": true
}
GET /api/v1/report-sections/api/v1/report-sections/fields/:fieldKey/label

Get the human-readable Norwegian label for a field key

Public

Response Example

{
  "field_key": "antall_akuttplasseringer",
  "label": "Antall akuttplasseringer",
  "description": "Totalt antall akuttplasseringer gjennomført i rapporteringsperioden.",
  "section_id": "barn-under-omsorg",
  "section_title": "Barn under omsorg"
}
GET /api/v1/report-sections/api/v1/report-sections/required-fields

Get all required fields across all active sections, optionally scoped to a period

Public

Response Example

{
  "period_id": "2024",
  "total_required_fields": 34,
  "required_fields": [
    {
      "field_key": "antall_barn_plassert_utenfor_hjemmet",
      "label": "Antall barn plassert utenfor hjemmet",
      "section_id": "barn-under-omsorg",
      "section_title": "Barn under omsorg"
    },
    {
      "field_key": "antall_akuttplasseringer",
      "label": "Antall akuttplasseringer",
      "section_id": "barn-under-omsorg",
      "section_title": "Barn under omsorg"
    },
    {
      "field_key": "antall_undersokelser_igangsatt",
      "label": "Antall undersøkelser igangsatt",
      "section_id": "undersokelser",
      "section_title": "Undersøkelser"
    }
  ]
}

Additional Metadata

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