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

# Create event

> Create a new scenario event



## OpenAPI

````yaml post /api/scenario-events
openapi: 3.1.0
info:
  title: LangWatch API
  version: 1.0.0
  description: LangWatch openapi spec
servers:
  - url: https://app.langwatch.ai
security:
  - api_key: []
paths:
  /api/scenario-events:
    post:
      description: Create a new scenario event
      operationId: postApiScenario-events
      parameters: []
      requestBody:
        content:
          application/json:
            schema:
              oneOf:
                - type: object
                  properties:
                    type:
                      type: string
                      const: SCENARIO_RUN_STARTED
                    timestamp:
                      type: number
                    rawEvent: {}
                    batchRunId:
                      type: string
                    scenarioId:
                      type: string
                    scenarioRunId:
                      type: string
                    scenarioSetId:
                      type: string
                      default: default
                    metadata:
                      type: object
                      properties:
                        name:
                          type: string
                        description:
                          type: string
                        langwatch:
                          type: object
                          properties:
                            targetReferenceId:
                              type: string
                            targetType:
                              type: string
                              enum:
                                - prompt
                                - http
                                - code
                            simulationSuiteId:
                              type: string
                          required:
                            - targetReferenceId
                            - targetType
                      additionalProperties: true
                  required:
                    - type
                    - timestamp
                    - batchRunId
                    - scenarioId
                    - scenarioRunId
                    - metadata
                - type: object
                  properties:
                    type:
                      type: string
                      const: SCENARIO_RUN_FINISHED
                    timestamp:
                      type: number
                    rawEvent: {}
                    batchRunId:
                      type: string
                    scenarioId:
                      type: string
                    scenarioRunId:
                      type: string
                    scenarioSetId:
                      type: string
                      default: default
                    status:
                      type: string
                      enum:
                        - SUCCESS
                        - ERROR
                        - CANCELLED
                        - IN_PROGRESS
                        - PENDING
                        - FAILED
                        - STALLED
                        - QUEUED
                        - RUNNING
                    results:
                      type:
                        - object
                        - 'null'
                      properties:
                        verdict:
                          type: string
                          enum:
                            - success
                            - failure
                            - inconclusive
                        reasoning:
                          type: string
                        metCriteria:
                          type: array
                          items:
                            type: string
                        unmetCriteria:
                          type: array
                          items:
                            type: string
                        error:
                          type: string
                      required:
                        - verdict
                        - metCriteria
                        - unmetCriteria
                  required:
                    - type
                    - timestamp
                    - batchRunId
                    - scenarioId
                    - scenarioRunId
                    - status
                - type: object
                  properties:
                    type:
                      type: string
                      const: SCENARIO_MESSAGE_SNAPSHOT
                    timestamp:
                      type: number
                    rawEvent: {}
                    messages:
                      type: array
                      items:
                        allOf:
                          - anyOf:
                              - oneOf:
                                  - type: object
                                    properties:
                                      id:
                                        type: string
                                      role:
                                        type: string
                                        const: developer
                                      content:
                                        type: string
                                      name:
                                        type: string
                                    required:
                                      - id
                                      - role
                                      - content
                                  - type: object
                                    properties:
                                      id:
                                        type: string
                                      role:
                                        type: string
                                        const: system
                                      content:
                                        type: string
                                      name:
                                        type: string
                                    required:
                                      - id
                                      - role
                                      - content
                                  - type: object
                                    properties:
                                      id:
                                        type: string
                                      role:
                                        type: string
                                        const: assistant
                                      content:
                                        type: string
                                      name:
                                        type: string
                                      toolCalls:
                                        type: array
                                        items:
                                          type: object
                                          properties:
                                            id:
                                              type: string
                                            type:
                                              type: string
                                              const: function
                                            function:
                                              type: object
                                              properties:
                                                name:
                                                  type: string
                                                arguments:
                                                  type: string
                                              required:
                                                - name
                                                - arguments
                                          required:
                                            - id
                                            - type
                                            - function
                                    required:
                                      - id
                                      - role
                                  - type: object
                                    properties:
                                      id:
                                        type: string
                                      role:
                                        type: string
                                        const: user
                                      content:
                                        type: string
                                      name:
                                        type: string
                                    required:
                                      - id
                                      - role
                                      - content
                                  - type: object
                                    properties:
                                      id:
                                        type: string
                                      content:
                                        type: string
                                      role:
                                        type: string
                                        const: tool
                                      toolCallId:
                                        type: string
                                      error:
                                        type: string
                                    required:
                                      - id
                                      - content
                                      - role
                                      - toolCallId
                              - type: object
                                properties:
                                  role:
                                    anyOf:
                                      - type: string
                                        const: system
                                      - type: string
                                        const: user
                                      - type: string
                                        const: assistant
                                      - type: string
                                        const: function
                                      - type: string
                                        const: tool
                                      - type: string
                                        const: unknown
                                  content:
                                    anyOf:
                                      - type: string
                                      - type: array
                                        items:
                                          anyOf:
                                            - type: object
                                              properties:
                                                type:
                                                  type: string
                                                  const: text
                                                text:
                                                  type: string
                                              required:
                                                - type
                                            - type: object
                                              properties:
                                                type:
                                                  type: string
                                                  const: text
                                                content:
                                                  type: string
                                              required:
                                                - type
                                            - type: object
                                              properties:
                                                text:
                                                  type: string
                                              required:
                                                - text
                                            - type: object
                                              properties:
                                                type:
                                                  type: string
                                                  const: image_url
                                                image_url:
                                                  type: object
                                                  properties:
                                                    url:
                                                      type: string
                                                    detail:
                                                      anyOf:
                                                        - type: string
                                                          const: auto
                                                        - type: string
                                                          const: low
                                                        - type: string
                                                          const: high
                                                  required:
                                                    - url
                                              required:
                                                - type
                                            - type: object
                                              properties:
                                                type:
                                                  type: string
                                                  const: tool_call
                                                toolName:
                                                  type: string
                                                toolCallId:
                                                  type: string
                                                args:
                                                  type: string
                                              required:
                                                - type
                                            - type: object
                                              properties:
                                                type:
                                                  type: string
                                                  const: tool_result
                                                toolName:
                                                  type: string
                                                toolCallId:
                                                  type: string
                                                result: {}
                                              required:
                                                - type
                                      - type: 'null'
                                  parts:
                                    type: array
                                    items:
                                      anyOf:
                                        - type: object
                                          properties:
                                            type:
                                              type: string
                                              const: text
                                            text:
                                              type: string
                                          required:
                                            - type
                                        - type: object
                                          properties:
                                            type:
                                              type: string
                                              const: text
                                            content:
                                              type: string
                                          required:
                                            - type
                                        - type: object
                                          properties:
                                            text:
                                              type: string
                                          required:
                                            - text
                                        - type: object
                                          properties:
                                            type:
                                              type: string
                                              const: image_url
                                            image_url:
                                              type: object
                                              properties:
                                                url:
                                                  type: string
                                                detail:
                                                  anyOf:
                                                    - type: string
                                                      const: auto
                                                    - type: string
                                                      const: low
                                                    - type: string
                                                      const: high
                                              required:
                                                - url
                                          required:
                                            - type
                                        - type: object
                                          properties:
                                            type:
                                              type: string
                                              const: tool_call
                                            toolName:
                                              type: string
                                            toolCallId:
                                              type: string
                                            args:
                                              type: string
                                          required:
                                            - type
                                        - type: object
                                          properties:
                                            type:
                                              type: string
                                              const: tool_result
                                            toolName:
                                              type: string
                                            toolCallId:
                                              type: string
                                            result: {}
                                          required:
                                            - type
                                  function_call:
                                    type:
                                      - object
                                      - 'null'
                                    properties:
                                      name:
                                        type: string
                                      arguments:
                                        type: string
                                  tool_calls:
                                    type:
                                      - array
                                      - 'null'
                                    items:
                                      type: object
                                      properties:
                                        id:
                                          type: string
                                        type:
                                          type: string
                                        function:
                                          type: object
                                          properties:
                                            name:
                                              type: string
                                            arguments:
                                              type: string
                                      required:
                                        - id
                                        - type
                                        - function
                                  tool_call_id:
                                    type:
                                      - string
                                      - 'null'
                                  name:
                                    type:
                                      - string
                                      - 'null'
                                  reasoning_content:
                                    type:
                                      - string
                                      - 'null'
                          - type: object
                            properties:
                              id:
                                type: string
                              trace_id:
                                type: string
                    batchRunId:
                      type: string
                    scenarioId:
                      type: string
                    scenarioRunId:
                      type: string
                    scenarioSetId:
                      type: string
                      default: default
                  required:
                    - type
                    - timestamp
                    - messages
                    - batchRunId
                    - scenarioId
                    - scenarioRunId
      responses:
        '201':
          description: Event created successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  url:
                    type:
                      - string
                      - 'null'
                required:
                  - success
        '400':
          description: Invalid event data
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                required:
                  - error
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  message:
                    type: string
                required:
                  - error
        '422':
          description: Unprocessable Entity
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  message:
                    type: string
                required:
                  - error
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  message:
                    type: string
                required:
                  - error
components:
  securitySchemes:
    api_key:
      type: apiKey
      in: header
      name: X-Auth-Token

````