---
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

- **2022-11-17** `e344ca2dcbe6` — 8 breaking, 8 warning, 114 info
  - added `#/components/schemas/DvTemporal` to the `allOf[subschema #1: Versionable]/allOf[subschema #1: LOCATABLE]/feeder_audit/feeder_system_audit/time` request property `allOf` list
  - added `#/components/schemas/DvTemporal` to the `allOf[subschema #1: Versionable]/allOf[subschema #1: LOCATABLE]/feeder_audit/originating_system_audit/time` request property `allOf` list
  - added `#/components/schemas/DvTemporal` to the `content/items/allOf[subschema #1: LOCATABLE]/feeder_audit/feeder_system_audit/time` request property `allOf` list
  - added `#/components/schemas/DvTemporal` to the `content/items/allOf[subschema #1: LOCATABLE]/feeder_audit/originating_system_audit/time` request property `allOf` list
  - …126 more
- …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/e344ca2dcbe6/schema)
