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

# Get Insights

> Retrieve the Proof of Delivery (PoD) analysis and intelligence for a session.



## OpenAPI

````yaml GET /v1/sessions/{id}/insights
openapi: 3.1.0
info:
  title: Desmo API
  description: >-
    API for accessing Desmo sessions and proof-of-delivery insights. Requires a
    secret API key (`sk_...`) for authentication.
  version: 1.0.0
servers:
  - url: https://api.getdesmo.io
    description: Production
security:
  - desmoKey: []
paths:
  /v1/sessions/{id}/insights:
    get:
      summary: Get session insights
      description: >-
        Retrieve the Proof of Delivery (PoD) analysis and intelligence for a
        session.
      operationId: getSessionInsights
      parameters:
        - name: id
          in: path
          description: The session ID
          required: true
          schema:
            type: string
      responses:
        '200':
          description: PoD Insights
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Insight'
              example:
                sessionId: sess_ce7f77e71be24f1b
                organizationId: 1428fcc7-119e-4397-9668-d5645b8166a8
                deliveryId: DELIVERY_123
                status: ready
                summary:
                  fraudScore: 0.12
                  frictionScore: 0.35
                  visibilityScore: 0.92
                  rightDoorstep: true
                  suspiciousBehavior: false
                  floorsClimbed: 4
                  elevatorUsed: true
                  totalDurationSec: 245
                  attemptCycles: 1
                reasonCodes:
                  - FULL_ATTEMPT
                  - DELIVERED_TO_RIGHT_DOORSTEP
                events:
                  - type: GATE
                    tStart: 0
                    confidence: 0.92
                  - type: WALKING
                    tStart: 0
                    tEnd: 15.5
                    confidence: 0.95
                  - type: ELEVATOR
                    tStart: 15.5
                    tEnd: 48
                    confidence: 0.88
                    metadata:
                      floors: 4
                  - type: STOPPED
                    tStart: 62
                    tEnd: 95
                    confidence: 0.97
                metrics:
                  timeFromEntranceToDoorSec: 95
                  timeAtDoorSec: 33
                pod:
                  type: photo
                  url: https://cdn.desmo.io/pod/DELIVERY_123.jpg
                pathImageUrl: https://cdn.desmo.io/paths/sess_ce7f77e71be24f1b.png
                createdAt: '2025-01-15T10:06:00Z'
                updatedAt: '2025-01-15T10:06:00Z'
        '401':
          description: Invalid or missing API key
        '403':
          description: Secret key required
        '404':
          description: Session not found
components:
  schemas:
    Insight:
      type: object
      description: Computed proof-of-delivery intelligence for a session
      properties:
        sessionId:
          type: string
          description: The session this insight belongs to
        organizationId:
          type: string
        deliveryId:
          type: string
        status:
          $ref: '#/components/schemas/InsightStatus'
        summary:
          $ref: '#/components/schemas/InsightSummary'
        reasonCodes:
          type: array
          items:
            $ref: '#/components/schemas/ReasonCode'
          description: Codes explaining the delivery outcome
        events:
          type: array
          items:
            $ref: '#/components/schemas/Event'
          description: Timeline of detected events during the delivery
        metrics:
          $ref: '#/components/schemas/InsightMetrics'
        pod:
          $ref: '#/components/schemas/Pod'
        pathImageUrl:
          type: string
          nullable: true
          description: URL to rendered path visualization
        errorMessage:
          type: string
          nullable: true
          description: Error details if status is 'failed'
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
      required:
        - sessionId
        - organizationId
        - deliveryId
        - status
        - reasonCodes
        - events
        - createdAt
        - updatedAt
    InsightStatus:
      type: string
      enum:
        - processing
        - ready
        - failed
      description: Processing status of the insight
    InsightSummary:
      type: object
      description: Summary scores and flags for the delivery
      properties:
        fraudScore:
          type: number
          format: float
          minimum: 0
          maximum: 1
          description: Likelihood of fraudulent behavior (0.0 = legit, 1.0 = suspicious)
        frictionScore:
          type: number
          format: float
          minimum: 0
          maximum: 1
          description: Delivery difficulty (0.0 = smooth, 1.0 = difficult)
        visibilityScore:
          type: number
          format: float
          minimum: 0
          maximum: 1
          description: Data completeness (0.0 = no data, 1.0 = complete)
        rightDoorstep:
          type: boolean
          description: Whether delivery reached the correct address
        suspiciousBehavior:
          type: boolean
          description: Whether suspicious patterns were detected
        floorsClimbed:
          type: integer
          nullable: true
          description: Number of floors traversed
        elevatorUsed:
          type: boolean
          nullable: true
          description: Whether an elevator was used
        totalDurationSec:
          type: integer
          nullable: true
          description: Total session duration in seconds
        attemptCycles:
          type: integer
          nullable: true
          description: Number of delivery attempts
    ReasonCode:
      type: string
      enum:
        - FULL_ATTEMPT
        - DELIVERED_TO_RIGHT_DOORSTEP
        - NO_ATTEMPT
        - PARTIAL_ATTEMPT
        - POSSIBLE_LOBBY_HANDOFF
        - POSSIBLE_WRONG_ADDRESS
        - POSSIBLE_NO_ATTEMPT
        - SESSION_TIMEOUT
        - INSUFFICIENT_DATA
        - TELEMETRY_STREAM_INTERRUPTED
      description: Reason code explaining delivery outcome
    Event:
      type: object
      description: A detected event in the delivery timeline
      properties:
        type:
          $ref: '#/components/schemas/EventType'
        tStart:
          type: number
          format: float
          description: Start time in seconds from session start
        tEnd:
          type: number
          format: float
          nullable: true
          description: End time in seconds (null for instant events)
        confidence:
          type: number
          format: float
          minimum: 0
          maximum: 1
          nullable: true
          description: Detection confidence (0.0 - 1.0)
        metadata:
          type: object
          nullable: true
          description: 'Event-specific data (e.g., {"floors": 4} for ELEVATOR)'
      required:
        - type
        - tStart
    InsightMetrics:
      type: object
      description: Timing metrics for the delivery
      properties:
        timeFromEntranceToDoorSec:
          type: integer
          nullable: true
          description: Time from building entrance to door in seconds
        timeAtDoorSec:
          type: integer
          nullable: true
          description: Time spent at the door in seconds
    Pod:
      type: object
      description: Proof of Delivery attachment
      properties:
        type:
          type: string
          enum:
            - photo
            - signature
            - note
        url:
          type: string
          description: URL to the POD asset
      required:
        - type
        - url
    EventType:
      type: string
      enum:
        - WALKING
        - STOPPED
        - BACKTRACKING
        - STAIRS
        - GATE
        - GPS_LOST
        - GPS_DEGRADED
        - GPS_RESTORED
        - ELEVATOR
        - DRIVING
      description: Type of delivery event
  securitySchemes:
    desmoKey:
      type: apiKey
      in: header
      name: Desmo-Key
      description: Secret API key (starts with `sk_sandbox_` or `sk_live_`)

````