Configuration

Enabling Transaction Publishing

Transactions are not published by default. To enable publishing, configure the following environment variables for SFApi service:

Statistics__SendStatisticsData=true
Statistics__TransactionCountingSystemUrl=<tcs-url>

Additionally, you must choose one authentication method (see below).

Authentication

When configuring Statistics__Authentication, you have two options:

CRM Authentication

Set the following environment variables:

Statistics__SendStatisticsData=true
Statistics__TransactionCountingSystemUrl=<tcs-url>
Statistics__Authentication__CrmToken=<your-token>

OAuth Client Credentials Authentication

Set the following environment variables:

Statistics__SendStatisticsData=true
Statistics__TransactionCountingSystemUrl=<tcs-url>
Statistics__Authentication__OAuth__TokenEndpoint=<token-endpoint-url>
Statistics__Authentication__OAuth__Audience=<audience>
Statistics__Authentication__OAuth__ClientId=<client-id>
Statistics__Authentication__OAuth__ClientSecret=<client-secret>

Session ID Header

Endpoints that create and send Transactions accept an optional header X-Session-Id.

PropertyDescription
FormatMust be a valid GUID string
PurposeUsed as the SessionId for all transactions created by the endpoint
DefaultIf no value is provided or the value is not a valid GUID, the SessionId will be set to the auto-generated TransactionId

Example Usage

POST /api/v1/Detect HTTP/1.1
X-Session-Id: 550e8400-e29b-41d4-a716-446655440000
Content-Type: application/json

{ ... }

This header allows you to group multiple related API calls under a single session for tracking and analytics purposes.

Advanced Configuration

For more fine-grained control, the following configuration options are also available:

ParameterDefaultDescription
Statistics__TransactionsPublishBatchSize1000Maximum number of transactions to send in a single batch
Statistics__TransactionsPublishTimeoutMs5000Timeout for publishing requests (in milliseconds)
Statistics__TransactionsPublishIntervalMs5000Interval between publish attempts (in milliseconds)
Statistics__TransactionsPublishRetryBackoffMs3000Backoff time before retrying after a failed publish (in milliseconds)