API Documentation
Complete guide to integrating FraudShield SMB into your application.
Getting Started
To start using the FraudShield API, you'll need to create an account and generate an API key from your dashboard.
- Sign up at FraudShield SMB
- Navigate to the API Keys section in your dashboard
- Click "Create New Key" and copy your API key
- Use the key in the Authorization header for all API requests
Authentication
All API requests require authentication using Bearer token in the Authorization header.
Authorization: Bearer YOUR_API_KEYScore Transaction
POST
/api/v1/scoreSubmit a transaction for real-time fraud scoring with SHAP explanations.
Request Body
{
"transaction_id": "txn_abc123",
"amount": 99.99,
"currency": "USD",
"user_id": "user_123",
"email": "user@example.com",
"ip_address": "192.168.1.1",
"device_fingerprint": "fp_xyz789",
"billing_address": {
"country": "US",
"zip": "10001"
},
"account_age_days": 30,
"previous_transactions": 5
}Response
{
"fraud_score": 0.23,
"risk_level": "low",
"prediction": "legitimate",
"shap_values": {
"amount": 0.05,
"account_age_days": -0.15,
"transaction_velocity": 0.08
},
"transaction_id": "txn_abc123",
"timestamp": "2025-01-15T10:30:00Z"
}Code Examples
Node.js
const response = await fetch('https://your-domain.com/api/v1/score', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer YOUR_API_KEY'
},
body: JSON.stringify({
transaction_id: 'txn_abc123',
amount: 99.99,
currency: 'USD',
user_id: 'user_123',
email: 'user@example.com',
ip_address: '192.168.1.1'
})
});
const result = await response.json();
console.log('Fraud Score:', result.fraud_score);
console.log('Risk Level:', result.risk_level);Python
import requests
url = "https://your-domain.com/api/v1/score"
headers = {
"Content-Type": "application/json",
"Authorization": "Bearer YOUR_API_KEY"
}
data = {
"transaction_id": "txn_abc123",
"amount": 99.99,
"currency": "USD",
"user_id": "user_123",
"email": "user@example.com",
"ip_address": "192.168.1.1"
}
response = requests.post(url, json=data, headers=headers)
result = response.json()
print(f"Fraud Score: {result['fraud_score']}")
print(f"Risk Level: {result['risk_level']}")cURL
curl -X POST https://your-domain.com/api/v1/score \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY" \
-d '{
"transaction_id": "txn_abc123",
"amount": 99.99,
"currency": "USD",
"user_id": "user_123",
"email": "user@example.com",
"ip_address": "192.168.1.1"
}'Rate Limits
All API endpoints are subject to rate limiting to ensure fair usage:
- 100 requests per minute per API key
- 10,000 requests per day per API key
- Rate limit headers included in all responses
Error Codes
| Code | Description |
|---|---|
| 400 | Bad Request - Invalid parameters |
| 401 | Unauthorized - Invalid API key |
| 429 | Too Many Requests - Rate limit exceeded |
| 500 | Internal Server Error |