Transaction Scoring API
This guide provides comprehensive information about the EagleSense transaction scoring API, including real-time evaluation and delayed attribute updates. This page describes methods for online prediction only. Uploading historical data and batch transaction scoring are covered separately and are available exclusively through S3.
Please note, in live EagleSense operation, it is crucial that we receive the status of all previous charge attempts — including CITs (even if they are not sent for scoring), MITs, Initials, and Rebills — for a given user and order before a new retry is submitted for scoring. This ensures we can recalculate aggregate features with full context prior to the next evaluation. You will use Batch Transaction Scoring method to send all processed transactions with their statuses (CITs, MITs, initials, and rebills), ensuring we receive complete transaction history and details regardless of whether a transaction requires scoring.
In addition, customer-initiated subscription transactions (CITs) may also be submitted to EagleSense for scoring directly, following this guide.
Real-Time Transaction Evaluation
Section titled “Real-Time Transaction Evaluation”Endpoint:
POST https://api.eaglesense.ai/data/realtime/transaction/evaluationAuthentication:
Please refer to the Authentication documentation for details on assuming the required AWS IAM role and configuring your requests with proper AWS Signature Version 4 authentication. Sign for service execute-api, region us-east-1, with host api.eaglesense.ai.
Request Body:
{ "user_id": "usr_789123456", "card_id": "card_abc987654", "merchant_transaction_id": "merch_txn_2024081401234567", "transaction_timestamp": "2024-08-14T15:30:45Z", "site_name": "StreamingPlatform", "action_platform": "web", "subscription_id": "sub_premium_456789", "package_id": "pkg_monthly_premium", "ref_token": "ref_xyz789012345", "payment_method_type": "credit_card", "transaction_amount": 12.99, "decline_reason": null, "acquirer_name": "VISA_PROCESSOR", "order_id": "ord_20240814_987654", "transaction_mid": "mid_streaming_001", "transaction_type": "purchase", "order_type": "subscription", "transaction_descriptor": "STREAMING_MONTHLY_SUB", "transaction_initiation": "customer", "refund": false, "refund_reason": null, "transaction_status": "completed", "authorization_type": "3ds_authenticated", "authorization_settle_time": "2024-08-14T15:32:10Z", "merchant_category_code": "5815", "transaction_currency": "USD", "transaction_currency_displayed": "USD", "transaction_currency_charged": "USD", "exchange_rate": 1.0, "3ds_transaction": true, "hashed_ip_address_network": "sha256_net_abc123", "hashed_ip_address_host": "sha256_host_def456", "ip_address": "192.168.1.100", "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36", "device_fingerprint": "fp_device_789abc123def", "device_language": "en-US", "product_description": "Monthly Premium Subscription", "card_bin": "424242", "bank_name": "Chase Bank", "card_timestamp_added": "2024-07-15T10:20:30Z", "bin_risk_level": "0.15", "last4": "4242", "card_expiration_timestamp": "2027-12-31T23:59:59Z", "card_brand": "visa", "card_level": "standard", "card_type": "credit", "cardholder_name": "John Smith", "card_country": "US", "card_billing_address": "123 Main St, New York, NY 10001", "multi_user_id": "multi_usr_family_001", "multi_user_ids": "usr_789123456,usr_789123457,usr_789123458", "multi_card_ids": "card_abc987654,card_abc987655", "related_data": "family_plan:true,primary_user:usr_789123456", "users_count": 3, "user_age": 32, "user_country": "US", "login_country": "US", "user_signup_timestamp": "2024-03-15T09:15:22Z", "traffic_source": "organic_search", "signup_method": "email", "local_timestamp": "2024-08-14T11:30:45-04:00", "local_timezone": "-240", "user_status": "active", "user_last_log_timestamp": "2024-08-14T14:45:12Z", "local_language": "en-US", "email_domain": "gmail.com", "hashed_username_email": "sha256_email_user789", "email": "john.smith@gmail.com", "phone_number": "+1-555-123-4567", "zip_code": "10001", "user_action_time": "2024-08-14T15:30:45Z", "user_engagement_time": 45.5, "user_other_product_usage": "streaming,music,cloud_storage", "user_first_session_timestamp": "2024-03-15T09:30:00Z", "user_last_session_timestamp": "2024-08-14T14:45:12Z", "user_sessions_count": 156, "subscription_status": "active", "subscription_auto_renewal": true, "subscription_start_timestamp": "2024-07-14T15:30:45Z", "subscription_end_timestamp": "2024-09-14T15:30:45Z", "subscription_initial_price": 9.99, "subscription_initial_period": 30, "subscription_recurring_price": 12.99, "subscription_recurring_period": 30, "premium_subscription_status": "active", "premium_subscription_auto_renewal": true, "premium_subscription_start_timestamp": "2024-07-14T15:30:45Z", "premium_subscription_end_timestamp": "2024-09-14T15:30:45Z", "payment_method_id": "pm_card_visa_4242", "brand_id": "brand_streaming_platform", "buyer_timestamp_creation": "2024-03-15T09:15:22Z"}Required fields
order_idis always required.- Each integration has its own set of required fields, agreed during onboarding. A missing or wrongly typed required field returns
422naming the field. merchant_transaction_idis optional. If you don’t send one, use thereference_idfrom the response to refer to the transaction in later updates.transaction_initiation: sendcustomerfor customer-initiated transactions (CITs). Some integrations require this field. Where it’s optional and omitted, the transaction is treated as non-CIT.
Field formats
- Timestamps: ISO 8601. A timezone offset is recommended (
2024-08-14T15:30:45Z); a value without one is read as UTC. local_timezone: the user’s offset from UTC in minutes, east positive ("-240"for New York in summer,"60"for Paris in winter), sent as a string.bin_risk_level: a numeric risk score, sent as a string ("0.15").subscription_initial_period,subscription_recurring_period: length in days, as an integer (30,365).merchant_category_code: the four-digit code, as a number or a string of digits.- Unknown fields are ignored, so the request can carry extra fields.
Response Format:
{ "transaction": { "reference_id": "6f1c2a7e-3b4d-4e8f-9a10-2b3c4d5e6f70", "merchant_transaction_id": "merch_txn_2024081401234567", "risk_status": 0, "status": "success", "error": null, "control_group": false }, "status": "success", "errors": ""}Field Descriptions:
reference_id: String — EagleSense’s identifier for this transaction, returned on every successful evaluation.merchant_transaction_id: String — your identifier, echoed as sent (nullif you didn’t send one).risk_status: Integer — assigned risk category:- 0 – Transaction with low indication of risk
- 1 – Transaction with high indication of risk
- 2 – No decision: returned with an error response
control_group: Boolean — the transaction is in the control group: it is always returned withrisk_status0 and should be processed as usual.
Error Responses:
-
403 Forbidden: the request is not signed, or the role is not allowed to call the API. -
422 Unprocessable Entity: the request is invalid, for example a required field is missing or has the wrong type. The body names the problem fields:{"transaction": {"reference_id": null,"merchant_transaction_id": "merch_txn_2024081401234567","risk_status": 2,"status": "error","error": "site_name: Input should be a valid string","control_group": false},"status": "error","errors": "site_name: Input should be a valid string"} -
500 Internal Server Error: processing error on our side. The body is{"detail": "Internal Server Error"}. Retrying later is safe.
Updating Transaction Data with Statuses and Delayed Attributes
Section titled “Updating Transaction Data with Statuses and Delayed Attributes”To provide Transaction Status Updates and Delayed Attributes — including refunds, chargebacks, and other post-transaction events — please refer to the Batch Update mechanism described on the Batch Transaction Status Updates and Delayed Attributes page.

