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.0For 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 responseConsole-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
Errors are uniformly
*client.AgentbaseError(same shape as the Server module, see ../server-sdk/go.md "Error handling").The Console Session cookie and OAuth test Sessions are mutually isolated; in short-lived JWT scenarios
WithJWT, writing to logs is forbidden.
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.
- Console (Node.js)
- Java
- Python
- Go
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// Organization = Team: Teams.create(teamId, name, roles) (positional parameters, POST /teams),
// Fill team.getId() into the 3-th positional parameter of projects.create below; for the full list of create positional parameters, see “Quick Start” in java.md in the same directory
io.agentbase.console.services.Teams teams = new io.agentbase.console.services.Teams(consoleClient);
var team = teams.create(
io.agentbase.console.ID.unique(), "My Team", java.util.List.of("owner"));
Projects projects = new Projects(consoleClient);
var project = projects.create(
io.agentbase.console.ID.unique(), "billing-service", team.getId(),
io.agentbase.console.enums.Region.DEFAULT, null, // poolTag is nullable
null, null, null, null, null, null, null, null, null, null);
var key = projects.createKey(project.getId(), "ci-deploy",
java.util.List.of(io.agentbase.console.enums.Scopes.USERS_READ,
io.agentbase.console.enums.Scopes.USERS_WRITE),
null, null, null);
System.out.println(key.getSecret()); // secret appears only once in the creation response# console_client initialization see "Initialization and auth loading" in python.md in the same directory; full steps see its "Quick start"
from agentbase_console.services.projects import Projects
from agentbase_console.services.teams import Teams
teams = Teams(console_client)
projects = Projects(console_client)
teams.create(team_id='my-team', name='My Team', roles=['owner']) # In the Console, Organization = Team
project = projects.create(project_id='unique()', name='My Project', team_id='my-team')
key = projects.create_key(
project_id=project.id, name='server key',
scopes=['users.read', 'users.write', 'teams.read', 'teams.write'],
key_id='unique()')
print(key.secret) # Appears only once, in the create response// For consoleClient initialization, see "Initialization and authentication loading" above; for the full steps, see "Quick start" above
consoleTeams := consolefacade.NewTeams(consoleClient)
consoleProjects := consolefacade.NewProjects(consoleClient)
_, _ = consoleTeams.Create("my-team", "My Team", consoleTeams.WithCreateRoles([]string{"owner"})) // In the Console, Organization = Team
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) // Appears only once, in the create responseUsage 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).
- Console (Node.js)
- Java
- Python
- Go
// account / organizations / projects are Console SDK service instances
await account.listUsageAggregates();
await organizations.listUsageAggregates({ organizationId: '<organizationId>' });
await projects.listUsageAggregates({ projectId: '<projectId>' });// The Java Console SDK generated name is getUsageAggregates (different from JS's listUsageAggregates)
new io.agentbase.console.services.Projects(consoleClient)
.getUsageAggregates("<projectId>"); // Project level
new io.agentbase.console.services.SelfHostedOrganizations(consoleClient)
.getUsageAggregates("<organizationId>"); // Organization level (same endpoints as the JS organizations surface)
// Account level (/account/usage/aggregates) has no typed method in console-java; use a direct REST call
// Legacy: applies to the project set by setProject (period enum ONE_HOUR / ONE_DAY)
new io.agentbase.console.services.Project(consoleClient)
.getUsage(null, null, io.agentbase.console.enums.ProjectUsageRange.ONE_DAY);# This document does not provide a Python SDK example for three-level usage aggregation.
# Examples in this section can use Node / Java / REST; for Python calls, check the Console SDK in use
# Use the published package's service classes, methods and parameters; do not guess from JS naming conventions.// server-go@release-2.6.0 has no three-level aggregate methods
// side; the only legacy pattern is selfhostedorganizations.GetUsage(organizationId, WithGetUsageRange).
// The Console Go face has been delivered since 2.7.0; this document does not cover its three-level aggregation usage—use Node / Java / REST instead, and do not infer from JS naming.Quotas and rate limits (direct REST calls)
The Go Console surface likewise has no typed quota/ratelimit evidence; use the unified REST entry point:
- REST (curl)
# 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 pitfallsExample Guide
Go (Server / Console) complete call syntax: ../examples/go.md