← Back to Overview

Analyze Rate

Analyze FX exchange rate markup and detect hidden fees

POST/api/fx/analyzeOptional Auth
publicproductoptional-auth

Example Request

cURL

curl -X POST https://margin.so/api/fx/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/fx/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/fx/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": {
    "from_currency": "EUR",
    "to_currency": "USD",
    "amount": 100.5,
    "processor": "stripe",
    "processor_rate": 1.12,
    "processor_amount": 112.56,
    "market_rate": 1.1,
    "market_amount": 110.55,
    "markup_cents": 201,
    "markup_bps": 180,
    "potential_savings_cents": 201,
    "potential_savings_bps": 180,
    "rate_source": "ECB",
    "rate_timestamp": "2025-12-25T10:00:00Z",
    "recommendation": "Consider routing through a processor with better FX rates"
  }
}

Request Body

FieldTypeRequiredDescription