The organizations client methods are currently in ALPHA. The API may change without notice. A one-time warning is emitted on first use.
Organizations group spaces and members under a billing account. The Get, Update, Delete, AddUser, and RemoveUser methods accept either an organization name or an ID — the SDK resolves names to IDs on your behalf.
List Organizations
List returns a paginated list of organizations.
Signature:
func (c *Client) List(ctx context.Context, req ListRequest) (*OrganizationList, error)
Usage Example:
package main
import (
"context"
"errors"
"fmt"
"log"
"github.com/Arize-ai/client-go-v2/arize"
"github.com/Arize-ai/client-go-v2/arize/organizations"
)
func main() {
client, err := arize.NewClient(arize.Config{APIKey: "your-api-key"})
if err != nil {
log.Fatal(err)
}
resp, err := client.Organizations.List(context.Background(), organizations.ListRequest{
Limit: 25,
})
if err != nil {
var unauthorized *arize.UnauthorizedError
if errors.As(err, &unauthorized) {
log.Fatalf("unauthorized: %v", unauthorized)
}
log.Fatal(err)
}
for _, org := range resp.Organizations {
fmt.Printf("%s: %s\n", org.Id, org.Name)
}
}
Get an Organization
Get returns a single organization, resolving by name or ID.
Signature:
func (c *Client) Get(ctx context.Context, req GetRequest) (*Organization, error)
Usage Example:
package main
import (
"context"
"errors"
"fmt"
"log"
"github.com/Arize-ai/client-go-v2/arize"
"github.com/Arize-ai/client-go-v2/arize/organizations"
)
func main() {
client, err := arize.NewClient(arize.Config{APIKey: "your-api-key"})
if err != nil {
log.Fatal(err)
}
org, err := client.Organizations.Get(
context.Background(),
organizations.GetRequest{Organization: "your-org-name-or-id"},
)
if err != nil {
var notFound *arize.NotFoundError
if errors.As(err, ¬Found) {
log.Fatalf("organization not found: %v", notFound)
}
log.Fatal(err)
}
fmt.Printf("org %s: %s\n", org.Id, org.Name)
}
Create an Organization
Create issues a POST to create a new organization and returns the created organization.
Signature:
func (c *Client) Create(
ctx context.Context,
req CreateRequest,
) (*Organization, error)
Usage Example:
package main
import (
"context"
"errors"
"fmt"
"log"
"github.com/Arize-ai/client-go-v2/arize"
"github.com/Arize-ai/client-go-v2/arize/organizations"
)
func main() {
client, err := arize.NewClient(arize.Config{APIKey: "your-api-key"})
if err != nil {
log.Fatal(err)
}
org, err := client.Organizations.Create(
context.Background(),
organizations.CreateRequest{
Name: "your-new-org",
},
)
if err != nil {
var conflict *arize.ConflictError
if errors.As(err, &conflict) {
log.Fatalf("organization already exists: %v", conflict)
}
log.Fatal(err)
}
fmt.Printf("created org %s\n", org.Id)
}
Update an Organization
Update modifies an existing organization, resolving the target by name or ID, and returns the updated organization. Name and Description are pointers — nil preserves the existing value, a pointer to an empty string clears the field.
Signature:
func (c *Client) Update(
ctx context.Context,
req UpdateRequest,
) (*Organization, error)
Usage Example:
package main
import (
"context"
"errors"
"fmt"
"log"
"github.com/Arize-ai/client-go-v2/arize"
"github.com/Arize-ai/client-go-v2/arize/organizations"
)
func main() {
client, err := arize.NewClient(arize.Config{APIKey: "your-api-key"})
if err != nil {
log.Fatal(err)
}
newName := "renamed-org"
org, err := client.Organizations.Update(
context.Background(),
organizations.UpdateRequest{
Organization: "your-org-name-or-id",
Name: &newName,
},
)
if err != nil {
var notFound *arize.NotFoundError
if errors.As(err, ¬Found) {
log.Fatalf("organization not found: %v", notFound)
}
log.Fatal(err)
}
fmt.Printf("updated org %s: %s\n", org.Id, org.Name)
}
Delete an Organization
Delete irreversibly removes an organization and cascades to all child resources (spaces, projects, API keys, datasets, monitors, etc.). It returns only an error.
Signature:
func (c *Client) Delete(ctx context.Context, req DeleteRequest) error
Usage Example:
package main
import (
"context"
"errors"
"log"
"github.com/Arize-ai/client-go-v2/arize"
"github.com/Arize-ai/client-go-v2/arize/organizations"
)
func main() {
client, err := arize.NewClient(arize.Config{APIKey: "your-api-key"})
if err != nil {
log.Fatal(err)
}
err = client.Organizations.Delete(
context.Background(),
organizations.DeleteRequest{Organization: "your-org-name-or-id"},
)
if err != nil {
var notFound *arize.NotFoundError
if errors.As(err, ¬Found) {
log.Printf("no organization to remove: %v", notFound)
return
}
log.Fatal(err)
}
}
Add a User to an Organization
AddUser adds a user to an organization, or upserts their role if they are already a member. Pass a PredefinedOrgRole built from one of the OrganizationRole* constants; custom role assignments are not yet supported for organizations.
Signature:
func (c *Client) AddUser(
ctx context.Context,
req AddUserRequest,
) (*OrganizationMembership, error)
Usage Example:
package main
import (
"context"
"errors"
"fmt"
"log"
"github.com/Arize-ai/client-go-v2/arize"
"github.com/Arize-ai/client-go-v2/arize/organizations"
)
func main() {
client, err := arize.NewClient(arize.Config{APIKey: "your-api-key"})
if err != nil {
log.Fatal(err)
}
membership, err := client.Organizations.AddUser(
context.Background(),
organizations.AddUserRequest{
Organization: "your-org-name-or-id",
UserID: "your-user-id",
Role: organizations.PredefinedOrgRole{
Name: organizations.OrganizationRoleMember,
},
},
)
if err != nil {
var forbidden *arize.ForbiddenError
if errors.As(err, &forbidden) {
log.Fatalf("forbidden: %v", forbidden)
}
log.Fatal(err)
}
fmt.Printf("user %s added to org\n", membership.UserId)
}
Remove a User from an Organization
RemoveUser removes a user from an organization. Membership removal cascades to all child spaces.
Signature:
func (c *Client) RemoveUser(ctx context.Context, req RemoveUserRequest) error
Usage Example:
package main
import (
"context"
"errors"
"log"
"github.com/Arize-ai/client-go-v2/arize"
"github.com/Arize-ai/client-go-v2/arize/organizations"
)
func main() {
client, err := arize.NewClient(arize.Config{APIKey: "your-api-key"})
if err != nil {
log.Fatal(err)
}
err = client.Organizations.RemoveUser(
context.Background(),
organizations.RemoveUserRequest{
Organization: "your-org-name-or-id",
UserID: "your-user-id",
},
)
if err != nil {
var notFound *arize.NotFoundError
if errors.As(err, ¬Found) {
log.Printf("user not in organization: %v", notFound)
return
}
log.Fatal(err)
}
}