> ## Documentation Index
> Fetch the complete documentation index at: https://docs.fossapay.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Calculate Crypto Transfer Fee

> Calculate the payout fee for a crypto transfer in USDC or USDT

## Request

<ParamField header="x-api-key" type="string" required>
  API Key for authentication
</ParamField>

## Query Parameters

<ParamField query="amount" type="number" required>
  The transfer amount for which to calculate the fee. Must be a positive number (minimum `0.01`).
</ParamField>

<ParamField query="currency" type="string" required>
  The stablecoin to calculate fees for. Must be one of: `usdc`, `usdt` (case-insensitive; values are normalized to lowercase).
</ParamField>

### Request Example

```bash theme={null}
curl -g 'https://api-production.fossapay.com/api/v1/transfers/crypto/calculate-fee?amount=200&currency=usdc' \
  -H "x-api-key: your_api_key_here"
```

```javascript theme={null}
const params = new URLSearchParams({
  amount: '200',
  currency: 'usdc',
});
const response = await fetch(
  `https://api-production.fossapay.com/api/v1/transfers/crypto/calculate-fee?${params}`,
  {
    method: 'GET',
    headers: {
      'x-api-key': 'your_api_key_here',
    },
  }
);

if (!response.ok) {
  throw new Error(`Request failed: ${response.status} ${response.statusText}`);
}

const feeData = await response.json();
```

<Note>
  This endpoint uses **GET** with **query parameters**, not a JSON body. When using `curl` in a shell, wrap the full URL in quotes (or use `curl -g`) so `&` between query parameters is not treated as a background operator.
</Note>

## Response

<ResponseExample>
  ```json Success Response theme={null}
  {
    "status": true,
    "statusCode": 200,
    "message": "Transfer fee calculated successfully",
    "data": {
      "amount": 200,
      "currency": "usdc",
      "feeAmount": 1,
      "total": 201
    }
  }
  ```
</ResponseExample>

| Field            | Description                                  |
| ---------------- | -------------------------------------------- |
| `data.amount`    | The amount you passed in the query           |
| `data.currency`  | The stablecoin (`usdc` or `usdt`)            |
| `data.feeAmount` | The fee charged for the crypto payout        |
| `data.total`     | `amount` + `feeAmount` (total including fee) |

## Validation errors

| HTTP status | Typical cause                                                                                                |
| ----------- | ------------------------------------------------------------------------------------------------------------ |
| `422`       | Missing or invalid query params (e.g. `amount` not a positive number, `currency` empty or not `usdc`/`usdt`) |
| `400`       | `amount` or `currency` missing after validation, or unsupported currency at the service layer                |
