Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

fix: update Moltbook API to v1 at moltbook.com

Adam Eivy4ebf3aad71ec
diff --git a/server/integrations/moltbook/api.js b/server/integrations/moltbook/api.js
index f19a5463d7..53490582f5 100644
--- a/server/integrations/moltbook/api.js
+++ b/server/integrations/moltbook/api.js
@@ -4,12 +4,12 @@
* REST API client for Moltbook - an AI agent social platform.
* All actions are performed via their REST API (no browser automation needed).
*
- * API Base: https://www.moltbook.app/api
+ * API Base: https://www.moltbook.com/api/v1
*/
import { checkRateLimit, recordAction } from './rateLimits.js';
-const API_BASE = 'https://www.moltbook.app/api';
+const API_BASE = 'https://www.moltbook.com/api/v1';
/**
* Make an API request to Moltbook
@@ -66,12 +66,14 @@ async function authRequest(apiKey, endpoint, options = {}) {
* @returns {{ api_key: string, claim_url: string }} Registration result
*/
export async function register(name, description = '') {
+ // Moltbook requires alphanumeric usernames with underscores/hyphens (3-30 chars)
+ const username = name.toLowerCase().replace(/\s+/g, '_').replace(/[^a-z0-9_-]/g, '');
const result = await request('/agents/register', {
method: 'POST',
- body: JSON.stringify({ name, description })
+ body: JSON.stringify({ name: username, description })
});
- console.log(`🆕 Moltbook: Registered agent "${name}"`);
+ console.log(`🆕 Moltbook: Registered agent "${username}"`);
return result;
}
diff --git a/server/routes/platformAccounts.js b/server/routes/platformAccounts.js
index e235670019..5f7966abd2 100644
--- a/server/routes/platformAccounts.js
+++ b/server/routes/platformAccounts.js
@@ -87,11 +87,12 @@ router.post('/', asyncHandler(async (req, res) => {
if (data.platform === 'moltbook') {
let apiKey, claimUrl, username;
- // Try to register with real Moltbook API
+ // Register with Moltbook API (v1 returns { agent: { api_key, claim_url, name } })
const result = await moltbook.register(data.name, data.description);
- apiKey = result.api_key;
- claimUrl = result.claim_url;
- username = result.username || data.name.toLowerCase().replace(/\s+/g, '_');
+ const agent_data = result.agent || result;
+ apiKey = agent_data.api_key;
+ claimUrl = agent_data.claim_url;
+ username = agent_data.name || data.name.toLowerCase().replace(/\s+/g, '_');
const account = await platformAccounts.createAccount({
agentId: data.agentId,