{
  "openapi": "3.1.1",
  "info": {
    "title": "Universal Audio Converter API",
    "version": "1.0.0",
    "summary": "Convert MP3, WAV, FLAC, Ogg, Opus, M4A and AIFF with bitrate and sample-rate control.",
    "description": "Every endpoint performs the same calculation as the human page and returns inputs, result, units, assumptions, sources, warnings and computedAt. MCP endpoint: /mcp."
  },
  "servers": [
    {
      "url": "https://audioconverter.usefulweb.site"
    }
  ],
  "paths": {
    "/api/v1/calculate": {
      "post": {
        "operationId": "calculate",
        "summary": "Convert MP3, WAV, FLAC, Ogg, Opus, M4A and AIFF with bitrate and sample-rate control.",
        "description": "Converts audio between MP3, WAV, FLAC, Ogg Vorbis, Ogg Opus, M4A (AAC) and AIFF with ffmpeg. Choose constant bitrate or VBR quality, sample rate, mono/stereo and bit depth; tags and album covers are kept where the format supports them. Shows an ffprobe report before and after, with a player and a download.\n\nMethodology:\n- The container is detected from the first bytes of the file (not the name) and passed to ffmpeg explicitly, so playlists or files that reference other files are never opened.\n- ffprobe reads codec, sample rate, channels, bitrate, duration and tags before conversion. ffmpeg then decodes the first audio track and encodes it with LAME (MP3), the native AAC encoder (M4A), libvorbis, libopus, FLAC or PCM (WAV/AIFF).\n- Lossy formats use either a fixed/average bitrate or a VBR quality level (MP3 -q:a, Vorbis -q:a; Opus/AAC use VBR at a matching target bitrate). Lossless formats ignore the bitrate.\n- Opus only supports 8/12/16/24/48 kHz and MP3 at most 48 kHz; other rates are resampled to the nearest supported rate and you get a warning.\n- Tags are copied with -map_metadata 0; album covers are copied for MP3, M4A and FLAC (Ogg/WAV/AIFF covers are not supported by ffmpeg muxers). Encoder version tags and timestamps are not written, so the same input always gives the same file.\n- ffprobe reads the result again for the before/after report.\n\nConverting a lossy file (MP3, AAC, Ogg) to another lossy format or to a lossless format cannot restore lost quality.",
        "tags": [
          "media"
        ],
        "x-mcp-tool": "audio_converter",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AudioConverterInput"
              },
              "examples": {
                "example1": {
                  "summary": "MP3 tone to Ogg Opus 64 kbit/s, mono",
                  "value": {
                    "file": {
                      "filename": "tone.mp3",
                      "contentType": "audio/mpeg",
                      "contentBase64": "SUQzAwAAAAAANFRJVDIAAAALAAAAVGVzdCB0b25lAFRQRTEAAAALAAAAdXNlZnVsd2ViAAAAAAAAAAAAAAD/4zjAAAAAAAAAAAAASW5mbwAAAA8AAAAJAAADYABVVVVVVVVVVVVVVWpqampqampqampqgICAgICAgICAgICVlZWVlZWVlZWVlaqqqqqqqqqqqqqqwMDAwMDAwMDAwMDV1dXV1dXV1dXV1erq6urq6urq6urq//////////////8AAAAATGF2ZiBsYW1lAAAAAAAAAAAAAAAAJAJgAAAAAAAAA2DhWsr/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD/4xjEAAyokqh5SAAAD22/4d3d3v/RESv5d3f5SSwbgLgLgLg3PlAxw/yhz9/R7+j38HAxkAffWBDmgH+Ud39CgQkKRFiBEz//4xjECA3w6qDBlDgA5MkBJoc7/EBhyQNsGAOBS4BzxgokpgaxKNMIQcg9HhsNv/x0ajU4GhL/hIGhKdBq////////////////4xjECw8QpjgB3gAA+GhGAAYBYAxfoGgIGBqDgYSYPhhOi9GJrekZAAshh+g1GCWCYAgOwqAOYCAAJbFkl+rfoA//b7/L5fX/4xjECQqwjo5YCbRi/n3qiICUpOT5DnL9WR4Ms63+X06P/v9H/+//+nJf+t9GXtsQBtdfrcl5/f+V1eIwQL/nESYRBr0i8sr/4xjEGQtIloJYCnZigON9/lP9n9b/T9v37q/9P2//1fRV///5O3qXQOATAhMCmwMhwSPQYQHRBgcjAEgOoWAuAIB4YAGRACL/4xjEJgpYpjQABvxEbLUb6v///jGAGAADfQMAIBwMCwEgEAvAxGjLAx9m1A6uxbA3pD+AwbAgAwDAJACBeAkAoj4ZgQohCDD/4xjENw04pkABVgAAAR/itBmDQVp/WLIJwRwGKJAwM/DsNjcZwDM5yDpBHgAgGAy0hSC/v8A3wDWMsT8L2PP//zMe5udL5uv/4xjEPRaRlozJlWgAL///+brMwdB8Bn//oB8BmiY1//9BMaaJuNf//3IVBd2AA//aqqp/9VVVOdqOJAwVLAwCARKyIBJV/QX/4xjEHQ1AmqR5xggBBn/0FCv8FBn/FBQp/xQYK/oKFHfiSf/9TEFNRTQuMSAoYWxwaGEgMClVVVVVVVVVVVVVVVVVVVVVVVU="
                    },
                    "format": "opus",
                    "bitrate": "64",
                    "channels": "1"
                  }
                },
                "example2": {
                  "summary": "MP3 to lossless FLAC with tags",
                  "value": {
                    "file": {
                      "filename": "tone.mp3",
                      "contentType": "audio/mpeg",
                      "contentBase64": "SUQzAwAAAAAANFRJVDIAAAALAAAAVGVzdCB0b25lAFRQRTEAAAALAAAAdXNlZnVsd2ViAAAAAAAAAAAAAAD/4zjAAAAAAAAAAAAASW5mbwAAAA8AAAAJAAADYABVVVVVVVVVVVVVVWpqampqampqampqgICAgICAgICAgICVlZWVlZWVlZWVlaqqqqqqqqqqqqqqwMDAwMDAwMDAwMDV1dXV1dXV1dXV1erq6urq6urq6urq//////////////8AAAAATGF2ZiBsYW1lAAAAAAAAAAAAAAAAJAJgAAAAAAAAA2DhWsr/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD/4xjEAAyokqh5SAAAD22/4d3d3v/RESv5d3f5SSwbgLgLgLg3PlAxw/yhz9/R7+j38HAxkAffWBDmgH+Ud39CgQkKRFiBEz//4xjECA3w6qDBlDgA5MkBJoc7/EBhyQNsGAOBS4BzxgokpgaxKNMIQcg9HhsNv/x0ajU4GhL/hIGhKdBq////////////////4xjECw8QpjgB3gAA+GhGAAYBYAxfoGgIGBqDgYSYPhhOi9GJrekZAAshh+g1GCWCYAgOwqAOYCAAJbFkl+rfoA//b7/L5fX/4xjECQqwjo5YCbRi/n3qiICUpOT5DnL9WR4Ms63+X06P/v9H/+//+nJf+t9GXtsQBtdfrcl5/f+V1eIwQL/nESYRBr0i8sr/4xjEGQtIloJYCnZigON9/lP9n9b/T9v37q/9P2//1fRV///5O3qXQOATAhMCmwMhwSPQYQHRBgcjAEgOoWAuAIB4YAGRACL/4xjEJgpYpjQABvxEbLUb6v///jGAGAADfQMAIBwMCwEgEAvAxGjLAx9m1A6uxbA3pD+AwbAgAwDAJACBeAkAoj4ZgQohCDD/4xjENw04pkABVgAAAR/itBmDQVp/WLIJwRwGKJAwM/DsNjcZwDM5yDpBHgAgGAy0hSC/v8A3wDWMsT8L2PP//zMe5udL5uv/4xjEPRaRlozJlWgAL///+brMwdB8Bn//oB8BmiY1//9BMaaJuNf//3IVBd2AA//aqqp/9VVVOdqOJAwVLAwCARKyIBJV/QX/4xjEHQ1AmqR5xggBBn/0FCv8FBn/FBQp/xQYK/oKFHfiSf/9TEFNRTQuMSAoYWxwaGEgMClVVVVVVVVVVVVVVVVVVVVVVVU="
                    },
                    "format": "flac"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Calculation result envelope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AudioConverterResult"
                }
              }
            }
          },
          "400": {
            "description": "Malformed JSON body.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "Invalid input (see errors[]).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (see Retry-After).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/tool": {
      "get": {
        "operationId": "getToolDefinition",
        "summary": "Inputs, output schema and examples for this tool",
        "responses": {
          "200": {
            "description": "Tool definition.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Problem": {
        "type": "object",
        "description": "RFC 9457 problem details. 422 responses include per-field `errors`.",
        "required": [
          "type",
          "title",
          "status",
          "detail"
        ],
        "properties": {
          "type": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "status": {
            "type": "integer"
          },
          "detail": {
            "type": "string"
          },
          "code": {
            "type": "string"
          },
          "errors": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "field",
                "message"
              ],
              "properties": {
                "field": {
                  "type": "string"
                },
                "message": {
                  "type": "string"
                }
              }
            }
          }
        }
      },
      "AudioConverterInput": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "file": {
            "title": "Audio file",
            "description": "MP3, WAV, FLAC, Ogg/Opus, M4A/AAC, AIFF or WMA (also the first audio track of a video), max 100 MB and 2 hours. Processed on our server in a private temporary folder that is deleted afterwards; the result can be downloaded for about 2 hours. Upload as {filename, contentType?, contentBase64}. Max 102400 KiB. Accepts .mp3,.wav,.flac,.ogg,.oga,.opus,.m4a,.aac,.aif,.aiff,.wma,.mp4,.mov,.webm,.mkv,audio/*.",
            "type": "object",
            "additionalProperties": false,
            "required": [
              "filename",
              "contentBase64"
            ],
            "properties": {
              "filename": {
                "type": "string"
              },
              "contentType": {
                "type": "string"
              },
              "contentBase64": {
                "type": "string"
              }
            }
          },
          "format": {
            "title": "Output format",
            "type": "string",
            "enum": [
              "mp3",
              "m4a",
              "ogg",
              "opus",
              "flac",
              "wav",
              "aiff"
            ],
            "default": "mp3"
          },
          "mode": {
            "title": "Bitrate mode (lossy formats)",
            "type": "string",
            "enum": [
              "cbr",
              "vbr"
            ],
            "default": "cbr"
          },
          "bitrate": {
            "title": "Bitrate",
            "description": "Used in fixed-bitrate mode. 128 kbit/s is fine for speech, 192–320 kbit/s for music.",
            "type": "string",
            "enum": [
              "32",
              "48",
              "64",
              "96",
              "128",
              "160",
              "192",
              "224",
              "256",
              "320"
            ],
            "default": "192"
          },
          "vbrQuality": {
            "title": "VBR quality",
            "type": "string",
            "enum": [
              "high",
              "medium",
              "low"
            ],
            "default": "high"
          },
          "sampleRate": {
            "title": "Sample rate",
            "type": "string",
            "enum": [
              "keep",
              "8000",
              "16000",
              "22050",
              "32000",
              "44100",
              "48000",
              "96000"
            ],
            "default": "keep"
          },
          "channels": {
            "title": "Channels",
            "type": "string",
            "enum": [
              "keep",
              "1",
              "2"
            ],
            "default": "keep"
          },
          "bitDepth": {
            "title": "Bit depth (WAV, FLAC, AIFF)",
            "type": "string",
            "enum": [
              "16",
              "24"
            ],
            "default": "16"
          },
          "keepTags": {
            "title": "Keep tags (title, artist, album …) and the album cover where the format supports it",
            "type": "boolean",
            "default": true
          }
        },
        "required": [
          "file"
        ]
      },
      "AudioConverterResult": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "schemaVersion",
          "tool",
          "computedAt",
          "inputs",
          "summary",
          "result",
          "units",
          "assumptions",
          "sources",
          "warnings",
          "presentation",
          "links"
        ],
        "properties": {
          "schemaVersion": {
            "type": "string",
            "const": "1.0"
          },
          "tool": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "id",
              "name",
              "version"
            ],
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "version": {
                "type": "string"
              }
            }
          },
          "computedAt": {
            "type": "string",
            "format": "date-time"
          },
          "inputs": {
            "type": "object",
            "description": "Normalised inputs actually used, including applied defaults."
          },
          "summary": {
            "type": "string"
          },
          "result": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "inputContainer",
              "outputFormat",
              "encoderSetting",
              "sampleRate",
              "channels",
              "durationSeconds",
              "originalBytes",
              "outputBytes",
              "tagsKept",
              "coverKept",
              "before",
              "after",
              "artifact"
            ],
            "properties": {
              "inputContainer": {
                "type": "string"
              },
              "outputFormat": {
                "type": "string",
                "enum": [
                  "mp3",
                  "wav",
                  "flac",
                  "ogg",
                  "opus",
                  "m4a",
                  "aiff"
                ]
              },
              "encoderSetting": {
                "type": "string"
              },
              "sampleRate": {
                "type": "integer"
              },
              "channels": {
                "type": "integer"
              },
              "durationSeconds": {
                "type": "number"
              },
              "originalBytes": {
                "type": "integer"
              },
              "outputBytes": {
                "type": "integer"
              },
              "tagsKept": {
                "type": "boolean"
              },
              "coverKept": {
                "type": "boolean"
              },
              "before": {
                "type": "object",
                "required": [
                  "container",
                  "durationSeconds",
                  "bytes",
                  "streams"
                ],
                "properties": {
                  "container": {
                    "type": "string"
                  },
                  "durationSeconds": {
                    "type": [
                      "number",
                      "null"
                    ]
                  },
                  "bytes": {
                    "type": "integer"
                  },
                  "bitRateKbps": {
                    "type": [
                      "number",
                      "null"
                    ]
                  },
                  "streams": {
                    "type": "array",
                    "items": {
                      "type": "object"
                    }
                  },
                  "tags": {
                    "type": "object"
                  }
                }
              },
              "after": {
                "type": "object",
                "required": [
                  "container",
                  "durationSeconds",
                  "bytes",
                  "streams"
                ],
                "properties": {
                  "container": {
                    "type": "string"
                  },
                  "durationSeconds": {
                    "type": [
                      "number",
                      "null"
                    ]
                  },
                  "bytes": {
                    "type": "integer"
                  },
                  "bitRateKbps": {
                    "type": [
                      "number",
                      "null"
                    ]
                  },
                  "streams": {
                    "type": "array",
                    "items": {
                      "type": "object"
                    }
                  },
                  "tags": {
                    "type": "object"
                  }
                }
              },
              "artifact": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "artifactId",
                  "filename",
                  "mime",
                  "bytes",
                  "sha256",
                  "path"
                ],
                "properties": {
                  "artifactId": {
                    "type": "string"
                  },
                  "filename": {
                    "type": "string"
                  },
                  "mime": {
                    "type": "string"
                  },
                  "bytes": {
                    "type": "integer"
                  },
                  "sha256": {
                    "type": "string"
                  },
                  "path": {
                    "type": "string",
                    "description": "Download path on the same site (valid for about 2 hours)."
                  }
                }
              }
            }
          },
          "units": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            }
          },
          "assumptions": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "sources": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": false,
              "required": [
                "title"
              ],
              "properties": {
                "title": {
                  "type": "string"
                },
                "url": {
                  "type": "string"
                },
                "publisher": {
                  "type": "string"
                },
                "retrievedAt": {
                  "type": "string"
                },
                "note": {
                  "type": "string"
                }
              }
            }
          },
          "warnings": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "presentation": {
            "type": "array",
            "items": {
              "type": "object"
            },
            "description": "Display blocks used by the human page (same data)."
          },
          "links": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "human",
              "api",
              "openapi",
              "methodology"
            ],
            "properties": {
              "human": {
                "type": "string",
                "format": "uri"
              },
              "api": {
                "type": "string",
                "format": "uri"
              },
              "openapi": {
                "type": "string",
                "format": "uri"
              },
              "methodology": {
                "type": "string",
                "format": "uri"
              }
            }
          }
        }
      }
    }
  }
}