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

# Intakes

> Collect and manage patient intake forms as structured questionnaire responses.

# Intakes

Intakes capture patient intake forms as FHIR QuestionnaireResponse resources — structured question-answer pairs that can be queried, versioned, and linked to encounters.

## Submit an Intake Form

```ts theme={null}
const { data: intake } = await clinik.intakes.submit({
  patientId: 'pt_abc123',
  encounterId: 'enc_xyz789',
  questionnaire: 'https://forms.clinikapi.com/new-patient-intake',
  status: 'completed',
  items: [
    {
      linkId: 'chief-complaint',
      text: 'Primary reason for visit',
      answer: [{ valueString: 'Persistent headaches for 2 weeks' }],
    },
    {
      linkId: 'allergies',
      text: 'Known allergies',
      answer: [
        { valueString: 'Penicillin' },
        { valueString: 'Sulfa drugs' },
      ],
    },
    {
      linkId: 'current-medications',
      text: 'Current medications',
      answer: [
        { valueString: 'Lisinopril 10mg daily' },
        { valueString: 'Metformin 500mg twice daily' },
      ],
    },
    {
      linkId: 'pain-level',
      text: 'Current pain level (0-10)',
      answer: [{ valueInteger: 6 }],
    },
    {
      linkId: 'temperature',
      text: 'Body temperature',
      answer: [{ valueQuantity: { value: 98.6, unit: '°F' } }],
    },
    {
      linkId: 'smoking-status',
      text: 'Smoking status',
      answer: [{
        valueCoding: {
          system: 'http://snomed.info/sct',
          code: '8517006',
          display: 'Former smoker',
        },
      }],
    },
  ],
});
```

## Based On / Part Of

Link intakes to the requests or procedures they fulfill:

```ts theme={null}
const { data } = await clinik.intakes.submit({
  patientId: 'pt_abc123',
  basedOn: ['sr_preop_assessment'],  // ServiceRequest this fulfills
  partOf: ['proc_surgery_001'],       // Procedure this is part of
  items: [
    { linkId: 'consent-confirmed', answer: [{ valueBoolean: true }] },
    { linkId: 'fasting-hours', answer: [{ valueInteger: 12 }] },
  ],
});
```

## Answer Types

| Type        | Field           | Example                                         |
| ----------- | --------------- | ----------------------------------------------- |
| Text        | `valueString`   | `"Persistent headaches"`                        |
| Yes/No      | `valueBoolean`  | `true`                                          |
| Number      | `valueInteger`  | `6`                                             |
| Decimal     | `valueDecimal`  | `98.6`                                          |
| Date        | `valueDate`     | `"2024-06-15"`                                  |
| Date-Time   | `valueDateTime` | `"2025-01-15T10:00:00Z"`                        |
| Time        | `valueTime`     | `"14:30:00"`                                    |
| Coded       | `valueCoding`   | `{ code: "8517006", display: "Former smoker" }` |
| Measurement | `valueQuantity` | `{ value: 165, unit: "lbs" }`                   |
| URI         | `valueUri`      | `"https://example.com/document"`                |

## Nested Questions

Group related questions using nested `items` — supports unlimited depth:

```ts theme={null}
{
  linkId: 'family-history',
  text: 'Family Medical History',
  items: [
    {
      linkId: 'fh-diabetes',
      text: 'Family history of diabetes?',
      answer: [{ valueBoolean: true }],
    },
    {
      linkId: 'fh-heart-disease',
      text: 'Family history of heart disease?',
      answer: [{ valueBoolean: false }],
    },
    {
      linkId: 'fh-details',
      text: 'Details',
      items: [
        {
          linkId: 'fh-diabetes-who',
          text: 'Who has diabetes?',
          answer: [{ valueString: 'Mother, maternal grandmother' }],
        },
      ],
    },
  ],
}
```

## Amend an Intake

```ts theme={null}
await clinik.intakes.update('intake_abc123', {
  status: 'amended',
  items: [
    {
      linkId: 'allergies',
      text: 'Known allergies',
      answer: [
        { valueString: 'Penicillin' },
        { valueString: 'Sulfa drugs' },
        { valueString: 'Latex' }, // newly reported
      ],
    },
  ],
});
```

## Search Intakes

```ts theme={null}
const { data } = await clinik.intakes.search({
  patientId: 'pt_abc123',
  status: 'completed',
  sort: '-date',
});
```

## Status Lifecycle

`in-progress` → `completed` → `amended` / `stopped`
