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

# Create Detection Session

> Create a customer detection session.



## OpenAPI

````yaml /generated/api.openapi.json post /api/detection/sessions
openapi: 3.1.0
info:
  title: Kynasmith Public API
  version: 0.1.0
servers: []
security: []
paths:
  /api/detection/sessions:
    post:
      tags:
        - detection
      summary: Create Detection Session
      description: Create a customer detection session.
      operationId: create_detection_session_api_detection_sessions_post
      parameters:
        - in: header
          name: Idempotency-Key
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: Idempotency-Key
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DetectionSessionCreateRequest'
        required: true
      responses:
        '201':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DetectionSessionCreateResponse'
          description: Successful Response
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PublicErrorEnvelope'
          description: The request payload or query parameters are invalid.
        '401':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PublicErrorEnvelope'
          description: Authentication failed.
        '403':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PublicErrorEnvelope'
          description: Caller is not authorized for this action.
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PublicErrorEnvelope'
          description: Referenced resource does not exist.
        '409':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PublicErrorEnvelope'
          description: Request conflicts with current resource state.
        '422':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PublicErrorEnvelope'
          description: Request validation failed for the targeted resource state.
      security:
        - BearerAccessToken: []
        - BearerAccessToken: []
components:
  schemas:
    DetectionSessionCreateRequest:
      description: Create-detection-session request payload.
      properties:
        contract_major:
          default: 1
          description: >-
            Coupled public runtime contract major version requested by the
            client.
          title: Contract Major
          type: integer
        mode:
          description: Runtime mode for the session.
          enum:
            - live
            - replay
          title: Mode
          type: string
        movespec_id:
          anyOf:
            - format: uuid
              type: string
            - type: 'null'
          description: >-
            Convenience MoveSpec identifier to resolve to the current released
            version.
          title: Movespec Id
        movespec_version_id:
          anyOf:
            - format: uuid
              type: string
            - type: 'null'
          description: Explicit immutable MoveSpec version identifier.
          title: Movespec Version Id
        project_id:
          description: Owning project identifier for the session.
          format: uuid
          title: Project Id
          type: string
      required:
        - project_id
        - mode
      title: DetectionSessionCreateRequest
      type: object
    DetectionSessionCreateResponse:
      description: Session-creation response returned after admission succeeds.
      properties:
        input_schema_version:
          description: Negotiated public pose-frame schema version.
          title: Input Schema Version
          type: string
        mode:
          description: Runtime mode for the session.
          enum:
            - live
            - replay
          title: Mode
          type: string
        output_schema_version:
          description: Negotiated public detection-event schema version.
          title: Output Schema Version
          type: string
        project_id:
          description: Bound customer project identifier.
          format: uuid
          title: Project Id
          type: string
        resolved_movespec_version_id:
          description: Immutable MoveSpec version selected for the session.
          format: uuid
          title: Resolved Movespec Version Id
          type: string
        runtime_token:
          description: Session-scoped runtime JWT for websocket attach.
          title: Runtime Token
          type: string
        session_id:
          description: Detection session identifier.
          format: uuid
          title: Session Id
          type: string
        status:
          const: created
          description: Initial lifecycle state.
          title: Status
          type: string
        stream_url:
          description: Stable public realtime websocket URL for the session.
          title: Stream Url
          type: string
      required:
        - session_id
        - project_id
        - status
        - mode
        - resolved_movespec_version_id
        - stream_url
        - runtime_token
        - input_schema_version
        - output_schema_version
      title: DetectionSessionCreateResponse
      type: object
    PublicErrorEnvelope:
      description: Stable public error envelope shared across transports.
      properties:
        error:
          $ref: '#/components/schemas/PublicErrorDetail'
          description: Structured error payload.
      required:
        - error
      title: PublicErrorEnvelope
      type: object
    PublicErrorDetail:
      description: Stable public error payload shared across transports.
      properties:
        code:
          description: Machine-readable error code.
          title: Code
          type: string
        details:
          additionalProperties:
            anyOf:
              - type: string
              - type: integer
              - type: number
              - type: boolean
              - type: 'null'
          description: Bounded structured error details.
          title: Details
          type: object
        message:
          description: Human-readable error message.
          title: Message
          type: string
        retryable:
          description: Whether the caller can retry safely.
          title: Retryable
          type: boolean
      required:
        - code
        - message
        - retryable
      title: PublicErrorDetail
      type: object
  securitySchemes:
    BearerAccessToken:
      description: Backend-issued machine access token for project-scoped API access.
      scheme: bearer
      type: http

````