> For the complete documentation index, see [llms.txt](https://docs-swap.crypto-chief.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs-swap.crypto-chief.com/api-reference/approve-allowance.md).

# Approve: Allowance

## Approve: Allowance

The current allowance: how much of a token an executor's spender may still pull from a wallet. EVM and TRON only; on Solana, TON and XRP Ledger approvals do not exist and the call is `400 INVALID_REQUEST`.

[`POST /v1/build`](/api-reference/build.md) checks allowances itself and returns the approval steps it needs. This endpoint is for checking before you build.

#### **Approve: Allowance**

<mark style="color:green;">`POST`</mark> `https://swap-api.crypto-chief.com/YOUR_API_KEY/v1/approve/allowance`

**Headers**

| Name         | Value                                                                                                           |
| ------------ | --------------------------------------------------------------------------------------------------------------- |
| Content-Type | `application/json`                                                                                              |
| X-Request-Id | Optional — your id for this call, echoed in the response ([Authentication](/getting-started/authentication.md)) |

**Body**

| Name       | Type   | Required | Description                                                                                                                                                                                                                                                                                                                                                                               |
| ---------- | ------ | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `network`  | string | true     | Network code, case-insensitive                                                                                                                                                                                                                                                                                                                                                            |
| `token`    | string | true     | The token — address or configured symbol                                                                                                                                                                                                                                                                                                                                                  |
| `owner`    | string | true     | The wallet whose allowance to read                                                                                                                                                                                                                                                                                                                                                        |
| `executor` | string | false    | An executor id, or `dex_router:<dex id>` for a DEX's own router (for example `dex_router:uniswap_v3`). Plain `dex_router` is `400 INVALID_REQUEST` when the network has several DEX routers. Default: the first `enabled` executor in the order [`/v1/liquidity-sources`](/api-reference/liquidity-sources.md) lists them ([which one](/api-reference/approve-spender.md#which-executor)) |

```json
{
  "network": "ETH_MAINNET",
  "token": "USDC",
  "owner": "0x1F33F99676B65968885adDFaFda3a736424d93C9",
  "executor": "oneinch_v6"
}
```

**Response**

{% tabs %}
{% tab title="200" %}

```json
{
  "allowance": "0"
}
```

{% endtab %}

{% tab title="400" %}

```json
{
  "error": "INVALID_REQUEST",
  "message": "approvals do not exist on TON networks"
}
```

{% endtab %}
{% endtabs %}

**Fields**

| Field       | Description                                                                                                        |
| ----------- | ------------------------------------------------------------------------------------------------------------------ |
| `allowance` | The remaining allowance in the token's base units, decimal string. `"0"` means the swap will need an approval step |

{% hint style="info" %}
For the Permit2 executor on TRON (`sun_universal_router`) this is the token's allowance to the Permit2 contract — the router's own Permit2 permission is a second layer, visible only in a [build's](/api-reference/build.md) steps: a missing one appears as a `permit2_approve` step.
{% endhint %}

### Example

`swap()` is defined in [Authentication](/getting-started/authentication.md).

{% tabs %}
{% tab title="JavaScript" %}

```javascript
const { allowance } = await swap("approve/allowance", {
  network: "ETH_MAINNET",
  token: "USDC",
  owner: "0x1F33F99676B65968885adDFaFda3a736424d93C9",
});
console.log(allowance);
```

{% endtab %}

{% tab title="PHP" %}

```php
$out = swap('approve/allowance', [
    'network' => 'ETH_MAINNET',
    'token'   => 'USDC',
    'owner'   => '0x1F33F99676B65968885adDFaFda3a736424d93C9',
]);
echo $out['allowance'], "\n";
```

{% endtab %}

{% tab title="GO" %}

```go
out, _, err := swap("approve/allowance", map[string]any{
	"network": "ETH_MAINNET",
	"token":   "USDC",
	"owner":   "0x1F33F99676B65968885adDFaFda3a736424d93C9",
})
if err != nil {
	log.Fatal(err)
}
fmt.Println(out["allowance"])
```

{% endtab %}

{% tab title="Python" %}

```python
out = swap("approve/allowance", {
    "network": "ETH_MAINNET",
    "token": "USDC",
    "owner": "0x1F33F99676B65968885adDFaFda3a736424d93C9",
})
print(out["allowance"])
```

{% endtab %}

{% tab title="curl" %}

```bash
curl -s -X POST "https://swap-api.crypto-chief.com/$CC_API_KEY/v1/approve/allowance" \
  -H "Content-Type: application/json" \
  -d '{"network":"ETH_MAINNET","token":"USDC","owner":"0x1F33F99676B65968885adDFaFda3a736424d93C9"}'
```

{% endtab %}
{% endtabs %}
