> ## 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.

# Generate a sound effect

> Starts a background job that generates a sound effect from a prompt. The response contains a
`job_id` to poll with `GET /sound-effect/{job_id}`, and the credits the job will be charged.
Requires a valid `X-API-KEY` header.

Throws:
- 402 if the workspace does not have enough credits
- 422 if the request body is invalid



## OpenAPI

````yaml POST /sound-effect
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:
  /sound-effect:
    post:
      tags:
        - Sound effects
      summary: Generate a sound effect
      description: >-
        Starts a background job that generates a sound effect from a prompt. The
        response contains a

        `job_id` to poll with `GET /sound-effect/{job_id}`, and the credits the
        job will be charged.

        Requires a valid `X-API-KEY` header.


        Throws:

        - 402 if the workspace does not have enough credits

        - 422 if the request body is invalid
      operationId: generate_sound_effect_sound_effect_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/GenerateSoundEffectApiRequest'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreateSoundEffectJobResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - APIKeyHeader: []
components:
  schemas:
    GenerateSoundEffectApiRequest:
      properties:
        prompt:
          type: string
          minLength: 1
          title: Prompt
          description: The sound to generate, e.g. 'heavy wooden door creaking open'
        duration_seconds:
          anyOf:
            - type: number
              maximum: 10
              minimum: 1
            - type: 'null'
          title: Duration Seconds
          description: Length of the sound (1-10 seconds). Omit it to let the model choose.
      additionalProperties: false
      type: object
      required:
        - prompt
      title: GenerateSoundEffectApiRequest
    CreateSoundEffectJobResponse:
      properties:
        job_id:
          type: string
          format: uuid
          title: Job Id
          description: Poll `GET /sound-effect/{job_id}` with this ID
        estimated_credits:
          type: number
          title: Estimated Credits
          description: Credits this job will be charged once the sound is ready
      type: object
      required:
        - job_id
        - estimated_credits
      title: CreateSoundEffectJobResponse
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    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

````

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