Advanced
API reference
Ghostdesk exposes a REST API for programmatic access. All endpoints require authentication.
Authentication
The web app authenticates via the sign-in flow. The server sets an auth_token cookie that’s automatically included in subsequent requests.
IDEs use personal API keys. Create one in Settings, then send Authorization: Bearer sak_… to the MCP endpoint. See Connect to Cursor.
/api/mcpRemote MCP server (Streamable HTTP). Bearer API key required. Tools: list_agents, create_agent, run_task, get_task, get_screenshot, send_message, stop_task, get_balance. Usage bills the wallet like the web app.
Endpoints
/api/auth/nonceGet a nonce for wallet sign-in.
{ "walletAddress": "..." }/api/auth/signinSign in with a signed message.
{ "walletAddress": "...", "signature": "...", "message": "..." }/api/account/keysList personal API keys (hash metadata only). Cookie auth.
/api/account/keysCreate a named key with an optional spend cap. The secret is returned once.
{ "name": "Cursor", "spendLimitSol": 0.05 }/api/account/keys/:idRevoke a key. Existing hashes stay; the secret stops working.
/api/accountGet account info and balance.
/api/account/depositVerify a deposit transaction.
{ "signature": "..." }/api/account/withdrawWithdrawable balance, reserved running-agent cost, limits and withdrawal history.
/api/account/withdrawDebit unused balance and pay it to the signed-in wallet. requestId is a client UUID; retries with the same id return the original withdrawal.
{ "requestId": "2c7e0b1a-4d3f-4b8e-9a11-0f3d2c1b0a99", "amount": "1000000" }/api/admin/withdrawals/:idApprove or reject a held withdrawal. Header Authorization: Bearer WITHDRAW_ADMIN_SECRET.
{ "action": "approve" }/api/sessionsList active sessions.
/api/sessionsCreate a new session.
/api/sessions/:idDestroy a session.
/api/sessions/:idRename an agent or change its default model. Body: { "name", "model" }.
/api/sessions/:id/chatEnqueue a background task. Returns 202 with the job. The loop keeps running if the client disconnects.
{ "message": "..." }/api/sessions/:id/livePoll chat, tool events and job status. Use full=1 for the transcript or after=n for new events.
/api/sessions/:id/memoryList durable notes the agent saved for this session.
/api/sessions/:id/memoryClear that agent’s memory.
/api/account/notificationsRecent completion notices. Add unread=1 to list only unseen ones.