SDKs
Python SDK
Official Python client for OnePath Connect.
The onepath-connect package is the official Python SDK, auto-generated from the OpenAPI spec using Speakeasy and published with full type annotations.
Access: The SDK is distributed through a private PyPI index. After your BAA is executed, you'll receive credentials to configure your package manager.
Setup
Add the OnePath index to your pip config or pyproject.toml:
# pip
pip install onepath-connect \
--index-url https://pypi.onepath.health/simple \
--extra-index-url https://pypi.org/simple# pyproject.toml (poetry)
[[tool.poetry.source]]
name = "onepath"
url = "https://pypi.onepath.health/simple"
priority = "supplemental"Quick Start
import os
from onepath import OnepathClient
client = OnepathClient(api_key=os.environ["ONEPATH_API_KEY"])
# Onboard a user
user = client.users.onboard(
external_id="your-internal-user-id",
consent_scope_id="full-health",
consent_token=generate_consent_token(user_id),
)
# Submit health data
client.users.update_health_data(user.user_id, observations=[
{
"code": "8867-4",
"system": "http://loinc.org",
"display": "Heart rate",
"value_quantity": {"value": 72, "unit": "beats/min"},
"effective_date_time": datetime.utcnow().isoformat(),
}
])
# Get AI insights
insights = client.insights.get(user.user_id)
print(insights.summary)Client Options
from onepath import OnepathClient
client = OnepathClient(
api_key="onepath_production_...", # defaults to ONEPATH_API_KEY env var
base_url="https://api.onepath.health", # override for sandbox
timeout=30, # seconds (default: 30)
)All Resources
client.users
# Register a user — idempotent on external_id
user = client.users.onboard(
external_id="user-123",
consent_scope_id="full-health",
)
# Submit FHIR health data
client.users.update_health_data(user_id, observations=[...], conditions=[...])
# Retrieve all health data
data = client.users.get_health_data(user_id)client.insights
insights = client.insights.get(user_id)
# insights.summary, insights.insights[], insights.health_scoreclient.lab
import base64
with open("lab_report.pdf", "rb") as f:
pdf_b64 = base64.b64encode(f.read()).decode()
result = client.lab.analyze(user_id, document_base64=pdf_b64)
for finding in result.findings:
print(f"{finding.test_name}: {finding.value} — {finding.status}")client.coaching
# Start a session
response = client.coaching.chat(
user_id,
message="What does my latest lab work say about my cholesterol?",
include_health_context=True,
)
# Continue the session
follow = client.coaching.chat(
user_id,
session_id=response.session_id,
message="What can I do to improve it?",
)client.goals
goals = client.goals.list(user_id)
goal = client.goals.create(
user_id,
title="Reduce resting heart rate to under 70 bpm",
category="cardiovascular",
target_date="2027-01-01",
)
client.goals.update(user_id, goal.goal_id, progress=40)client.health_score
score = client.health_score.get(user_id)
# score.overall_score, score.domains.cardiovascular, score.trendclient.medications
Medication order/refill lifecycle — full parity with the JS SDK, since this resource is server-to-server only. See the medication refill lifecycle guide for the full end-to-end flow.
order = client.medications.create_order(
user_id,
external_order_reference="wellvi_order_9182",
medication_name="Semaglutide",
medication_category="peptide",
expected_supply_duration_days=28,
start_date="2026-08-18",
tebra_practice_config_id="5f2c1e3a-...",
idempotency_key="wellvi_order_9182",
)
due = client.medications.get_refills_due(within_days=5)
client.medications.submit_progress_checkin(
user_id,
order["medicationRequestId"],
answers=[{"code": "wellvi-side-effects", "value": "None reported"}],
)
# Refilled: call create_order() again with renews_order_reference set.
# Not refilled: close the loop instead —
client.medications.discontinue_order(
user_id, order["medicationRequestId"], reason="patient-discontinued"
)Error Handling
from onepath.errors import (
OnepathAuthError,
OnepathValidationError,
OnepathRateLimitError,
OnepathNotFoundError,
)
import time
try:
user = client.users.onboard(external_id="user-123", consent_scope_id="full-health")
except OnepathAuthError:
# 401 — API key invalid or expired
pass
except OnepathValidationError as e:
print(e.details) # {"external_id": ["required"]}
except OnepathRateLimitError as e:
time.sleep(e.retry_after)
# then retry
except OnepathNotFoundError:
passType Annotations
The SDK ships a py.typed marker and full type stubs:
from onepath.types import (
OnboardUserResponse,
GetInsightsResponse,
HealthInsight,
FhirObservation,
)