On A\&P-merged templates, the Core API can return Assessment & Plan as **structured subsections**: one per clinical problem, each with a stable `id`. Use those IDs to attach ICD-10 codes per problem and to export the note problem-by-problem into an EHR.

## When structured A\&P is returned[​](#when-structured-ap-is-returned "Direct link to When structured A\&P is returned")

Structured subsections appear when the note uses an **A\&P-merged template** (keys ending in `_AP_MERGED`, for example `GENERIC_SOAP_AP_MERGED`). Custom organization templates with a merged Assessment & Plan section qualify too.

[Discover templates and sections](/core-api/guides/note-templates/note-templates-sections.md) for the authoritative list available to your organization.

## Read the generated note[​](#read-the-generated-note "Direct link to Read the generated note")

Every section carries a required `content` union: `TEXT` or `SUBSECTIONS`.

**Text sections** (default, including A\&P on non-merged templates):

```
{

  "key": "HISTORY_OF_PRESENT_ILLNESS",

  "title": "History of present illness",

  "content": {

    "type": "TEXT",

    "text": "The patient reports..."

  }

}
```

**Structured Assessment & Plan** (A\&P-merged templates only):

```
{

  "key": "ASSESSMENT_AND_PLAN",

  "title": "Assessment & Plan",

  "content": {

    "type": "SUBSECTIONS",

    "subsections": [

      {

        "id": "550e8400-e29b-41d4-a716-446655440000",

        "title": "Hypertension",

        "text": "Continue lisinopril 10 mg daily."

      },

      {

        "id": "6ba7b810-9dad-11d1-80b4-00c04fd430c8",

        "title": "Type 2 diabetes",

        "text": "Maintain metformin; recheck A1c in 3 months."

      }

    ]

  }

}
```

A single note mixes both variants: A\&P uses `SUBSECTIONS`; all other sections use `TEXT`.

Note request bodies accept `content.type: "TEXT"` or `content.type: "SUBSECTIONS"` on the Assessment & Plan section. To receive `subsection_id` on normalized conditions, the input note must use `content.type: "SUBSECTIONS"` with stable `subsections[].id` values; do not send `content.type: "TEXT"` when generation returned `SUBSECTIONS`.

## Generate ICD-10 codes by subsection[​](#generate-icd-10-codes-by-subsection "Direct link to Generate ICD-10 codes by subsection")

Paths below use the **Server API**; **User API** equivalents exist at `/v1/core/user/...` with the same shapes.

1. Generate or edit the note ([`POST /v1/core/server/generate-note`](/core-api/reference/server/generate-note.md) or [`POST /v1/core/server/edit-note-with-instructions`](/core-api/reference/server/edit-note-with-instructions.md)).
2. Call [`POST /v1/core/server/generate-normalized-data`](/core-api/reference/server/generate-normalized-data.md) with the full note. **Preserve subsection `id` values** on the A\&P section when you resend the note:

```
{

  "note": {

    "locale": "ENGLISH_US",

    "template_key": "GENERIC_MULTIPLE_SECTIONS_AP_MERGED",

    "sections": [

      {

        "key": "ASSESSMENT_AND_PLAN",

        "title": "Assessment & Plan",

        "content": {

          "type": "SUBSECTIONS",

          "subsections": [

            {

              "id": "550e8400-e29b-41d4-a716-446655440000",

              "title": "Hypertension",

              "text": "Continue lisinopril 10 mg daily."

            },

            {

              "id": "6ba7b810-9dad-11d1-80b4-00c04fd430c8",

              "title": "Type 2 diabetes",

              "text": "Maintain metformin; recheck A1c in 3 months."

            }

          ]

        }

      }

    ]

  }

}
```

Each returned `condition` includes `subsection_id`: a UUID matching one `content.subsections[].id` from the input note's A\&P section when the condition is tied to structured A\&P, or `null` otherwise:

```
{

  "conditions": [

    {

      "coding": {

        "system": "http://hl7.org/fhir/sid/icd-10-cm",

        "code": "I10",

        "display": "Essential (primary) hypertension"

      },

      "categories": ["ENCOUNTER_DIAGNOSIS"],

      "subsection_id": "550e8400-e29b-41d4-a716-446655440000"

    },

    {

      "coding": {

        "system": "http://hl7.org/fhir/sid/icd-10-cm",

        "code": "E11.9",

        "display": "Type 2 diabetes mellitus without complications"

      },

      "categories": ["ENCOUNTER_DIAGNOSIS"],

      "subsection_id": "6ba7b810-9dad-11d1-80b4-00c04fd430c8"

    }

  ]

}
```

* One `condition` is one code; a subsection may appear on multiple conditions.
* `subsection_id` is `null` when the condition is not tied to a subsection (for example problem-list items).

## Preserve subsection IDs[​](#preserve-subsection-ids "Direct link to Preserve subsection IDs")

When editing a note before normalization or export, round-trip `SUBSECTIONS` verbatim so `id` values stay stable. [`POST /v1/core/server/edit-note-with-instructions`](/core-api/reference/server/edit-note-with-instructions.md) accepts the same `content` union on each section.

## Async responses and webhooks[​](#async-responses-and-webhooks "Direct link to Async responses and webhooks")

[`POST /v1/core/server/generate-note-async`](/core-api/reference/server/generate-note-async.md) poll responses use the **`X-Nabla-Api-Version` header** on the poll request. They follow the same `content` union as synchronous endpoints.

**Webhook** payloads (`generate_note_async.succeeded`, `generate_normalized_data_async.succeeded`) use your organization's **pinned API version**, not the version header on the original async POST. Until you upgrade the pinned version, webhook note sections keep the legacy `{ key, title, text }` shape even if you call `/next` endpoints.

Normalized codes are not included in note generation responses. Call [`POST /v1/core/server/generate-normalized-data`](/core-api/reference/server/generate-normalized-data.md) (or the async variant) after you have the final note.

See [Setup Webhooks](/core-api/guides/setup-webhooks.md) for delivery details.

## Validation[​](#validation "Direct link to Validation")

* `content.type: "SUBSECTIONS"` on a non-A\&P section returns `400 BAD_REQUEST`.

See [Note customization](/core-api/guides/note-templates/note-customization.md) for how `split_by_problem` differs from structured subsections.
