Docs
Contents

Console SDK(Go)

Replace <APPBASE_ENDPOINT_WITH_V1>, <APPBASE_CONSOLE_ORIGIN>, and <APPBASE_CONSOLE_HOST> where used with values for the intended environment before running the examples.

The Go management-surface SDK (module agentbase-console-go-sdk) covers the Console / management-surface API: organization and project governance, Key issuance, cross-project operations, and can be consumed simultaneously via replace with the Server module (../server-sdk/go.md) (the facade package names are both agentbase; use an alias when importing). For the Node / Java / Python surfaces, see nodejs.md / java.md / python.md in the same directory.

Artifacts and installation

Not published to the public Go module proxy: download the release ZIP, verify it, then in your application module go.mod add the Server module together with a replace pointing to a local directory:

require (
	agentbase-console-go-sdk v0.0.0
	agentbase-go-sdk v0.0.0
)

replace agentbase-go-sdk => /path/to/agentbase-go-sdk-2.12.0

replace agentbase-console-go-sdk => /path/to/agentbase-console-go-sdk-2.12.0

For download and verification commands see ../examples/go.md "Acquisition and installation"; the Go surface ships since agentbase-sdks v2.7.0 (2.6.0 has no such language surface).

Initialization and auth mounting

The Console login response body contains no session secret (it lives only in the a_session_console cookie); first fetch the cookie via raw HTTP, then attach it to the Console SDK client:

import (
	consolefacade "agentbase-console-go-sdk/agentbase"
)

consoleClient := consolefacade.NewClient(
	consolefacade.WithEndpoint("<APPBASE_ENDPOINT_WITH_V1>"),
	consolefacade.WithProject("console"),
)
consoleClient.AddHeader("origin", "<APPBASE_CONSOLE_ORIGIN>")
consoleClient.AddHeader("x-forwarded-host", "<APPBASE_CONSOLE_HOST>")
consoleClient.AddHeader("Cookie", "a_session_console="+cookieFromLoginResponse)

Typical governance calls

The service surface includes account, teams, projects, users, proxy, migrations, etc.; calling conventions match the Server module (required parameters by position, optional parameters With*):

import (
	"fmt"

	consolefacade "agentbase-console-go-sdk/agentbase"
)

consoleTeams := consolefacade.NewTeams(consoleClient)
consoleProjects := consolefacade.NewProjects(consoleClient)

_, _ = consoleTeams.Create("my-team", "My Team", consoleTeams.WithCreateRoles([]string{"owner"}))
project, _ := consoleProjects.Create("unique()", "My Project", "my-team")
key, _ := consoleProjects.CreateKey(project.Id, "server key", []string{
	"users.read", "users.write", "teams.read", "teams.write",
})
_ = key // Store the key from this creation response directly in your secret manager.

Console-only operations such as organizations, members, and platform registration cannot use a project API Key.

Feature surface navigation

For the complete mapping of governance domains to services see nodejs.md "Feature surface navigation"; feature pages per domain: Organizations, Projects and Keys, Quotas, Usage, Sites and Domains, Platform Operations.

Errors and boundaries

Examples by language

The following presents examples by language for each functional domain; each card can switch languages (synced across the full page).

Create a team, project, and issue a Key

Python method names are snake_case, Go uses a facade New* constructor + With* options. This domain has no direct REST call tab; for direct REST calls, see the "Quotas and rate limits" card below.

Before running this example, provide a short-lived management JWT for the target Console in APPBASE_ADMIN_JWT.

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

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

const client = new Client()
    .setEndpoint(process.env.APPBASE_ENDPOINT!)           // <APPBASE_ENDPOINT_WITH_V1>
    .setProject(process.env.APPBASE_CONSOLE_PROJECT_ID ?? 'console')
    .setJWT(token);

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 teams = new Teams(client);
const team = await teams.create({ teamId: ID.unique(), name: 'My Team' });

const projects = new Projects(client);
const project = await projects.create({
    projectId: ID.unique(),
    name: 'todo-app',
    teamId: team.$id,
});

const key = await projects.createKey({
    projectId: project.$id,
    name: 'setup-script',
    scopes: [Scopes.UsersRead, Scopes.UsersWrite]   // minimize scope
});
// key.secret is returned only once at creation

Usage queries

Three-level aggregation (the most recent 30 UTC days) and the legacy scheme are two separate systems; method names cannot be guessed from each other (see usage).

// account / organizations / projects are Console SDK service instances
await account.listUsageAggregates();
await organizations.listUsageAggregates({ organizationId: '<organizationId>' });
await projects.listUsageAggregates({ projectId: '<projectId>' });

Quotas and rate limits (direct REST calls)

The Go Console surface likewise has no typed quota/ratelimit evidence; use the unified REST entry point:

# Query current quota and rate limits:
curl -sS "$APPBASE_ENDPOINT/projects/<projectId>/limits" \
  -H "X-Appwrite-Project: $APPBASE_CONSOLE_PROJECT_ID" \
  -H "X-Appwrite-Key: $APPBASE_CONSOLE_API_KEY"
# Settings: PATCH the same path, body is flat rate-limit + quota fields; Quota 0 = unlimited, RateLimit must be a positive integer
curl -sS -X PATCH "$APPBASE_ENDPOINT/projects/<projectId>/limits" \
  -H 'Content-Type: application/json' \
  -H "X-Appwrite-Project: $APPBASE_CONSOLE_PROJECT_ID" \
  -H "X-Appwrite-Key: $APPBASE_CONSOLE_API_KEY" \
  -d '{"databaseStorageLimit": 0}'
# See limits.mdx for the full field set and field-name pitfalls

Example Guide