← Back to Overview

Analyze History

Analyze historical transaction data to estimate potential savings from steering

POST/api/steer/analyzeOptional Auth
publicproductoptional-auth

Example Request

cURL

curl -X POST https://margin.so/api/steer/analyze \
  -H "Content-Type: application/json" \
  -H "X-API-Key: sk_live_your_api_key_here" \
  -d '{}'

JavaScript

const response = await fetch('https://margin.so/api/steer/analyze', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'X-API-Key': 'sk_live_your_api_key_here'
  },
  body: JSON.stringify({})
});

const data = await response.json();
console.log(data);

Python

import requests

response = requests.post(
    'https://margin.so/api/steer/analyze',
    headers={
        'Content-Type': 'application/json',
        'X-API-Key': 'sk_live_your_api_key_here'
    },
    json={}
)

data = response.json()
print(data)

Example Response

{
  "success": true,
  "data": {
    "total_transactions": 2,
    "commercial_card_transactions": 1,
    "commercial_card_percentage": 50,
    "total_volume_cents": 35000,
    "commercial_card_volume_cents": 10000,
    "potential_savings_cents": 160,
    "potential_savings_bps": 160,
    "steering_success_rate_estimate": 0.35,
    "estimated_monthly_savings_cents": 56,
    "breakdown": {
      "by_category": {
        "CORPORATE": {
          "count": 1,
          "volume_cents": 10000,
          "potential_savings_cents": 160
        }
      }
    }
  }
}

Request Body

FieldTypeRequiredDescription