मुख्य सामग्री पर जाएं
POST
/
token
/
approve
Approve ERC20 allowance (EVM)
curl --request POST \
  --url https://api.afkcrypto.com/v1/token/approve \
  --header 'Content-Type: application/json' \
  --header 'Idempotency-Key: <idempotency-key>' \
  --header 'x-api-key: <api-key>' \
  --data '
{
  "chain": "<string>",
  "token": "<string>",
  "spender": "<string>",
  "amount": "<string>",
  "from": "<string>"
}
'
{ "id": "tx_...", "status": "SUBMITTED", "hash": "0x...", "explorerUrl": "https://basescan.org/tx/0x...", "chainName": "Base" }
केवल EVM। Idempotency-Key हेडर आवश्यक है।
{ "id": "tx_...", "status": "SUBMITTED", "hash": "0x...", "explorerUrl": "https://basescan.org/tx/0x...", "chainName": "Base" }

प्राधिकरण

x-api-key
string
header
आवश्यक

हेडर

Idempotency-Key
string<uuid>
आवश्यक

Provide a unique Idempotency-Key per user to ensure single submission.

बॉडी

application/json
chain
string
आवश्यक

EVM chain slug.

token
string
आवश्यक

ERC20 token address to approve.

spender
string
आवश्यक

Spender (router) address to approve.

amount
string
आवश्यक

Allowance amount in token units (uint256 string).

from
string | null

Optional sender wallet; defaults to user's default wallet for the chain.

प्रतिक्रिया

Submission accepted

id
string
आवश्यक

AFK transaction id for the submitted action.

status
enum<string>
आवश्यक

Submission status.

उपलब्ध विकल्प:
SUBMITTED
hash
string | null
आवश्यक

On-chain transaction hash/signature (may be null at submission time).

explorerUrl
string | null
आवश्यक

Direct link to the transaction on a chain explorer. Null until a hash/signature exists.

chainName
string
आवश्यक

Human-readable chain name for display (e.g., Base, Ethereum, Solana).