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

# Generate Run Trajectory

> Mark the latest trajectory for a run as generated.

This promotes whichever trajectory is currently latest by `updated_at`.
If a duplicated trajectory tied to this run is the latest row, this
endpoint may return/promote that duplicate.



## OpenAPI

````yaml /openapi.json post /v1/runs/{run_id}/generate-trajectory
openapi: 3.1.0
info:
  title: Cyberdesk Cloud
  description: >-
    The Cyberdesk API provides programmatic access to all platform features,
    enabling you to automate desktop tasks at scale.
  version: 1.0.0
servers:
  - url: https://api.cyberdesk.io
    description: Production server
  - url: https://cyberdesk-api-dev.fly.dev
    description: Development server
security: []
paths:
  /v1/runs/{run_id}/generate-trajectory:
    post:
      tags:
        - runs
      summary: Generate Run Trajectory
      description: |-
        Mark the latest trajectory for a run as generated.

        This promotes whichever trajectory is currently latest by `updated_at`.
        If a duplicated trajectory tied to this run is the latest row, this
        endpoint may return/promote that duplicate.
      operationId: generate_run_trajectory_v1_runs__run_id__generate_trajectory_post
      parameters:
        - name: run_id
          in: path
          required: true
          schema:
            type: string
            format: uuid
            title: Run Id
        - name: Idempotency-Key
          in: header
          required: false
          description: >-
            Unique key for idempotent requests. If provided, the server ensures
            the request is processed at most once. Retries with the same key
            return the original response. SDKs auto-generate this for write
            requests.
          schema:
            type: string
            example: 550e8400-e29b-41d4-a716-446655440000
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TrajectoryResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - HTTPBearer: []
components:
  schemas:
    TrajectoryResponse:
      properties:
        name:
          anyOf:
            - type: string
              maxLength: 255
            - type: 'null'
          title: Name
        description:
          anyOf:
            - type: string
            - type: 'null'
          title: Description
        workflow_id:
          type: string
          format: uuid
          title: Workflow Id
        run_id:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: Run Id
          description: Optional run that created this trajectory
        trajectory_data:
          items:
            additionalProperties: true
            type: object
          type: array
          minItems: 1
          title: Trajectory Data
        dimensions:
          additionalProperties:
            type: integer
          type: object
          title: Dimensions
          description: Display dimensions when trajectory was recorded
        original_input_values:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Original Input Values
          description: Original input values used when trajectory was created
        is_approved:
          type: boolean
          title: Is Approved
        has_been_approved:
          type: boolean
          title: Has Been Approved
        is_generated:
          type: boolean
          title: Is Generated
        is_main:
          type: boolean
          title: Is Main
        id:
          type: string
          format: uuid
          title: Id
        user_id:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: User Id
        organization_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Organization Id
        created_at:
          type: string
          format: date-time
          title: Created At
        updated_at:
          type: string
          format: date-time
          title: Updated At
      type: object
      required:
        - workflow_id
        - trajectory_data
        - dimensions
        - is_approved
        - has_been_approved
        - is_generated
        - is_main
        - id
        - created_at
        - updated_at
      title: TrajectoryResponse
      description: Trajectory response schema
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          additionalProperties: true
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    HTTPBearer:
      type: http
      scheme: bearer

````