Skip to main content
POST
/
v1
/
patients
/
batch
import olira
from olira import CreatePatientRequest, ExternalIdentifier

olira.init(api_key="YOUR_API_KEY")
result = olira.create_patients_batch(
    patients=[
        CreatePatientRequest(
            external_identifiers=[
                ExternalIdentifier(system="epic", value="MRN-1001"),
            ],
        ),
    ],
)
print(result.items, result.errors)
PatientBatchResult(
    count=1,
    items=[
        PatientBatchItem(index=0, id="019b2f80-0000-7000-8000-000000000002", source=None),
    ],
    errors=[],
)
olira.create_patients_batch(patients: list[CreatePatientRequest]) -> PatientBatchResult
Requires scope: api:manage-patients Partial success is supported — check errors alongside items.

Parameters

patients
list[CreatePatientRequest]
required
Each item follows the same shape as create_patient (validated server-side).

Returns

PatientBatchResult
count
int
Number of patients processed in this request.
items
list[PatientBatchItem]
Successful creations with index and new id.
items[].index
int
Input index in the batch.
items[].id
str
New Olira patient id.
items[].source
str | None
Optional provenance hint from API.
errors
list[BatchError]
Per-row failures (index, code, message).

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
from olira import CreatePatientRequest, ExternalIdentifier

olira.init(api_key="YOUR_API_KEY")
result = olira.create_patients_batch(
    patients=[
        CreatePatientRequest(
            external_identifiers=[
                ExternalIdentifier(system="epic", value="MRN-1001"),
            ],
        ),
    ],
)
print(result.items, result.errors)
PatientBatchResult(
    count=1,
    items=[
        PatientBatchItem(index=0, id="019b2f80-0000-7000-8000-000000000002", source=None),
    ],
    errors=[],
)