API Routes
The Next.js API surface backing tipping claims, IPFS pinning, AI agents, and more.
LFG's frontend is a Next.js app, and a handful of server-side routes exist specifically because they hold secrets or need Node-only APIs that must never ship to the client bundle.
POST /api/tipping/sign-claim
Signs the claim attestation digest described in Oracle Signing. A wallet recipient is signed only when tokenInfo shows that the connected wallet launched that token and the handle is that wallet. An X recipient is signed only when this server's sign-in cookie proves X returned the same account name. A pasted access token is ignored. Runs on the Node.js runtime (not Edge).
| Field | Type | Notes |
|---|---|---|
platform | string | The royalty platform. wallet claims use the launch wallet. twitter claims use the signed-in X account. |
handle | string | For a wallet claim, the launch wallet. For X, the account that just signed in. |
claimerAddress | 0x address | Where claimTips will pay out. For a wallet claim this has to be the launch wallet. For a social claim it is the wallet the signed-in account chooses. |
token | 0x address (optional) | When set, that token's stored royalty must be this platform and handle. It does not authorize a social claim. |
chainId | number | Robinhood Chain mainnet, 4663. The signature is bound to that chain's OmniTippingEscrow. |
accessToken | string (optional) | Ignored. Social claims use the httpOnly sign-in cookie from /api/tipping/oauth/callback. |
Note
When ORACLE_SIGNER_PRIVATE_KEY isn't configured on a given deployment, this route returns { simulated: true, signature: null } rather than throwing — the same 'explicit demo mode, not a silent failure' pattern used elsewhere in the app for unconfigured integrations.
AI agent routes
The agent routes need the signed-in wallet session (the lfg_wallet_session cookie). An address typed into a request body or query string is ignored, and a wallet can only reach agents it owns. Without a session they answer 401. A browser request from another site is refused with 403. In the paths below, {id} is the agent's id.
| Route | Auth | What it does |
|---|---|---|
POST /api/console/create | Wallet session | Creates an agent. Needs a name of at least two characters and a mission. A repeat of the same launch within 10 minutes returns the existing agent. |
GET /api/agents/models | None | The model catalog: every model the x402 gateways offer right now, its price, and whether it calls tools natively. |
GET /api/agents/{id}/chat | Wallet session, owner only | The agent's chats, routine runs, heartbeats and sub-agents. With ?session=, one of them with its messages and cards. |
POST /api/agents/{id}/chat | Wallet session, owner only | send a message (a new chat when there is no sessionId), continue, stop or resume. Answers with a server-sent event stream: text as it is written, each tool call, cards and spend. |
GET / POST /api/agents/{id}/approvals | Wallet session, owner only | Lists open cards, and answers one: approve, deny, keep a draft to post yourself, answer a question, or hand back the hash of a transaction you signed. |
GET /api/agents/{id}/events?after= | Wallet session, owner only | Everything the agent's sessions did after an event id, for the console to follow live. |
POST /api/agents/{id}/live-view | Wallet session, owner only | Opens the agent's browser to watch (view) or drive (control). Answers with a one-minute ticket for your own agent host, or a short-lived viewer link from the browser provider. Neither is ever put in a page address. |
POST /api/agents/{id}/browser | Wallet session, owner only | take-over the browser, so the agent leaves it alone, then hand-back with a note for the agent. |
GET / POST /api/agents/{id}/providers | Wallet session, owner only | Which sandbox and browser are connected. save tests the key with the provider before storing it; remove deletes it. |
GET / POST /api/agents/{id}/memory | Wallet session, owner only | Search memories with ?q=, or add, edit (including pin) and delete one. |
GET / POST /api/agents/{id}/schedules | Wallet session, owner only | Lists routines, and can create, update, delete or run one now. |
GET /api/agents/engine?swarmId= | Wallet session, owner only | The agent's wallet, its latest mission and its recent events. |
POST /api/agents/engine | Wallet session, owner only | Runs a mission step for the creator: start or advance it, approve or change a plan, answer the agent, skip a step, store the E2B key. |
/api/console/settings | Wallet session, owner only | Reads and saves run mode, autonomy, limits, powers, trading settings and public listing. |
GET /api/agents/cron | Authorization: Bearer CRON_SECRET | Called every minute by the scheduler. Fires due routines and heartbeats, wakes agents whose wait is over, and moves running chats, sub-agents and missions forward. Not for browsers. |
Why these live server-side
- Secret custody —
ORACLE_SIGNER_PRIVATE_KEYmust never reach client-bundled code; only a server route can hold it. - Independent verification — OAuth access tokens are checked against the platform's own identity API server-side, so a compromised or spoofed client can't just assert a handle it doesn't control.
- Node-only dependencies — signing and RPC reads use APIs that either don't exist or don't behave identically on the Edge runtime.
