Docs
Contents

Console SDK(Node.js / JavaScript)

Before running the examples, replace <APPBASE_ENDPOINT_WITH_V1>, <APPBASE_CONSOLE_ORIGIN>, and <APPBASE_CONSOLE_HOST> where used with values for the intended environment, and verify that the project and credentials belong to that environment.

The Console SDK targets management-plane callers: Console panel capabilities, organization and project governance, and cross-project operations automation, authenticated with a management identity—an email-password Session or a short-lived JWT. npm coordinate agentbase-console-sdk@2.12.0. See the same directory for the Java / Python / Go surfaces: java.md / python.md / go.md; for the browser frontend use the Client SDK; for the server-side data plane use the Server SDK.

Installation and initialization

npm install agentbase-console-sdk@2.12.0 --save-exact

Method One: sdk wrapper object (recommended; manages endpoints and modes automatically)

import { sdk, realtime } from 'agentbase-console-sdk';

sdk.forConsole.projects.list(/* Organization/Console-level calls */);
sdk.forConsoleIn('default').health.get();      // Specify region
sdk.forProject('default', '<projectId>').tablesDB.listRows(...); // Project resource plane; automatically calls setProject + setMode('admin')

Method Two: bare Client (when fine-grained authentication control is needed)

import { Client } from 'agentbase-console-sdk';

const client = new Client()
  .setEndpoint('<APPBASE_ENDPOINT_WITH_V1>')
  .setProject('<consoleOrProjectId>');   // X-Appwrite-Project header

Authentication loading (choose one of three; mutually exclusive):

Other setters: setMode('admin'), setLocale, setSelfSigned.

5-minute quick start (management automation)

const projects = sdk.forConsole.projects;

const project = await projects.create({
  projectId: 'unique()', name: 'My Project', teamId: '<teamId>', region: 'default',
});
const key = await projects.createKey(project.$id, 'server key', [
  'users.read', 'users.write', 'teams.read', 'teams.write',
]);
// key.secret appears only once in the creation response; hand it to the server for secure storage immediately

On the server side, get a Key and integrate with the Server SDK; governance-plane tasks such as domain rules, migrations, and backups continue to use the services on this page.

Console-exclusive services

ServiceCovers
OrganizationsAdministrative capabilities such as organization members and billing; instantiated separately by the Console Client as an export class, not on the sdk.forConsole wrapper object
ProxySite/API/function/redirect domain rules (createSiteRule / listRules / getRule / updateRuleVerification / deleteRule)
VcsGit integration: installations, repository discovery, branch lists, repository content, external deployment status write-back
MigrationsMigration jobs (Appwrite/Firebase/Supabase/NHost/AppBase/CSV import-export): create, report, retry, delete; also includes SchemaMigration (a TablesDB-based schema planning/execution assistant)
Assistantassistant.chat() Management-side AI assistant
ConsolePlatform metadata: listRegions / listTags, plan and resource queries, column/index suggestions (suggestColumns / suggestIndexes), variables
AdminPlatform management: pool/label lists, storage migration, project table schema conversion, project deletion audit and recovery
Activities / Backups / DomainsEvent streams, backup policies and archives, domain assets

Create a project, issue a backend key, and register a Web platform

The example uses agentbase-console-sdk@2.12.0. Provide a short-lived management JWT for the target Console, a Web hostname you can register in APPBASE_WEB_HOSTNAME, and permissions to create an organization and project. Omit region so the service uses its configured default.

import { Client, Projects, Teams, ID, Scopes, PlatformType } from 'agentbase-console-sdk';

function refuseAutomaticRedirects(client: Client) {
  const originalPrepareRequest = client.prepareRequest;
  if (typeof originalPrepareRequest !== 'function') throw new Error('Redirect control unavailable');
  client.prepareRequest = function (...args) {
    const request = originalPrepareRequest.apply(this, args);
    request.options.redirect = 'error';
    return request;
  };
}

const token = process.env.APPBASE_ADMIN_JWT;
if (!token) throw new Error('Set APPBASE_ADMIN_JWT for the target Console');
const webHostname = process.env.APPBASE_WEB_HOSTNAME;
if (!webHostname) throw new Error('Set APPBASE_WEB_HOSTNAME');

// 1. Initialize the management-plane Client (first point it at the console project to complete organization and project provisioning)
const consoleClient = new Client()
  .setEndpoint(process.env.APPBASE_ENDPOINT ?? '<APPBASE_ENDPOINT_WITH_V1>')
  .setProject(process.env.APPBASE_CONSOLE_PROJECT_ID ?? 'console')
  .setJWT(token);
refuseAutomaticRedirects(consoleClient);

const teams = new Teams(consoleClient);
const projects = new Projects(consoleClient);

// 2. Create an organization (Team) and a Shared V2 enterprise project
const org = await teams.create({
  teamId: '69c6d1aa00062e6bb60',
  name: 'Agentbase 企业智能中台',
});

const project = await projects.create({
  projectId: '<APPBASE_PROJECT_ID>',
  name: '企业智能客服与知识中台',
  teamId: org.$id,
});

// 3. Issue an API Key with a minimal permission set for backend services (the secret is returned only once, in the creation response)
const serverKey = await projects.createKey({
  projectId: project.$id,
  name: 'prod-backend-service-key',
  scopes: [
    Scopes.UsersRead,
    Scopes.UsersWrite,
    Scopes.TablesRead,
    Scopes.TablesWrite,
    Scopes.RowsRead,
    Scopes.RowsWrite,
  ],
});
// Store the key from this creation response directly in your secret manager.

// 4. Register frontend Web platform domains (enables browser CORS trust; only Console Session/JWT can call)
await projects.createPlatform({
  projectId: project.$id,
  type: PlatformType.Web,
  name: 'Enterprise Support Portal',
  hostname: webHostname,
});

After creating the project, configure its database and follow the SQL Proxy guide to run parameterized queries. After creating a knowledge base, use the lexicon guide to create and bind a lexicon.

Selection comparison: Console SDK vs. Server SDK vs. Client Web SDK

DimensionConsole SDK (agentbase-console-sdk@2.12.0)Server SDK (agentbase-node-sdk@2.12.0)Client Web SDK (agentbase-web-sdk@2.12.0)
Core positioningOrganization and project lifecycle governance, platform registration, domain rules, migrations, backups, SQL endpointBusiness backend data-plane reads/writes, user management, RAG knowledge base, memory, model gateway, and observability reportingBrowser-side user login sessions, RLS-protected data reads/writes, and Realtime subscriptions
Auth credentialsAdmin Session Cookie / short-lived JWT (project API Key supported for SQL scenarios)Project API Key (X-Appwrite-Key, bypasses RLS)End-user Session Cookie / JWT (strictly enforces RLS row-level permissions)
Exclusive capabilitiesOrganizations, Projects.create/createKey/createPlatform, Proxy, Vcs, Migrations, Admin, Backups, SqlUsers.createToken (Custom Token issuance) and full project-level server-side batch processingAccount Browser OAuth redirect login, Realtime WebSocket subscriptions (shares realtime capabilities with Console)

Versions and SDK support

Functional surface navigation (governance domain → services)

DomainServices and method highlightsFeature documentation
OrganizationOrganizations: members, billing address, invoices, top-ups, organization Keys, listUsageAggregates({ organizationId }); instantiated by new Organizations(client)../organization.md, ../usage.md
Project lifecycleProjects.create({ projectId, name, teamId, region: 'default', poolTag }) / get / update / delete / list../overview.md
Project Keys and platformsprojects.createKey (scope as a lowercase dot-separated string; secret visible only at creation time), createDevKey, createPlatform / listPlatforms (Console Session only), updateOAuth2../overview.md
Quotas and rate limitsProject projects.getQuotaLimits / updateQuotaLimits; account account.getQuotaLimits / updateQuotaLimits / deleteQuotaLimits (no listLimitsProjects); /limits via client.call../limits.md
Three-level usagesdk.forConsole.account / sdk.forConsole.projects and the standalone Organizations service's listUsageAggregates() (the most recent 30 UTC days)../usage.md
Project resource planeTablesDB / Sql / Sites / Functions / Storage / Messaging / Memory (including project configuration and rollback) / Users / Teams / Tokens / LLMGateway (including usage) / Webhooks / Graphql / Avatars / Locale / HealthFeature pages (../misc/webhooks.md, etc.)
SQLSql.query / Sql.execute (exclusive to the JS Console SDK; for the Java / Python / Go Console surfaces see each page's notes)../databases/sql-proxy.md
Sites and domainsSites full set + Proxy domain rules + Domains../sites.md
Realtimerealtime.forProject(region, channels, cb) / realtime.forConsole(...)../realtime.md
Platform operationsAdmin / Backups / Activities / Health (including management-plane queue checks)../misc/webhooks.md

Errors and boundaries

Example Guide