iAutoPay Fact API
Base URLs:
- - fact-api:
https://apipaymcp.okart.fun (Payment API) - napi-ser:
http://ipaynapi.gpuart.cn (User Management & API Keys)
Network Configuration
- - Chain: Base Sepolia (Testnet)
- Chain ID: eip155:84532
- Asset:
0x036CbD53842c5426634e7929541eC2318f3dCF7e (USDC) - Payee: INLINECODE3
Pricing
| Duration | Price (USDC) |
|---|
| 1 day | 0.09 |
| 7 days |
0.49 |
| 30 days | 0.99 |
Endpoints
fact-api (Payment Service)
GET /info - Server Information
Get current server status, pricing, and configuration.
CODEBLOCK0
Response:
CODEBLOCK1
POST /v1/buy-apikey - Purchase API Key
Buy an API key with specified duration. Payment is handled via EIP-3009 signed payment in the request header.
CODEBLOCK2
Request Body:
CODEBLOCK3
Headers:
| Header | Type | Required | Description |
|---|
| Content-Type | string | Yes | "application/json" |
| PAYMENT-SIGNATURE |
string | Yes | EIP-3009 signed payment payload (JSON string) |
PAYMENT-SIGNATURE Payload:
CODEBLOCK4
Duration Options:
| Value | Duration | Price |
|---|
| 1 | 1 day | 0.09 USDC |
| 7 |
7 days | 0.49 USDC |
| 30 | 30 days | 0.99 USDC |
Response:
CODEBLOCK5
Response Fields:
| Field | Type | Description |
|---|
| apiKey | string | Your API key (use this for authentication) |
| txHash |
string | Blockchain transaction hash |
| payState | string | Payment status ("paid") |
| durationDays | number | API key duration in days |
| transactionId | string | Unique transaction ID |
POST /v1/transfer - Pay Stablecoin
Pay USDC to any address using EIP-3009 off-chain signature.
GET /user/me - Get User Information
Get your user account information, API keys, and usage statistics. Requires authentication with your API key.
CODEBLOCK6
Response:
CODEBLOCK7
Note: The first purchase automatically creates your user account. No separate registration is required!
GET /user/my-keys - List User API Keys
Get all API keys for your user account. Requires authentication with your API key.
CODEBLOCK8
Response:
CODEBLOCK9
POST /v1/transfer - Pay Stablecoin
Pay USDC to any address using EIP-3009 off-chain signature.
CODEBLOCK10
Request Body:
CODEBLOCK11
Parameters:
| Parameter | Type | Required | Description |
|---|
| to | string | Yes | Recipient wallet address |
| amount |
string | Yes | Amount in smallest unit (10000 = 0.01 USDC) |
| asset | string | Yes | Token contract address (USDC on Base Sepolia) |
Headers:
| Header | Type | Required | Description |
|---|
| Content-Type | string | Yes | "application/json" |
| PAYMENT-SIGNATURE |
string | Yes | EIP-3009 signed payment payload (JSON string) |
Response:
CODEBLOCK12
User Management (New Feature)
The iAutoPay system now includes automatic user registration. When you purchase an API key for the first time, a user account is automatically created and linked to your wallet address.
Auto-Registration Flow
- 1. First Purchase: Call
/v1/buy-apikey with your signed payment - Auto-Create User: System automatically creates user account
- API Key Assigned: API key is linked to your user account
- User Info Available: Use
/user/me to view account details
No separate registration step is required!
User Endpoints
GET /user/me - Get User Information
Get your user account information, API keys, and usage statistics.
CODEBLOCK13
Response:
CODEBLOCK14
GET /user/my-keys - List User API Keys
Get all API keys for your user account.
CODEBLOCK15
Response:
CODEBLOCK16
GET /refresh_pricing - Refresh Pricing
Refresh pricing information from server (cached).
CODEBLOCK17
Response:
CODEBLOCK18
napi-ser (User Management)
GET /user/me - Get User Information
Get your user account information, API keys, and usage statistics. Requires authentication with your API key.
CODEBLOCK19
Response:
CODEBLOCK20
Note: The first purchase automatically creates your user account. No separate registration is required!
GET /user/my-keys - List User API Keys
Get all API keys for your user account. Requires authentication with your API key.
CODEBLOCK21
Response:
CODEBLOCK22
Payment Flow
The Fact API uses EIP-3009 (Transfer With Authorization) for off-chain payment signing. This means you don't need to send an on-chain transaction first - you sign a payment authorization and include it in the API request.
Steps:
- 1. Get Payment Info: Call
/info to get the payee address and USDC contract address - Sign Payment: Create an EIP-3009 signature using your wallet's private key
- Buy API Key: Call
/v1/buy-apikey with signed payment in the PAYMENT-SIGNATURE header - Auto-Registration: The first purchase automatically creates your user account
- Get User Info: Use
/user/me endpoint with your API key to check account details
Important: Auto-Registration
- - No separate registration step required
- First purchase automatically creates user account
- User account is linked to your wallet address
- All future purchases are associated with the same user account
User Management Endpoints (napi-ser):
- -
GET /user/me - Get user information, API keys, and statistics - INLINECODE11 - List all API keys for your account
EIP-3009 Signature Requirements:
- - Domain: Token name, version (2 for USDC), chainId, verifyingContract (USDC address)
- Type: TransferWithAuthorization(from, to, value, validAfter, validBefore, nonce)
- Valid Before: Current timestamp + 8 hours (28800 seconds)
USDC Contract: 0x036CbD53842c5426634e7929541eC2318f3dCF7e (Base Sepolia)
Payee: INLINECODE13
CLI Scripts
This skill includes ready-to-use CLI scripts for all endpoints.
Dependencies:
CODEBLOCK23
Get Server Info
CODEBLOCK24
Get Wallet Address
CODEBLOCK25
Buy API Key
CODEBLOCK26
Refresh Pricing
CODEBLOCK27
Python Implementation
info.py
CODEBLOCK28
get_address.py
CODEBLOCK29
buy_apikey.py
CODEBLOCK30
refresh_pricing.py
CODEBLOCK31
TypeScript Implementation
info.ts
CODEBLOCK32
get_address.ts
CODEBLOCK33
buy_apikey.ts
CODEBLOCK34
refresh_pricing.ts
CODEBLOCK35
Complete Purchase Flow
CODEBLOCK36
Error Handling
All endpoints return errors as:
CODEBLOCK37
Common error codes:
- -
INVALID_DURATION (400) - Duration must be 1, 7, or 30 - INLINECODE15 (402) - Payment transaction failed
- INLINECODE16 (402) - Not enough USDC in wallet
- INLINECODE17 (429) - Too many requests
- INLINECODE18 (500) - Server error
Security Notes
Private Key Management
Never commit private keys to version control!
Auto-Registration Security:
- - User accounts are automatically created on first purchase
- No separate registration endpoint required
- User account is linked to your wallet address
- All future purchases are automatically associated with your user account
- User data is accessible via
/user/me endpoint with your API key
Recommended approaches:
- 1. Environment Variables (Recommended)
CODEBLOCK38
- 2. CLI Arguments (For testing)
CODEBLOCK39
- 3. For Skill Implementation
- Pass private key via environment variables
- Never hardcode in code
- Use
dotenv to load from
.env file
Best Practices:
- - Use a dedicated wallet for API purchases (not main wallet)
- Test on Base Sepolia (Chain ID: 84532) before mainnet
- Store API keys securely (environment variables or secret manager)
- Verify transaction on Base Sepolia explorer before using API key
- Rotate API keys regularly
iAutoPay Fact API
基础URL:
- - fact-api:https://apipaymcp.okart.fun(支付API)
- napi-ser:http://ipaynapi.gpuart.cn(用户管理与API密钥)
网络配置
- - 链:Base Sepolia(测试网)
- 链ID:eip155:84532
- 资产:0x036CbD53842c5426634e7929541eC2318f3dCF7e(USDC)
- 收款方:0x1a85156c2943b63febeee7883bd84a7d1cf0da0c
定价
0.49 |
| 30天 | 0.99 |
端点
fact-api(支付服务)
GET /info - 服务器信息
获取当前服务器状态、定价和配置。
bash
curl https://apipaymcp.okart.fun/info
响应:
json
{
name: iAutoPay Fact API,
version: 0.1.0,
environment: dev,
network: eip155:84532,
asset: 0x036CbD53842c5426634e7929541eC2318f3dCF7e,
prices: {
1day: 90000,
1dayUsdc: 0.09,
7days: 490000,
7daysUsdc: 0.49,
30days: 990000,
30daysUsdc: 0.99
},
payee: 0x1a85156c2943b63febeee7883bd84a7d1cf0da0c,
bypassPayment: false,
paymentScheme: exact
}
POST /v1/buy-apikey - 购买API密钥
购买指定时长的API密钥。通过请求头中的EIP-3009签名支付进行处理。
bash
curl -X POST https://apipaymcp.okart.fun/v1/buy-apikey \
-H Content-Type: application/json \
-H PAYMENT-SIGNATURE: {\from\:\0x...\,\to\:\0x...\,\value\:\90000\,\validAfter\:\0\,\validBefore\:\1738368000\,\nonce\:\0x...\,\v\:27,\r\:\0x...\,\s\:\0x...\} \
-d {duration: 7}
请求体:
json
{
duration: 7
}
请求头:
| 请求头 | 类型 | 必填 | 描述 |
|---|
| Content-Type | string | 是 | application/json |
| PAYMENT-SIGNATURE |
string | 是 | EIP-3009签名支付载荷(JSON字符串) |
PAYMENT-SIGNATURE载荷:
json
{
from: 0x1234567890abcdef1234567890abcdef12345678,
to: 0x1a85156c2943b63febeee7883bd84a7d1cf0da0c,
value: 490000,
validAfter: 0,
validBefore: 1738368000,
nonce: 0xabc123...,
v: 27,
r: 0x...,
s: 0x...
}
时长选项:
7天 | 0.49 USDC |
| 30 | 30天 | 0.99 USDC |
响应:
json
{
apiKey: sk-7ac3d7c8fed74b0a8ae8f949e017e9f5,
txHash: 0x1f62f45e5ae6e8cd637048d0f099d324f749f61d35906ffe481e36e92689769b,
payState: paid,
durationDays: 7,
transactionId: ed66d250-7353-473d-bc73-0bd7541f40c0
}
响应字段:
| 字段 | 类型 | 描述 |
|---|
| apiKey | string | 您的API密钥(用于身份验证) |
| txHash |
string | 区块链交易哈希 |
| payState | string | 支付状态(paid) |
| durationDays | number | API密钥有效天数 |
| transactionId | string | 唯一交易ID |
POST /v1/transfer - 支付稳定币
使用EIP-3009链下签名向任意地址支付USDC。
GET /user/me - 获取用户信息
获取您的用户账户信息、API密钥和使用统计。需要使用您的API密钥进行身份验证。
bash
curl http://ipaynapi.gpuart.cn/user/me \
-H Authorization: Bearer YOURAPIKEY
响应:
json
{
success: true,
data: {
user: {
id: user_xxx,
walletAddress: 0x1234567890abcdef1234567890abcdef12345678,
createdAt: 1772072451317,
lastPurchasedAt: 1772072457962,
status: active,
totalPurchases: 2
},
activeApiKeys: 2,
totalSpent: 1480000,
apiKeys: [
{
apiKey: sk-xxx,
durationDays: 7,
createdAt: 2026-02-26T02:01:12.904Z,
expiresAt: 2026-03-05T02:01:12.904Z,
status: active
}
],
recentTransactions: [...]
}
}
注意:首次购买会自动创建您的用户账户。无需单独注册!
GET /user/my-keys - 列出用户API密钥
获取您用户账户的所有API密钥。需要使用您的API密钥进行身份验证。
bash
curl http://ipaynapi.gpuart.cn/user/my-keys \
-H Authorization: Bearer YOURAPIKEY
响应:
json
{
success: true,
count: 2,
data: [
{
apiKey: sk-xxx,
durationDays: 7,
createdAt: 2026-02-26T02:01:12.904Z,
expiresAt: 2026-03-05T02:01:12.904Z,
status: active
}
]
}
POST /v1/transfer - 支付稳定币
使用EIP-3009链下签名向任意地址支付USDC。
bash
curl -X POST https://apipaymcp.okart.fun/v1/transfer \
-H Content-Type: application/json \
-H PAYMENT-SIGNATURE: {\from\:\0x...\,\to\:\0x...\,\value\:\10000\,\validAfter\:\0\,\validBefore\:\1738368000\,\nonce\:\0x...\,\v\:27,\r\:\0x...\,\s\:\0x...\} \
-d {to: 0x1234567890abcdef1234567890abcdef12345678, amount: 10000, asset: 0x036CbD53842c5426634e7929541eC2318f3dCF7e}
请求体:
json
{
to: 0x1234567890abcdef1234567890abcdef12345678,
amount: 10000,
asset: 0x036CbD53842c5426634e7929541eC2318f3dCF7e
}
参数:
接收方