> ## Documentation Index
> Fetch the complete documentation index at: https://docs.clinikapi.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Documents

> SDK reference for structured document (Composition) operations.

# clinik.documents

Compositions are structured clinical documents with sections — discharge summaries, referral letters, care plans, etc.

## create

```ts theme={null}
const { data, meta } = await clinik.documents.create(request: DocumentCreateRequest): Promise<ApiResponse<Composition>>
```

| Field             | Type                  | Required | Description                              |
| ----------------- | --------------------- | -------- | ---------------------------------------- |
| `status`          | `string`              | Yes      | preliminary, final, amended              |
| `type`            | `string`              | Yes      | Document type (e.g. "discharge-summary") |
| `category`        | `string[]`            | No       | Document categories for classification   |
| `patientId`       | `string`              | Yes      | Patient reference                        |
| `encounterId`     | `string`              | No       | Encounter reference                      |
| `practitionerId`  | `string`              | Yes      | Author reference                         |
| `title`           | `string`              | Yes      | Document title                           |
| `date`            | `string`              | No       | Document date                            |
| `sections`        | `DocumentSection[]`   | Yes      | Document sections (recursive)            |
| `confidentiality` | `'N' \| 'R' \| 'V'`   | No       | Normal, Restricted, Very Restricted      |
| `attester`        | `DocumentAttester[]`  | No       | Who attested to accuracy                 |
| `custodianId`     | `string`              | No       | Organization maintaining the document    |
| `relatesTo`       | `DocumentRelatesTo[]` | No       | Relationships to other compositions      |
| `event`           | `DocumentEvent[]`     | No       | Clinical services being documented       |

### Section Structure (recursive)

```ts theme={null}
{
  title: string;
  code?: string;
  text: string;
  resourceIds?: string[];
  authorId?: string;       // Per-section author
  mode?: 'working' | 'snapshot' | 'changes';
  sections?: DocumentSection[];  // Nested sub-sections
}
```

### Attester Structure

```ts theme={null}
{
  mode: 'personal' | 'professional' | 'legal' | 'official';
  time?: string;
  partyId?: string;  // Practitioner ID
}
```

## search / read / update / delete

Same pattern as other resources.
