---
title: "Create COMPOSITION"
method: POST
path: "/ehr/{ehr_id}/composition"
tags: ["COMPOSITION"]
---

# Create COMPOSITION

`POST /ehr/{ehr_id}/composition`

Creates the first version of a new COMPOSITION in the EHR identified by `ehr_id`.

## Path parameters

- `ehr_id` string, required

## Headers

- `Prefer` 'return=representation' | 'return=minimal'

## Request body

- Composition
  - `_type` string

## Response `201`

`201 Created` is returned when the COMPOSITION was created. 
Content body is only returned when `Prefer` header has `return=representation`, otherwise only headers are returned.

- Composition
  - `_type` string

## Other responses

- `400` — `400 Bad Request` is returned when the request URL or body (if provided) could not be parsed or has invalid content (e.g. invalid `ehr_id`, or either the body of the request could not be read, or could not be converted to a valid COMPOSITION object).
- `404` — `404 Not Found` is returned when an EHR with `ehr_id` does not exist.
- `422` — `422 Unprocessable Entity` is returned when the content could be converted to a COMPOSITION, but there are semantic validation errors, such as the underlying template is not known or is not validating the supplied COMPOSITION.

## Changes

- **2023-11-24** `ff910ba47bcc` — 548 info
  - the `_type` request property default value changed from `DATE_STRUCTURE` to `DATA_STRUCTURE`
  - the `_type` request property default value changed from `DATE_STRUCTURE` to `DATA_STRUCTURE`
  - the `_type` request property default value changed from `DATE_STRUCTURE` to `DATA_STRUCTURE`
  - the `_type` request property default value changed from `DATE_STRUCTURE` to `DATA_STRUCTURE`
  - …544 more
- **2022-11-18** `efc4016dfb0e` — 2 info
  - added `ENTRY, CARE_ENTRY` discriminator mapping keys to the `content/items/` request property
  - added `ENTRY, CARE_ENTRY` discriminator mapping keys to the `content/items/` response property for the response status `201`
- …earlier changes not shown

[Full history](https://skmtc.dev/openehr/apis/ehr-api/changes/ehr/:ehr_id/composition/post.md)

---

[API](https://skmtc.dev/openehr/apis/ehr-api.md) · [All operations](https://skmtc.dev/openehr/apis/ehr-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/openehr/ehr-api/revisions/ff910ba47bcc/schema)
