Docs
Contents

Console SDK(Go)

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.10.0

replace agentbase-console-go-sdk => /path/to/agentbase-console-go-sdk-2.10.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("https://appbuild.oceanbase.com/v1"),
	consolefacade.WithProject("console"),
)
consoleClient.AddHeader("origin", "https://appbuild.oceanbase.com")
consoleClient.AddHeader("x-forwarded-host", "appbuild.oceanbase.com")
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",
})
fmt.Println(key.Secret) // API Key used by the Server SDK, appears only once in the creation response

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.

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

const client = new Client()
    .setEndpoint(process.env.APPBASE_ENDPOINT!)           // https://appbuild.oceanbase.com/v1
    .setProject(process.env.APPBASE_CONSOLE_PROJECT_ID!); // Console project, usually console

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,
    region: 'default'        // Region enum not used by Appwrite Cloud
});

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