# Generated by scripts/build-specs.ts from specs/. Edit the sources, then run `npm run specs`.
asyncapi: 3.1.0
id: https://orgasm.dev/asyncapi.json
info:
  title: orgasm.dev events
  version: 1.0.0
  description: |
    The events orgasm.dev sends about a live session or a recording: imminence
    once a second, orgasm onset, peak and end as they are called, each edge
    orgasm.dev counts, the subject read, status changes and input warnings;
    and, by webhook, `credits.low` when your company's balance runs low.

    The same event objects travel on three channels:

    - **Stream**: server-sent events from `GET /v1/live-sessions/{sessionId}/stream`.
    - **Socket**: a WebSocket at `/v1/live-sessions/{sessionId}/ws`, which also
      accepts stimulation reports from the client.
    - **Webhooks**: signed HTTP POSTs to endpoints you register, for every
      event type except `imminence.updated`, `signals.updated` and
      `stimulation.updated`, which come often and are only streamed, and for
      `credits.low`, which belongs to your company rather than a session.

    A stream or socket that asks with `frames=face` also receives
    `face.frame`, the face about five times a second for a display that draws
    it. A frame is not an event: it has no `id` or `sequence` and is never
    stored, replayed or sent to webhooks.

    They are also listed by `GET /v1/live-sessions/{sessionId}/events` and
    `GET /v1/recordings/{recordingId}/events` (see the OpenAPI document,
    <https://orgasm.dev/openapi.json>).

    **Delivery.** At least once. A redelivered event keeps its `id`;
    deduplicate on it. `sequence` numbers the events of a session or recording
    from 1 without gaps, so sort by it and use it to notice a gap; webhook
    retries in particular can arrive out of order.

    **Replay.** The stream and the socket replay what you missed when you
    reconnect with the last `id` you saw (`Last-Event-ID`, `after`, or a
    `resume` message). Every `imminence.updated` also repeats the session's
    last eight orgasm calls in `data.recentCalls`, so a call whose own message
    was lost is seen within a second.

    **Timing.** Calls are retrospective: `data.eventAtS` is the moment named,
    `data.calledAtS` when the detector was sure enough to call it, typically a
    few seconds later. Times ending in `S` are seconds on the media's clock;
    `wallTime` is UTC.
  contact:
    name: orgasm.dev
    url: https://orgasm.dev/docs
  license:
    name: Proprietary
  tags:
    - name: live
      description: Live sessions.
    - name: recordings
      description: Recordings.
    - name: webhooks
      description: Deliveries to your server.
  externalDocs:
    description: Realtime guide
    url: https://orgasm.dev/docs/guides/realtime
defaultContentType: application/json
servers:
  stream:
    host: orgasm.dev
    protocol: https
    description: Server-sent events.
    security:
      - $ref: "#/components/securitySchemes/secretKey"
      - $ref: "#/components/securitySchemes/clientToken"
      - $ref: "#/components/securitySchemes/clientTokenQuery"
  socket:
    host: orgasm.dev
    protocol: wss
    description: WebSocket.
    security:
      - $ref: "#/components/securitySchemes/secretKey"
      - $ref: "#/components/securitySchemes/clientTokenQuery"
  localStream:
    host: localhost:4010
    protocol: http
    description: The standalone sandbox (`npm run mock`).
  localSocket:
    host: localhost:4010
    protocol: ws
    description: The standalone sandbox (`npm run mock`).
  yourServer:
    host: "{host}"
    protocol: https
    description: Your server, which receives webhook deliveries at the URL you registered.
    variables:
      host:
        description: The host of your webhook endpoint.
        default: api.example.com
channels:
  liveSessionStream:
    address: /v1/live-sessions/{sessionId}/stream
    title: Live session stream
    summary: A live session's events as server-sent events.
    description: |
      `GET` with `Accept: text/event-stream`. Each message is sent as one
      server-sent event whose `id:` is the event `id`, `event:` its `type`,
      and `data:` the event as JSON. A comment line is sent every 15 seconds.
      The stream closes after the session's final `session.status`.

      Authenticate with a secret key or the session's client token in
      `Authorization`, or, in a browser, with `?token=` and the client token.
      Reconnect with `Last-Event-ID` or `?after=` to replay what you missed.
      Filter with `?types=`. With `?frames=face` the stream also sends
      `face.frame` about five times a second, as server-sent events with
      `event: face.frame` and no `id:` line.
    servers:
      - $ref: "#/servers/stream"
      - $ref: "#/servers/localStream"
    parameters:
      sessionId:
        description: The live session's `id`.
    tags:
      - name: live
    messages:
      imminenceUpdated:
        $ref: "#/components/messages/imminenceUpdated"
      signalsUpdated:
        $ref: "#/components/messages/signalsUpdated"
      stimulationUpdated:
        $ref: "#/components/messages/stimulationUpdated"
      faceFrame:
        $ref: "#/components/messages/faceFrame"
      orgasmOnset:
        $ref: "#/components/messages/orgasmOnset"
      orgasmPeak:
        $ref: "#/components/messages/orgasmPeak"
      orgasmEnd:
        $ref: "#/components/messages/orgasmEnd"
      edgeCompleted:
        $ref: "#/components/messages/edgeCompleted"
      subjectIdentified:
        $ref: "#/components/messages/subjectIdentified"
      sessionStatus:
        $ref: "#/components/messages/sessionStatus"
      inputWarning:
        $ref: "#/components/messages/inputWarning"
  liveSessionSocket:
    address: /v1/live-sessions/{sessionId}/ws
    title: Live session socket
    summary: A live session's events over a WebSocket, plus stimulation reports from the client.
    description: |
      Connect with `?token=` and the session's client token, or an
      `Authorization` header with the secret key or the client token where
      your client can set one. View tokens read the stream instead, since
      they never go in a URL. Add `?after=` to replay from an event,
      `?types=` to filter, and `?frames=face` for `face.frame`. orgasm.dev
      sends each event as one JSON text frame, in `sequence` order. A socket
      counts toward the session's 12 streams; another is refused with a
      `socket.error` (`rate_limited`) and closed.

      The client may send `stimulation` reports and a `resume` request;
      anything else is answered with a `socket.error` frame and the socket
      stays open. The server closes the socket with code 1000 after the
      final `session.status`, and with 1008 when its token stops working.
    servers:
      - $ref: "#/servers/socket"
      - $ref: "#/servers/localSocket"
    parameters:
      sessionId:
        description: The live session's `id`.
    tags:
      - name: live
    bindings:
      ws:
        query:
          type: object
          properties:
            token:
              description: The session's client token.
              type: string
            after:
              description: Replay events after this event `id`.
              type: string
            types:
              description: Comma-separated event types to receive.
              type: string
            frames:
              description: Comma-separated extra messages to receive; `face` for `face.frame`.
              type: string
    messages:
      imminenceUpdated:
        $ref: "#/components/messages/imminenceUpdated"
      signalsUpdated:
        $ref: "#/components/messages/signalsUpdated"
      stimulationUpdated:
        $ref: "#/components/messages/stimulationUpdated"
      faceFrame:
        $ref: "#/components/messages/faceFrame"
      orgasmOnset:
        $ref: "#/components/messages/orgasmOnset"
      orgasmPeak:
        $ref: "#/components/messages/orgasmPeak"
      orgasmEnd:
        $ref: "#/components/messages/orgasmEnd"
      edgeCompleted:
        $ref: "#/components/messages/edgeCompleted"
      subjectIdentified:
        $ref: "#/components/messages/subjectIdentified"
      sessionStatus:
        $ref: "#/components/messages/sessionStatus"
      inputWarning:
        $ref: "#/components/messages/inputWarning"
      socketError:
        $ref: "#/components/messages/socketError"
      clientStimulation:
        $ref: "#/components/messages/clientStimulation"
      clientResume:
        $ref: "#/components/messages/clientResume"
  webhookDelivery:
    address: null
    title: Webhook delivery
    summary: Events POSTed to the endpoints you registered.
    description: |
      orgasm.dev POSTs one event per request to each enabled endpoint
      subscribed to its type, at the URL you registered (so the address is
      yours). Requests are signed per the Standard Webhooks specification.

      Verify `webhook-signature` before trusting the body: it is `v1,`
      followed by the base64 HMAC-SHA256, keyed with the base64 part of your
      endpoint's `whsec_` secret, of `{webhook-id}.{webhook-timestamp}.{body}`.
      Refuse a `webhook-timestamp` more than five minutes from your clock.

      Answer with any 2xx status within 10 seconds. Anything else, or no
      answer, is retried with exponential backoff for up to 24 hours. Process
      the event after you answer, and deduplicate on `webhook-id`, which is
      the event `id`.
    servers:
      - $ref: "#/servers/yourServer"
    tags:
      - name: webhooks
    messages:
      orgasmOnset:
        $ref: "#/components/messages/webhookOrgasmOnset"
      orgasmPeak:
        $ref: "#/components/messages/webhookOrgasmPeak"
      orgasmEnd:
        $ref: "#/components/messages/webhookOrgasmEnd"
      edgeCompleted:
        $ref: "#/components/messages/webhookEdgeCompleted"
      subjectIdentified:
        $ref: "#/components/messages/webhookSubjectIdentified"
      sessionStatus:
        $ref: "#/components/messages/webhookSessionStatus"
      inputWarning:
        $ref: "#/components/messages/webhookInputWarning"
      recordingCompleted:
        $ref: "#/components/messages/webhookRecordingCompleted"
      recordingFailed:
        $ref: "#/components/messages/webhookRecordingFailed"
      creditsLow:
        $ref: "#/components/messages/webhookCreditsLow"
operations:
  streamLiveSessionEvents:
    action: send
    channel:
      $ref: "#/channels/liveSessionStream"
    title: Stream a live session's events
    summary: orgasm.dev sends a live session's events as server-sent events.
    description: Open the stream once the session is created; it carries every event of the session, in `sequence` order, until its final `session.status`.
    tags:
      - name: live
    messages:
      - $ref: "#/channels/liveSessionStream/messages/imminenceUpdated"
      - $ref: "#/channels/liveSessionStream/messages/signalsUpdated"
      - $ref: "#/channels/liveSessionStream/messages/stimulationUpdated"
      - $ref: "#/channels/liveSessionStream/messages/faceFrame"
      - $ref: "#/channels/liveSessionStream/messages/orgasmOnset"
      - $ref: "#/channels/liveSessionStream/messages/orgasmPeak"
      - $ref: "#/channels/liveSessionStream/messages/orgasmEnd"
      - $ref: "#/channels/liveSessionStream/messages/edgeCompleted"
      - $ref: "#/channels/liveSessionStream/messages/subjectIdentified"
      - $ref: "#/channels/liveSessionStream/messages/sessionStatus"
      - $ref: "#/channels/liveSessionStream/messages/inputWarning"
  sendSocketEvents:
    action: send
    channel:
      $ref: "#/channels/liveSessionSocket"
    title: Receive events on the socket
    summary: orgasm.dev sends a live session's events over the WebSocket.
    description: The same events as the stream, one JSON text frame each, in `sequence` order, and a `socket.error` frame when a client message is refused.
    tags:
      - name: live
    messages:
      - $ref: "#/channels/liveSessionSocket/messages/imminenceUpdated"
      - $ref: "#/channels/liveSessionSocket/messages/signalsUpdated"
      - $ref: "#/channels/liveSessionSocket/messages/stimulationUpdated"
      - $ref: "#/channels/liveSessionSocket/messages/faceFrame"
      - $ref: "#/channels/liveSessionSocket/messages/orgasmOnset"
      - $ref: "#/channels/liveSessionSocket/messages/orgasmPeak"
      - $ref: "#/channels/liveSessionSocket/messages/orgasmEnd"
      - $ref: "#/channels/liveSessionSocket/messages/edgeCompleted"
      - $ref: "#/channels/liveSessionSocket/messages/subjectIdentified"
      - $ref: "#/channels/liveSessionSocket/messages/sessionStatus"
      - $ref: "#/channels/liveSessionSocket/messages/inputWarning"
      - $ref: "#/channels/liveSessionSocket/messages/socketError"
  receiveSocketMessages:
    action: receive
    channel:
      $ref: "#/channels/liveSessionSocket"
    title: Send messages on the socket
    summary: orgasm.dev receives stimulation reports and resume requests over the WebSocket.
    description: "`stimulation` is the socket form of `POST /v1/live-sessions/{sessionId}/stimulation`. `resume` replays events after the given `id` without reconnecting."
    tags:
      - name: live
    messages:
      - $ref: "#/channels/liveSessionSocket/messages/clientStimulation"
      - $ref: "#/channels/liveSessionSocket/messages/clientResume"
  deliverWebhooks:
    action: send
    channel:
      $ref: "#/channels/webhookDelivery"
    title: Receive webhooks
    summary: orgasm.dev POSTs events to your webhook endpoints.
    description: Register endpoints with `POST /v1/webhook-endpoints`, choosing the event types each receives. Live-session and recording events are delivered alike; `recording.completed` and `recording.failed` exist only here and in the recording's event list, and `credits.low` only here, to live endpoints.
    tags:
      - name: webhooks
      - name: recordings
    bindings:
      http:
        method: POST
    messages:
      - $ref: "#/channels/webhookDelivery/messages/orgasmOnset"
      - $ref: "#/channels/webhookDelivery/messages/orgasmPeak"
      - $ref: "#/channels/webhookDelivery/messages/orgasmEnd"
      - $ref: "#/channels/webhookDelivery/messages/edgeCompleted"
      - $ref: "#/channels/webhookDelivery/messages/subjectIdentified"
      - $ref: "#/channels/webhookDelivery/messages/sessionStatus"
      - $ref: "#/channels/webhookDelivery/messages/inputWarning"
      - $ref: "#/channels/webhookDelivery/messages/recordingCompleted"
      - $ref: "#/channels/webhookDelivery/messages/recordingFailed"
      - $ref: "#/channels/webhookDelivery/messages/creditsLow"
components:
  securitySchemes:
    secretKey:
      type: http
      scheme: bearer
      bearerFormat: sk_test_… or sk_live_…
      description: A secret key in `Authorization`. Keep it on your server.
    clientToken:
      type: http
      scheme: bearer
      bearerFormat: ct_…
      description: A live session's client token in `Authorization`; safe on the end user's device.
    clientTokenQuery:
      type: httpApiKey
      name: token
      in: query
      description: A live session's client token as `?token=`, for browsers and socket clients that cannot set headers.
  schemas:
    EventType:
      title: EventType
      description: The kind of event. New types can be added at any time; ignore a type you do not recognise rather than failing.
      type: string
      enum:
        - imminence.updated
        - signals.updated
        - stimulation.updated
        - orgasm.onset
        - orgasm.peak
        - orgasm.end
        - edge.completed
        - subject.identified
        - session.status
        - input.warning
        - recording.completed
        - recording.failed
    Confidence:
      title: Confidence
      description: "How complete the input behind this event was. `high`: the face was tracked throughout the window the signal reads and every input it uses was present. `medium`: an input was missing or partial for part of that window. `low`: the event rests on degraded input, or comes from a detector that ran while the subject was undetermined. `null` on events that are not signals (`session.status`, `input.warning`, `recording.*`). Confidence describes the input, not a calibrated probability that the event is right."
      type:
        - string
        - "null"
      enum:
        - high
        - medium
        - low
        - null
    Detector:
      title: Detector
      description: Which detector made a call. `onset_end` calls the start and the end of an orgasm and applies to women. `peak` calls a single peak and applies to men. `face_end` calls the end of a man's orgasm from the face alone.
      type: string
      enum:
        - onset_end
        - peak
        - face_end
    EventBase:
      title: EventBase
      description: "The envelope every event shares, on every channel: the stream, the socket, webhooks and the event lists. Unknown fields may be added; ignore them."
      type: object
      required:
        - id
        - object
        - type
        - mode
        - sequence
        - streamTimeS
        - wallTime
        - confidence
        - data
      properties:
        id:
          description: Unique and stable. A redelivered event carries the same `id`, so deduplicate on it.
          type: string
          pattern: ^evt_[0-9a-z]{20}$
          examples:
            - evt_4q7m2k9x8w1c3n6b5v0z
        object:
          type: string
          const: event
        type:
          $ref: "#/components/schemas/EventType"
        mode:
          description: "`test` for sandbox events, `live` for live analysis."
          type: string
          enum:
            - test
            - live
        sessionId:
          description: The live session the event belongs to. Absent on recording events.
          type: string
          pattern: ^ls_[0-9a-z]{20}$
          examples:
            - ls_8f3kq2m7x9w4c1n6t5ra
        recordingId:
          description: The recording the event belongs to. Absent on live-session events.
          type: string
          pattern: ^rec_[0-9a-z]{20}$
          examples:
            - rec_2n5v8c1x4m7q0w3e6r9t
        sequence:
          description: Position of the event in its session or recording, starting at 1 and increasing by one. Use it to order events and to notice a gap.
          type: integer
          minimum: 1
        streamTimeS:
          description: When the event was produced, in seconds on the media's own clock (time since the first frame of the live stream, or time into the recording). For an orgasm call this is the moment the call was made, which is later than the moment it names (`data.eventAtS`).
          type: number
          minimum: 0
        wallTime:
          description: When the event was produced, as UTC wall-clock time. For recordings it is when the analysis made the call, not a time in the recording.
          type: string
          format: date-time
        confidence:
          $ref: "#/components/schemas/Confidence"
        data:
          description: The event's own fields; see each event type.
          type: object
      oneOf:
        - required:
            - sessionId
        - required:
            - recordingId
    RecentCall:
      title: RecentCall
      description: An orgasm call, as repeated in every `imminence.updated`.
      type: object
      required:
        - id
        - type
        - eventAtS
      properties:
        id:
          description: The `id` of the call's own event.
          type: string
          pattern: ^evt_[0-9a-z]{20}$
        type:
          type: string
          enum:
            - orgasm.onset
            - orgasm.peak
            - orgasm.end
        eventAtS:
          description: The moment the call names, in stream seconds.
          type: number
    ImminenceData:
      title: ImminenceData
      type: object
      required:
        - p30
        - p60
        - logit30
        - logit60
        - featuresPresent
        - faceVisible
        - baselineReady
        - stimulationAware
        - recentCalls
      properties:
        p30:
          description: Probability that the next orgasm begins within 30 seconds, given that it has not begun yet (the onset for a woman, the peak for a man). A probability over a horizon, not a countdown. `null` while the face is not visible or its baseline is not ready.
          type:
            - number
            - "null"
          minimum: 0
          maximum: 1
        p60:
          description: The same probability over 60 seconds. Never lower than `p30`.
          type:
            - number
            - "null"
          minimum: 0
          maximum: 1
        logit30:
          description: "`p30` as a logit, ln(p / (1 - p)). Add your own prior on this scale to combine it with what your product knows."
          type:
            - number
            - "null"
        logit60:
          description: "`p60` as a logit."
          type:
            - number
            - "null"
        featuresPresent:
          description: Share of the model's inputs that were available this second, from 0 to 1. Lower values mean the face was turned away, occluded or too far for part of the second.
          type: number
          minimum: 0
          maximum: 1
        faceVisible:
          description: Whether a face was tracked in the last second.
          type: boolean
        baselineReady:
          description: Whether the person's own resting baseline is in. It takes about a minute of visible face after the stream starts; imminence is `null` before.
          type: boolean
        stimulationAware:
          description: Whether you have reported stimulation for this session (see `reportStimulation`). When `true`, imminence also accounts for how long the person has been stimulated; when `false`, it reads the face alone.
          type: boolean
        recentCalls:
          description: The last orgasm calls of the session, oldest first, at most eight, repeated in every update so that a call whose own event you missed is still seen within a second.
          type: array
          maxItems: 8
          items:
            $ref: "#/components/schemas/RecentCall"
    OrgasmOnsetData:
      title: OrgasmOnsetData
      type: object
      required:
        - orgasmIndex
        - eventAtS
        - calledAtS
        - lagS
        - detector
        - score
        - threshold
      properties:
        orgasmIndex:
          description: Which orgasm of the session this is, from 1. The onset and the end of the same orgasm share it.
          type: integer
          minimum: 1
        eventAtS:
          description: The moment the orgasm began, in stream seconds.
          type: number
        calledAtS:
          description: The moment the detector made the call, in stream seconds.
          type: number
        lagS:
          description: "`calledAtS - eventAtS`: how late the call is."
          type: number
          minimum: 0
        detector:
          type: string
          const: onset_end
        score:
          description: The detector's score for the call, on the scale of `threshold`.
          type: number
          minimum: 0
          maximum: 1
        threshold:
          description: The level the detector calls at. A score at or above it made the call.
          type: number
          minimum: 0
          maximum: 1
    OrgasmPeakData:
      title: OrgasmPeakData
      type: object
      required:
        - orgasmIndex
        - eventAtS
        - calledAtS
        - lagS
        - detector
        - score
        - threshold
      properties:
        orgasmIndex:
          description: Which orgasm of the session this is, from 1. The peak and the face-based end of the same orgasm share it.
          type: integer
          minimum: 1
        eventAtS:
          description: The moment of the peak, in stream seconds.
          type: number
        calledAtS:
          description: The moment the detector made the call, in stream seconds.
          type: number
        lagS:
          description: "`calledAtS - eventAtS`."
          type: number
          minimum: 0
        detector:
          type: string
          const: peak
        score:
          type: number
          minimum: 0
          maximum: 1
        threshold:
          type: number
          minimum: 0
          maximum: 1
    OrgasmEndData:
      title: OrgasmEndData
      type: object
      required:
        - orgasmIndex
        - eventAtS
        - startedAtS
        - durationS
        - calledAtS
        - lagS
        - detector
        - score
        - threshold
        - ruined
      properties:
        orgasmIndex:
          description: Which orgasm of the session ended.
          type: integer
          minimum: 1
        eventAtS:
          description: The moment the orgasm ended, in stream seconds.
          type: number
        startedAtS:
          description: "When the same orgasm began: its onset (`onset_end`) or its peak (`face_end`)."
          type: number
        durationS:
          description: "`eventAtS - startedAtS`."
          type: number
          minimum: 0
        calledAtS:
          description: The moment the detector made the call, in stream seconds.
          type: number
        lagS:
          description: "`calledAtS - eventAtS`."
          type: number
          minimum: 0
        detector:
          type: string
          enum:
            - onset_end
            - face_end
        score:
          description: The detector's score, or `null` for `face_end`, which has none.
          type:
            - number
            - "null"
          minimum: 0
          maximum: 1
        threshold:
          description: The detector's calling level, or `null` for `face_end`.
          type:
            - number
            - "null"
          minimum: 0
          maximum: 1
        ruined:
          description: "Whether the orgasm was ruined: the last stimulation report before it began was `off`, sent within the 30 seconds before while `p30` was at 0.75 or above (the ruin preset's stop). Charged as a ruin, at the price of an orgasm. Always `false` for a recording, which takes no stimulation reports."
          type: boolean
    EdgeCompletedData:
      title: EdgeCompletedData
      type: object
      required:
        - edgeIndex
        - startedAtS
        - eventAtS
        - durationS
        - peakP30
      properties:
        edgeIndex:
          description: Which edge of the session this is, from 1.
          type: integer
          minimum: 1
        startedAtS:
          description: When `p30` reached 0.6, the edge preset's back-off level, in stream seconds.
          type: number
        eventAtS:
          description: When `p30` fell back below 0.3, the preset's resume level, which made the approach an edge, in stream seconds.
          type: number
        durationS:
          description: "`eventAtS - startedAtS`."
          type: number
          minimum: 0
        peakP30:
          description: The highest `p30` of the approach.
          type: number
          minimum: 0.6
          maximum: 1
    SubjectIdentifiedData:
      title: SubjectIdentifiedData
      type: object
      required:
        - sex
        - pWoman
        - secondsObserved
        - decidedAtS
        - hint
        - detectors
      properties:
        sex:
          description: "Whether the face reads as a woman's or a man's, which decides the detectors that apply. `undetermined` is common: the read is made once, from the first 30 seconds of visible face, and only decides when it is clear. It is an estimate for choosing detectors, not a statement about the person's sex or gender identity."
          type: string
          enum:
            - woman
            - man
            - undetermined
        pWoman:
          description: The read's probability that the face is a woman's, or `null` when the face could not be read.
          type:
            - number
            - "null"
          minimum: 0
          maximum: 1
        secondsObserved:
          description: Seconds of visible face the read was made from (at most 30).
          type: integer
          minimum: 0
          maximum: 30
        decidedAtS:
          description: When the read was made, in stream seconds.
          type: number
        hint:
          description: The `subjectHint` you gave when you created the session, or `null`.
          type:
            - string
            - "null"
          enum:
            - woman
            - man
            - null
        detectors:
          description: "The detectors that apply from now on. A hint decides them when given; otherwise the read does; while undetermined, all of them run and their calls arrive with `confidence: low`."
          type: array
          minItems: 1
          uniqueItems: true
          items:
            $ref: "#/components/schemas/Detector"
    InputsPresence:
      title: InputsPresence
      description: Which inputs are arriving right now.
      type: object
      required:
        - face
        - audio
        - body
      properties:
        face:
          type: object
          required:
            - present
            - baselineReady
          properties:
            present:
              description: A face was tracked in the last second.
              type: boolean
            baselineReady:
              description: The person's resting baseline is in.
              type: boolean
        audio:
          type: object
          required:
            - declared
            - present
          properties:
            declared:
              description: You said the stream would carry the microphone.
              type: boolean
            present:
              description: Audio is arriving.
              type: boolean
        body:
          type: object
          required:
            - declared
            - present
          properties:
            declared:
              description: You said a body view would be published.
              type: boolean
            present:
              description: The body view is arriving.
              type: boolean
    SessionStatusData:
      title: SessionStatusData
      type: object
      required:
        - status
        - previousStatus
        - degraded
        - inputs
        - endedReason
      properties:
        status:
          description: "`starting`: analysis capacity is being prepared (a few minutes when none is warm). `ready`: the device can publish. `calibrating`: media is arriving and the person's baseline is being taken. `analyzing`: every signal the inputs allow is running. `ended`: no more events follow."
          type: string
          enum:
            - starting
            - ready
            - calibrating
            - analyzing
            - ended
        previousStatus:
          type:
            - string
            - "null"
          enum:
            - starting
            - ready
            - calibrating
            - analyzing
            - ended
            - null
        degraded:
          description: An input the session declared is missing, or the face is not visible. The open `input.warning` events say which.
          type: boolean
        inputs:
          $ref: "#/components/schemas/InputsPresence"
        endedReason:
          description: "Why the session ended, once `status` is `ended`. `client_ended`: you ended it. `media_ended`: the device stopped publishing. `media_timeout`: no frames arrived for too long. `max_duration`: `maxDurationS` elapsed. `interrupted`: the analysis capacity was lost; create a new session. `policy`: the session broke the acceptable use policy. `error`: an internal failure."
          type:
            - string
            - "null"
          enum:
            - client_ended
            - media_ended
            - media_timeout
            - max_duration
            - interrupted
            - policy
            - error
            - null
    InputWarningData:
      title: InputWarningData
      type: object
      required:
        - code
        - state
        - message
        - sinceS
      properties:
        code:
          description: "`face_not_visible`: no face is tracked. `multiple_faces`: more than one face is in view and the analysis cannot tell which is the subject. `audio_absent`: the stream carries no microphone, so onset, peak and end are unavailable. `baseline_pending`: imminence starts once the baseline is in. `body_stream_absent`: a declared body view is not arriving. `low_confidence`: input quality is too low for confident calls."
          type: string
          enum:
            - face_not_visible
            - multiple_faces
            - audio_absent
            - baseline_pending
            - body_stream_absent
            - low_confidence
        state:
          description: "`raised` when the condition starts, `cleared` when it ends."
          type: string
          enum:
            - raised
            - cleared
        message:
          description: A sentence you can show the person, in English.
          type: string
        sinceS:
          description: When the condition started, in stream seconds.
          type: number
    FaceRegions:
      title: FaceRegions
      description: "How far each region of the face has moved from the person's own baseline, from 0 (as at rest) to 1 (a full movement): the largest of the region's expression channels, left and right together."
      type: object
      required:
        - brows
        - eyes
        - cheeks
        - nose
        - lips
        - corners
        - jaw
      properties:
        brows:
          type: number
          minimum: 0
          maximum: 1
        eyes:
          type: number
          minimum: 0
          maximum: 1
        cheeks:
          type: number
          minimum: 0
          maximum: 1
        nose:
          type: number
          minimum: 0
          maximum: 1
        lips:
          type: number
          minimum: 0
          maximum: 1
        corners:
          type: number
          minimum: 0
          maximum: 1
        jaw:
          type: number
          minimum: 0
          maximum: 1
    FaceExpression:
      title: FaceExpression
      description: The face's expression as 24 channels, each from 0 (as at the person's own rest) to 1 (a full movement). Names ending in `L` and `R` are the person's own left and right. Channels may be added; draw the ones you know.
      type: object
      required:
        - eyeBlinkL
        - eyeBlinkR
        - eyeWideL
        - eyeWideR
        - browDownL
        - browDownR
        - browInnerUp
        - browOuterUpL
        - browOuterUpR
        - jawOpen
        - lipsPart
        - mouthSmileL
        - mouthSmileR
        - mouthStretch
        - mouthPucker
        - noseSneer
        - noseFlare
        - cheekSquintL
        - cheekSquintR
        - chinRaise
        - lidTighten
        - browTogether
        - noseWrinkle
        - lidRaise
      properties:
        eyeBlinkL:
          type: number
          minimum: 0
          maximum: 1
        eyeBlinkR:
          type: number
          minimum: 0
          maximum: 1
        eyeWideL:
          type: number
          minimum: 0
          maximum: 1
        eyeWideR:
          type: number
          minimum: 0
          maximum: 1
        browDownL:
          type: number
          minimum: 0
          maximum: 1
        browDownR:
          type: number
          minimum: 0
          maximum: 1
        browInnerUp:
          type: number
          minimum: 0
          maximum: 1
        browOuterUpL:
          type: number
          minimum: 0
          maximum: 1
        browOuterUpR:
          type: number
          minimum: 0
          maximum: 1
        jawOpen:
          type: number
          minimum: 0
          maximum: 1
        lipsPart:
          type: number
          minimum: 0
          maximum: 1
        mouthSmileL:
          type: number
          minimum: 0
          maximum: 1
        mouthSmileR:
          type: number
          minimum: 0
          maximum: 1
        mouthStretch:
          type: number
          minimum: 0
          maximum: 1
        mouthPucker:
          type: number
          minimum: 0
          maximum: 1
        noseSneer:
          type: number
          minimum: 0
          maximum: 1
        noseFlare:
          type: number
          minimum: 0
          maximum: 1
        cheekSquintL:
          type: number
          minimum: 0
          maximum: 1
        cheekSquintR:
          type: number
          minimum: 0
          maximum: 1
        chinRaise:
          type: number
          minimum: 0
          maximum: 1
        lidTighten:
          type: number
          minimum: 0
          maximum: 1
        browTogether:
          type: number
          minimum: 0
          maximum: 1
        noseWrinkle:
          type: number
          minimum: 0
          maximum: 1
        lidRaise:
          type: number
          minimum: 0
          maximum: 1
      additionalProperties:
        type: number
        minimum: 0
        maximum: 1
    HeadPose:
      title: HeadPose
      description: How far the head has turned from the person's own resting pose, in degrees, as someone facing them sees it.
      type: object
      required:
        - yawDeg
        - pitchDeg
        - rollDeg
      properties:
        yawDeg:
          description: Positive turns the face toward the viewer's right, the person's own left.
          type: number
          minimum: -90
          maximum: 90
        pitchDeg:
          description: Positive raises the chin; negative lowers it.
          type: number
          minimum: -90
          maximum: 90
        rollDeg:
          description: Positive tips the top of the head toward the viewer's right.
          type: number
          minimum: -90
          maximum: 90
    CameraHeadPose:
      title: CameraHeadPose
      description: "The head's own angles against a face square to the camera, in degrees, as someone facing the person sees them, with HeadPose's senses. Not its turn from the resting pose: a head held tilted, or lying on its side, reads as it is."
      type: object
      required:
        - yawDeg
        - pitchDeg
        - rollDeg
      properties:
        yawDeg:
          description: Positive turns the face toward the viewer's right, the person's own left.
          type: number
          minimum: -180
          maximum: 180
        pitchDeg:
          description: Positive raises the chin; negative lowers it.
          type: number
          minimum: -90
          maximum: 90
        rollDeg:
          description: Positive tips the top of the head toward the viewer's right; a head lying on its side reads about 90 either way.
          type: number
          minimum: -180
          maximum: 180
    FaceChannels:
      title: FaceChannels
      description: "How the face is moving: its expression and the head's turn, measured against the person's own resting baseline. Drawn on a generic face, they show what the face is doing and nothing of what it looks like."
      type: object
      required:
        - expression
        - head
      properties:
        expression:
          $ref: "#/components/schemas/FaceExpression"
        head:
          $ref: "#/components/schemas/HeadPose"
    SignalsData:
      title: SignalsData
      description: The body's other signals, as a heads-up display shows them. Each is `null` while its input is absent or still calibrating; none is a call, and none is charged.
      type: object
      required:
        - vocalizationsPerMin
        - loudnessAboveBaselineDb
        - contractionsPerMin
        - movement
        - faceRegions
        - face
      properties:
        vocalizationsPerMin:
          description: Vocalizations a minute, from the microphone; null without it.
          type:
            - number
            - "null"
          minimum: 0
        loudnessAboveBaselineDb:
          description: How much louder the voice is than at the baseline, in decibels; null without the microphone or before its baseline.
          type:
            - number
            - "null"
        contractionsPerMin:
          description: Pelvic floor contractions a minute, from the body view; null without it.
          type:
            - number
            - "null"
          minimum: 0
        movement:
          description: How still the body is, from the body view; null without it.
          type:
            - string
            - "null"
          enum:
            - settled
            - shifting
            - unsettled
            - null
        faceRegions:
          description: Null while the face is out of view or before the baseline is in.
          oneOf:
            - $ref: "#/components/schemas/FaceRegions"
            - type: "null"
        face:
          description: The face's expression channels and the head's turn, once a second, for a display that draws a face; `face.frame` carries the same about five times a second to readers that ask. Null while the face is out of view or before the baseline is in. A view token reads it only when made with `includeFace`.
          oneOf:
            - $ref: "#/components/schemas/FaceChannels"
            - type: "null"
    StimulationChannel:
      title: StimulationChannel
      description: One output of a device with more than one, such as an e-stim unit's channels.
      type: object
      required:
        - id
        - level
        - levelMax
      properties:
        id:
          description: The output's name, such as `a` or `b`.
          type: string
          pattern: ^[a-z0-9]{1,8}$
        level:
          description: The output's level now, on the device's own scale.
          type: number
          minimum: 0
        levelMax:
          description: The highest level the output will go to now, on the same scale; null when your product did not say.
          type:
            - number
            - "null"
          exclusiveMinimum: 0
    StimulationDevice:
      title: StimulationDevice
      description: The device your product drives, as a display names it.
      type: object
      required:
        - label
        - connected
      properties:
        label:
          description: What a display calls the device, such as `Wand` or `Unit`; null when your product did not say. Never the person's name.
          type:
            - string
            - "null"
          maxLength: 40
        connected:
          description: False while your product cannot reach the device; a display shows it as disconnected.
          type: boolean
    StimulationData:
      title: StimulationData
      description: "The stimulation your product last reported, merged across its reports: a report updates the fields it carries and keeps the rest. Fields your product never reported are null."
      type: object
      required:
        - state
        - intensity
        - level
        - levelMax
        - channels
        - mode
        - modeLabel
        - device
        - drive
        - changedAtS
      properties:
        state:
          description: Whether stimulation is on or off.
          type: string
          enum:
            - on
            - off
        intensity:
          description: The intensity from 0 to 1 on your product's own scale.
          type:
            - number
            - "null"
          minimum: 0
          maximum: 1
        level:
          description: The device's level on its own scale, such as 0 to 100.
          type:
            - number
            - "null"
          minimum: 0
        levelMax:
          description: The highest level the device will go to now, on the same scale.
          type:
            - number
            - "null"
          exclusiveMinimum: 0
        channels:
          description: Each output's level, for a device with more than one.
          type:
            - array
            - "null"
          maxItems: 4
          items:
            $ref: "#/components/schemas/StimulationChannel"
        mode:
          description: The device's mode or pattern, as your product names it.
          type:
            - string
            - "null"
          maxLength: 40
        modeLabel:
          description: The mode's name to show; without it a display shows `mode` in words.
          type:
            - string
            - "null"
          maxLength: 40
        device:
          oneOf:
            - $ref: "#/components/schemas/StimulationDevice"
            - type: "null"
        drive:
          description: "Who sets the level: `auto` (your product, following the person's signals), `manual` (the person's own hand), `hold` (held where it is) or `paused`."
          type:
            - string
            - "null"
          enum:
            - auto
            - manual
            - hold
            - paused
            - null
        changedAtS:
          description: When the change happened, in stream seconds. The event's own `streamTimeS` is when orgasm.dev received the report, which can be later.
          type: number
          minimum: 0
    StimulationReportChannel:
      title: StimulationReportChannel
      description: One output's level.
      type: object
      required:
        - id
        - level
      properties:
        id:
          description: The output's name, such as `a` or `b`.
          type: string
          pattern: ^[a-z0-9]{1,8}$
        level:
          type: number
          minimum: 0
        levelMax:
          type:
            - number
            - "null"
          exclusiveMinimum: 0
    StimulationReportDevice:
      title: StimulationReportDevice
      description: The device your product drives.
      type: object
      properties:
        label:
          description: What a display calls it, such as `Wand` or `Unit`. Never the person's name.
          type:
            - string
            - "null"
          maxLength: 40
        connected:
          description: False while your product cannot reach the device. Omitted, it keeps its last value, true at first.
          type: boolean
    FaceFrame:
      title: FaceFrame
      description: "The face, and the head as the camera sees it, about five times a second, for a display that draws them, sent only to readers that ask with `frames=face`, between the once-a-second `signals.updated`. Not an event: it has no `id` or `sequence`, is never stored or replayed, and a reader that falls behind gets the newest frame."
      type: object
      required:
        - type
        - sessionId
        - streamTimeS
        - face
      properties:
        type:
          type: string
          const: face.frame
        sessionId:
          type: string
          pattern: ^ls_[0-9a-z]{20}$
        streamTimeS:
          description: When the frame was measured, in stream seconds.
          type: number
          minimum: 0
        face:
          description: Null while the face is out of view or before the baseline is in.
          oneOf:
            - $ref: "#/components/schemas/FaceChannels"
            - type: "null"
        cameraHead:
          description: The head as the camera sees it, for a display that draws the head as it is rather than by its turn from the resting pose. It needs no baseline, so it is there whenever the face is in view, while `face` is still null too. Null while the face is out of view or when the analysis does not measure it; treat a frame without it the same way.
          oneOf:
            - $ref: "#/components/schemas/CameraHeadPose"
            - type: "null"
    RecordingCompletedData:
      title: RecordingCompletedData
      type: object
      required:
        - durationS
        - orgasmCount
        - subject
      properties:
        durationS:
          description: Length of the recording, in seconds.
          type: number
        orgasmCount:
          description: How many orgasms the analysis called in the recording.
          type: integer
          minimum: 0
        subject:
          type: object
          required:
            - sex
            - pWoman
          properties:
            sex:
              type: string
              enum:
                - woman
                - man
                - undetermined
            pWoman:
              type:
                - number
                - "null"
              minimum: 0
              maximum: 1
    RecordingFailedData:
      title: RecordingFailedData
      type: object
      required:
        - code
        - message
      properties:
        code:
          description: "`unreadable_media`: the file could not be decoded (H.264 or H.265 video is required). `no_face`: no face was visible long enough to analyse. `too_short`: under two minutes. `too_long`: over four hours. `fetch_failed`: `source.url` could not be fetched. `upload_expired`: the upload URL expired before a file arrived. `internal`: an internal failure; submit it again."
          type: string
          enum:
            - unreadable_media
            - no_face
            - too_short
            - too_long
            - fetch_failed
            - upload_expired
            - internal
        message:
          type: string
    ImminenceUpdatedEvent:
      title: imminence.updated
      description: "About once a second while the face is analysed: the probability that the next orgasm begins within 30 and 60 seconds. Streamed only; never sent to webhooks."
      allOf:
        - $ref: "#/components/schemas/EventBase"
        - type: object
          required:
            - type
            - data
          properties:
            type:
              const: imminence.updated
            data:
              $ref: "#/components/schemas/ImminenceData"
    SignalsUpdatedEvent:
      title: signals.updated
      description: "Once a second with each `imminence.updated` of a live session: the vocalization rate and loudness from the microphone, the contraction rate and movement from the body view, and how far each region of the face has moved from the baseline. For a heads-up display; not a call, and never charged. Streamed only; never sent to webhooks."
      allOf:
        - $ref: "#/components/schemas/EventBase"
        - type: object
          required:
            - type
            - data
          properties:
            type:
              const: signals.updated
            data:
              $ref: "#/components/schemas/SignalsData"
    StimulationUpdatedEvent:
      title: stimulation.updated
      description: "Each time your product reports stimulation, through `reportStimulation` or a `stimulation` message on the socket: the device's state, level, channels and mode as reported, for a display beside the person's signals. At most four a second; reports in between are merged into the next. Streamed only; never sent to webhooks."
      allOf:
        - $ref: "#/components/schemas/EventBase"
        - type: object
          required:
            - type
            - data
          properties:
            type:
              const: stimulation.updated
            data:
              $ref: "#/components/schemas/StimulationData"
    OrgasmOnsetEvent:
      title: orgasm.onset
      description: An orgasm began. Applies to women (the `onset_end` detector). Requires the microphone. The call arrives a few seconds after the moment it names.
      allOf:
        - $ref: "#/components/schemas/EventBase"
        - type: object
          required:
            - type
            - data
          properties:
            type:
              const: orgasm.onset
            data:
              $ref: "#/components/schemas/OrgasmOnsetData"
    OrgasmPeakEvent:
      title: orgasm.peak
      description: The peak of an orgasm. Applies to men (the `peak` detector). Requires the microphone. The call arrives a few seconds after the moment it names.
      allOf:
        - $ref: "#/components/schemas/EventBase"
        - type: object
          required:
            - type
            - data
          properties:
            type:
              const: orgasm.peak
            data:
              $ref: "#/components/schemas/OrgasmPeakData"
    OrgasmEndEvent:
      title: orgasm.end
      description: An orgasm ended. For women it closes the orgasm an `orgasm.onset` opened (`onset_end`, requires the microphone); for men it follows an `orgasm.peak` and is read from the face (`face_end`).
      allOf:
        - $ref: "#/components/schemas/EventBase"
        - type: object
          required:
            - type
            - data
          properties:
            type:
              const: orgasm.end
            data:
              $ref: "#/components/schemas/OrgasmEndData"
    EdgeCompletedEvent:
      title: edge.completed
      description: "An edge: imminence (`p30`) reached 0.6 and fell back below 0.3 with no orgasm called in between. orgasm.dev counts it on its side, as the edge preset's back-off and resume levels, and charges half a credit for it in live mode. Sent with the reading that completed it; its `confidence` is the lowest of the approach's readings. Without the microphone no orgasm can be called, so every approach that recedes is an edge."
      allOf:
        - $ref: "#/components/schemas/EventBase"
        - type: object
          required:
            - type
            - data
          properties:
            type:
              const: edge.completed
            data:
              $ref: "#/components/schemas/EdgeCompletedData"
    SubjectIdentifiedEvent:
      title: subject.identified
      description: "Once per session or recording, after about 30 seconds of visible face: whether the face reads as a woman's or a man's, and which detectors apply from then on."
      allOf:
        - $ref: "#/components/schemas/EventBase"
        - type: object
          required:
            - type
            - data
          properties:
            type:
              const: subject.identified
            data:
              $ref: "#/components/schemas/SubjectIdentifiedData"
    SessionStatusEvent:
      title: session.status
      description: The live session changed status, or its inputs changed.
      allOf:
        - $ref: "#/components/schemas/EventBase"
        - type: object
          required:
            - type
            - data
          properties:
            type:
              const: session.status
            data:
              $ref: "#/components/schemas/SessionStatusData"
    InputWarningEvent:
      title: input.warning
      description: An input problem started (`raised`) or stopped (`cleared`). Show `message` to the person when it helps them fix it.
      allOf:
        - $ref: "#/components/schemas/EventBase"
        - type: object
          required:
            - type
            - data
          properties:
            type:
              const: input.warning
            data:
              $ref: "#/components/schemas/InputWarningData"
    RecordingCompletedEvent:
      title: recording.completed
      description: A recording finished processing. Fetch its events with `listRecordingEvents`.
      allOf:
        - $ref: "#/components/schemas/EventBase"
        - type: object
          required:
            - type
            - data
          properties:
            type:
              const: recording.completed
            data:
              $ref: "#/components/schemas/RecordingCompletedData"
    RecordingFailedEvent:
      title: recording.failed
      description: A recording could not be processed.
      allOf:
        - $ref: "#/components/schemas/EventBase"
        - type: object
          required:
            - type
            - data
          properties:
            type:
              const: recording.failed
            data:
              $ref: "#/components/schemas/RecordingFailedData"
    CreditsLowData:
      title: CreditsLowData
      type: object
      required:
        - domain
        - balance
        - threshold
        - freeRemaining
        - packageId
      properties:
        domain:
          description: The company domain the credits belong to.
          type: string
          examples:
            - studio.example
        balance:
          description: Credits available now, in halves.
          type: number
        threshold:
          description: "The level that sent it: 20% of the credits the latest package posted (4 of the free 20)."
          type: number
        freeRemaining:
          description: How many of the free credits are left.
          type: number
          minimum: 0
        packageId:
          description: The package the threshold is measured against.
          type: string
          pattern: ^(free|pkg_[0-9a-z]{20})$
    CreditsLowEvent:
      title: credits.low
      description: Your company's credit balance fell to 20% or less of its latest package (4 of the free 20). Sent once per package, by webhook only, to the company's live endpoints subscribed to it. It belongs to no session, so it has no `sessionId`, `sequence` or stream time.
      type: object
      required:
        - id
        - object
        - type
        - mode
        - wallTime
        - data
      properties:
        id:
          description: Unique and stable; deduplicate on it.
          type: string
          pattern: ^evt_[0-9a-z]{20}$
        object:
          type: string
          const: event
        type:
          type: string
          const: credits.low
        mode:
          description: Credits are live mode's.
          type: string
          const: live
        wallTime:
          description: When the balance crossed the threshold, as UTC wall-clock time.
          type: string
          format: date-time
        data:
          $ref: "#/components/schemas/CreditsLowData"
    Event:
      title: Event
      description: Any event. Switch on `type`.
      oneOf:
        - $ref: "#/components/schemas/ImminenceUpdatedEvent"
        - $ref: "#/components/schemas/SignalsUpdatedEvent"
        - $ref: "#/components/schemas/StimulationUpdatedEvent"
        - $ref: "#/components/schemas/OrgasmOnsetEvent"
        - $ref: "#/components/schemas/OrgasmPeakEvent"
        - $ref: "#/components/schemas/OrgasmEndEvent"
        - $ref: "#/components/schemas/EdgeCompletedEvent"
        - $ref: "#/components/schemas/SubjectIdentifiedEvent"
        - $ref: "#/components/schemas/SessionStatusEvent"
        - $ref: "#/components/schemas/InputWarningEvent"
        - $ref: "#/components/schemas/RecordingCompletedEvent"
        - $ref: "#/components/schemas/RecordingFailedEvent"
    WebhookHeaders:
      title: WebhookHeaders
      description: The headers of every webhook delivery, per the Standard Webhooks specification.
      type: object
      required:
        - webhook-id
        - webhook-timestamp
        - webhook-signature
        - content-type
      properties:
        webhook-id:
          description: The event `id`. The same on every retry; deduplicate on it.
          type: string
          pattern: ^evt_[0-9a-z]{20}$
        webhook-timestamp:
          description: When this attempt was sent, in Unix seconds.
          type: string
          pattern: ^[0-9]+$
        webhook-signature:
          description: "`v1,` and the base64 HMAC-SHA256 of `{webhook-id}.{webhook-timestamp}.{body}`, keyed with your endpoint's secret. Several space-separated signatures may appear while a secret is being rotated; accept any that verifies."
          type: string
        content-type:
          type: string
          const: application/json
        user-agent:
          type: string
          examples:
            - orgasm.dev-webhooks/1.0
    SocketError:
      title: SocketError
      description: Sent on the socket when a client message is refused.
      type: object
      required:
        - type
        - code
        - detail
      properties:
        type:
          type: string
          const: socket.error
        code:
          type: string
          enum:
            - invalid_message
            - unknown_action
            - session_ended
            - forbidden
            - rate_limited
        detail:
          type: string
    ClientStimulation:
      title: ClientStimulation
      description: "A stimulation report, as on `POST /v1/live-sessions/{sessionId}/stimulation`: every field but `state` is optional, one you omit keeps the value you last reported, and `null` clears it. Each reaches the session's readers as `stimulation.updated`."
      type: object
      required:
        - action
        - state
      properties:
        action:
          type: string
          const: stimulation
        state:
          type: string
          enum:
            - on
            - off
        intensity:
          type:
            - number
            - "null"
          minimum: 0
          maximum: 1
        level:
          type:
            - number
            - "null"
          minimum: 0
        levelMax:
          type:
            - number
            - "null"
          exclusiveMinimum: 0
        channels:
          type:
            - array
            - "null"
          maxItems: 4
          items:
            $ref: "#/components/schemas/StimulationReportChannel"
        mode:
          type:
            - string
            - "null"
          maxLength: 40
        modeLabel:
          type:
            - string
            - "null"
          maxLength: 40
        device:
          oneOf:
            - $ref: "#/components/schemas/StimulationReportDevice"
            - type: "null"
        drive:
          type:
            - string
            - "null"
          enum:
            - auto
            - manual
            - hold
            - paused
            - null
        streamTimeS:
          type: number
          minimum: 0
    ClientResume:
      title: ClientResume
      description: Ask for every event after `after` to be sent again, in order.
      type: object
      required:
        - action
        - after
      properties:
        action:
          type: string
          const: resume
        after:
          type: string
          pattern: ^evt_[0-9a-z]{20}$
  messages:
    imminenceUpdated:
      name: imminence.updated
      title: Imminence updated
      summary: The probability that the next orgasm begins within 30 and 60 seconds, about once a second.
      contentType: application/json
      payload:
        $ref: "#/components/schemas/ImminenceUpdatedEvent"
      examples:
        - name: rising
          summary: A second after a woman’s onset call, which it repeats in recentCalls.
          payload:
            id: evt_1yohem6b9mw24jlm4lp7
            object: event
            type: imminence.updated
            mode: test
            sessionId: ls_8f3kq2m7x9w4c1n6t5ra
            sequence: 970
            streamTimeS: 543
            confidence: high
            data:
              p30: 0.883
              p60: 0.986
              logit30: 2.02
              logit60: 4.28
              featuresPresent: 0.93
              faceVisible: true
              baselineReady: true
              stimulationAware: false
              recentCalls:
                - id: evt_2099smltv0t2c2wzzyzq
                  type: orgasm.onset
                  eventAtS: 538
            wallTime: 2026-10-16T14:00:55.300Z
        - name: faceLost
          summary: "While the face is out of view: no reading."
          payload:
            id: evt_11in5qr8yg62bhxr3i0v
            object: event
            type: imminence.updated
            mode: test
            sessionId: ls_8f3kq2m7x9w4c1n6t5ra
            sequence: 485
            streamTimeS: 300
            confidence: low
            data:
              p30: null
              p60: null
              logit30: null
              logit60: null
              featuresPresent: 0
              faceVisible: false
              baselineReady: true
              stimulationAware: false
              recentCalls: []
            wallTime: 2026-10-16T14:00:31.000Z
    signalsUpdated:
      name: signals.updated
      title: Signals updated
      summary: Vocalizations, contractions, movement, the face's regions and its channels, once a second with imminence; for a heads-up display.
      contentType: application/json
      payload:
        $ref: "#/components/schemas/SignalsUpdatedEvent"
      examples:
        - name: withFace
          summary: "Five minutes in: the voice, the face’s regions, and its channels for a display that draws the face."
          payload:
            id: evt_16jli44dbp220eivj30s
            object: event
            type: signals.updated
            mode: test
            sessionId: ls_8f3kq2m7x9w4c1n6t5ra
            sequence: 484
            streamTimeS: 300
            confidence: high
            data:
              vocalizationsPerMin: 3
              loudnessAboveBaselineDb: 2
              contractionsPerMin: null
              movement: null
              faceRegions:
                brows: 0.13
                eyes: 0.11
                cheeks: 0.13
                nose: 0.09
                lips: 0.13
                corners: 0.11
                jaw: 0.19
              face:
                expression:
                  eyeBlinkL: 0.03
                  eyeBlinkR: 0.08
                  eyeWideL: 0.05
                  eyeWideR: 0.11
                  browDownL: 0.03
                  browDownR: 0.11
                  browInnerUp: 0.11
                  browOuterUpL: 0.13
                  browOuterUpR: 0.03
                  jawOpen: 0.19
                  lipsPart: 0.13
                  mouthSmileL: 0.11
                  mouthSmileR: 0.03
                  mouthStretch: 0.12
                  mouthPucker: 0
                  noseSneer: 0.09
                  noseFlare: 0.04
                  cheekSquintL: 0.13
                  cheekSquintR: 0.08
                  chinRaise: 0.08
                  lidTighten: 0.07
                  browTogether: 0.08
                  noseWrinkle: 0.04
                  lidRaise: 0.06
                head:
                  yawDeg: 4.8
                  pitchDeg: -0.7
                  rollDeg: 3.5
            wallTime: 2026-10-16T14:00:31.000Z
    stimulationUpdated:
      name: stimulation.updated
      title: Stimulation updated
      summary: The device's state, level, channels and mode, as your product reported them; at most four a second.
      contentType: application/json
      payload:
        $ref: "#/components/schemas/StimulationUpdatedEvent"
      examples:
        - name: unit
          summary: A two-channel unit in its waves mode, set by your product.
          payload:
            id: evt_27agnfxkudp0cl1yesg8
            object: event
            type: stimulation.updated
            mode: test
            sessionId: ls_8f3kq2m7x9w4c1n6t5ra
            sequence: 365
            streamTimeS: 240
            confidence: null
            data:
              state: on
              intensity: null
              level: 31
              levelMax: 60
              channels:
                - id: a
                  level: 31
                  levelMax: 60
                - id: b
                  level: 24
                  levelMax: 60
              mode: waves
              modeLabel: Waves
              device:
                label: Unit
                connected: true
              drive: auto
              changedAtS: 240
            wallTime: 2026-10-16T14:00:25.000Z
        - name: levelRaised
          summary: A later report changed only the levels; the mode and the device are kept.
          payload:
            id: evt_0khvy2sbv7q09712bg1x
            object: event
            type: stimulation.updated
            mode: test
            sessionId: ls_8f3kq2m7x9w4c1n6t5ra
            sequence: 486
            streamTimeS: 300
            confidence: null
            data:
              state: on
              intensity: null
              level: 34
              levelMax: 60
              channels:
                - id: a
                  level: 34
                  levelMax: 60
                - id: b
                  level: 27
                  levelMax: 60
              mode: waves
              modeLabel: Waves
              device:
                label: Unit
                connected: true
              drive: auto
              changedAtS: 300
            wallTime: 2026-10-16T14:00:31.000Z
    faceFrame:
      name: face.frame
      title: Face frame
      summary: The face's channels and the head as the camera sees it, about five times a second, for a display that draws them; with `frames=face` only, never stored.
      contentType: application/json
      payload:
        $ref: "#/components/schemas/FaceFrame"
      examples:
        - name: face
          summary: The face between two readings, five minutes in.
          payload:
            type: face.frame
            sessionId: ls_8f3kq2m7x9w4c1n6t5ra
            streamTimeS: 312.4
            face:
              expression:
                eyeBlinkL: 0.04
                eyeBlinkR: 0.06
                eyeWideL: 0.09
                eyeWideR: 0.09
                browDownL: 0.03
                browDownR: 0.07
                browInnerUp: 0.19
                browOuterUpL: 0.05
                browOuterUpR: 0.06
                jawOpen: 0.18
                lipsPart: 0.17
                mouthSmileL: 0.05
                mouthSmileR: 0.07
                mouthStretch: 0.09
                mouthPucker: 0.06
                noseSneer: 0.01
                noseFlare: 0.06
                cheekSquintL: 0.15
                cheekSquintR: 0.09
                chinRaise: 0.02
                lidTighten: 0.12
                browTogether: 0.07
                noseWrinkle: 0.04
                lidRaise: 0.04
              head:
                yawDeg: 5.4
                pitchDeg: -1.6
                rollDeg: -2.8
            cameraHead:
              yawDeg: 5.4
              pitchDeg: -1.6
              rollDeg: -2.8
        - name: calibrating
          summary: "Before the baseline: the head as the camera sees it, the face not yet."
          payload:
            type: face.frame
            sessionId: ls_8f3kq2m7x9w4c1n6t5ra
            streamTimeS: 30.2
            face: null
            cameraHead:
              yawDeg: -3.7
              pitchDeg: -3.4
              rollDeg: -1.6
    orgasmOnset:
      name: orgasm.onset
      title: Orgasm onset
      summary: An orgasm began (women; needs the microphone).
      contentType: application/json
      payload:
        $ref: "#/components/schemas/OrgasmOnsetEvent"
      examples:
        - name: woman
          summary: The onset of a woman’s orgasm, called 4.6 seconds after it began.
          payload: &a1
            id: evt_2099smltv0t2c2wzzyzq
            object: event
            type: orgasm.onset
            mode: test
            sessionId: ls_8f3kq2m7x9w4c1n6t5ra
            sequence: 969
            streamTimeS: 542.6
            confidence: high
            data:
              orgasmIndex: 1
              eventAtS: 538
              calledAtS: 542.6
              lagS: 4.6
              detector: onset_end
              score: 0.71
              threshold: 0.5
            wallTime: 2026-10-16T14:00:55.260Z
    orgasmPeak:
      name: orgasm.peak
      title: Orgasm peak
      summary: The peak of an orgasm (men; needs the microphone).
      contentType: application/json
      payload:
        $ref: "#/components/schemas/OrgasmPeakEvent"
      examples:
        - name: man
          summary: A man’s peak, called 3.2 seconds after it.
          payload: &a2
            id: evt_26m8iv7m9ik1q6bbpxah
            object: event
            type: orgasm.peak
            mode: test
            sessionId: ls_8f3kq2m7x9w4c1n6t5ra
            sequence: 1293
            streamTimeS: 704.2
            confidence: high
            data:
              orgasmIndex: 1
              eventAtS: 701
              calledAtS: 704.2
              lagS: 3.2
              detector: peak
              score: 0.66
              threshold: 0.5
            wallTime: 2026-10-16T14:01:11.420Z
    orgasmEnd:
      name: orgasm.end
      title: Orgasm end
      summary: An orgasm ended.
      contentType: application/json
      payload:
        $ref: "#/components/schemas/OrgasmEndEvent"
      examples:
        - name: woman
          summary: The end of a woman’s orgasm, from the onset-and-end detector.
          payload: &a3
            id: evt_2b9vobycwv70h1fs0mre
            object: event
            type: orgasm.end
            mode: test
            sessionId: ls_8f3kq2m7x9w4c1n6t5ra
            sequence: 1046
            streamTimeS: 580.2
            confidence: high
            data:
              orgasmIndex: 1
              eventAtS: 575
              startedAtS: 538
              durationS: 37
              calledAtS: 580.2
              lagS: 5.2
              detector: onset_end
              score: 0.68
              threshold: 0.5
              ruined: false
            wallTime: 2026-10-16T14:00:59.020Z
        - name: man
          summary: The end of a man’s orgasm, read from his face.
          payload: &a4
            id: evt_1ayrl74h5aa24meaff3k
            object: event
            type: orgasm.end
            mode: test
            sessionId: ls_8f3kq2m7x9w4c1n6t5ra
            sequence: 1376
            streamTimeS: 745.5
            confidence: high
            data:
              orgasmIndex: 1
              eventAtS: 742
              startedAtS: 701
              durationS: 41
              calledAtS: 745.5
              lagS: 3.5
              detector: face_end
              score: null
              threshold: null
              ruined: false
            wallTime: 2026-10-16T14:01:15.550Z
        - name: ruined
          summary: "The end of a ruined orgasm: stimulation was reported off at the point of no return."
          payload: &a5
            id: evt_20wbdv4aq0o16ns5dfu9
            object: event
            type: orgasm.end
            mode: test
            sessionId: ls_8f3kq2m7x9w4c1n6t5ra
            sequence: 1172
            streamTimeS: 643.9
            confidence: high
            data:
              orgasmIndex: 1
              eventAtS: 640
              startedAtS: 612
              durationS: 28
              calledAtS: 643.9
              lagS: 3.9
              detector: face_end
              score: null
              threshold: null
              ruined: true
            wallTime: 2026-10-16T14:01:05.390Z
    edgeCompleted:
      name: edge.completed
      title: Edge completed
      summary: Imminence reached 0.6 and fell back below 0.3 with no orgasm called; half a credit in live mode.
      contentType: application/json
      payload:
        $ref: "#/components/schemas/EdgeCompletedEvent"
      examples:
        - name: first
          summary: "The first of three edges: imminence reached 0.6 and fell back below 0.3."
          payload: &a6
            id: evt_2gi9on772qb0beswjxgp
            object: event
            type: edge.completed
            mode: test
            sessionId: ls_8f3kq2m7x9w4c1n6t5ra
            sequence: 706
            streamTimeS: 411
            confidence: high
            data:
              edgeIndex: 1
              startedAtS: 362
              eventAtS: 411
              durationS: 49
              peakP30: 0.687
            wallTime: 2026-10-16T14:00:42.100Z
    subjectIdentified:
      name: subject.identified
      title: Subject identified
      summary: Whether the face reads as a woman's or a man's, and which detectors apply.
      contentType: application/json
      payload:
        $ref: "#/components/schemas/SubjectIdentifiedEvent"
      examples:
        - name: woman
          summary: The face reads as a woman’s.
          payload: &a7
            id: evt_0z6tc53e7py0ep61nm8s
            object: event
            type: subject.identified
            mode: test
            sessionId: ls_8f3kq2m7x9w4c1n6t5ra
            sequence: 4
            streamTimeS: 32
            confidence: high
            data:
              sex: woman
              pWoman: 0.94
              secondsObserved: 30
              decidedAtS: 32
              hint: null
              detectors:
                - onset_end
            wallTime: 2026-10-16T14:00:04.200Z
        - name: man
          summary: The face reads as a man’s.
          payload: &a8
            id: evt_0z6tc53e7py0ep61nm8s
            object: event
            type: subject.identified
            mode: test
            sessionId: ls_8f3kq2m7x9w4c1n6t5ra
            sequence: 4
            streamTimeS: 31
            confidence: high
            data:
              sex: man
              pWoman: 0.07
              secondsObserved: 30
              decidedAtS: 31
              hint: null
              detectors:
                - peak
                - face_end
            wallTime: 2026-10-16T14:00:04.100Z
        - name: undetermined
          summary: "Undetermined: every detector runs."
          payload: &a9
            id: evt_0z6tc53e7py0ep61nm8s
            object: event
            type: subject.identified
            mode: test
            sessionId: ls_8f3kq2m7x9w4c1n6t5ra
            sequence: 4
            streamTimeS: 33
            confidence: low
            data:
              sex: undetermined
              pWoman: 0.52
              secondsObserved: 30
              decidedAtS: 33
              hint: null
              detectors:
                - onset_end
                - peak
                - face_end
            wallTime: 2026-10-16T14:00:04.300Z
    sessionStatus:
      name: session.status
      title: Session status
      summary: The session's status or inputs changed.
      contentType: application/json
      payload:
        $ref: "#/components/schemas/SessionStatusEvent"
      examples:
        - name: analyzing
          summary: The baseline is in and every signal runs.
          payload: &a10
            id: evt_0a8shq12uin1saa234wn
            object: event
            type: session.status
            mode: test
            sessionId: ls_8f3kq2m7x9w4c1n6t5ra
            sequence: 5
            streamTimeS: 62
            confidence: null
            data:
              status: analyzing
              previousStatus: calibrating
              degraded: false
              inputs:
                face:
                  present: true
                  baselineReady: true
                audio:
                  declared: true
                  present: true
                body:
                  declared: false
                  present: false
              endedReason: null
            wallTime: 2026-10-16T14:00:07.200Z
        - name: degraded
          summary: The face left the frame.
          payload: &a11
            id: evt_16jli44dbp220eivj30s
            object: event
            type: session.status
            mode: test
            sessionId: ls_8f3kq2m7x9w4c1n6t5ra
            sequence: 484
            streamTimeS: 300
            confidence: null
            data:
              status: analyzing
              previousStatus: analyzing
              degraded: true
              inputs:
                face:
                  present: false
                  baselineReady: true
                audio:
                  declared: true
                  present: true
                body:
                  declared: false
                  present: false
              endedReason: null
            wallTime: 2026-10-16T14:00:31.000Z
        - name: ended
          summary: The device stopped publishing.
          payload: &a12
            id: evt_25frt90df451tghy9rsh
            object: event
            type: session.status
            mode: test
            sessionId: ls_8f3kq2m7x9w4c1n6t5ra
            sequence: 1205
            streamTimeS: 660
            confidence: null
            data:
              status: ended
              previousStatus: analyzing
              degraded: false
              inputs:
                face:
                  present: false
                  baselineReady: false
                audio:
                  declared: true
                  present: false
                body:
                  declared: false
                  present: false
              endedReason: media_ended
            wallTime: 2026-10-16T14:01:07.000Z
    inputWarning:
      name: input.warning
      title: Input warning
      summary: An input problem started or stopped.
      contentType: application/json
      payload:
        $ref: "#/components/schemas/InputWarningEvent"
      examples:
        - name: faceLost
          summary: The face left the frame.
          payload: &a13
            id: evt_1x82ikl67c70dowtacc7
            object: event
            type: input.warning
            mode: test
            sessionId: ls_8f3kq2m7x9w4c1n6t5ra
            sequence: 483
            streamTimeS: 300
            confidence: null
            data:
              code: face_not_visible
              state: raised
              message: Your face is not visible. Move back into view of the front camera.
              sinceS: 300
            wallTime: 2026-10-16T14:00:31.000Z
        - name: noMicrophone
          summary: The stream carries no microphone.
          payload: &a14
            id: evt_159r5y1xo9x0sbbssbl5
            object: event
            type: input.warning
            mode: test
            sessionId: ls_8f3kq2m7x9w4c1n6t5ra
            sequence: 3
            streamTimeS: 0
            confidence: null
            data:
              code: audio_absent
              state: raised
              message: No microphone audio is arriving, so onset, peak and end cannot be called.
              sinceS: 0
            wallTime: 2026-10-16T14:00:01.000Z
    socketError:
      name: socket.error
      title: Socket error
      summary: A client message was refused.
      contentType: application/json
      payload:
        $ref: "#/components/schemas/SocketError"
      examples:
        - name: unknownAction
          summary: The client sent an action the socket does not know.
          payload:
            type: socket.error
            code: unknown_action
            detail: Unknown action "pause". Send "stimulation" or "resume".
    clientStimulation:
      name: stimulation
      title: Stimulation report
      summary: The client reports that stimulation started, stopped or changed.
      contentType: application/json
      payload:
        $ref: "#/components/schemas/ClientStimulation"
      examples:
        - name: started
          summary: Stimulation started at 40 % intensity.
          payload:
            action: stimulation
            state: on
            intensity: 0.4
    clientResume:
      name: resume
      title: Resume
      summary: The client asks for missed events again.
      contentType: application/json
      payload:
        $ref: "#/components/schemas/ClientResume"
      examples:
        - name: afterOnset
          summary: Replay everything after the onset call.
          payload:
            action: resume
            after: evt_4q7m2k9x8w1c3n6b5v0z
    webhookOrgasmOnset:
      name: orgasm.onset
      title: Orgasm onset (webhook)
      summary: An orgasm began, delivered to your endpoint.
      contentType: application/json
      headers:
        $ref: "#/components/schemas/WebhookHeaders"
      payload:
        $ref: "#/components/schemas/OrgasmOnsetEvent"
      examples:
        - name: woman
          summary: The onset of a woman’s orgasm, called 4.6 seconds after it began. Signed with the sample secret whsec_MfKQ9r8GKYqrTwjUPD8ILPZIo2LaLaSw.
          headers:
            webhook-id: evt_2099smltv0t2c2wzzyzq
            webhook-timestamp: "1792159256"
            webhook-signature: v1,Oe+TJZs5fPss0goFqsiMfXNiv24UUAR07rjfMfPO41s=
            content-type: application/json
            user-agent: orgasm.dev-webhooks/1.0
          payload: *a1
    webhookOrgasmPeak:
      name: orgasm.peak
      title: Orgasm peak (webhook)
      summary: The peak of an orgasm, delivered to your endpoint.
      contentType: application/json
      headers:
        $ref: "#/components/schemas/WebhookHeaders"
      payload:
        $ref: "#/components/schemas/OrgasmPeakEvent"
      examples:
        - name: man
          summary: A man’s peak, called 3.2 seconds after it. Signed with the sample secret whsec_MfKQ9r8GKYqrTwjUPD8ILPZIo2LaLaSw.
          headers:
            webhook-id: evt_26m8iv7m9ik1q6bbpxah
            webhook-timestamp: "1792159272"
            webhook-signature: v1,OFiaVOykiE8QE6QIwX/QbEDBTqZD925gSMFCpE6Ur0I=
            content-type: application/json
            user-agent: orgasm.dev-webhooks/1.0
          payload: *a2
    webhookOrgasmEnd:
      name: orgasm.end
      title: Orgasm end (webhook)
      summary: An orgasm ended, delivered to your endpoint.
      contentType: application/json
      headers:
        $ref: "#/components/schemas/WebhookHeaders"
      payload:
        $ref: "#/components/schemas/OrgasmEndEvent"
      examples:
        - name: woman
          summary: The end of a woman’s orgasm, from the onset-and-end detector. Signed with the sample secret whsec_MfKQ9r8GKYqrTwjUPD8ILPZIo2LaLaSw.
          headers:
            webhook-id: evt_2b9vobycwv70h1fs0mre
            webhook-timestamp: "1792159260"
            webhook-signature: v1,kQUkoSBHsKirJHEIF6tEnNXHqOztCoiQ/iobjOyTWwY=
            content-type: application/json
            user-agent: orgasm.dev-webhooks/1.0
          payload: *a3
        - name: man
          summary: The end of a man’s orgasm, read from his face. Signed with the sample secret whsec_MfKQ9r8GKYqrTwjUPD8ILPZIo2LaLaSw.
          headers:
            webhook-id: evt_1ayrl74h5aa24meaff3k
            webhook-timestamp: "1792159276"
            webhook-signature: v1,XOB9a/+B+PWwJ6lafGpaT4pU5RbCxIG1ZovjrQ4LQYs=
            content-type: application/json
            user-agent: orgasm.dev-webhooks/1.0
          payload: *a4
        - name: ruined
          summary: "The end of a ruined orgasm: stimulation was reported off at the point of no return. Signed with the sample secret whsec_MfKQ9r8GKYqrTwjUPD8ILPZIo2LaLaSw."
          headers:
            webhook-id: evt_20wbdv4aq0o16ns5dfu9
            webhook-timestamp: "1792159266"
            webhook-signature: v1,Ag8riekwpRj9aTBoNsi53/1Un1oUSBhB9rMRxDGrGJE=
            content-type: application/json
            user-agent: orgasm.dev-webhooks/1.0
          payload: *a5
    webhookEdgeCompleted:
      name: edge.completed
      title: Edge completed (webhook)
      summary: An edge orgasm.dev counted, delivered to your endpoint.
      contentType: application/json
      headers:
        $ref: "#/components/schemas/WebhookHeaders"
      payload:
        $ref: "#/components/schemas/EdgeCompletedEvent"
      examples:
        - name: first
          summary: "The first of three edges: imminence reached 0.6 and fell back below 0.3. Signed with the sample secret whsec_MfKQ9r8GKYqrTwjUPD8ILPZIo2LaLaSw."
          headers:
            webhook-id: evt_2gi9on772qb0beswjxgp
            webhook-timestamp: "1792159243"
            webhook-signature: v1,fq6G5netcfbWgerNJAySBOP2xBUNM0FvgFtJVkyEV0w=
            content-type: application/json
            user-agent: orgasm.dev-webhooks/1.0
          payload: *a6
    webhookSubjectIdentified:
      name: subject.identified
      title: Subject identified (webhook)
      summary: The subject read, delivered to your endpoint.
      contentType: application/json
      headers:
        $ref: "#/components/schemas/WebhookHeaders"
      payload:
        $ref: "#/components/schemas/SubjectIdentifiedEvent"
      examples:
        - name: woman
          summary: The face reads as a woman’s. Signed with the sample secret whsec_MfKQ9r8GKYqrTwjUPD8ILPZIo2LaLaSw.
          headers:
            webhook-id: evt_0z6tc53e7py0ep61nm8s
            webhook-timestamp: "1792159205"
            webhook-signature: v1,pjbUe12iIP/pmZPP8Sl5FutWccnLlnKO0rOc35jwAhQ=
            content-type: application/json
            user-agent: orgasm.dev-webhooks/1.0
          payload: *a7
        - name: man
          summary: The face reads as a man’s. Signed with the sample secret whsec_MfKQ9r8GKYqrTwjUPD8ILPZIo2LaLaSw.
          headers:
            webhook-id: evt_0z6tc53e7py0ep61nm8s
            webhook-timestamp: "1792159205"
            webhook-signature: v1,dLYs8kbhCYexlNt8KYpj/WC/WE9G34ldGgdhQQ7fh3k=
            content-type: application/json
            user-agent: orgasm.dev-webhooks/1.0
          payload: *a8
        - name: undetermined
          summary: "Undetermined: every detector runs. Signed with the sample secret whsec_MfKQ9r8GKYqrTwjUPD8ILPZIo2LaLaSw."
          headers:
            webhook-id: evt_0z6tc53e7py0ep61nm8s
            webhook-timestamp: "1792159205"
            webhook-signature: v1,kv+83u50wTx2/tAn2YIw72iChhHI6hMv6H2u73TUMvE=
            content-type: application/json
            user-agent: orgasm.dev-webhooks/1.0
          payload: *a9
    webhookSessionStatus:
      name: session.status
      title: Session status (webhook)
      summary: A session status change, delivered to your endpoint.
      contentType: application/json
      headers:
        $ref: "#/components/schemas/WebhookHeaders"
      payload:
        $ref: "#/components/schemas/SessionStatusEvent"
      examples:
        - name: analyzing
          summary: The baseline is in and every signal runs. Signed with the sample secret whsec_MfKQ9r8GKYqrTwjUPD8ILPZIo2LaLaSw.
          headers:
            webhook-id: evt_0a8shq12uin1saa234wn
            webhook-timestamp: "1792159208"
            webhook-signature: v1,3sTka7QwHgjQfZTUy12Uo7XpnOrwalsNXT9qMYYCF00=
            content-type: application/json
            user-agent: orgasm.dev-webhooks/1.0
          payload: *a10
        - name: degraded
          summary: The face left the frame. Signed with the sample secret whsec_MfKQ9r8GKYqrTwjUPD8ILPZIo2LaLaSw.
          headers:
            webhook-id: evt_16jli44dbp220eivj30s
            webhook-timestamp: "1792159232"
            webhook-signature: v1,l6BpOHaOX+bRJ0KwSDxxZGARCmqIcRGiivkZ7W0sWP4=
            content-type: application/json
            user-agent: orgasm.dev-webhooks/1.0
          payload: *a11
        - name: ended
          summary: The device stopped publishing. Signed with the sample secret whsec_MfKQ9r8GKYqrTwjUPD8ILPZIo2LaLaSw.
          headers:
            webhook-id: evt_25frt90df451tghy9rsh
            webhook-timestamp: "1792159268"
            webhook-signature: v1,HT5zA0aGpwQt64lcwiEXWF+RCqZhFdsemsCPYhoMExQ=
            content-type: application/json
            user-agent: orgasm.dev-webhooks/1.0
          payload: *a12
    webhookInputWarning:
      name: input.warning
      title: Input warning (webhook)
      summary: An input warning, delivered to your endpoint.
      contentType: application/json
      headers:
        $ref: "#/components/schemas/WebhookHeaders"
      payload:
        $ref: "#/components/schemas/InputWarningEvent"
      examples:
        - name: faceLost
          summary: The face left the frame. Signed with the sample secret whsec_MfKQ9r8GKYqrTwjUPD8ILPZIo2LaLaSw.
          headers:
            webhook-id: evt_1x82ikl67c70dowtacc7
            webhook-timestamp: "1792159232"
            webhook-signature: v1,QieQnF2T1nUbxGB0Zn/inOhAsHcGaaxiY6AzWEjSfx0=
            content-type: application/json
            user-agent: orgasm.dev-webhooks/1.0
          payload: *a13
        - name: noMicrophone
          summary: The stream carries no microphone. Signed with the sample secret whsec_MfKQ9r8GKYqrTwjUPD8ILPZIo2LaLaSw.
          headers:
            webhook-id: evt_159r5y1xo9x0sbbssbl5
            webhook-timestamp: "1792159202"
            webhook-signature: v1,V+soHjIe6W77iG5VtcqIzhUnJMn0KLYW8WpMgVmyjVI=
            content-type: application/json
            user-agent: orgasm.dev-webhooks/1.0
          payload: *a14
    webhookRecordingCompleted:
      name: recording.completed
      title: Recording completed (webhook)
      summary: A recording finished processing.
      contentType: application/json
      headers:
        $ref: "#/components/schemas/WebhookHeaders"
      payload:
        $ref: "#/components/schemas/RecordingCompletedEvent"
      examples:
        - name: man
          summary: A 13-minute recording with one orgasm. Signed with the sample secret whsec_MfKQ9r8GKYqrTwjUPD8ILPZIo2LaLaSw.
          headers:
            webhook-id: evt_01e7nwowmv01p3y9h7qm
            webhook-timestamp: "1792159234"
            webhook-signature: v1,4neSv/nEwOsBxMJ48S9a025g8x+VGcqHIeSq05T3Rso=
            content-type: application/json
            user-agent: orgasm.dev-webhooks/1.0
          payload:
            id: evt_01e7nwowmv01p3y9h7qm
            object: event
            type: recording.completed
            mode: test
            recordingId: rec_2n5v8c1x4m7q0w3e6r9t
            sequence: 722
            streamTimeS: 780
            confidence: null
            data:
              durationS: 780
              orgasmCount: 1
              subject:
                sex: man
                pWoman: 0.07
            wallTime: 2026-10-16T14:00:33.000Z
    webhookRecordingFailed:
      name: recording.failed
      title: Recording failed (webhook)
      summary: A recording could not be processed.
      contentType: application/json
      headers:
        $ref: "#/components/schemas/WebhookHeaders"
      payload:
        $ref: "#/components/schemas/RecordingFailedEvent"
      examples:
        - name: fetchFailed
          summary: The enclave could not fetch source.url. Signed with the sample secret whsec_MfKQ9r8GKYqrTwjUPD8ILPZIo2LaLaSw.
          headers:
            webhook-id: evt_7r2k9m4x1c6v8b3n5q0z
            webhook-timestamp: "1792159234"
            webhook-signature: v1,2iGKYKFWVhHKcUz2IZUEw7TImEl4WAr3dKmHZu47lT4=
            content-type: application/json
            user-agent: orgasm.dev-webhooks/1.0
          payload:
            id: evt_7r2k9m4x1c6v8b3n5q0z
            object: event
            type: recording.failed
            mode: test
            recordingId: rec_2n5v8c1x4m7q0w3e6r9t
            sequence: 1
            streamTimeS: 0
            confidence: null
            data:
              code: fetch_failed
              message: source.url answered 403 Forbidden.
            wallTime: 2026-10-16T14:00:33.000Z
    webhookCreditsLow:
      name: credits.low
      title: Credits low (webhook)
      summary: Your company's credits fell to 20% of its latest package, delivered to your live endpoints.
      contentType: application/json
      headers:
        $ref: "#/components/schemas/WebhookHeaders"
      payload:
        $ref: "#/components/schemas/CreditsLowEvent"
      examples:
        - name: freeLow
          summary: Four of the free 20 left. Signed with the sample secret whsec_MfKQ9r8GKYqrTwjUPD8ILPZIo2LaLaSw.
          headers:
            webhook-id: evt_5c2x8v1b4n7m0q3w6e9r
            webhook-timestamp: "1792160468"
            webhook-signature: v1,4Z6EzzjPY0+f2Ow/J4yZmGOuIFffeiJ7FJZWU9/Yvho=
            content-type: application/json
            user-agent: orgasm.dev-webhooks/1.0
          payload:
            id: evt_5c2x8v1b4n7m0q3w6e9r
            object: event
            type: credits.low
            mode: live
            wallTime: 2026-10-16T14:21:07Z
            data:
              domain: studio.example
              balance: 4
              threshold: 4
              freeRemaining: 4
              packageId: free
