> ## Documentation Index
> Fetch the complete documentation index at: https://docs.luxxon.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Cancel session

> Consumer-side cancel. Allowed only in REQUESTED — once an operator has accepted, the consumer must end (not cancel).



## OpenAPI

````yaml /openapi.json delete /api/v1/sessions/{id}
openapi: 3.0.0
info:
  title: Luxxon API
  description: Programmable vision — on-demand live video feeds
  version: 0.1.0
  contact: {}
servers:
  - url: https://api.luxxon.dev/api/v1
security: []
tags:
  - name: Authentication
    description: SIWE wallet sign-in. Used by the dashboard; API-key callers skip this.
  - name: Me
    description: Identity self-introspection — wallet or API key.
  - name: Workspaces
    description: Tenant root. Coverage area, availability, members.
  - name: API keys
    description: Per-workspace scoped credentials (lxxn_*).
  - name: Pricing
    description: Live rate + optional pre-quoted rate lock.
  - name: Sessions
    description: 'Visual session lifecycle: request → dispatch → authorize → start → end.'
  - name: Wallet
    description: On-chain wallet state and event log for a workspace.
  - name: Settlements
    description: On-chain settlement view per session.
  - name: Health
    description: Proof-of-life. No auth.
  - name: Webhooks
    description: Inbound video events from Cloudflare Stream. Internal.
paths:
  /api/v1/sessions/{id}:
    delete:
      tags:
        - Sessions
      summary: Cancel session
      description: >-
        Consumer-side cancel. Allowed only in REQUESTED — once an operator has
        accepted, the consumer must end (not cancel).
      operationId: LxSessionsController_cancel
      parameters:
        - name: id
          required: true
          in: path
          schema:
            type: string
            example: b1e2f3a4-5b6c-7d8e-9f0a-1b2c3d4e5f6a
        - name: x-lx-consistency-token
          required: false
          in: header
          schema:
            type: string
      responses:
        '200':
          description: Request successful
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/LxSuccessResponseDto'
                  - properties:
                      data:
                        $ref: '#/components/schemas/LxSessionDto'
        '401':
          description: NOT_AUTHENTICATED
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/LxErrorResponseDto'
              examples:
                NOT_AUTHENTICATED:
                  summary: NOT_AUTHENTICATED — Session expired or missing
                  value:
                    statusCode: 401
                    code: NOT_AUTHENTICATED
                    message: Session expired or missing
                    detail: not_authenticated:example
                    timestamp: '2026-05-13T12:00:00.000Z'
        '403':
          description: NOT_AUTHORIZED
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/LxErrorResponseDto'
              examples:
                NOT_AUTHORIZED:
                  summary: NOT_AUTHORIZED — Not authorized for this operation
                  value:
                    statusCode: 403
                    code: NOT_AUTHORIZED
                    message: Not authorized for this operation
                    detail: not_authorized:example
                    timestamp: '2026-05-13T12:00:00.000Z'
        '404':
          description: SESSION_NOT_FOUND
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/LxErrorResponseDto'
              examples:
                SESSION_NOT_FOUND:
                  summary: SESSION_NOT_FOUND — Session not found
                  value:
                    statusCode: 404
                    code: SESSION_NOT_FOUND
                    message: Session not found
                    detail: session_not_found:example
                    timestamp: '2026-05-13T12:00:00.000Z'
        '409':
          description: INVALID_STATE
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/LxErrorResponseDto'
              examples:
                INVALID_STATE:
                  summary: INVALID_STATE — Operation not allowed in the current state
                  value:
                    statusCode: 409
                    code: INVALID_STATE
                    message: Operation not allowed in the current state
                    detail: invalid_state:example
                    timestamp: '2026-05-13T12:00:00.000Z'
        '503':
          description: AUTHZ_ERROR
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/LxErrorResponseDto'
              examples:
                AUTHZ_ERROR:
                  summary: AUTHZ_ERROR — Authorization service unavailable
                  value:
                    statusCode: 503
                    code: AUTHZ_ERROR
                    message: Authorization service unavailable
                    detail: authz_error:example
                    timestamp: '2026-05-13T12:00:00.000Z'
      security:
        - access-token: []
components:
  schemas:
    LxSuccessResponseDto:
      type: object
      properties:
        statusCode:
          type: number
          example: 200
        message:
          type: string
          example: Request successful
        data:
          type: object
          description: Endpoint-specific payload. See the per-endpoint schema.
        timestamp:
          type: string
          example: '2026-05-13T12:00:00.000Z'
      required:
        - statusCode
        - message
        - data
        - timestamp
    LxSessionDto:
      type: object
      properties:
        id:
          type: string
          example: b1e2f3a4-5b6c-7d8e-9f0a-1b2c3d4e5f6a
        consumerWorkspaceId:
          type: string
          example: 8c3a5b6f-1d2e-4f7a-9b8c-d1e2f3a4b5c6
        operatorWorkspaceId:
          type: string
          nullable: true
          example: 9d4b6c7f-2e3f-5a8b-0c1d-e2f3a4b5c6d7
        state:
          type: string
          enum:
            - REQUESTED
            - ASSIGNED
            - LIVE
            - PAUSED
            - ENDED
            - EXPIRED
            - CANCELLED
          example: REQUESTED
        maxDurationSeconds:
          type: number
          example: 600
        waitTimeoutSeconds:
          type: number
          example: 300
          description: >-
            Pre-LIVE wait deadline in seconds. After `createdAt +
            waitTimeoutSeconds` without a first decoded frame, the session flips
            to EXPIRED.
        ratePerSecondMicroUsdc:
          type: string
          example: '1000'
          description: Rate per second in µUSDC. String — may exceed JS Number.
        holdMicroUsdc:
          type: string
          example: '600000'
          description: Pre-authorized hold in µUSDC.
        startedAt:
          type: string
          nullable: true
          example: null
        endedAt:
          type: string
          nullable: true
          example: null
        cleanSeconds:
          type: number
          example: 0
          description: >-
            Chargeable seconds = (endedAt - startedAt) - sum(disconnect
            windows). Computed at /end and passed to settle().
        chargedMicroUsdc:
          type: string
          example: '0'
          description: 'Derived: cleanSeconds × ratePerSecondMicroUsdc.'
        settlementTxHash:
          type: string
          nullable: true
          example: null
        videoBackendRef:
          type: string
          nullable: true
          example: 6a7aab6e273b40251e8ee72d7ca05719
          description: >-
            Opaque video-backend reference (Cloudflare Stream live_input uid).
            Set at /start, null after /end teardown.
        createdAt:
          type: string
          example: '2026-05-13T11:30:00.000Z'
        requestedLat:
          type: number
          nullable: true
          example: 4.711234
          description: >-
            Latitude of the requested point. Sourced from the PostGIS
            `requested_at_point` geography column at read time. Null only for
            legacy rows pre-PostGIS migration.
        requestedLng:
          type: number
          nullable: true
          example: -74.072456
          description: >-
            Longitude of the requested point. Sourced from the PostGIS
            `requested_at_point` geography column at read time. Null only for
            legacy rows pre-PostGIS migration.
        authorized:
          type: boolean
          example: false
          description: >-
            True once the consumer has POSTed their EIP-712 signature via
            /authorize. The raw signature stays server-side; this boolean lets
            clients gate UI affordances.
        whepUrl:
          type: string
          nullable: true
          example: https://customer-CODE.cloudflarestream.com/UID/webRTC/play
          description: >-
            WebRTC WHEP playback URL. Present when state=LIVE; readable by both
            consumer + operator administrators.
        whipUrl:
          type: string
          nullable: true
          example: https://customer-CODE.cloudflarestream.com/SECRETkUID/webRTC/publish
          description: >-
            WebRTC WHIP publishing URL. Present when state=LIVE and the caller
            is the operator side.
      required:
        - id
        - consumerWorkspaceId
        - operatorWorkspaceId
        - state
        - maxDurationSeconds
        - waitTimeoutSeconds
        - ratePerSecondMicroUsdc
        - holdMicroUsdc
        - startedAt
        - endedAt
        - cleanSeconds
        - chargedMicroUsdc
        - settlementTxHash
        - videoBackendRef
        - createdAt
        - requestedLat
        - requestedLng
        - authorized
    LxErrorResponseDto:
      type: object
      properties:
        statusCode:
          type: number
          example: 400
        code:
          type: string
          example: INVALID_INPUT
          description: Machine-readable error code — see ErrorCodes.
        message:
          type: string
          example: Invalid request payload
        detail:
          type: string
          example: session:workspaceMismatch
          description: Short, safe-to-expose label scoping the failure site.
        timestamp:
          type: string
          example: '2026-05-13T12:00:00.000Z'
      required:
        - statusCode
        - code
        - message
        - timestamp
  securitySchemes:
    access-token:
      scheme: bearer
      bearerFormat: JWT or lxxn_*
      type: http

````