Querying Approvals for Address-Based Asset Tracking

ยท

Overview

This guide explains how to paginate through approval records for a single address, identifying which projects have been authorized and detailing the specific assets/amounts permitted under each authorization.


API Endpoint

Request Method:
POST https://web3.okx.com/api/v5/wallet/security/approvals


Request Parameters

ParameterTypeRequiredDescription
addressListArrayYesList of addresses (max 20)
> chainIndexStringYesUnique chain identifier (e.g., ETH for Ethereum)
> addressStringYesWallet address (e.g., 0x742d35Cc6634C0532925a3b844Bc454e4438f44e)
limitStringNoNumber of records per page (default: 50, max: 100)
cursorStringNoPagination cursor (leave empty for first page)

Response Parameters

ParameterTypeDescription
chainIndexStringChain identifier matching the request
cursorStringNext page cursor (empty if no more pages)
approvalProjectsArrayList of authorized projects
> projectNameStringProject name (e.g., Uniswap)
> projectIconStringURL to project logo
> approveAddressStringContract address of the authorized project
> tokensArrayApproved tokens/amounts
>> imageUrlStringToken logo URL
>> symbolStringToken symbol (e.g., USDT)
>> statusStringApproval status: 1 (success), 2 (canceling), 3 (pending)
>> tokenAddressStringToken contract address
>> approvalNumStringApproved amount (divide by 10^[token decimals] for actual value)

Example Workflow

Step 1: Prepare the Request

{
  "addressList": [
    {
      "chainIndex": "ETH",
      "address": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e"
    }
  ],
  "limit": "50"
}

Step 2: Interpret the Response

{
  "chainIndex": "ETH",
  "cursor": "next_page_cursor_123",
  "approvalProjects": [
    {
      "projectName": "Uniswap",
      "projectIcon": "https://example.com/uniswap.png",
      "approveAddress": "0x1f9840a85d5aF5bf1D1762F925BDADdC4201F984",
      "tokens": [
        {
          "imageUrl": "https://example.com/usdt.png",
          "symbol": "USDT",
          "status": "1",
          "tokenAddress": "0xdAC17F958D2ee523a2206206994597C13D831ec7",
          "approvalNum": "1000000000000000000"
        }
      ]
    }
  ]
}

๐Ÿ‘‰ Learn how to revoke approvals securely


FAQs

1. What happens if I exceed the 20-address limit?

The API will reject the request. Split larger address lists into multiple requests.

2. How do I calculate the actual approved amount?

Divide approvalNum by 10^[token decimals]. For USDT (6 decimals), 1000000000000000000 = 1,000,000 USDT.

3. Can I filter approvals by status?

Not directly via API. Filter client-side using the status field.

4. Why is my cursor empty in the response?

It indicates the last page of results.


Best Practices