---
title: "Update COMPOSITION"
method: PUT
path: "/ehr/{ehr_id}/composition/{uid_based_id}"
tags: ["COMPOSITION"]
---

# Update COMPOSITION

`PUT /ehr/{ehr_id}/composition/{uid_based_id}`

Updates COMPOSITION identified by `uid_based_id` and associated with the EHR identified by `ehr_id`.

The `uid_based_id` can take only a form of an HIER_OBJECT_ID identifier taken from VERSIONED_OBJECT.uid.value (i.e. a `versioned_object_uid`).

If the request body already contains a COMPOSITION.uid.value, it must match the `uid_based_id` in the URL. 

The existing latest `version_uid` of COMPOSITION resource (i.e. the `preceding_version_uid`) must be specified in the `If-Match` header.

## Path parameters

- `ehr_id` string, required
- `uid_based_id` string, required

## Headers

- `If-Match` string, required
- `Prefer` 'return=representation' | 'return=minimal'

## Request body

- Composition
  - `_type` string

## Response `200`

`200 OK` is returned when the COMPOSITION is successfully updated and the updated resource is returned in the body when `Prefer` header value is `return=representation`.

- Composition
  - `_type` string

## Other responses

- `400` — `400 Bad Request` is returned when the request could not be parsed or is invalid (e.g. malformed request URL syntax, missing required header or parameter, or syntactically invalid header, parameter or content). The response body MAY contain error details.
- `404` — `404 Not Found` is returned when an EHR with `ehr_id` does not exist, or when the `uid_based_id` does not exist.
- `412` — `412 Precondition Failed` is returned when `If-Match` request header doesn't match the latest version on the service side. Returns also latest `version_uid` in the `Location` and `ETag` headers.
- `422` — `422 Unprocessable Entity` is returned when the content type and syntax is correct, could be converted to a resource, but there are semantic validation errors, such as the underlying template is not known or is not validating the supplied resource.

## Changes

- **2024-07-09** `6318c0ca72c8` — 113 breaking, 17 warning, 205 info
  - request property `_type` was restricted to a list of enum values
  - request property `allOf[subschema #1: Versionable]/allOf[subschema #1: LOCATABLE]/feeder_audit/feeder_system_audit/time/_type` was restricted to a list of enum values
  - request property `allOf[subschema #1: Versionable]/allOf[subschema #1: LOCATABLE]/feeder_audit/feeder_system_audit/time/allOf[subschema #1: DV_TEMPORAL]/accuracy/_type` was restricted to a list of enum values
  - request property `allOf[subschema #1: Versionable]/allOf[subschema #1: LOCATABLE]/feeder_audit/originating_system_audit/time/_type` was restricted to a list of enum values
  - …331 more
- **2024-07-09** `b39f0948583d` — 4 breaking, 8 info
  - removed the enum value `DV_ENCAPSULATED` of the request property `allOf[subschema #1: Versionable]/allOf[subschema #1: LOCATABLE]/feeder_audit/original_content/_type`
  - removed the enum value `DV_ENCAPSULATED` of the request property `content/items/allOf[subschema #1: LOCATABLE]/feeder_audit/original_content/_type`
  - removed the enum value `DV_PARSABLE` of the request property `allOf[subschema #1: Versionable]/allOf[subschema #1: LOCATABLE]/feeder_audit/original_content/_type`
  - removed the enum value `DV_PARSABLE` of the request property `content/items/allOf[subschema #1: LOCATABLE]/feeder_audit/original_content/_type`
  - …8 more
- …earlier changes not shown

[Full history](https://skmtc.dev/openehr/apis/ehr-api/changes/ehr/:ehr_id/composition/:uid_based_id/put.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.dev/openehr/apis/ehr-api/revisions/6318c0ca72c8?raw)
