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

# Get latest lock session

> Returns the most recent lock session with all segment history. Returns null if no sessions exist.



## OpenAPI

````yaml https://dashboard.researchanddesire.com/openapi.yaml get /lkbx/sessions/latest
openapi: 3.1.0
info:
  title: Research And Desire API
  description: >
    The Research And Desire API provides programmatic access to your devices and
    data.


    All responses follow a standard envelope format:

    - Success: `{ "ok": true, "data": <result> }`

    - Error: `{ "ok": false, "error": "<message>" }`


    ## Pagination


    List endpoints support pagination via query parameters:

    - `limit`: Number of records to return (default: 50, max: 100)

    - `offset`: Number of records to skip (default: 0)


    Paginated responses include pagination metadata alongside the data array.


    ## Authentication


    All endpoints require a Bearer token in the Authorization header.

    Tokens can be created in the Dashboard settings (requires Ultra
    subscription).
  version: 1.0.0
  contact:
    name: Research And Desire Support
    url: https://www.researchanddesire.com/support
servers:
  - url: https://dashboard.researchanddesire.com/api/v1
    description: Production API
security:
  - bearerAuth: []
tags:
  - name: Users
    description: User account information
  - name: DTT
    description: Deepthroat Trainer devices
  - name: DTT Templates
    description: Deepthroat Trainer training program templates
  - name: DTT Sessions
    description: Deepthroat Trainer training session history
  - name: LKBX
    description: Chastity Lockbox devices
  - name: Lock Templates
    description: Lock templates
  - name: Lock Sessions
    description: Lock session management
  - name: OSSM
    description: Open Source Sex Machine devices
paths:
  /lkbx/sessions/latest:
    get:
      tags:
        - Lock Sessions
      summary: Get latest lock session
      description: >-
        Returns the most recent lock session with all segment history. Returns
        null if no sessions exist.
      operationId: getLatestLockSession
      responses:
        '200':
          description: Latest session or null
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/LatestLockSessionResponse'
              examples:
                sessionExists:
                  summary: Session exists
                  value:
                    ok: true
                    data:
                      id: 7
                      name: Weekend Lock
                      lockState: locked
                      isActive: true
                      LockSegment:
                        - id: 1
                          type: start
                          isLocked: true
                noSessions:
                  summary: No sessions
                  value:
                    ok: true
                    data: null
                    message: no sessions found
        '401':
          $ref: '#/components/responses/Unauthorized'
        '500':
          $ref: '#/components/responses/InternalError'
components:
  schemas:
    LatestLockSessionResponse:
      type: object
      required:
        - ok
      properties:
        ok:
          type: boolean
          const: true
        data:
          oneOf:
            - $ref: '#/components/schemas/LockSessionDetail'
            - type: 'null'
        message:
          type: string
          description: Message when no sessions found
    LockSessionDetail:
      allOf:
        - $ref: '#/components/schemas/LockSessionSummary'
        - type: object
          properties:
            LockSegment:
              type: array
              items:
                $ref: '#/components/schemas/LockSegment'
    ErrorResponse:
      type: object
      required:
        - ok
        - error
      properties:
        ok:
          type: boolean
          const: false
        error:
          type: string
    LockSessionSummary:
      type: object
      properties:
        id:
          type: integer
          description: Session ID
        bubbleId:
          type: string
          description: Unique public identifier
        publicId:
          type: string
          description: Public session ID
        ownerId:
          type: integer
          description: Owner user ID
        name:
          type: string
          description: Session name
        lockState:
          type: string
          enum:
            - pending
            - locked
            - completed
            - abandoned
            - break
          description: Current lock state
        duration:
          type: integer
          description: Lock duration in seconds
        startDate:
          type: string
          format: date-time
          nullable: true
          description: Session start time
        endDate:
          type: string
          format: date-time
          nullable: true
          description: Session end time
        isActive:
          type: boolean
          description: Whether session is active
        createdAt:
          type: string
          format: date-time
          description: Creation timestamp
    LockSegment:
      type: object
      properties:
        id:
          type: integer
        type:
          type: string
          description: Segment type (start, locked, break, unlocked)
        createdAt:
          type: string
          format: date-time
        isLocked:
          type: boolean
          description: Lock state during segment
  responses:
    Unauthorized:
      description: Authentication required or token invalid
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            ok: false
            error: Unauthorized
    InternalError:
      description: Internal server error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            ok: false
            error: Internal server error
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: |
        API tokens can be created in the Dashboard settings.
        Requires an Ultra subscription.

````