Skip to content

Retain API

The Retain API lets you programmatically choose which session recordings to keep and convert to MP4 video. This is designed for lead generation companies and other businesses that only want to retain recordings for sessions that matter — for example, leads that were actually sold — rather than auto-retaining every session.

Each retained session costs $0.10 and is billed from your prepaid wallet on a pay-as-you-go basis.

https://api.econsent.org

All endpoints require a Bearer token with the vzew_retention permission in the Authorization header:

Authorization: Bearer YOUR_INTEGRATION_TOKEN

You can generate an integration token from your dashboard under Settings > Integrations.


POST /api/integrations/:companyId/retain/:sessionId

Section titled “POST /api/integrations/:companyId/retain/:sessionId”

Retain a single session recording and queue it for MP4 video conversion. The session’s retention_status is set to retained and rrweb_to_video_status is set to pending, which triggers the conversion pipeline.

ParameterTypeRequiredDescription
companyIdstringYesYour company ID
sessionIdstringYesThe session ID to retain
Terminal window
curl -X POST https://api.econsent.org/api/integrations/comp-abc/retain/sess-12345 \
-H "Authorization: Bearer YOUR_INTEGRATION_TOKEN"
{
"success": true,
"sessionId": "sess-12345",
"status": "queued_for_conversion",
"cost_charged": 0.10,
"remaining_balance": 95.40
}
FieldTypeDescription
successbooleanWhether the retention was processed
sessionIdstringThe session ID that was retained
statusstringAlways queued_for_conversion on success
cost_chargednumberAmount charged for this retention ($0.10)
remaining_balancenumberYour remaining wallet balance after the charge

POST /api/integrations/:companyId/retain/batch

Section titled “POST /api/integrations/:companyId/retain/batch”

Retain multiple session recordings in a single request. Each session is charged individually at $0.10 per session.

ParameterTypeRequiredDescription
companyIdstringYesYour company ID
ParameterTypeRequiredDescription
session_idsstring[]YesArray of session IDs to retain (max 100)
Terminal window
curl -X POST https://api.econsent.org/api/integrations/comp-abc/retain/batch \
-H "Authorization: Bearer YOUR_INTEGRATION_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"session_ids": [
"sess-12345",
"sess-67890",
"sess-abcde",
"sess-fghij",
"sess-klmno"
]
}'
{
"success": true,
"retained": 5,
"failed": 1,
"total_cost": 0.50,
"remaining_balance": 94.90,
"results": [
{ "sessionId": "sess-12345", "success": true, "status": "queued_for_conversion" },
{ "sessionId": "sess-67890", "success": true, "status": "queued_for_conversion" },
{ "sessionId": "sess-abcde", "success": true, "status": "queued_for_conversion" },
{ "sessionId": "sess-fghij", "success": true, "status": "queued_for_conversion" },
{ "sessionId": "sess-klmno", "success": true, "status": "queued_for_conversion" },
{ "sessionId": "sess-invalid", "success": false, "error": "Session not found" }
]
}
FieldTypeDescription
successbooleanWhether the batch request was processed
retainednumberNumber of sessions successfully retained
failednumberNumber of sessions that failed to retain
total_costnumberTotal amount charged for all successful retentions
remaining_balancenumberYour remaining wallet balance after all charges
resultsarrayPer-session results with individual success/failure status

For lead generation companies, the typical workflow is:

  1. Capture consent — eConsent records the session automatically when a consumer fills out your form
  2. Post lead to buyer — Your system sends the lead to the buyer/advertiser
  3. Buyer accepts lead — Once the lead is sold and accepted, call the Retain API
  4. MP4 generated — The recording is converted to MP4 and stored for long-term compliance
// Example: retain session after lead is sold
async function onLeadSold(companyId, sessionId) {
const response = await fetch(
`https://api.econsent.org/api/integrations/${companyId}/retain/${sessionId}`,
{
method: 'POST',
headers: { 'Authorization': `Bearer ${API_TOKEN}` },
}
);
const data = await response.json();
if (!data.success) {
console.error('Failed to retain session:', data.error);
}
}

This approach means you only pay $0.10 per lead that matters, rather than retaining every session at scale.


EndpointLimit
Single retain500 requests per minute
Batch retain500 requests per minute

Exceeding the rate limit returns a 429 response. Implement exponential backoff in your integration.


StatusMeaningExample scenario
401UnauthorizedInvalid or expired integration token
402Payment requiredInsufficient wallet balance to cover the retention cost
404Not foundSession ID does not exist or does not belong to your company
409ConflictSession has already been retained
429Rate limitedExceeded 500 requests per minute
{
"success": false,
"error": "Insufficient wallet balance",
"required": 0.10,
"current_balance": 0.05
}

ActionCost
Retain single session$0.10 per session
Retain batch (per session)$0.10 per session

All costs are deducted from your prepaid wallet balance. The batch endpoint charges per successful retention — failed sessions within a batch are not charged.