Quickstart
Issue an API Key and execute your first MemePerp AI Agent API request in 3 steps (~60 seconds).
Step 1: Issue an API Key via Wallet Signature
You can connect your wallet on /agent to generate an API Key in one click, or run the 2-step gasless signature flow programmatically:
1.1 Request a One-Time Challenge (Valid for 5 Minutes)
bash
curl "https://devapi.ours.meme/api/v1/agent/keys/challenge?wallet=0xYOUR_WALLET_ADDRESS"Example response:
json
{
"code": 0,
"msg": "success",
"data": {
"wallet": "0xYOUR_WALLET_ADDRESS",
"action": "issue",
"nonce": "9f8e7d6c5b4a32109f8e7d6c5b4a3210",
"message": "ours.meme wants you to sign in with your wallet:\n0xYOUR_WALLET_ADDRESS\n...",
"expiresAt": 1764000300,
"chainId": 97
}
}1.2 Sign with personal_sign and Exchange for an API Key
bash
curl -X POST "https://devapi.ours.meme/api/v1/agent/keys" \
-H "Content-Type: application/json" \
-d '{
"wallet": "0xYOUR_WALLET_ADDRESS",
"nonce": "9f8e7d6c5b4a32109f8e7d6c5b4a3210",
"signature": "0xYOUR_PERSONAL_SIGN_HEX",
"label": "my-first-agent"
}'Store data.apiKey (mpk_live_... or mpk_test_...) immediately as MEMEPERP_API_KEY — the plaintext key is shown once only.
Note: Each wallet holds at most 1 active key. Calling
POST /v1/agent/keysagain atomically overwrites the old key, which immediately returns HTTP401.
Step 2: Call Endpoints with Your API Key
Pass your API Key using either standard header:
X-API-Key: mpk_test_...Authorization: Bearer mpk_test_...
Example A: Live Oracle Price
bash
curl -X POST "https://devapi.ours.meme/api/agent/tools/get_price" \
-H "Content-Type: application/json" \
-H "X-API-Key: $MEMEPERP_API_KEY" \
-d '{"market": "BTC"}'Example B: Account Positions & Private Pending Orders
bash
curl -X POST "https://devapi.ours.meme/api/agent/tools/get_account" \
-H "Content-Type: application/json" \
-H "X-API-Key: $MEMEPERP_API_KEY" \
-d '{"account": "0xYOUR_WALLET_ADDRESS"}'Example C: Build an Unsigned Open Position Transaction
bash
curl -X POST "https://devapi.ours.meme/api/agent/tools/build_open_position" \
-H "Content-Type: application/json" \
-H "X-API-Key: $MEMEPERP_API_KEY" \
-d '{
"account": "0xYOUR_WALLET_ADDRESS",
"market": "BTC",
"side": "long",
"collateralUsdc": 50,
"leverage": 10,
"slippagePct": 0.3
}'Step 3: Monitor Real-Time Quota Headers
Every authenticated API Key response includes live minute and UTC daily quota headers:
http
X-RateLimit-Limit: 60
X-RateLimit-Remaining: 59
X-RateLimit-Reset: 1764000060
X-DailyLimit-Limit: 2000
X-DailyLimit-Remaining: 1999
X-DailyLimit-Reset: 1764028800You can also inspect full key metadata and live usage anytime via GET /api/v1/agent/keys/me.