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

# Download YouTube music audio

> Use this operation to save the audio from one public YouTube or YouTube Music URL as MP3, M4A, or WebM. The response contains a retained audio file URL and normalized track metadata.



## OpenAPI

````yaml /api-reference/openapi.json post /v1/youtube/music/download
openapi: 3.1.0
info:
  description: >-
    Direct authenticated APIs for public social data, people data, transcripts,
    documents, text, and SEO. Send an API key as a Bearer token. Responses never
    include provider credentials or raw provider payloads.
  license:
    name: Proprietary
    url: https://agentbody.io
  title: AgentBody API
  version: '2026-08-19'
servers:
  - url: https://api.agentbody.io
security:
  - bearerAuth: []
paths:
  /v1/youtube/music/download:
    post:
      tags:
        - youtube
      summary: Download YouTube music audio
      description: >-
        Use this operation to save the audio from one public YouTube or YouTube
        Music URL as MP3, M4A, or WebM. The response contains a retained audio
        file URL and normalized track metadata.
      operationId: post_v1_youtube_music_download
      parameters:
        - $ref: '#/components/parameters/IdempotencyKey'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/MusicDownloadRequest'
        required: true
      responses:
        '200':
          $ref: '#/components/responses/MusicDownloadSuccess'
        '400':
          content:
            application/json:
              example:
                error:
                  code: INVALID_ARGUMENT
                  message: example error
              schema:
                additionalProperties: false
                properties:
                  error:
                    additionalProperties: false
                    properties:
                      code:
                        const: INVALID_ARGUMENT
                        type: string
                      message:
                        type: string
                    required:
                      - code
                      - message
                    type: object
                required:
                  - error
                type: object
          description: Correct the input; do not retry unchanged.
          headers:
            X-Request-Id:
              description: Gateway request identifier for support and audit.
              schema:
                format: uuid
                type: string
        '401':
          content:
            application/json:
              example:
                error:
                  code: UNAUTHENTICATED
                  message: example error
              schema:
                additionalProperties: false
                properties:
                  error:
                    additionalProperties: false
                    properties:
                      code:
                        const: UNAUTHENTICATED
                        type: string
                      message:
                        type: string
                    required:
                      - code
                      - message
                    type: object
                required:
                  - error
                type: object
          description: Configure a valid API key; do not retry unchanged.
          headers:
            X-Request-Id:
              description: Gateway request identifier for support and audit.
              schema:
                format: uuid
                type: string
        '409':
          content:
            application/json:
              example:
                error:
                  code: CONFLICT
                  message: example error
              schema:
                additionalProperties: false
                properties:
                  error:
                    additionalProperties: false
                    properties:
                      code:
                        const: CONFLICT
                        type: string
                      message:
                        type: string
                    required:
                      - code
                      - message
                    type: object
                required:
                  - error
                type: object
          description: Follow the documented Idempotency-Key behavior before retrying.
          headers:
            X-Request-Id:
              description: Gateway request identifier for support and audit.
              schema:
                format: uuid
                type: string
        '502':
          content:
            application/json:
              example:
                error:
                  code: UPSTREAM_INVALID_RESPONSE
                  message: example error
              schema:
                additionalProperties: false
                properties:
                  error:
                    additionalProperties: false
                    properties:
                      code:
                        const: UPSTREAM_INVALID_RESPONSE
                        type: string
                      message:
                        type: string
                    required:
                      - code
                      - message
                    type: object
                required:
                  - error
                type: object
          description: Retry with backoff, then report temporary unavailability.
          headers:
            X-Request-Id:
              description: Gateway request identifier for support and audit.
              schema:
                format: uuid
                type: string
        '503':
          content:
            application/json:
              example:
                error:
                  code: UPSTREAM_UNAVAILABLE
                  message: example error
              schema:
                additionalProperties: false
                properties:
                  error:
                    additionalProperties: false
                    properties:
                      code:
                        const: UPSTREAM_UNAVAILABLE
                        type: string
                      message:
                        type: string
                    required:
                      - code
                      - message
                    type: object
                required:
                  - error
                type: object
          description: Retry with backoff, then report temporary unavailability.
          headers:
            X-Request-Id:
              description: Gateway request identifier for support and audit.
              schema:
                format: uuid
                type: string
        '504':
          content:
            application/json:
              example:
                error:
                  code: UPSTREAM_TIMEOUT
                  message: example error
              schema:
                additionalProperties: false
                properties:
                  error:
                    additionalProperties: false
                    properties:
                      code:
                        const: UPSTREAM_TIMEOUT
                        type: string
                      message:
                        type: string
                    required:
                      - code
                      - message
                    type: object
                required:
                  - error
                type: object
          description: Retry with backoff, then report temporary unavailability.
          headers:
            X-Request-Id:
              description: Gateway request identifier for support and audit.
              schema:
                format: uuid
                type: string
components:
  parameters:
    IdempotencyKey:
      description: Optional key for safely retrying a billable write request.
      example: request-20260819-001
      in: header
      name: Idempotency-Key
      required: false
      schema:
        maxLength: 255
        minLength: 1
        type: string
  schemas:
    MusicDownloadRequest:
      additionalProperties: false
      properties:
        audio_format:
          default: mp3
          enum:
            - mp3
            - m4a
            - webm
          type: string
        region:
          default: US
          maxLength: 2
          minLength: 2
          pattern: ^[A-Z]{2}$
          type: string
        url:
          format: uri
          type: string
      required:
        - url
      type: object
    MusicDownloadResult:
      additionalProperties: false
      properties:
        audio_format:
          type: string
        audio_url:
          format: uri
          type: string
        bitrate:
          format: int64
          type: integer
        bytes:
          format: int64
          type: integer
        channel_title:
          type: string
        content_type:
          type: string
        duration_seconds:
          type: number
        size_mb:
          type: number
        title:
          type: string
        url:
          format: uri
          type: string
        video_id:
          type: string
      required:
        - video_id
        - url
        - title
        - audio_url
        - content_type
        - audio_format
      type: object
  responses:
    MusicDownloadSuccess:
      content:
        application/json:
          example:
            audio_format: mp3
            audio_url: https://example.com/audio.mp3
            bitrate: 192000
            bytes: 4194304
            channel_title: Example Channel
            content_type: audio/mpeg
            duration_seconds: 180
            size_mb: 4
            title: Example Track
            url: https://www.youtube.com/watch?v=Gef1KePPRoI
            video_id: Gef1KePPRoI
          schema:
            $ref: '#/components/schemas/MusicDownloadResult'
      description: Retained audio file and normalized public track metadata.
      headers:
        X-Request-Id:
          description: Gateway request identifier for support and audit.
          schema:
            format: uuid
            type: string
  securitySchemes:
    bearerAuth:
      scheme: bearer
      type: http

````