# GET /fee-discount

> GET /fee-discount of the Intear DEX Aggregator: a trader's TEAR fee discount, signed to pass to Intear DEX in their own swaps.

This page is part of the DEX Aggregator docs. The aggregator is at `https://router.intear.tech`, with live quotes at `wss://router.intear.tech/route/subscribe`, on NEAR mainnet only. https://docs.intear.tech/dex-aggregator/llms-full.txt has all of its pages in one file, and https://docs.intear.tech/llms.txt lists every page of the Intear docs.

```
GET https://router.intear.tech/fee-discount
```

Returns the [fee discount](https://docs.intear.tech/dex-aggregator/guides/amounts.md#fee-discounts) of a trader who stakes TEAR, signed for the trader, to take in their own calls to [Intear DEX](https://docs.intear.tech/intear-dex/guides/swaps.md#fee-discounts). Routes of the aggregator come with their discount signed in already, so you only need this to swap on Intear DEX yourself.

## Example

```
https://router.intear.tech/fee-discount?trader_id=slimedragon.near
```

## Query parameters

| Parameter | Type | Description |
| --- | --- | --- |
| `trader_id` | account ID | Required. The trader whose discount it is |
| `key` | string | Optional. API key, to lift the [rate limit](https://docs.intear.tech/dex-aggregator/reference/errors.md#rate-limits) |

## Response

`200 OK` with `Content-Type: application/json`:

```json
{
  "trader_id": "slimedragon.near",
  "fee_discount": 250000,
  "expiration_block_height": 226687665,
  "signed_fee_discount": {
    "discount": {
      "ForTrader": {
        "trader_id": "slimedragon.near",
        "fee_discount": 250000,
        "expiration_block_height": 226687665
      }
    },
    "signature": "r8UZ6li9/i3bS0rb5MEmGQl5HWZePym1LU61a4dWcT+Y+1ZqEAv9+n1w98M5fNZwS93OOg4cWOacwqW/tAeUDw=="
  }
}
```

| Field | Type | Description |
| --- | --- | --- |
| `trader_id` | string | The trader |
| `fee_discount` | integer | The discount, out of 1000000: `250000` is 25% |
| `expiration_block_height` | integer | The last block the discount can be used in, 1008000 blocks after the current one, about 7 days |
| `signed_fee_discount` | object | A [`SignedFeeDiscount`](https://docs.intear.tech/intear-dex/reference/types.md#signedfeediscount) of the `ForTrader` kind, to pass as `fee_discount` to `swap_simple` or `execute_operations` |

Intear DEX takes a `ForTrader` discount only in calls that the trader makes itself, not in `ft_transfer_call` or `deposit_near` deposits. Request a new one before it expires.

## Errors

Errors are plain text (`text/plain`):

| Status | Message | Cause |
| --- | --- | --- |
| `404` | `<trader_id> doesn't stake enough TEAR for a fee discount` | The trader stakes less than 10 TEAR |
| `400` | `Failed to deserialize query string: ...` | `trader_id` is missing or isn't an account ID |
| `502` | `Failed to get the TEAR stake of <trader_id>: <reason>` | Reading the trader's stake failed |
| `503` | `Block height is not loaded yet` | The aggregator couldn't read the current block since it started |

A request over the [rate limit](https://docs.intear.tech/dex-aggregator/reference/errors.md#rate-limits) gets `429 Too Many Requests`, and a wrong `key` `401 Unauthorized`, as for `/route`.
