Skip to main content
POST
Log S2S Session Duration

Log S2S Session Duration

Log the duration of a completed Speech-to-Speech session and deduct the time from the user’s S2S time quota.

Endpoint

Description

Log the duration of a completed Speech-to-Speech session and deduct the time from the user’s S2S time quota. This should be called after a session ends to track usage accurately.

Usage Tracking

  • Duration is specified in milliseconds
  • Automatically converted to minutes and deducted from user’s quota
  • Time is tracked per-user based on license tier
  • Activity logs are created for audit purposes

Authentication

Required: API Key

Request Body

Request Example

JavaScript/Node.js

Python

Response

Success Response (200)

Response Fields

Error Responses

400 Bad Request

401 Unauthorized

500 Internal Server Error

Notes

  • Call this endpoint after each S2S session ends to accurately track usage
  • Duration should be calculated from when the WebRTC connection is established until it’s closed
  • Time is automatically converted from milliseconds to minutes and deducted from the user’s quota
  • The user_id parameter allows billing to a different user account
  • Activity logs are automatically created for audit purposes
  • Ensure you have sufficient remaining time before starting a session (check with /speech/s2s/status)

Authorizations

Authorization
string
header
required

API key authentication using Bearer token format. Example: Authorization: Bearer sk-your-api-key-here

Body

application/json
durationMs
integer

Session duration in milliseconds

Required range: x >= 0
Example:

42624

user_id
string

Optional user ID to bill this session to (defaults to API key owner)

Example:

"60a7c8f5e8b4f5001f7a8c23"

Response

Session logged successfully

success
boolean
Example:

true

message
string
Example:

"S2S session logged successfully"

request_id
string

Request ID for tracking

Example:

"3fb8d444-2242-4764-9202-8e9e72464192"