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

# GET /patients/{id}

> Retrieve patient information by ID

## Endpoint

```
GET https://api.mycura.org/api/cura/patients/{id}
```

## Path Parameters

<ParamField path="id" type="string" required>
  The unique UUID of the patient to retrieve
</ParamField>

## Response

<ResponseField name="success" type="boolean">
  Indicates if the request was successful
</ResponseField>

<ResponseField name="patient" type="object">
  The patient information object

  <Expandable title="Patient Object Fields">
    <ResponseField name="id" type="string">Unique patient identifier (UUID)</ResponseField>
    <ResponseField name="name" type="string">Patient's full name</ResponseField>
    <ResponseField name="phone_number" type="string">Patient's phone number (normalized format)</ResponseField>
    <ResponseField name="gender" type="string">Patient's gender (may be null)</ResponseField>
    <ResponseField name="age" type="number">Patient's age (may be null)</ResponseField>
    <ResponseField name="height" type="string">Patient's height (may be null)</ResponseField>
    <ResponseField name="weight" type="string">Patient's weight (may be null)</ResponseField>
    <ResponseField name="race" type="string">Patient's race/ethnicity (may be null)</ResponseField>
    <ResponseField name="blood_type" type="string">Patient's blood type (may be null)</ResponseField>
    <ResponseField name="conditions" type="array">Array of medical conditions</ResponseField>
    <ResponseField name="medications" type="array">Array of current medications (may be null)</ResponseField>
    <ResponseField name="allergies" type="string">Known allergies (may be null)</ResponseField>
    <ResponseField name="notes" type="array">Additional notes about the patient</ResponseField>
    <ResponseField name="reminders_enabled" type="boolean">Whether reminders are enabled</ResponseField>
    <ResponseField name="refill_info" type="object">Prescription refill information (may be null)</ResponseField>
    <ResponseField name="join_status" type="string">How the patient joined (WEB, WHATSAPP, API, etc.) (may be null)</ResponseField>
    <ResponseField name="subscription_plan" type="string">Patient's subscription plan (default: "free")</ResponseField>
    <ResponseField name="whatsapp_terms_accepted" type="boolean">Whether WhatsApp terms were accepted</ResponseField>
    <ResponseField name="never_show_audio_prompt" type="boolean">Whether to show audio prompt</ResponseField>
    <ResponseField name="access_code" type="string">Patient access code (may be null)</ResponseField>
    <ResponseField name="apple_messages_id" type="string">Apple Messages identifier (may be null)</ResponseField>
    <ResponseField name="apple_messages_terms_accepted" type="boolean">Whether Apple Messages terms were accepted</ResponseField>
    <ResponseField name="created_at" type="string">Timestamp when patient record was created</ResponseField>
    <ResponseField name="updated_at" type="string">Timestamp when patient record was last updated</ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="error" type="string">
  Error message if the request failed (only present when success is false)
</ResponseField>

## Examples

### Basic Request

<CodeGroup>
  ```bash cURL theme={null}
  curl -X GET "https://api.mycura.org/api/cura/patients/28dffdd1-c18b-46e4-88f7-9b2f073c70dc" \
    -H "X-API-Key: YOUR_API_KEY"
  ```

  ```javascript Node.js theme={null}
  const response = await fetch('https://api.mycura.org/api/cura/patients/28dffdd1-c18b-46e4-88f7-9b2f073c70dc', {
    method: 'GET',
    headers: {
      'X-API-Key': 'YOUR_API_KEY'
    }
  });

  const data = await response.json();
  console.log(data.patient);
  ```

  ```python Python theme={null}
  import requests

  response = requests.get(
      'https://api.mycura.org/api/cura/patients/28dffdd1-c18b-46e4-88f7-9b2f073c70dc',
      headers={
          'X-API-Key': 'YOUR_API_KEY'
      }
  )

  data = response.json()
  print(data['patient'])
  ```
</CodeGroup>

## Response Examples

### Success Response

```json theme={null}
{
  "success": true,
  "patient": {
    "id": "28dffdd1-c18b-46e4-88f7-9b2f073c70dc",
    "name": "Ansh Mehta",
    "phone_number": "15622853979",
    "conditions": [
      "{\"name\":\"GERD\",\"symptoms\":\"Heart burn\"}"
    ],
    "allergies": null,
    "medications": null,
    "notes": [],
    "reminders_enabled": false,
    "refill_info": null,
    "join_status": null,
    "subscription_plan": "free",
    "whatsapp_terms_accepted": true,
    "created_at": "2025-08-29T22:08:42.746701+00:00",
    "updated_at": "2025-08-29T22:10:07.30223+00:00"
  }
}
```

### Patient Not Found

```json theme={null}
{
  "error": "Patient not found"
}
```

## Use Cases

<AccordionGroup>
  <Accordion icon="search" title="Patient Lookup">
    Retrieve patient information before making chat requests to understand available context:

    ```javascript theme={null}
    // Get patient info first
    const response = await fetch(`https://api.mycura.org/api/cura/patients/${patientId}`, {
      headers: { 'X-API-Key': apiKey }
    });
    const { patient } = await response.json();

    // Use patient context in chat
    const chatResponse = await fetch('https://api.mycura.org/api/cura/chat', {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json',
        'X-API-Key': apiKey
      },
      body: JSON.stringify({
        message: 'What are my medication interactions?',
        patientId: patient.id
      })
    });
    ```
  </Accordion>

  <Accordion icon="sync" title="Data Synchronization">
    Sync patient data between your system and Cura:

    ```javascript theme={null}
    // Check if patient data needs updating
    const curaResponse = await fetch(`https://api.mycura.org/api/cura/patients/${patientId}`, {
      headers: { 'X-API-Key': apiKey }
    });
    const { patient: curaPatient } = await curaResponse.json();

    const localPatient = await getLocalPatient(patientId);

    if (curaPatient.updated_at !== localPatient.updated_at) {
      // Sync the data
      await updateLocalPatient(patientId, curaPatient);
    }
    ```
  </Accordion>

  <Accordion icon="shield-check" title="Access Verification">
    Verify patient access before displaying sensitive information:

    ```javascript theme={null}
    try {
      const response = await fetch(`https://api.mycura.org/api/cura/patients/${patientId}`, {
        headers: { 'X-API-Key': apiKey }
      });
      
      if (!response.ok) {
        throw new Error('Patient not found');
      }
      
      const { patient } = await response.json();
      // Patient exists and user has access
      displayPatientDashboard(patient);
    } catch (error) {
      // Handle unauthorized access or missing patient
      showAccessDenied();
    }
    ```
  </Accordion>
</AccordionGroup>

## Best Practices

<Note>
  **Privacy Considerations**: Only retrieve patient data when necessary and ensure proper access controls are in place in your application.
</Note>

* **Cache Appropriately**: Cache patient data to reduce API calls, but refresh when needed
* **Error Handling**: Always check for patient existence before using the data
* **Access Control**: Implement proper authorization in your application layer
* **Data Freshness**: Check `updated_at` timestamps to determine if cached data is stale

## Error Codes

| Status Code | Error Message                    | Description                             |
| ----------- | -------------------------------- | --------------------------------------- |
| 401         | "Unauthorized - Invalid API key" | The provided API key is invalid         |
| 404         | "Patient not found"              | No patient exists with the specified ID |
| 500         | "Failed to fetch patient"        | An unexpected error occurred            |
