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

# Quickstart

> Create an API key, register a patient, send your first log, and read compiled patient state, end to end in a few minutes.

This walkthrough takes you from zero to reading compiled patient state: create an API key, register a patient, send a log, and query the result. It assumes your organization is already provisioned; if not, start with [Setup](/setup).

<Steps>
  <Step title="Create an API key" titleSize="h3">
    In the Console, go to [**Settings → API Keys**](/console/settings#api-keys) and create a key with the
    `sdk:event-log`, `api:manage-patients`, and `sdk:state-read` scopes. Or use
    the [CLI](/cli/keys):

    ```bash theme={null}
    olira keys create --name "quickstart" \
      --scopes sdk:event-log api:manage-patients sdk:state-read
    ```

    Send your API key as a Bearer token in the `Authorization` header on every request:

    ```http theme={null}
    Authorization: Bearer YOUR_OLIRA_API_KEY
    ```

    API keys are shown only once at creation. Store them in an environment variable or secrets manager, never in source control.
  </Step>

  <Step title="Install the SDK and initialize" titleSize="h3">
    ```bash theme={null}
    pip install olira
    ```

    ```python theme={null}
    import os
    import olira

    olira.init(api_key=os.environ["OLIRA_API_KEY"])
    ```
  </Step>

  <Step title="Register a patient" titleSize="h3">
    Olira assigns the patient ID. Persist it in your database and use it for
    all future calls.

    ```python theme={null}
    patient = olira.create_patient(
        first_name="Ada",
        last_name="Example",
        email="ada@example.com",
        external_identifiers=[{"system": "mrn", "value": "MRN-12345"}],
    )
    patient_id = patient.id
    ```
  </Step>

  <Step title="Send your first log" titleSize="h3">
    Every log has a type and a structured payload. Send a symptom report via
    the SDK or plain HTTP:

    <CodeGroup>
      ```python Python theme={null}
      from olira import OliraLogType

      olira.log(
          log_type=OliraLogType.SYMPTOM_REPORT,
          patient_id=patient_id,
          payload={
              "instrument": "esas_r",
              "symptoms": [
                  {"name": "pain", "score": 4},
                  {"name": "fatigue", "score": 6},
              ],
          },
      )
      olira.flush()
      ```

      ```http HTTP theme={null}
      POST /v1/logs/batch
      Authorization: Bearer YOUR_API_KEY
      Content-Type: application/json

      {
        "logs": [
          {
            "log_type": "symptom_report",
            "patient_id": "8a4fde23-0f1b-4c2a-9d7e-b36c1a5f0e82",
            "timestamp": "2026-03-18T09:00:00Z",
            "payload": {
              "instrument": "esas_r",
              "symptoms": [
                { "name": "pain", "score": 4 },
                { "name": "fatigue", "score": 6 }
              ]
            }
          }
        ]
      }
      ```
    </CodeGroup>

    Olira validates the `log_type` and payload against the catalog, writes the
    record, and updates the patient's state. See
    [How logs work](/send-data/how-logs-work) for the full submission fields.
  </Step>

  <Step title="Read compiled state" titleSize="h3">
    Query the patient's compiled state (stable data, event-state modules, and
    logs) with the same SDK:

    ```python theme={null}
    # Structured symptom state compiled from your logs
    module = olira.get_event_state_module(
        patient_id=patient_id,
        module_type="symptoms",
    )
    print(module)

    # Or the raw logs you just sent
    logs = olira.get_logs(patient_id=patient_id, log_types=["symptom_report"])
    print(logs.count)
    ```

    Agent runtimes can read the same state over the
    [MCP Patient State server](/mcp-server).
  </Step>
</Steps>

## Next steps

<Columns cols={2}>
  <Card title="Logging from your codebase" icon="code" href="/send-data/logging-from-codebase">
    Wire your backend to the SDK: batch patient creation, traces, and
    verification.
  </Card>

  <Card title="Accessing patient state" icon="database" href="/read-data/accessing-patient-state">
    Choose between MCP, SDK, and REST for downstream workflows.
  </Card>

  <Card title="Log types catalog" icon="list" href="/reference/log-types/symptom-reports">
    Payload schemas and required fields for every supported log type.
  </Card>

  <Card title="Historical backfill" icon="clock-rotate-left" href="/send-data/historical-backfill">
    Load months or years of past data in one controlled job.
  </Card>
</Columns>
