Natzar Partner API Reference - v1.0.0
    Preparing search index...

    Module index

    Natzar Partner API — typed contract

    The single source of truth for the Partner API's public surface: every REST route, wire shape, error code, webhook payload, and embed-widget event is typed and documented here. The server validates requests against the zod schemas in this package, and this package is what the published API reference is generated from — contract, validation, and documentation cannot drift apart.

    All routes live under /v1 on your assigned API host. /v1 evolves additively only: new endpoints, new OPTIONAL request fields, new response fields, and new enum/union members (statuses, error codes, event types) may appear without notice — write clients that ignore unknown fields and tolerate unknown union members. Anything breaking ships as /v2 with a migration window; /v1 will not be removed out from under you.

    Every request carries your API key:

    Authorization: Bearer pp_live_…   (pp_test_… outside production)
    

    The key identifies your partner account AND your tenant — every resource you create or read is scoped to it; other tenants' resources are indistinguishable from nonexistent ones (404). Keys are secrets: server side only, never in a browser (the embed widgets use short-lived consult-scoped session tokens instead — see ./embed).

    Routes that act AS A CLINICIAN (replying, going on the video rota, taking a call) additionally need to know which person, and take any one of three physician credentials:

    • X-Natzar-Physician: <Cognito ID token> beside the key — PROVEN: the clinician signed in to us.
    • Authorization: Bearer <physician session token> INSTEAD of the key — SESSION: your backend exchanged its own login for it via POST /v1/physicians/{id}/session. The browser-safe form, restricted to the physician-side routes (403 forbidden elsewhere).
    • X-Natzar-Physician-Id: <physician id> beside the key — ASSERTED: your server vouches; refused with 403 forbidden when your account has assertion switched off.

    {id} on the /v1/physicians/{id}/… routes may be me, the acting physician. The full rules are in ./endpoints, "Acting as a physician".

    Non-2xx responses carry {error: {code, message, details?}} with a stable machine-readable code (see ./errors). 409s signal a state conflict on the consult lifecycle — re-read, then retry only if the operation still applies.

    • ./errors — error codes, wire shape, HTTP status mapping.
    • ./resources — the read (response) resource shapes.
    • ./schemas — zod schemas for every request body/query (the runtime validation contract).
    • ./endpoints — per-route request/response pairs + the Endpoints route table.
    • ./webhooks — outbound webhook events, payloads, and the X-Natzar-Signature verification scheme.
    • ./embed — the <natzar-telehealth>/<natzar-async> custom-element contract (attributes, DOM events, postMessage protocol).
    • ./schedule — the physician availability engine: how a schedule is stored (rules + dated exceptions), resolved into a calendar, edited by date, and diffed into a PATCH /schedule body. Pure; the platform runs the same code.
    • ./timezones — the IANA-zone helpers a zone picker or a zone label needs (the id list, validation, the device zone, offset labels, "9 h ahead" in five languages). Pure; the platform's own pickers use them.
    • ./languages — the physician-language preference: the five codes a physician may declare, their names, the base-code normalizer (fr_CH → fr) and the tier ranking every assigner applies (the patient's language, then English, then anyone). Pure; the platform routes with it.
    EmbedAttributes
    NatzarEmbedElementApi
    EmbedEventDetailMap
    UpsertPatientResponse
    GetPatientResponse
    UpdatePatientResponse
    CreatePhysicianResponse
    GetPhysicianResponse
    SendPortalInviteResponse
    SetPhysicianAvailabilityResponse
    CreatePhysicianSessionResponse
    PresenceResponse
    GetPhysicianAgendaResponse
    SpecialtyResource
    ListSpecialtiesResponse
    SetPhysicianSpecialtiesResponse
    SetPhysicianLanguagesResponse
    ModalityCapabilities
    TenantCapabilities
    GetPatientStateResponse
    PostAgentMessageResponse
    TranscriptPage
    CreateAsyncConsultResponse
    GetAsyncConsultResponse
    PostAsyncMessageResponse
    ClaimAsyncConsultResponse
    TakeoverAsyncConsultResponse
    ResolveAsyncConsultResponse
    CloseAsyncConsultResponse
    RespondAsyncConsentResponse
    EscalateAsyncConsultResponse
    RateAsyncConsultResponse
    CreateEmbedSessionResponse
    UploadUrlSlot
    CreateUploadUrlsResponse
    CreateTelehealthConsultResponse
    GetTelehealthConsultResponse
    CancelTelehealthConsultResponse
    LiveKitGrant
    JoinTelehealthConsultResponse
    RateTelehealthConsultResponse
    TelehealthRoomResponse
    EndTelehealthConsultResponse
    TelehealthReadyResponse
    TelehealthSlot
    TelehealthAppointment
    ListTelehealthSlotsResponse
    BookTelehealthConsultResponse
    GetPhysicianLicensesResponse
    GetPhysicianScheduleResponse
    Endpoints
    ApiError
    Page
    PatientResource
    PatientSummary
    PhysicianPresence
    PhysicianResource
    AsyncConsultRating
    AsyncConsultResource
    AttachmentResource
    MessageResource
    TelehealthTranscriptSegment
    TelehealthTranscript
    TelehealthRating
    TelehealthConsultResource
    TelehealthQueueEntry
    PhysicianWorkspace
    PartnerEventResource
    ScheduleRule
    ScheduleException
    ScheduleDocument
    LocalInterval
    ResolvedDay
    ScheduleChangeSet
    DayBreakdown
    TimeZoneDescription
    WebhookEnvelope
    AsyncConsultEventData
    AsyncConsultAssignedData
    AsyncConsultReassignedData
    AsyncConsultClosedData
    AsyncConsultRatedData
    AsyncConsultMessageData
    AsyncConsultMessageRejectedData
    TelehealthEventData
    TelehealthRingingData
    TelehealthRatedData
    EmbedTagName
    EmbedLocale
    EmbedTheme
    EmbedEventName
    EmbedDomEventName
    EmbedPostMessage
    ListPatientsResponse
    ListPhysiciansResponse
    GetPhysicianWorkspaceResponse
    ListAgentMessagesResponse
    ListAsyncConsultsResponse
    ListAsyncMessagesResponse
    PostAsyncReplyResponse
    ListTelehealthConsultsResponse
    TelehealthAppointmentState
    PhysicianScheduleRule
    PhysicianScheduleException
    ListEventsResponse
    Route
    RequestOf
    ResponseOf
    ErrorCode
    PhysicianLanguage
    LanguageHolder
    LanguageTier
    IsoDateTime
    IsoDate
    AsyncConsultStatus
    AsyncClosedReason
    TelehealthStatus
    PatientSex
    PatientLang
    AsyncNotice
    MessageClassification
    MessageAuthor
    ConsultOrigin
    AsyncMessageResource
    AgentMessageResource
    PhysicianWorkspaceList
    ScheduleSpecialty
    ScheduleValidationProblem
    ScheduleValidation
    UpsertPatientRequest
    ListPatientsQuery
    UpdatePatientRequest
    CreatePhysicianRequest
    ListPhysiciansQuery
    SetPhysicianAvailabilityRequest
    CreatePhysicianSessionRequest
    SetPhysicianPresenceRequest
    PhysicianHeartbeatRequest
    PhysicianAgendaQuery
    SetPhysicianSpecialtiesRequest
    SetPhysicianLanguagesRequest
    EscalateAsyncConsultRequest
    TelehealthRoomRequest
    EndTelehealthConsultRequest
    TelehealthReadyRequest
    GetPatientStateQuery
    RespondAsyncConsentRequest
    RateAsyncConsultRequest
    JoinTelehealthConsultRequest
    RateTelehealthConsultRequest
    CreateAgentEmbedSessionRequest
    PostAgentMessageRequest
    ListAgentMessagesQuery
    CreateAsyncConsultRequest
    ListAsyncConsultsQuery
    ListAsyncMessagesQuery
    PostAsyncMessageRequest
    PostAsyncReplyRequest
    ClaimAsyncConsultRequest
    TakeoverAsyncConsultRequest
    ResolveAsyncConsultRequest
    CloseAsyncConsultRequest
    CreateEmbedSessionRequest
    CreateUploadUrlsRequest
    CreateTelehealthConsultRequest
    ListTelehealthConsultsQuery
    CancelTelehealthConsultRequest
    ListTelehealthSlotsQuery
    BookTelehealthConsultRequest
    SetPhysicianScheduleRequest
    UpdatePhysicianScheduleRequest
    PhysicianScheduleQuery
    SetPhysicianLicensesRequest
    PhysicianLicenseInput
    ListEventsQuery
    OffsetDifferenceLanguage
    WebhookEvent
    WebhookEventType
    EMBED_TAG_TELEHEALTH
    EMBED_TAG_ASYNC
    EMBED_TAG_AGENT
    EMBED_MESSAGE_SOURCE
    EMBED_DOM_EVENT_PREFIX
    EMBED_EVENT_NAMES
    ERROR_HTTP_STATUS
    PHYSICIAN_LANGUAGES
    MAX_PHYSICIAN_LANGUAGES
    ROUTING_FALLBACK_LANGUAGE
    LANGUAGE_NAMES
    PHYSICIAN_PRESENCE_TTL_SECONDS
    PHYSICIAN_HEARTBEAT_INTERVAL_SECONDS
    PHYSICIAN_WORKSPACE_LIST_CAP
    MINUTES_PER_DAY
    MAX_EXCEPTION_SPAN_DAYS
    MAX_RULE_INTERVAL_WEEKS
    MAX_SCHEDULE_RANGE_DAYS
    MAX_RULES_PER_PHYSICIAN
    MAX_EXCEPTIONS_PER_WRITE
    MAX_EXCEPTION_REASON_LENGTH
    DEFAULT_COVERAGE_GAP_DAYS
    SCHEDULE_PROBLEM_MESSAGES
    E164_PHONE_REGEX
    EXTERNAL_ID_REGEX
    MAX_MESSAGE_ATTACHMENTS
    MAX_UPLOAD_FILES
    MAX_ATTACHMENT_SIZE_BYTES
    MAX_MESSAGE_LENGTH
    MAX_CONTEXT_LENGTH
    ianaZoneSchema
    specialtySlugSchema
    physicianLanguageSchema
    upsertPatientSchema
    listPatientsQuerySchema
    updatePatientSchema
    createPhysicianSchema
    listPhysiciansQuerySchema
    setPhysicianAvailabilitySchema
    createPhysicianSessionSchema
    setPhysicianPresenceSchema
    physicianHeartbeatSchema
    AGENDA_MAX_WINDOW_MS
    physicianAgendaQuerySchema
    setPhysicianSpecialtiesSchema
    setPhysicianLanguagesSchema
    getPatientStateQuerySchema
    postAgentMessageSchema
    createAgentEmbedSessionSchema
    listAgentMessagesQuerySchema
    createAsyncConsultSchema
    listAsyncConsultsQuerySchema
    listAsyncMessagesQuerySchema
    postAsyncMessageSchema
    postAsyncReplySchema
    claimAsyncConsultSchema
    takeoverAsyncConsultSchema
    resolveAsyncConsultSchema
    closeAsyncConsultSchema
    escalateAsyncConsultSchema
    respondAsyncConsentSchema
    rateAsyncConsultSchema
    createEmbedSessionSchema
    createUploadUrlsSchema
    physicianLicenseSchema
    setPhysicianLicensesSchema
    createTelehealthConsultSchema
    listTelehealthSlotsQuerySchema
    bookTelehealthConsultSchema
    setPhysicianScheduleSchema
    updatePhysicianScheduleSchema
    physicianScheduleQuerySchema
    listTelehealthConsultsQuerySchema
    joinTelehealthConsultSchema
    rateTelehealthConsultSchema
    cancelTelehealthConsultSchema
    telehealthRoomSchema
    endTelehealthConsultSchema
    telehealthReadySchema
    listEventsQuerySchema
    IANA_ZONE_REGEX
    MAX_ZONE_ID_LENGTH
    FALLBACK_TIME_ZONE_IDS
    WEBHOOK_SIGNATURE_HEADER
    WEBHOOK_EVENT_HEADER
    WEBHOOK_SIGNATURE_VERSION
    WEBHOOK_EVENT_TYPES
    httpStatusFor
    languageName
    baseLanguageOf
    normalizeLanguages
    spokenLanguages
    speaksLanguage
    languageTier
    compareLanguageTier
    rankByLanguage
    languagesOffered
    parseLocalDate
    isLocalDate
    dayNumber
    addLocalDays
    daysBetween
    weekdayOfLocalDate
    localDateRange
    firstWeekdayOnOrAfter
    isSaneWindow
    ruleAppliesOn
    exceptionEndDate
    exceptionCoversDate
    isWholeDay
    mergeIntervals
    subtractBlocks
    intervalsForDay
    resolveDays
    describeDay
    publishedMinutesByDate
    coverageHorizon
    normalizeSpecialtySlug
    normalizeScheduleRule
    normalizeScheduleException
    openWindow
    closeWindow
    blockDates
    unblockDate
    endRuleBefore
    sameRule
    sameException
    diffSchedule
    isEmptyChangeSet
    isKnownTimeZone
    deviceTimeZone
    listTimeZoneIds
    offsetMinutes
    formatOffset
    describeTimeZone
    offsetDifferenceMinutes
    describeOffsetDifference