Skip to main content

Server-Side SDKs

Build voice-enabled backends with VocaFuse. Generate tokens for frontend authentication, manage voice notes, and receive transcriptions via webhooks.


Available SDKs

VocaFuse currently provides:

  • Python SDK — Full-featured SDK for Python applications with support for Flask, Django, FastAPI, and other frameworks
  • Node.js SDK — Official Node.js/TypeScript SDK for Express, Next.js, NestJS, and other JavaScript backends

Key Features

Server-Side SDKs provide the following capabilities:

  • Authentication — Generate JWT tokens for client applications
  • Voice Note Management — List, retrieve, and delete voice notes
  • Transcription Access — Retrieve transcription data with confidence scores
  • Webhook Configuration — Set up and manage webhook endpoints
  • Signature Validation — Verify webhook authenticity

When to Use Server-Side SDKs

Use Server-Side SDKs when you need to:

  • Generate JWT tokens for your client applications to authenticate with VocaFuse
  • Retrieve voice notes and transcriptions from your backend
  • Manage voice note data programmatically
  • Configure and validate webhooks
  • Build server-side integrations with VocaFuse

Install

pip install vocafuse

Or add to requirements.txt:

vocafuse>=1.0.0

Initialize

from vocafuse import Client
import os

client = Client(
api_key=os.environ['VOCAFUSE_API_KEY'],
api_secret=os.environ['VOCAFUSE_API_SECRET']
)

Get your API keys from the VocaFuse dashboard.


Basic Operations

# List voice notes
recordings = client.recordings.list(limit=10)

# Get a specific voice note
recording = client.recordings.get('rec_123')

# Get transcription
transcription = client.recordings('rec_123').transcription.get()
print(transcription['text'])

# Delete
client.recordings('rec_123').delete()

Generate Frontend Tokens

Your frontend needs a token to upload audio. Create an endpoint that generates tokens:

from vocafuse import AccessToken

@app.route('/api/vocafuse-token', methods=['POST'])
def generate_token():
token = AccessToken(
api_key=os.environ['VOCAFUSE_API_KEY'],
api_secret=os.environ['VOCAFUSE_API_SECRET'],
identity=str(current_user.id)
)
return jsonify(token(expires_in=3600))

Handle Webhooks

Receive transcription results when processing completes:

from vocafuse import RequestValidator

validator = RequestValidator(os.environ['VOCAFUSE_WEBHOOK_SECRET'])

@app.route('/api/webhooks/vocafuse', methods=['POST'])
def handle_webhook():
payload = request.get_data(as_text=True)
signature = request.headers.get('X-VocaFuse-Signature')

if not validator.validate(payload, signature):
return {'error': 'Invalid signature'}, 401

data = request.get_json()
if data['event'] == 'recording.transcribed':
print(data['recording']['transcription']['text'])

return {'status': 'received'}, 200

Security

Server-Side SDKs use your API Key and API Secret for authentication. These credentials should:

  • ✅ Be stored securely in environment variables
  • ✅ Never be exposed in client-side code
  • ✅ Be kept confidential and rotated regularly
  • ✅ Have appropriate access controls on your servers
API Credentials

Never commit API credentials to version control. Always use environment variables or secure credential management systems.


Next Steps

GoalResource
Build complete speech-to-text backendPython Tutorial →
Configure timeouts, retries, errorsConfiguration →
Explore all API endpointsAPI Reference →
Production webhook patternsWebhooks Guide →