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

# Start preview chat

> API endpoint to start a preview chat session with an unpublished agent for testing purposes.



## OpenAPI

````yaml POST /v1/agents/{agentId}/preview/start
openapi: 3.0.3
info:
  title: Chat API
  version: 3.0.0
servers:
  - url: https://release0.com/api
security: []
externalDocs:
  url: https://docs.release0.com/api-reference
paths:
  /v1/agents/{agentId}/preview/start:
    post:
      summary: Start preview chat
      operationId: startPreview
      parameters:
        - in: path
          name: agentId
          description: Identifier of the agent.
          schema:
            type: string
            description: Identifier of the agent.
          required: true
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                isStreamEnabled:
                  type: boolean
                  default: false
                message:
                  oneOf:
                    - $ref: '#/components/schemas/textSentMessage'
                    - $ref: '#/components/schemas/audioSentMessage'
                  discriminator:
                    propertyName: type
                    mapping:
                      text: '#/components/schemas/textSentMessage'
                      audio: '#/components/schemas/audioSentMessage'
                isOnlyRegistering:
                  type: boolean
                  description: >-
                    If set to `true`, the session will only be registered and
                    the bot will not be started.
                  default: false
                agent:
                  description: If provided, overrides the agent used to start the chat.
                startFrom:
                  oneOf:
                    - type: object
                      properties:
                        type:
                          type: string
                          enum:
                            - group
                        groupId:
                          type: string
                      required:
                        - type
                        - groupId
                    - type: object
                      properties:
                        type:
                          type: string
                          enum:
                            - event
                        eventId:
                          type: string
                      required:
                        - type
                        - eventId
                initialContext:
                  type: object
                  additionalProperties: {}
                  description: >-
                    Initial context used to prefill variables when starting the
                    session.
                  example:
                    First name: John
                    Email: john@gmail.com
                sessionId:
                  type: string
                  description: >-
                    If provided, it will be used as the session identifier and
                    will overwrite any existing session with the same ID.
                password:
                  type: string
                  description: >-
                    Password required if the agent was created with password
                    protection.
                textBubbleContentFormat:
                  type: string
                  enum:
                    - richText
                    - markdown
                  default: richText
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema: {}
        '400':
          description: Invalid input data
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error.BAD_REQUEST'
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error.INTERNAL_SERVER_ERROR'
components:
  schemas:
    textSentMessage:
      type: object
      properties:
        type:
          type: string
          enum:
            - text
        text:
          type: string
        attachedFileUrls:
          type: array
          items:
            type: string
          description: >-
            Can only be provided when the current input block is a text block
            that supports attachments.
      required:
        - type
        - text
      title: Text
    audioSentMessage:
      type: object
      properties:
        type:
          type: string
          enum:
            - audio
        url:
          type: string
      required:
        - type
        - url
      description: >-
        Can only be provided when the current input block is a text block that
        supports audio messages.
      title: Audio
    error.BAD_REQUEST:
      type: object
      properties:
        message:
          type: string
          description: The error message
          example: Invalid input data
        code:
          type: string
          description: The error code
          example: BAD_REQUEST
        issues:
          type: array
          items:
            type: object
            properties:
              message:
                type: string
            required:
              - message
          description: An array of issues that were responsible for the error
          example: []
      required:
        - message
        - code
      title: Error
      description: The error information
      example:
        code: BAD_REQUEST
        message: Invalid input data
        issues: []
    error.INTERNAL_SERVER_ERROR:
      type: object
      properties:
        message:
          type: string
          description: The error message
          example: Internal server error
        code:
          type: string
          description: The error code
          example: INTERNAL_SERVER_ERROR
        issues:
          type: array
          items:
            type: object
            properties:
              message:
                type: string
            required:
              - message
          description: An array of issues that were responsible for the error
          example: []
      required:
        - message
        - code
      title: Error
      description: The error information
      example:
        code: INTERNAL_SERVER_ERROR
        message: Internal server error
        issues: []

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.