Code Examples

Ready-to-use examples for integrating VoxParse into your application.

Python

Python - Full Transcription
import requests

API_KEY = "YOUR_API_KEY"
url = "https://api.voxparse.com/v1/transcribe"

with open("call.mp3", "rb") as f:
    response = requests.post(url,
        headers={"X-API-Key": API_KEY},
        files={"file": ("call.mp3", f, "audio/mpeg")},
        data={"language": "en", "plan": "pro"}  # or "lite" for $0.15/hr
    )

result = response.json()
print(result["transcript"])
print(result["ai_analysis"]["call_summary"])

Node.js

Node.js - Full Transcription
import fs from "fs";

const form = new FormData();
form.append("file", new Blob([fs.readFileSync("call.mp3")]), "call.mp3");
form.append("language", "en");
form.append("plan", "pro"); // or "lite" for $0.15/hr

const res = await fetch("https://api.voxparse.com/v1/transcribe", {
  method: "POST",
  headers: { "X-API-Key": "YOUR_API_KEY" },
  body: form,
});

const data = await res.json();
console.log(data.transcript);
console.log(data.ai_analysis.call_summary);

curl

curl - Quick Test
curl -X POST https://api.voxparse.com/v1/transcribe \
  -H "X-API-Key: YOUR_API_KEY" \
  -F "[email protected]" \
  -F "plan=pro" \
  -F "language=en" \
  -F "auto_chapters=true" \
  -F "instructions=Rate this call 1-10 on professionalism"
Plan selection: All examples above use plan=pro ($0.39/hr) for full AI analysis. Use plan=lite ($0.15/hr) for diarization + transcript cleanup only. Custom instructions and auto chapters require the Pro plan.

Webhook Signature Verification

When receiving webhook deliveries, always verify the HMAC-SHA256 signature before processing the payload.

Node.js — Verify Webhook Signature
import crypto from 'crypto';

function verifyWebhook(req, secret) {
  const timestamp = req.headers['x-voxparse-timestamp'];
  const signature = req.headers['x-voxparse-signature'];
  const body = JSON.stringify(req.body);

  const expected = crypto
    .createHmac('sha256', secret)
    .update(timestamp + '.' + body)
    .digest('hex');

  return crypto.timingSafeEqual(
    Buffer.from(signature, 'hex'),
    Buffer.from(expected, 'hex')
  );
}
Python — Verify Webhook Signature
import hmac, hashlib

def verify_webhook(headers, body, secret):
    timestamp = headers.get('X-VoxParse-Timestamp', '')
    signature = headers.get('X-VoxParse-Signature', '')

    expected = hmac.new(
        secret.encode(),
        f"{timestamp}.{body}".encode(),
        hashlib.sha256
    ).hexdigest()

    return hmac.compare_digest(signature, expected)
Tip: Use constant-time comparison (timingSafeEqual in Node.js, hmac.compare_digest in Python) to prevent timing attacks. See the full Webhooks documentation for payload structure and retry policy.