Overview

The Transaction Counting System (TCS) integration allows SmartFace to publish statistics as transactions for monitoring, billing, and analytics purposes.

Overview

Statistics generated by SmartFace operations are published as Transactions to the Transaction Counting System (TCS). This enables:

  • Usage Tracking - Monitor API usage and operation counts
  • Billing Integration - Track transactions for billing and licensing purposes
  • Analytics - Collect data for performance analysis and reporting

How It Works

When enabled, SmartFace automatically sends transaction data to TCS whenever certain API endpoints are called. Each transaction includes:

  • Transaction ID - A unique identifier for each transaction
  • Session ID - Groups related transactions together (can be specified via header or auto-generated)
  • Operation Details - Information about the API operation performed

Supported Operations

The following SmartFace API endpoints publish transactions to TCS:

EndpointDescription
POST api/v1/DetectFace detection operations
POST api/v1/Faces/SpoofCheckFace liveness/spoof detection
POST api/v1/Palms/SpoofCheckPalm liveness/spoof detection
POST api/v1/Watchlists/SearchFace search in watchlists
POST api/v1/Watchlists/SearchByTemplateTemplate-based watchlist search
POST api/v1/Watchlists/SearchByPalmPalm search in watchlists
POST api/v1/Watchlists/SearchByPalmTemplatePalm template-based watchlist search

Reliability & Error Handling

The TCS integration is designed to be resilient to endpoint failures and network issues:

  • Batched Publishing - Statistics are buffered and sent to TCS in batches for efficient processing
  • Automatic Retries - If a publish attempt fails, the system retries up to 3 times with exponential backoff and jitter
  • No Data Loss - Failed batches are safely re-queued back into the internal buffer for later retry
  • Bounded Buffers - Internal buffer have large enough limit of 500_000 messages. This is big enough to handle extended TCS outages.
  • Automatic Recovery - Once the TCS endpoint becomes available again, queued statistics are automatically published

This design ensures that temporary TCS outages do not result in lost transaction data, and the system recovers gracefully without manual intervention.

Getting Started

To enable TCS integration:

  1. Configure the environment variables to enable transaction publishing
  2. Set up authentication using either CRM or OAuth method
  3. Optionally use the X-Session-Id header to group related transactions