Detect Fraudulent API Signups and Stolen Key Usage in Real Time
Last updated: November 29, 2026
Quick Overview
Design an ML system that flags fraudulent API accounts (stolen cards, free-credit farming, resale of access) and detects when a legitimate customer's API key has been leaked and is being abused.
OpenAI
November 29, 20260
0
0 solved
Design an ML system that flags fraudulent API accounts (stolen cards, free-credit farming, resale of access) and detects when a legitimate customer's API key has been leaked and is being abused.
OpenAI's API is a target for payment fraud and for stolen keys scraped from public repositories, both of which cost real GPU money. The interviewer looks for a layered design that combines signup-time risk scoring with behavioral anomaly detection on usage, and that keeps false positives from blocking real developers.
What the Interviewer Expects
- Separate two problems: fraudulent accounts at signup or payment, and compromised keys on good accounts
- Engineer features from payment, device, network, and usage behavior
- Use supervised models where labels exist (chargebacks, confirmed abuse) and anomaly detection where they do not
- Score in real time at signup and in near real time on usage streams
- Choose graduated actions: step-up verification, spend caps, key rotation prompts, suspension
- Close the loop with analyst review and label feedback
Key Topics to Cover
How to Approach This
- Start by mapping the business objective to a concrete ML objective and metric.
- Cover the full pipeline: data collection, feature engineering, model selection, training, serving.
- Discuss online vs offline evaluation. Plan an A/B test to validate real-world impact.
- Address the serving latency budget and whether batch or real-time inference is needed.
- Think about the data flywheel: how user feedback improves the model over time.
Possible Follow-up Questions
- How do you get labels when chargebacks arrive 60 days later?
- A leaked key suddenly serves traffic from 50 new IPs; how fast can you act, and what do you do?
- How do you handle fraud rings that create hundreds of accounts with different cards?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice ML System Design ProblemsSample Answer
Requirements
- At signup and first payment: risk score within 200 ms to decide approve, verify (phone, ID), or block.
- On usage: detect anomalous spend or access patterns per key within minutes.
- Actions graded ...
High-Level Design
- Signup scorer: features from email domain age, device fingerprint, IP reputation and ASN (datacenter, residential proxy), card BIN country vs IP country, velocity of signups per device or card, ...