Skip to main content
POST
/
v1
/
patients
import olira

olira.init(api_key="YOUR_API_KEY")

patient = olira.create_patient(
    first_name="Ada",
    last_name="Lovelace",
    email="ada@example.com",
    timezone="UTC",
)
print(patient.id)
Patient(
    id="019b2f80-0000-7000-8000-000000000001",
    first_name="Ada",
    last_name="Lovelace",
    email="ada@example.com",
    sex="unknown",
    timezone="UTC",
    status="active",
    phone_number=None,
    date_of_birth=None,
    created_at="2026-01-15T12:00:00Z",
    external_identifiers=[],
    metadata=None,
)
olira.create_patient(
    first_name: str | None = None,
    last_name: str | None = None,
    email: str | None = None,
    phone_number: str | None = None,
    date_of_birth: str | None = None,
    sex: str = "unknown",
    timezone: str = "UTC",
    external_identifiers: list[ExternalIdentifier] | None = None,
    metadata: dict[str, Any] | None = None,
) -> Patient
Requires scope: api:manage-patients Olira assigns a stable patient id — use it in all subsequent calls. Shell patients are supported if you send at least one anchor field (external id, email, phone, name, or DOB).

Parameters

first_name
str | None
Given name; omit for shell patients.
last_name
str | None
Family name; omit for shell patients.
email
str | None
Contact email.
phone_number
str | None
Contact phone.
date_of_birth
str | None
ISO 8601 datetime string.
sex
str
default:"\"unknown\""
Stored sex/gender field.
timezone
str
default:"\"UTC\""
IANA timezone (e.g. America/New_York).
external_identifiers
list[ExternalIdentifier] | None
Links to your systems (Epic MRN, FHIR id, etc.).
metadata
dict[str, Any] | None
Arbitrary JSON-safe metadata.

Returns

Patient — Created patient including Olira-assigned id.
id
str
Olira patient id.
first_name
str | None
Given name.
last_name
str | None
Family name.
sex
str | None
Sex/gender.
timezone
str
IANA timezone.
status
str
Patient lifecycle status from API.
email
str | None
Email.
phone_number
str | None
Phone.
date_of_birth
str | None
DOB ISO string.
created_at
str | None
Creation timestamp.
external_identifiers
list[ExternalIdentifier]
External ids.
metadata
dict[str, Any] | None
Metadata blob.

Raises

ExceptionWhen
AuthErrorHTTP 401 or 403 — invalid API key or insufficient OAuth scope for this endpoint.
ValidationErrorHTTP 400, 404, or 422 — malformed JSON, unknown patient, or validation failure (message includes response excerpt).
ServerErrorHTTP 409 (e.g. conflicting external identifier) or repeated 5xx after retries; includes status_code when applicable.
RateLimitErrorHTTP 429 — rate limited; check retry_after (seconds).
NetworkErrorConnection timeout, DNS failure, or read error after retries.
import olira

olira.init(api_key="YOUR_API_KEY")

patient = olira.create_patient(
    first_name="Ada",
    last_name="Lovelace",
    email="ada@example.com",
    timezone="UTC",
)
print(patient.id)
Patient(
    id="019b2f80-0000-7000-8000-000000000001",
    first_name="Ada",
    last_name="Lovelace",
    email="ada@example.com",
    sex="unknown",
    timezone="UTC",
    status="active",
    phone_number=None,
    date_of_birth=None,
    created_at="2026-01-15T12:00:00Z",
    external_identifiers=[],
    metadata=None,
)