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

# Token Approval

<span style={{ color: "#16a34a" }}>`POST`</span> `/approve`

This endpoint generates an unsigned transaction for approving token spending. The approval transaction lets a smart contract (or a specified sender address) spend a given amount of tokens on behalf of the recipient. If a sender is provided, the approval will be generated using that address (and only the ENSC asset type is allowed in that case). Otherwise, the recipient’s address is used.

**Headers**

| Name          | Value              |
| ------------- | ------------------ |
| Content-Type  | `application/json` |
| Authorization | `Bearer <api_key>` |

**Body**

| Name        | Type   | Description                                                                                                                                                   |
| ----------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `recipient` | string | The wallet address that will receive the approval.                                                                                                            |
| `assetType` | string | The asset type, provided as an enum value (e.g., `ENSC`, `USDC`, `USDT`, etc.).                                                                               |
| `amount`    | number | The amount to approve.                                                                                                                                        |
| `sender`    | string | *Optional.* If provided, the approval will be generated using this address instead of the recipient. When provided, only `ENSC` is allowed as the asset type. |

**Example 1: Approval for Redeeming Assets (No Sender Provided)**

**Request**

<Tabs>
  <Tab title="Body">
    ```json theme={null}
    {
      "recipient": "0xRecipientAddressABC123",
      "assetType": "USDC",
      "amount": 50
    }
    ```
  </Tab>

  <Tab title="Response (200) Ok">
    ```json theme={null}
    {
      "status": 200,
      "message": "Unsigned approve transaction generated successfully",
      "data": {
        "to": "0xTokenContractAddressXYZ",
        "value": 0,
        "gasLimit": "0x186a0",
        "gasPrice": "20000000000",
        "nonce": "5",
        "data": "0x095ea7b3000000000000000000000000DEXContractAddressDEF4560000000000000000000000000000000000000000000000000000000000000032",
        "from": "0xRecipientAddressABC123",
        "spender": "0xDEXContractAddressDEF456"
      }
    }
    ```
  </Tab>

  <Tab title="Invalid Recipient (400) bad">
    ```json theme={null}
    {
      "status": 400,
      "error": "Invalid Request",
      "message": "Invalid recipient address",
      "data": null
    }
    ```
  </Tab>
</Tabs>

**Example 2: Approval for Transfers (Sender Provided)**

**Request**

<Tabs>
  <Tab title="Body">
    ```json theme={null}
    {
      "recipient": "0xRecipientAddressABC123",
      "sender": "0xSenderAddress987654",
      "assetType": "ENSC",
      "amount": 10
    }
    ```
  </Tab>

  <Tab title="Response (200) Ok">
    ```json theme={null}
    {
      "status": 200,
      "message": "Unsigned approve transaction generated successfully",
      "data": {
        "to": "0xTokenContractAddressXYZ",
        "value": 0,
        "gasLimit": "0x186a0",
        "gasPrice": "20000000000",
        "nonce": "12",
        "data": "0x095ea7b3000000000000000000000000SenderAddress987654000000000000000000000000000000000000000000000000000000000000000a",
        "from": "0xSenderAddress987654",
        "spender": "0xSenderAddress987654"
      }
    }
    ```
  </Tab>

  <Tab title="Invalid Asset When Sender is Provided (400) bad">
    ```json theme={null}
    {
      "status": 400,
      "error": "Invalid Asset",
      "message": "When a sender is provided, only ENSC asset type is allowed",
      "data": null
    }
    ```
  </Tab>
</Tabs>
