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

# Preview pronunciation rule

> Generates preview audio for a pronunciation rule without saving it.



## OpenAPI

````yaml post /rules/preview
openapi: 3.0.1
info:
  title: BeyondWords REST API
  description: |-
    This is the documentation for the BeyondWords REST API.
              You can use this API to use BeyondWords programmatically.
              You can get your API Key and Project ID for each project in the Project settings tab in the BeyondWords
              <a href="https://dash.beyondwords.io/dashboard">dashboard</a>.
  version: 1.0.0
servers:
  - url: https://api.beyondwords.io/v1
security: []
paths:
  /rules/preview:
    post:
      tags:
        - Rules
      summary: Preview rule audio
      description: Generates preview audio for a pronunciation rule without saving it.
      operationId: rules#preview
      parameters: []
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/requestBodyPreviewRule'
            examples:
              example:
                $ref: '#/components/examples/requestRuleExample'
      responses:
        '200':
          description: successful
      security:
        - apiKey: []
components:
  schemas:
    requestBodyPreviewRule:
      type: object
      properties:
        type:
          type: string
          description: >-
            The rule type. Possible values are `substitute`, `say_as_word`,
            `say_as_letter_sequence`, `ipa_transcription`,
            `pinyin_transcription`, `jyutping_transcription`. Please note that
            not all voices support all rules
          enum:
            - substitute
            - say_as_word
            - say_as_letter_sequence
            - ipa_transcription
            - pinyin_transcription
            - jyutping_transcription
        key:
          type: string
          description: The exact text to match in content when previewing this rule
        value:
          type: string
          nullable: true
          description: Replacement text or phonetic transcription (depending on rule type)
        project:
          type: object
          nullable: true
          properties:
            id:
              type: integer
              minimum: 1
              description: Project ID for the preview
        content:
          type: object
          nullable: true
          properties:
            id:
              type: string
              description: Content ID for the preview
        language:
          type: object
          nullable: true
          properties:
            code:
              type: string
              description: Language code (ISO 639-1 with optional region, e.g., en_GB)
              pattern: ^[a-z]{2}(_[A-Z]{2})?$
              maxLength: 10
        preview_voice:
          type: object
          nullable: true
          properties:
            id:
              type: integer
              minimum: 1
              description: Voice ID to use for preview generation
  examples:
    requestRuleExample:
      summary: Sample creation of a rule in a content item
      value:
        key: CO2
        value: carbon dioxide
        type: substitute
        project:
          id: 1
        content:
          id: d8414aee-4171-419e-be42-bd57e9e2ccd2
  securitySchemes:
    apiKey:
      type: apiKey
      name: X-Api-Key
      in: header

````