API Documentation

Welcome to the WaveformAPI documentation. Our API allows you to generate beautiful audio waveforms from any public audio URL.

Authentication

Authenticate your requests by including your API key in the x-api-key header.

x-api-key: your_api_key_here
POST

/api/v1/generate

Generates a waveform image from an audio URL.

Parameters

NameTypeDescription
urlstringRequiredPublic URL of the audio file.
pixel_per_secondnumberDefault: 100. Zoom level of the waveform.
samplesnumberDefault: 800. Number of samples to generate.

Examples

cURL
curl -X POST https://waveformapi.com/api/v1/generate \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://example.com/audio.mp3",
    "pixel_per_second": 100,
    "samples": 800
  }'
Node.js
const response = await fetch('https://waveformapi.com/api/v1/generate', {
  method: 'POST',
  headers: {
    'x-api-key': 'YOUR_API_KEY',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    url: 'https://example.com/audio.mp3',
    pixel_per_second: 100,
    samples: 800,
  }),
});

const buffer = await response.arrayBuffer();
// Save buffer to file...
Python
import requests

url = "https://waveformapi.com/api/v1/generate"
headers = {
    "x-api-key": "YOUR_API_KEY",
    "Content-Type": "application/json"
}
data = {
    "url": "https://example.com/audio.mp3",
    "pixel_per_second": 100,
    "samples": 800
}

response = requests.post(url, headers=headers, json=data)

with open("waveform.png", "wb") as f:
    f.write(response.content)

Errors

401

Unauthorized

Invalid or missing API key.

402

Payment Required

Subscription expired or insufficient credits.

400

Bad Request

Missing required parameters (url).