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

# Create any audio content with a user provided script

> Starts a background job to produce an audio file with the provided script segments. The response
    contains a `job_id` that can be used to query with the `/podcast/{job_id}` to query for status.
    Requires a valid `X-API-TOKEN` header.

    Throws:
    - 429 if the user has too many jobs in flight.
    - 400 if any voice_id or music_id provided is invalid



## OpenAPI

````yaml POST /podcast/scripted
openapi: 3.1.0
info:
  title: Wondercraft Public API
  version: 0.0.1
servers:
  - url: https://api.wondercraft.ai/v1
    description: Base Wondercraft API
security: []
paths:
  /podcast/scripted:
    post:
      tags:
        - Podcasts
      summary: Create any audio content with a user provided script
      description: >-
        Starts a background job to produce an audio file with the provided
        script segments. The response
            contains a `job_id` that can be used to query with the `/podcast/{job_id}` to query for status.
            Requires a valid `X-API-TOKEN` header.

            Throws:
            - 429 if the user has too many jobs in flight.
            - 400 if any voice_id or music_id provided is invalid
      operationId: generate_user_scripted_episode_podcast_scripted_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/GenerateUserScriptedEpisodeRequest'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GenerateEpisodeResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - APIKeyHeader: []
components:
  schemas:
    GenerateUserScriptedEpisodeRequest:
      properties:
        script:
          items:
            $ref: '#/components/schemas/ScriptSegment'
          type: array
          title: Script
          description: The segments forming the script for the episode
        music_spec:
          anyOf:
            - $ref: '#/components/schemas/MusicTrackSpec'
            - type: 'null'
          description: >-
            An optional spec for adding background music to the generated
            script. Note that if the chosenmusic track is longer than the
            duration of the generated script, it will be cut off.
      additionalProperties: false
      type: object
      required:
        - script
      title: GenerateUserScriptedEpisodeRequest
      description: >-
        A request to start a job to generate audio content with a provided
        script.
    GenerateEpisodeResponse:
      properties:
        job_id:
          type: string
          format: uuid
          title: Job Id
          description: >-
            The job ID for the episode generation. The status of this job can be
            queried using the`/podcast/{job_id}` endpoint.
      additionalProperties: false
      type: object
      required:
        - job_id
      title: GenerateEpisodeResponse
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ScriptSegment:
      properties:
        text:
          type: string
          title: Text
          description: The text to be spoken for this part of the dialogue
        voice_id:
          type: string
          title: Voice Id
          description: >-
            A unique identifier for the voice copied from the Wondercraft
            Platform to use for the speaker of this segment.
      additionalProperties: false
      type: object
      required:
        - text
        - voice_id
      title: ScriptSegment
      description: A single unit of speech in the script defined by the user.
    MusicTrackSpec:
      properties:
        music_id:
          type: string
          title: Music Id
          description: >-
            The ID of the music track to used in the background. This can be
            copied from theWondercraft platform
        fade_in_ms:
          type: integer
          title: Fade In Ms
          description: >-
            The number of milliseconds to fade in from the start of the music
            track
          default: 0
        fade_out_ms:
          type: integer
          title: Fade Out Ms
          description: >-
            The number of milliseconds to fade out from the end of the music
            track
          default: 0
        playback_start:
          type: integer
          title: Playback Start
          description: >-
            A millisecond into the music track at which we start playing.
            Equivalent to trimming thebeginning of the music track. Defaults to
            0 (i.e. no trimming)
          default: 0
        playback_end:
          anyOf:
            - type: integer
            - type: 'null'
          title: Playback End
          description: >-
            How many milliseconds into the music should we playback. Equivalent
            to trimming up to this numberof milliseconds from the music track.
            Defaults to the entire music track.
        volume:
          type: number
          title: Volume
          description: >-
            The volume to apply to the music track. Defaults to 0.05. Must be
            between 0.0 and 1.0
          default: 0.05
        loop:
          type: boolean
          title: Loop
          description: Whether to loop the music track. Defaults to False.
          default: false
      additionalProperties: false
      type: object
      required:
        - music_id
      title: MusicTrackSpec
      description: >-
        A music track to add to the generated audio. Note that the music will
        always be added at the very beginning of the

        generated podcast and will be automatically trimmed to match the content
        length.
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    APIKeyHeader:
      type: apiKey
      in: header
      name: X-API-KEY

````