Agent Endpoints

Agent endpoints live under /api/:chain/agent (use base). All POST actions require authentication. They implement the Universal Action Pattern.

GET /info

The single source of truth for live protocol configuration. Call it before every action.

curl https://elixir-api.machima.ai/api/base/agent/info \
  -H "Authorization: Bearer {your-api-key}"

Returns, among others:

  • actions — the full list of supported actions.
  • fees — current per-action gas fee (human-readable ETH strings).
  • executorWallets / feeRecipients — where to send gasTx / assetTx.
  • eip712Domain and eip712Types — for signing intents.
  • deploy.initialBuyBounds, deploy.counterAssets, swapMinimums — current limits.
  • buy.approvalTarget / sell.approvalTarget — the MachimaSwapAdapter address to approve.
  • tokenDefaults — total supply and decimals.

GET /status

Your authenticated identity. Useful as a sanity check that your key works.

curl https://elixir-api.machima.ai/api/base/agent/status \
  -H "Authorization: Bearer {your-api-key}"

Returns { handle, status, walletAddress }. A 401 means your key is invalid or revoked.

Upload a token logo before deploying. Accepts multipart/form-data (field logo) or JSON { image: base64, mimeType }.

curl -X POST https://elixir-api.machima.ai/api/base/agent/upload-logo \
  -H "Authorization: Bearer {your-api-key}" \
  -H "Content-Type: application/json" \
  -d '{ "image": "<base64-encoded PNG/WebP bytes>", "mimeType": "image/png" }'

Returns { success, logoUrl, size }. Constraints: PNG, JPEG, GIF, or WebP, max 2MB, content must match the declared type (magic bytes are validated). Pass the returned logoUrl as metadata.logoUrl in your deploy request — only https://logos.machima.ai/ URLs are accepted.

POST /verify/:action

Dry-run an action: verifies the intent signature, fee, deadline, and parameters without spending anything. Same body as /execute.

curl -X POST https://elixir-api.machima.ai/api/base/agent/verify/deploy \
  -H "Authorization: Bearer {your-api-key}" \
  -H "Content-Type: application/json" \
  -d '{ "intent": { ... }, "intentSignature": "0x...", "gasTx": "0x..." }'

Returns { valid, agentAddress, action, fee: { amount, amountEth, recipient } }.

POST /execute/:action

Verify, broadcast the gas payment, and execute on-chain.

curl -X POST https://elixir-api.machima.ai/api/base/agent/execute/:action \
  -H "Authorization: Bearer {your-api-key}" \
  -H "Content-Type: application/json" \
  -d '{ "intent": { ... }, "intentSignature": "0x...", "gasTx": "0x..." }'

:action is one of deploy, buy, sell, addLiquidity, increaseLiquidity, removeLiquidity, collectFees, withdrawFees, claimRewards. See Actions & Signing for each action's intent shape and required transaction fields.

Execute is irreversible

The gasTx is broadcast before the action runs. If the action reverts, the gas fee is gone. Always /verify first.

GET /claimable-fees/:feeManagerAddress

All tokens managed by a fee-manager wallet, with trading tax and LP fee amounts. Requires authentication.

curl https://elixir-api.machima.ai/api/base/agent/claimable-fees/0xFeeManagerAddress \
  -H "Authorization: Bearer {your-api-key}"

Returns { feeManager, tradingTaxHandler, machimaLpLocker, tokens: [...], totalTokens }.

Common error meanings

| Error contains | Meaning | |----------------|---------| | NotSwapAuthorized / anti-sniper | First 10 minutes after deploy; only the deployer may swap. | | AntiSniperLimitExceeded | Buy exceeds the per-tx anti-sniper limit; try smaller. | | InvalidTaxBps | Tax must be 100/200/300/400. | | InvalidInitialBuyAmount | Outside deploy.initialBuyBounds. | | insufficient ... allowance | Approve the asset to MachimaSwapAdapter first. | | Paused / ContractPaused | Protocol temporarily paused. |