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

# Patient Data

> Query patient intent and manage patient properties

# Patient Data

Access patient-specific data such as intent status and custom properties. These endpoints use the shop customer ID and shop identifier to identify patients.

## Check Patient Intent

Query whether a patient has completed a specific intent (e.g., a questionnaire submission).

```bash theme={null}
GET /api/v0/patient/intent
```

<ParamField query="shop_customer_id" type="string" required>
  The customer ID from your shop system
</ParamField>

<ParamField query="shop_identifier" type="string" required>
  Your shop identifier (e.g., `my-store.myshopify.com`)
</ParamField>

<ParamField query="intent" type="string" required>
  The intent identifier to check
</ParamField>

### Example Request

```bash theme={null}
curl -X GET "https://api.rxscale.com/api/v0/patient/intent?shop_customer_id=CUST123&shop_identifier=my-store.myshopify.com&intent=weight-loss-questionnaire" \
  -H "X-API-Key: your-api-key-here"
```

### Response

```json theme={null}
{
  "return_code": "signed_within_12_months"
}
```

The `return_code` indicates when the patient last completed a signed submission for the given intent.

<Warning>
  This endpoint returns `404` if the patient is not known to RxScale. If the patient was just created (e.g., during a Shopify checkout), their profile may not be available immediately. Wait 1–2 seconds and retry before treating a `404` as a definitive "patient not found".
</Warning>

## Get Patient Property

Retrieve a specific property value for a patient.

```bash theme={null}
GET /api/v0/patient/properties
```

<ParamField query="shop_customer_id" type="string" required>
  The customer ID from your shop system
</ParamField>

<ParamField query="shop_identifier" type="string" required>
  Your shop identifier
</ParamField>

<ParamField query="field" type="string" required>
  The property field name to retrieve. You can find the field key in the admin tool under **Settings > Profile Fields** — use the **key** value shown for each field.
</ParamField>

### Example Request

```bash theme={null}
curl -X GET "https://api.rxscale.com/api/v0/patient/properties?shop_customer_id=CUST123&shop_identifier=my-store.myshopify.com&field=allergies" \
  -H "X-API-Key: your-api-key-here"
```

## Set Patient Property

Set or update a property value for a patient.

```bash theme={null}
POST /api/v0/patient/properties
```

<ParamField query="shop_customer_id" type="string" required>
  The customer ID from your shop system
</ParamField>

<ParamField query="shop_identifier" type="string" required>
  Your shop identifier
</ParamField>

### Request Body (form-data)

| Field   | Type   | Required | Description             |
| ------- | ------ | -------- | ----------------------- |
| `field` | string | Yes      | The property field name |
| `value` | string | Yes      | The value to set        |

### Example Request

```bash theme={null}
curl -X POST "https://api.rxscale.com/api/v0/patient/properties?shop_customer_id=CUST123&shop_identifier=my-store.myshopify.com" \
  -H "X-API-Key: your-api-key-here" \
  -F "field=allergies" \
  -F "value=penicillin"
```

<Note>
  Patient properties are custom fields defined per organisation. You can configure available property fields in the **Settings > Profile Fields** section of the admin tool.
</Note>
