ElevenLabs Music Generation API

The ElevenLabs Music Generation API creates music from text prompts, allowing developers to generate original musical compositions programmatically. Users describe the desired genre, mood, tempo, and instrumentation in natural language and receive generated audio output. The API is designed for applications that need background music, jingles, or custom soundtracks without requiring manual composition.

OpenAPI Specification

elevenlabs-music-openapi.yml Raw ↑
openapi: 3.1.0
info:
  title: ElevenLabs Music Generation API
  description: >-
    The ElevenLabs Music Generation API creates music from text prompts,
    allowing developers to generate original musical compositions
    programmatically. Users describe the desired genre, mood, tempo, and
    instrumentation in natural language and receive generated audio output.
    The API supports generating stems, lyrics, and full compositions with
    seamless looping and professional-grade quality.
  version: '1.0'
  contact:
    name: ElevenLabs Support
    url: https://help.elevenlabs.io
  termsOfService: https://elevenlabs.io/terms-of-service
externalDocs:
  description: ElevenLabs Music Generation Documentation
  url: https://elevenlabs.io/docs/overview/capabilities/music
servers:
  - url: https://api.elevenlabs.io
    description: Production Server
tags:
  - name: Music Generation
    description: >-
      Endpoints for generating music from text prompts using AI models.
security:
  - apiKeyAuth: []
paths:
  /v1/music:
    post:
      operationId: createMusic
      summary: Create music
      description: >-
        Generates an original musical composition from a text prompt
        describing the desired genre, mood, tempo, instrumentation, and
        other characteristics. Returns generated audio in the specified
        format.
      tags:
        - Music Generation
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/MusicGenerationRequest'
      responses:
        '200':
          description: Music generated successfully
          content:
            audio/mpeg:
              schema:
                type: string
                format: binary
        '400':
          description: Bad request - invalid parameters
        '401':
          description: Unauthorized - invalid or missing API key
        '422':
          description: Unprocessable entity - validation error
components:
  securitySchemes:
    apiKeyAuth:
      type: apiKey
      in: header
      name: xi-api-key
      description: >-
        ElevenLabs API key passed in the xi-api-key header for authentication.
  schemas:
    MusicGenerationRequest:
      type: object
      required:
        - prompt
      properties:
        prompt:
          type: string
          description: >-
            A natural language description of the music to generate. Include
            details about genre, mood, tempo, instrumentation, and any
            other desired characteristics.
          maxLength: 1000
        duration_seconds:
          type: number
          description: >-
            The desired duration of the generated music in seconds.
          minimum: 1
        loop:
          type: boolean
          description: >-
            Whether the generated music should be designed to loop
            seamlessly.
          default: false
        instrumental:
          type: boolean
          description: >-
            Whether to generate instrumental-only music without vocals
            or lyrics.
          default: false