API Reference — Voice Tracking
API Reference — Voice Tracking
Track voice agent usage directly via our REST API. This is ideal for custom integrations where you prefer not to use our SDKs. Follow the session lifecycle below to ensure accurate tracking and billing.
Prerequisite: Complete the Voice Agent Setup before implementing voice tracking.
Integration Steps
Follow this 6-step sequence to implement a robust voice tracking pipeline.
1. Create or Get Customer
Before starting a session, ensure your customer exists in Paygent. This endpoint retrieves an existing customer by externalId or creates a new one if not found.
2. Initialize Voice Session
Initialize a unique session for each voice call. Use your own unique sessionId (e.g., Call SID or UUID) to link all subsequent tracking events.
3. Track STT
Track Speech-to-Text usage by providing the audio duration in minutes.
4. Track LLM
Track Large Language Model usage by providing prompt and completion token counts.
5. Track TTS
Track Text-to-Speech usage by providing the total character count processed.
6. Set Indicator
Finally, set a voice indicator (e.g., call completion) with the total call duration in minutes.
