Python SDK API reference

Every client method, argument, and return type.

Construction

from cohesion import Client
client = Client(
    api_key="ck_live_...",
    base_url="https://api.cohesionauth.com",   # default
    timeout=30.0,                               # seconds, default 30
    max_retries=3,                              # default 3, exponential backoff
)

Methods

score(session_id, operator_id, domain, interaction, idempotency_key=None) -> ScoreResponse

Wraps POST /v1/score.

score_batch(operator_id, domain, interactions, idempotency_key=None) -> BatchScoreResponse

Wraps POST /v1/score/batch.

operator_profile(operator_id) -> OperatorProfile

Wraps GET /v1/operator/:id/profile.

organization_dashboard() -> OrganizationDashboard

Wraps GET /v1/organization/dashboard.

maintenance_recommend(operator_id) -> MaintenanceRecommendation

Wraps POST /v1/maintenance/recommend.

compliance_report(period_start, period_end) -> ComplianceReport

Wraps GET /v1/compliance/report.

admin.rotate_key() -> RotatedKey

Wraps POST /v1/admin/key/rotate. Returns the new key once.

admin.revoke_key() -> RevokedKey

Wraps POST /v1/admin/key/revoke.

admin.audit_log(event_type=None, since=None, until=None, limit=100) -> list[AuditEvent]

Wraps GET /v1/admin/audit-log.

Errors

The SDK raises typed exceptions:

Next step

Cookbook for end-to-end recipes.