if statements across services. Rule changes ship through an API the same day instead of in the next release. Validation history gives you one place to investigate why a transaction received its decision.
Trade-off: you add one HTTP call to the critical path of every transaction. The target is p99 under 80ms. In return, you get a single point for policy and decision history, and you remove duplicated logic from product code.
This guide walks you through setting up Tracer and running your first validation. In a few steps, you’ll have a working environment ready to validate transactions in real time.
For step-by-step API instructions with request and response examples, see the Tracer API quick start.
Why use Tracer
- Real-time validation: Make ALLOW/DENY/REVIEW decisions in under 80ms (p99)
- Flexible rules: Expression-based rule engine for custom business logic
- Spending control: Configure limits by account, portfolio, segment, and period
- Validation history: Stored decisions for investigation and reporting
- Product-agnostic: Validates transactions of any payment scheme, such as
CARD,WIRE,PIX, orCRYPTO
- Understand Tracer architecture and core concepts
- Have a working development environment
- Run your first transaction validation
- Configure a spending limit
What is Tracer
Tracer is a transaction validation platform that evaluates rules and limits and returns instant decisions. Your system calls Tracer before it executes a transaction. It then acts on the decision (ALLOW, DENY, or REVIEW) according to your business logic.
How it works
Figure 1. How Tracer works
- Rules evaluate expressions against the transaction context
- Limits check spending thresholds for applicable scopes
- Decision returns ALLOW, DENY, or REVIEW based on evaluation results
Core contexts
Tracer has three bounded contexts:- Validation Context - Orchestrates requests, coordinates evaluation, and stores validation history
- Rules Context - Manages rule definitions and expression evaluation
- Limits Context - Manages spending limits and usage tracking
Prerequisites
Before you start, make sure you have:
- Docker installed
- PostgreSQL 17, with a database for Tracer (
tracerin the examples below) - API Key for authentication
Infrastructure dependencies
Tracer requires the following components:Ports
Default ports used by Tracer services:Step 1: Run Tracer
Tracer ships as two public images on Docker Hub. Use the same tag for both:
The examples use the tag
4.3.0. Tracer does not apply migrations when it starts, so run the migration image first.
Apply the schema
0 when the schema is up to date. You can run it again safely.
Start Tracer
DB_SSL_MODE="disable" and ALLOW_INSECURE_TLS="true" fit a local PostgreSQL without TLS. In production, set DB_SSL_MODE to require or stronger, and leave ALLOW_INSECURE_TLS unset.
Essential environment variables
For every variable, see Environment variables.
Step 2: Authenticate to the API
Tracer supports API key and plugin authentication. Plugin authentication takes precedence when you enable both, except on endpoints configured as API-key-only.
The remaining steps use the API key form because most local-development setups run that way. If plugin authentication applies to your request, replace
X-API-Key: your-secure-api-key with Authorization: Bearer $JWT in every example.
API Key
Include the API Key in theX-API-Key header:
Bearer JWT
Include the JWT issued by Access Manager in theAuthorization header:
tenantId claim from the JWT and routes the request to the correct tenant database.
You never pass the tenant identifier in a header, path, body, or rule scope. The token is the only source of truth.
cURL example
Step 3: Configure a spending limit
Spending limits control transaction amounts by scope and period. Create a limit using
POST /v1/limits.
Limit types
For detailed configuration of all limit types including reset times, time windows, and custom periods, see the Spending limits guide.
Scopes
Apply limits to specific contexts:- Segment: Apply to all accounts in a segment (e.g., corporate customers)
- Portfolio: Apply to accounts in a portfolio
- Account: Apply to a specific account
- Payment scheme: Apply only to one scheme, such as
CARDorPIX
Create a limit
Activate a limit
Limit lifecycle
Limits start inDRAFT status and follow the lifecycle DRAFT → ACTIVE → INACTIVE. Inactive limits can return to DRAFT for editing, or you can delete them. Activate a limit to start enforcement. For the full lifecycle and transition rules, see the Spending limits guide.
Monitor usage
EveryPOST /v1/validations response carries limitUsageDetails, with one entry per limit Tracer checked. Each entry holds the cap and the amount attempted. For a limit that keeps a count, it also holds the projected consumption of the current period: the amount already counted, the capacity that unconfirmed Midaz ledger reservations hold, and this transaction. The endpoint GET /v1/limits/{id}/usage reports the current period of the limit, for its most-used scope.
For detailed configuration options, see the Spending limits guide.
Step 4: Validate your first transaction
With limits configured, you’re ready to validate a transaction using
POST /v1/validations.
Submit a transaction for validation
Send a validation request with the transaction context including:- Transaction details (scheme, amount, asset, timestamp)
- Account information
- Optional: segment, portfolio, merchant, and custom
The
transactionTimestamp must be recent, which is why the example generates it. Tracer rejects a future timestamp with error code 0419 (1-minute clock skew tolerance). Tracer rejects a timestamp older than 24 hours with error code 0421.requestId is the idempotency key. Send a new UUID for each attempt. If you repeat one, Tracer returns the decision it already recorded for that key. A rule you activated in between will not appear to take effect.
The response names the rules Tracer evaluated, the rules that matched, and the current limit usage. That detail helps with debugging and customer support.
Why Tracer returns a decision instead of blocking directly. Tracer is a decisioning layer, not an authorization gateway. The calling system holds the customer relationship and knows the channel. It decides what to do with a DENY. For example, your card-issuing system may honor a
DENY for a stand-in pre-auth. It may still capture the request for analytics. By returning a decision, Tracer fits into any authorization flow without owning the customer-facing UX.Step 5: Create a validation rule
Rules let you define custom business logic that evaluates during validation. Create a rule using the
POST /v1/rules endpoint with an expression, action, and optional scopes.
For example, to block high-value transactions:
Tracer preserves the name’s case and internal whitespace, trimming only leading and trailing whitespace before storage. Take the
ruleId from the response and use it in the activate call below.Activate a rule
Activation takes effect right away on the instance that served the activate call. A single-instance setup evaluates the rule on your next validation. When you run several instances behind a load balancer, the others pick the change up on their next rule sync. The interval is
RULE_SYNC_POLL_INTERVAL_SECONDS, default 10. Deactivation propagates the same way.Rule lifecycle
Rules follow the same lifecycle as limits:DRAFT → ACTIVE → INACTIVE. To start evaluation, activate the rule using POST /v1/rules/{id}/activate. You can deactivate and reactivate an active rule as needed.
For detailed information about rule expressions and lifecycle management, see the Rules engine guide.
Observability
Tracer exposes endpoints for monitoring and observability.
Key metrics
Tracer exposes OpenTelemetry-compatible metrics via the OTLP exporter, plus custom application metrics:tracer_auth_failures_total{reason}- Authentication failures by reason (missing_api_key, invalid_api_key)tracer_validation_rollback_failures_total- Usage rollback failures during REVIEW decisions (eventual consistency gaps that self-correct at period boundaries)
Verification
Confirm that everything works correctly.
Checklist
- Tracer container started and healthy
- API Key authentication working
- Spending limit configured
- Test transaction validated successfully
- Rule created and activated
Next steps
From here, you can explore more advanced features:
- Integration guide - Learn how to integrate your authorization system with Tracer
- Rules engine - Write validation rules in CEL and manage their lifecycle
- Spending limits - Configure and manage spending limits by scope and period
- Validation history and compliance - Query validation history and use it in your compliance processes
Quick reference
The three flows you’ll use most:
- Validate a transaction:
POST /v1/validations. See the Tracer API quick start for the request shape. - Manage rules:
/v1/rules(CRUD + lifecycle endpoints/activate,/deactivate,/draft). See the Rules engine guide. - Manage limits:
/v1/limits(CRUD + lifecycle +/usage). See the Spending limits guide.
What your system should do with each decision
Tracer returns decisions as recommendations. Your system must implement the appropriate action for each decision.

