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

# Create scenario from transcript

> Create a scenario draft by analyzing a conversation transcript. The system uses LLM to extract user intent, 
conversation goals, and user characteristics from the transcript, then generates an appropriate persona package.

The endpoint supports:
- Fetching transcript via sessionId from analytics service (RPC call)
- Direct transcript content via transcriptContent
- Optional flow context for enhanced persona generation
- Content safety validation (warnings only, non-blocking)

Priority: If both sessionId and transcriptContent are provided, sessionId takes precedence.

Returns a complete persona package and metadata about the analysis.




## OpenAPI

````yaml https://api-trial.cognigy.ai/testing/openapi/openapi-viewer.json post /personas/from-transcript
openapi: 3.0.0
info:
  title: SIMULATOR OPENAPI REST-ful-API Reference
  version: 2025.20.0
  description: >

    ### Introduction

    This is the [OpenAPI 3.0](https://swagger.io/specification/) documentation

    of the
    [REST](https://en.wikipedia.org/wiki/Representational_state_transfer)-ful
    SIMULATOR OPENAPI API.


    ### Cross-Origin Resource Sharing

    This API features Cross-Origin Resource Sharing (CORS) implemented in

    compliance with [W3C spec](https://www.w3.org/TR/cors/), which allows

    cross-domain communication from the browser. All responses have a wildcard

    same-origin header which makes the API completely accessible.


    ### Authentication

    SIMULATOR OPENAPI offers following forms of authentication:

    - Bearer Token (JWT)

    - API Key


    ### Error Handling

    This API uses HTTP status codes equal or above 400 to indicate errors. Error

    details are generated in compliance with [RFC 7807 - "Problem Details for
    HTTP APIs"](https://tools.ietf.org/html/rfc7807).


    Every error response contains a traceId, which should be provided to the
    SIMULATOR OPENAPI Technical Support when reporting an error.
  contact:
    name: Cognigy Technical Support
    url: https://www.cognigy.com
    email: support@cognigy.com
  license:
    name: Cognigy Proprietary License
servers:
  - url: https://api-trial.cognigy.ai/testing
    description: Cognigy Service Testing API
security:
  - bearerAuth: []
  - apiKeyAuth: []
tags:
  - name: Simulations
    description: >-
      Simulation management operations - Create, read, update, and delete
      simulations
externalDocs:
  description: SIMULATOR OPENAPI Documentation
  url: https://docs.cognigy.com/docs/service-testing/
paths:
  /personas/from-transcript:
    post:
      tags:
        - Personas
      summary: Create scenario from transcript
      description: >
        Create a scenario draft by analyzing a conversation transcript. The
        system uses LLM to extract user intent, 

        conversation goals, and user characteristics from the transcript, then
        generates an appropriate persona package.


        The endpoint supports:

        - Fetching transcript via sessionId from analytics service (RPC call)

        - Direct transcript content via transcriptContent

        - Optional flow context for enhanced persona generation

        - Content safety validation (warnings only, non-blocking)


        Priority: If both sessionId and transcriptContent are provided,
        sessionId takes precedence.


        Returns a complete persona package and metadata about the analysis.
      operationId: createScenarioFromTranscript
      parameters:
        - name: projectId
          in: query
          required: false
          schema:
            type: string
          description: Project identifier (alternative to projectReference in body)
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                projectReference:
                  type: string
                  description: >-
                    Project reference for context identification (alternative to
                    projectId query parameter)
                sessionId:
                  type: string
                  description: >-
                    Session identifier to retrieve transcript from analytics
                    service. If provided, takes precedence over
                    transcriptContent.
                transcriptContent:
                  type: object
                  description: >-
                    Direct transcript content. Optional if sessionId is
                    provided.
                  properties:
                    messages:
                      type: array
                      description: Array of conversation messages
                      items:
                        type: object
                        properties:
                          source:
                            type: string
                            enum:
                              - user
                              - bot
                              - agent
                              - suggestion
                            description: >-
                              Message source type: 'user' (customer), 'bot' (AI
                              agent), 'agent' (live human agent), 'suggestion'
                              (system suggestion)
                          content:
                            type: string
                            description: Message content
                          timestamp:
                            type: string
                            format: date-time
                            description: Message timestamp
                        required:
                          - source
                          - content
                          - timestamp
                  required:
                    - messages
                flowId:
                  type: string
                  description: >-
                    Optional: Flow ID to associate with and extract agent
                    context for enhanced generation
                numberOfSuccessCriteria:
                  type: integer
                  description: >-
                    Optional: Number of success criteria to generate (default:
                    5, min: 1, max: 10)
                  minimum: 1
                  maximum: 10
                  default: 5
                analysisOptions:
                  type: object
                  description: Optional analysis configuration
                  properties:
                    maxTurns:
                      type: integer
                      description: 'Limit transcript to first N turns (default: no limit)'
                      minimum: 1
                    focusOnUserGoals:
                      type: boolean
                      description: 'Focus analysis on extracting user goals (default: true)'
            examples:
              withSessionId:
                summary: Request with sessionId (fetches from analytics service)
                value:
                  projectReference: 683ef2a378a878cc6550f78b
                  sessionId: session-8f9046b1-6f80-474c-9ce7-24866dbd7cf3
                  flowId: 683ef3d978a878cc6550fb9d
                  numberOfSuccessCriteria: 5
              withTranscriptContent:
                summary: Request with direct transcript content
                value:
                  projectReference: 683ef2a378a878cc6550f78b
                  transcriptContent:
                    messages:
                      - source: user
                        content: Hi, I need help unlocking my account
                        timestamp: '2025-10-22T10:00:00.000Z'
                      - source: bot
                        content: I can help you with that. Can you provide your email?
                        timestamp: '2025-10-22T10:00:05.000Z'
                  flowId: 683ef3d978a878cc6550fb9d
                  numberOfSuccessCriteria: 5
      responses:
        '200':
          description: Scenario created successfully from transcript
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    description: Whether the generation was successful
                  personaPackage:
                    type: object
                    description: Generated persona package
                    properties:
                      simulationName:
                        type: string
                        description: Generated scenario name
                      personaName:
                        type: string
                        description: Generated persona name
                      personaDescription:
                        type: string
                        description: >-
                          Generated persona description capturing user
                          characteristics
                      mission:
                        type: string
                        description: Generated mission based on user goals
                      successCriteria:
                        type: array
                        description: Generated success criteria
                        items:
                          type: object
                          properties:
                            name:
                              type: string
                              description: Success criterion name
                            text:
                              type: string
                              description: Success criterion description
                          required:
                            - name
                            - text
                    required:
                      - simulationName
                      - personaName
                      - personaDescription
                      - mission
                      - successCriteria
                  metadata:
                    type: object
                    description: Analysis metadata
                    properties:
                      transcriptSummary:
                        type: string
                        description: Brief summary of the analyzed transcript
                      analysisTimestamp:
                        type: string
                        format: date-time
                        description: When the analysis was performed
                      warnings:
                        type: array
                        description: Content safety warnings (if any)
                        items:
                          type: string
                      turnCount:
                        type: integer
                        description: Number of turns in the transcript
                      extractedIntents:
                        type: array
                        description: User intents/goals extracted from transcript
                        items:
                          type: string
                      messages:
                        type: array
                        description: Original transcript messages
                        items:
                          type: object
                          properties:
                            source:
                              type: string
                              enum:
                                - user
                                - bot
                                - agent
                                - suggestion
                              description: Message source
                            content:
                              type: string
                              description: Message content
                            timestamp:
                              type: string
                              format: date-time
                              description: Message timestamp
                          required:
                            - source
                            - content
                            - timestamp
                    required:
                      - transcriptSummary
                      - analysisTimestamp
                      - messages
                required:
                  - success
                  - personaPackage
                  - metadata
              example:
                success: true
                personaPackage:
                  simulationName: Account Unlock Request
                  personaName: Frustrated Traveler
                  personaDescription: >-
                    A business traveler who is tech-savvy but stressed due to
                    being locked out of their account before an important
                    flight. Communicates directly and expects quick resolutions.
                  mission: >-
                    Unlock the account quickly to access booking information for
                    an upcoming flight
                  successCriteria:
                    - name: Account Unlocked
                      text: User successfully regains access to their account
                    - name: Booking Confirmed
                      text: User can view and confirm their flight booking details
                    - name: Security Verified
                      text: Account security is verified and strengthened
                metadata:
                  transcriptSummary: >-
                    8-turn conversation (4 user, 4 bot): "Hi, I need help
                    unlocking my account. I have a flight in 2 hours..."
                  analysisTimestamp: '2024-10-22T10:00:43.000Z'
                  warnings: []
                  turnCount: 8
                  extractedIntents:
                    - Unlock account
                    - Access flight booking
                    - Verify travel details
                  messages:
                    - source: user
                      content: >-
                        Hi, I need help unlocking my account. I have a flight in
                        2 hours and I cannot access my booking.
                      timestamp: '2024-10-22T10:00:00.000Z'
                    - source: bot
                      content: >-
                        Hello! I can help you unlock your account. Can you
                        please provide me with your email address?
                      timestamp: '2024-10-22T10:00:05.000Z'
                    - source: user
                      content: My email is traveler@example.com
                      timestamp: '2024-10-22T10:00:15.000Z'
                    - source: bot
                      content: >-
                        Thank you. I have found your account. For security
                        purposes, can you verify your date of birth?
                      timestamp: '2024-10-22T10:00:20.000Z'
                    - source: user
                      content: January 15, 1985
                      timestamp: '2024-10-22T10:00:30.000Z'
                    - source: bot
                      content: >-
                        Perfect. Your account has been unlocked. You should now
                        be able to access your booking.
                      timestamp: '2024-10-22T10:00:35.000Z'
                    - source: user
                      content: Thank you! Can you confirm my flight details?
                      timestamp: '2024-10-22T10:00:45.000Z'
                    - source: bot
                      content: >-
                        Your flight is scheduled for today at 12:00 PM, Flight
                        AB123 to New York.
                      timestamp: '2024-10-22T10:00:50.000Z'
        '400':
          description: Bad Request - Invalid input parameters
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    description: Validation error message
                required:
                  - error
              examples:
                missingTranscript:
                  value:
                    error: One of sessionId or transcriptContent is required
                invalidMessages:
                  value:
                    error: transcriptContent.messages must be an array
                emptyTranscript:
                  value:
                    error: Transcript must contain at least one message
                invalidSource:
                  value:
                    error: >-
                      Message source must be one of: user, bot, agent,
                      suggestion
                transcriptTooShort:
                  value:
                    error: Transcript must contain at least 2 messages, got 1
                invalidSessionId:
                  value:
                    error: sessionId must be a non-empty string
                sessionNotFound:
                  value:
                    error: >-
                      No valid transcript messages found for session
                      session-xyz. The conversation may be empty or contain only
                      system messages.
        '401':
          description: Unauthorized - Invalid or missing authentication
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    description: Unauthorized error message
                  code:
                    type: string
                    description: Unauthorized error code
                  traceId:
                    type: string
                    description: Trace ID for debugging
                required:
                  - error
        '403':
          description: Forbidden - Insufficient permissions
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    description: Forbidden error message
                  code:
                    type: string
                    description: Forbidden error code
                  traceId:
                    type: string
                    description: Trace ID for debugging
                required:
                  - error
        '500':
          description: Internal Server Error - Server error
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    description: Error message
                  code:
                    type: string
                    description: Error code
                  traceId:
                    type: string
                    description: Trace ID for debugging
                required:
                  - error
      security:
        - bearerAuth: []
        - apiKeyAuth: []
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: JWT Bearer Token for authentication
    apiKeyAuth:
      type: apiKey
      in: header
      name: X-API-Key
      description: API Key for authentication

````