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

# Create directory

`POST /ehr/{ehr_id}/directory`

Creates a new directory FOLDER associated with the EHR identified by `ehr_id`.

## Path parameters

- `ehr_id` string, uuid, required

## Headers

- `Prefer` 'return=representation' | 'return=minimal' | 'return=identifier'
- `Accept` 'application/json' | 'application/xml' | 'application/openehr.wt.flat+json' | 'application/openehr.wt.structured+json'
- `Content-Type` 'application/json' | 'application/xml' | 'application/openehr.wt.flat+json' | 'application/openehr.wt.structured+json'

## Request body

- Folder
  - `_type` string

## Response `201`

`201 Created` is returned when the FOLDER is successfully created. 
If `Prefer` header is `return=representation`, the full resource is included in the response body; if is `return=identifier`, only its unique identifier is included. 
If the `Prefer` header is missing or set to `return=minimal`, the body is empty.

- union
  - Folder
    - `_type` string
  - Identifier
    - `uid` string, required — The (version) resource identifier.

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

---

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