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

# Anamnesis

> Submit external anamnesis data and connect it to patients

# Anamnesis

The Anamnesis API allows external providers to submit medical questionnaire responses (anamnesis data) and connect them to patients in the RxScale system.

## Base Path

```
/api/v3-1/anamnesis
```

## Authentication

All endpoints require an API key via the `X-API-Key` header. See [Authentication](/authentication) for details.

<Note>
  The legacy `X-RxScale-Authorization` header is also supported for backward compatibility but `X-API-Key` is recommended for new integrations.
</Note>

## Submit External Anamnesis

Submit anamnesis data from an external provider for a specific questionnaire.

```bash theme={null}
POST /api/v3-1/anamnesis/questionnaires/{questionnaire_uid}/external/submissions
```

<ParamField path="questionnaire_uid" type="string" required>
  The UID of the questionnaire to submit against
</ParamField>

### Request Body

```json theme={null}
{
  "data": {
    "lastName": "Müller",
    "dob": "1990-05-15"
  },
  "anamnesis_provider_uid": "fc9ef771-79a4-4f60-a930-d62a3527565e",
  "external_identifier": "ext-submission-001"
}
```

| Field                    | Type   | Required | Description                                                                    |
| ------------------------ | ------ | -------- | ------------------------------------------------------------------------------ |
| `data`                   | object | Yes      | The anamnesis response data. Structure depends on the questionnaire definition |
| `anamnesis_provider_uid` | string | Yes      | Your anamnesis provider UID (provided by RxScale)                              |
| `external_identifier`    | string | Yes      | Your external identifier for this submission (for tracking)                    |

### Example Request

```bash theme={null}
curl -X POST "https://api.rxscale.com/api/v3-1/anamnesis/questionnaires/abc123-def456/external/submissions" \
  -H "X-API-Key: your-api-key-here" \
  -H "Content-Type: application/json" \
  -d '{
    "data": {"lastName": "Müller", "dob": "1990-05-15"},
    "anamnesis_provider_uid": "fc9ef771-79a4-4f60-a930-d62a3527565e",
    "external_identifier": "ext-submission-001"
  }'
```

<Note>
  The `data` object structure must match the fields defined in the questionnaire. Contact your RxScale account manager to get the questionnaire schema.
</Note>

## Connect Anamnesis to Patient

Link a submitted anamnesis to a patient profile using their shop customer ID.

```bash theme={null}
POST /api/v3-1/anamnesis/{anamnesis_uid}/patient
```

<ParamField path="anamnesis_uid" type="string" required>
  The UID of the anamnesis submission to connect
</ParamField>

### Request Body

```json theme={null}
{
  "shop_identifier": "my-store.myshopify.com",
  "shop_patient_id": "CUST123"
}
```

| Field             | Type   | Required | Description                           |
| ----------------- | ------ | -------- | ------------------------------------- |
| `shop_identifier` | string | Yes      | Your shop identifier                  |
| `shop_patient_id` | string | Yes      | The customer ID from your shop system |

### Example Request

```bash theme={null}
curl -X POST "https://api.rxscale.com/api/v3-1/anamnesis/xyz789/patient" \
  -H "X-API-Key: your-api-key-here" \
  -H "Content-Type: application/json" \
  -d '{
    "shop_identifier": "my-store.myshopify.com",
    "shop_patient_id": "CUST123"
  }'
```

<Warning>
  Each anamnesis submission can only be connected to one patient. Attempting to connect an already-connected anamnesis will result in an error.
</Warning>

## Typical Integration Flow

<Steps>
  <Step title="Submit Anamnesis">
    Your external system collects patient questionnaire responses and submits them via the external submissions endpoint.
  </Step>

  <Step title="Receive Anamnesis UID">
    The API returns an anamnesis UID that you store alongside the submission in your system.
  </Step>

  <Step title="Connect to Patient">
    When the patient is identified in your shop (e.g., during checkout), connect the anamnesis to their patient profile.
  </Step>

  <Step title="Doctor Review">
    The connected anamnesis becomes available for doctor review in the RxScale doctor portal.
  </Step>
</Steps>
