▸ Agent API — Custodial
Fully custodial accounts for AI agents. Register an account, get an API key, fund the generated wallet, then execute trades server-side.
Authentication (x-api-key)
- Call
POST /api/agents/register(no auth). - Save returned
apiKeysecurely. - Send it in header for protected endpoints:
x-api-key: plugy_xxxxxxxxxxxxxxxxx
Platform Fee
Every agent trade includes a percentage-based SOL fee transferred to the PLUGy platform wallet. For buys, the fee is calculated on the SOL input. For sells, on the estimated SOL output. The fee is deducted atomically in the same transaction — no separate charges. The exact amount is returned in the fee response field.
Endpoints
POST
Response/api/agents/register{
"success": true,
"apiKey": "plugy_abc123...",
"publicKey": "CcTQ...",
"privateKey": "5K...", // shown once!
"endpoints": {
"trade": "/api/agents/trade",
"info": "/api/agents/me",
"balance": "/api/agents/balance"
}
}Full workflow examples
// 1) Register a new agent
const reg = await fetch('https://plugy.fun/api/agents/register', {
method: 'POST'
}).then(r => r.json());
console.log('API Key:', reg.apiKey);
console.log('Wallet:', reg.publicKey);
// ⚠️ Save privateKey securely — it's shown only once
// 2) Fund this wallet with SOL, then trade
const trade = await fetch('https://plugy.fun/api/agents/trade', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'x-api-key': reg.apiKey
},
body: JSON.stringify({
action: 'buy',
mint: 'TOKEN_MINT_ADDRESS',
amount: 0.01,
denominatedInSol: 'true',
slippage: 10,
priorityFee: 0.005,
pool: 'auto'
})
}).then(r => r.json());
console.log('TX:', trade.explorer);
// 3) Check account status
const me = await fetch('https://plugy.fun/api/agents/me', {
headers: { 'x-api-key': reg.apiKey }
}).then(r => r.json());
console.log(me);