Welcome to VoicePact API
The VoicePact API is a RESTful service that enables voice-based contract creation and management for underserved communities. Built with FastAPI, it provides a modern, high-performance interface for creating, managing, and executing binding agreements through voice calls, SMS, and mobile money integration.Base URL
The API is versioned and accessible at:/api/v1 as configured in the application settings.
API Version
Current Version: 1.0.0 The API uses URL path versioning. Version 1 endpoints are available at/api/v1/*.
Core Features
Voice Processing
Convert voice recordings into structured contracts with automatic term extraction
Contract Management
Create, manage, and track binding agreements with cryptographic signatures
Mobile Money Integration
Process payments and escrow through Africa’s Talking payment gateway
SMS Notifications
Send contract confirmations and updates via SMS
Available Endpoints
Voice Processing
POST /api/v1/voice/conference/create- Create voice conference for contract negotiationPOST /api/v1/voice/process- Process voice recording into contractPOST /api/v1/voice/upload- Upload audio file for processingPOST /api/v1/voice/webhook- Webhook for voice call events
Contract Management
POST /api/v1/contracts/create- Create contract from transcriptPOST /api/v1/contracts/create/manual- Create contract manuallyGET /api/v1/contracts/{contract_id}- Get contract by IDGET /api/v1/contracts/- List contracts with filteringPUT /api/v1/contracts/{contract_id}- Update contractPOST /api/v1/contracts/{contract_id}/confirm- Confirm contract by phoneGET /api/v1/contracts/{contract_id}/status- Get contract status
Payments
POST /api/v1/payments/checkout- Initiate mobile money checkoutPOST /api/v1/payments/webhook- Payment webhook handlerGET /api/v1/payments/{payment_id}- Get payment detailsGET /api/v1/payments/contract/{contract_id}- Get payments for contractGET /api/v1/payments/wallet/balance- Get wallet balance
SMS Integration
POST /api/v1/sms/send- Send single SMSPOST /api/v1/sms/send/bulk- Send bulk SMSPOST /api/v1/sms/send/contract- Send contract confirmation SMSPOST /api/v1/sms/webhook- SMS webhook handlerGET /api/v1/sms/status- Check SMS service status
USSD
POST /api/v1/ussd- USSD menu handler
WebSocket
WS /api/v1/ws- Real-time contract updates
Quick Start
1. Check API Health
2. Create a Simple Contract
3. Check Contract Status
Response Format
All API responses follow a consistent JSON format:Success Response
Error Response
Rate Limiting
Currently, there are no enforced rate limits. However, we recommend:- Maximum 100 requests per minute per IP
- Maximum 1000 requests per hour per IP
CORS Support
The API supports CORS for the following origins:http://localhost:3000http://127.0.0.1:3000
CORS_ORIGINS environment variable.
Compression
The API supports GZip compression for responses larger than 1000 bytes. Include theAccept-Encoding: gzip header in your requests.
Environments
- Development
- Production
- Debug mode enabled
- Detailed error messages
- Interactive API docs at
/docs - Base URL:
http://localhost:8000/api/v1
Interactive Documentation
In development mode, interactive API documentation is available at:- Swagger UI:
http://localhost:8000/docs - ReDoc:
http://localhost:8000/redoc
Next Steps
Authentication
Learn about API security and authentication methods
Error Handling
Understand error codes and how to handle them