Library
Transaction enrichment library for Flask
Use TxnKit as a transaction enrichment API from Flask. This page shows the safe request shape, a short code snippet, and the boundary for keeping sensitive data out of the integration.
Target intent
Flask apps adding a lightweight transaction enrichment endpoint.
TxnKit should not receive card numbers, account numbers, customer names, or full statements.
Raw descriptor
POS PURCHASE MAIN ST CAFEShort Flask API snippet
@app.post("/api/enrich-transaction")
def enrich_transaction():
response = requests.post(
"https://api.txnkit.dev/v1/enrich",
headers={"Authorization": f"Bearer {os.environ['TXNKIT_API_KEY']}"},
json={"raw_description": request.json["raw_description"], "country": "CA"},
timeout=1,
)
return jsonify(response.json()), response.status_codeKeep API keys out of browser bundles. For frontend stacks, call a backend route or serverless function that owns the TxnKit request.
API-shaped output
{
"normalized_merchant": null,
"display_name": null,
"category": null,
"subcategory": null,
"website": null,
"logos": {
"preferred": null,
"variants": [],
"warnings": [
"no_verified_logo_for_low_confidence_descriptor"
]
},
"confidence": 0.25,
"recurring_hint": false,
"processor_hint": "unknown",
"location_hint": null,
"signals": [
"generic_card_descriptor"
],
"warnings": [
"weak_merchant_evidence"
]
}Low-confidence results should keep fallback labels and warnings visible instead of forcing a guessed logo or website.
When to use
- You are building in Flask and need one-descriptor merchant cleanup through an HTTP API.
- Your app can keep the TxnKit API key on the server side or inside a trusted serverless function.
- You need merchant display names, categories, confidence, signals, warnings, and logo-ready metadata.
When not to use
- TxnKit should not receive card numbers, account numbers, customer names, or full statements.
- Do not use TxnKit to process card numbers, account numbers, full statements, bank credentials, emails, phone numbers, addresses, customer names, or customer PII.
- Do not use TxnKit when the product requirement is guaranteed merchant identity, every-merchant resolution, or contracted uptime terms.
Proof surfaces
The public contract is POST /v1/enrich, backed by the OpenAPI file, benchmark examples, privacy rules, and deterministic request-path tests.