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

# Create TTS history

> Create a new TTS history entry for a generated audio clip.



## OpenAPI

````yaml /api-reference/openapi.json post /v2/tts/histories
openapi: 3.0.1
info:
  title: Hamsa API
  description: Trying out our transcription and media-to-text APIs
  license:
    name: MIT
  version: 1.0.0
servers:
  - url: https://api.tryhamsa.com
security: []
paths:
  /v2/tts/histories:
    post:
      summary: Create TTS history
      description: Create a new TTS history entry for a generated audio clip.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateTtsHistoryRequest'
      responses:
        '200':
          description: History created successfully.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreateTtsHistoryResponse'
        '400':
          description: Validation error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ValidationErrorResponse'
        '404':
          description: Resource not found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NotFoundResponse'
        '500':
          description: Internal server error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InternalServerErrorResponse'
      security:
        - ApiKeyAuth: []
components:
  schemas:
    CreateTtsHistoryRequest:
      type: object
      required:
        - apiKey
        - ttsVoiceId
        - script
      properties:
        ttsVoiceId:
          type: string
          format: uuid
          example: 633f19a6-089b-4950-bfab-55f5c750732e
          description: TTS voice identifier
        script:
          type: string
          minLength: 1
          maxLength: 3000
          example: مرحباً، هذا مثال على نص التحويل إلى صوت.
          description: Text to be synthesized. Must contain real Arabic or English text.
        config:
          type: object
          description: Optional voice generation configuration
          properties:
            speed:
              type: number
              minimum: 0
              maximum: 2
              default: 1
              example: 1
              description: Speech speed multiplier
            expressiveness:
              type: number
              minimum: 0
              maximum: 2
              default: 1
              example: 1
              description: Speech expressiveness level
          example:
            speed: 1
            expressiveness: 1
        voiceDictionaryIds:
          type: array
          minItems: 1
          maxItems: 10
          description: Optional list of voice dictionary identifiers
          items:
            type: string
            format: uuid
            example: 6ac0324d-bcb9-40f3-a57a-de6da7b721c8
        apiKey:
          type: string
          format: uuid
          example: 9f5f1f6a-2b1d-4a33-8fd4-6f5c2b89e3aa
          description: API key identifier (used for API key authorization)
    CreateTtsHistoryResponse:
      type: object
      allOf:
        - $ref: '#/components/schemas/SuccessResponse'
        - type: object
          properties:
            data:
              type: array
              example: []
    ValidationErrorResponse:
      type: object
      properties:
        code:
          type: integer
          example: 9400
        message:
          type: string
          example: Field must be a string!
        messageKey:
          type: string
          example: FieldMustBeString
    NotFoundResponse:
      type: object
      properties:
        success:
          type: boolean
          example: false
        code:
          type: integer
          example: 404
        message:
          type: string
          example: Resource not found
    InternalServerErrorResponse:
      type: object
      properties:
        success:
          type: boolean
          example: false
        code:
          type: integer
          example: 500
        message:
          type: string
          example: Internal server error
    SuccessResponse:
      type: object
      properties:
        success:
          type: boolean
          example: true
        message:
          type: string
          example: Operation completed successfully
        messageKey:
          type: string
          example: OPERATION_SUCCESSFUL
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: Authorization
      description: >-
        Pass the API key in the Authorization header, You need to put Token
        keyword before the API key. e.g. 'Authorization: Token <api-key>'

````