Skip to main content

Documentation Index

Fetch the complete documentation index at: https://arize-ax.mintlify.dev/docs/llms.txt

Use this file to discover all available pages before exploring further.

The spaces client methods are currently in ALPHA. The API may change without notice. A one-time warning is emitted on first use.
A space groups projects, datasets, and monitors under an organization. The Get, Update, Delete, AddUser, and RemoveUser methods accept either a space name or an ID, and List/Create accept an organization name or ID — the SDK resolves names to IDs on your behalf. When adding a user, build the role assignment with AssignPredefinedRole (one of the UserSpaceRole values) or AssignCustomRole (an existing custom role ID — see Roles).

List Spaces

List returns a paginated list of spaces. Organization, when non-empty, accepts an organization name or ID and restricts results to that organization. Signature:
func (c *Client) List(ctx context.Context, req ListRequest) (*SpaceList, 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/spaces"
)

func main() {
    client, err := arize.NewClient(arize.Config{APIKey: "your-api-key"})
    if err != nil {
        log.Fatal(err)
    }

    resp, err := client.Spaces.List(context.Background(), spaces.ListRequest{
        Organization: "your-org-name-or-id",
        Limit:        25,
    })
    if err != nil {
        var unauthorized *arize.UnauthorizedError
        if errors.As(err, &unauthorized) {
            log.Fatalf("unauthorized: %v", unauthorized)
        }
        log.Fatal(err)
    }

    for _, space := range resp.Spaces {
        fmt.Printf("%s: %s\n", space.Id, space.Name)
    }
}

Get a Space

Get returns a single space, resolving by name or ID. Signature:
func (c *Client) Get(ctx context.Context, req GetRequest) (*Space, 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/spaces"
)

func main() {
    client, err := arize.NewClient(arize.Config{APIKey: "your-api-key"})
    if err != nil {
        log.Fatal(err)
    }

    space, err := client.Spaces.Get(
        context.Background(),
        spaces.GetRequest{Space: "your-space-name-or-id"},
    )
    if err != nil {
        var notFound *arize.NotFoundError
        if errors.As(err, &notFound) {
            log.Fatalf("space not found: %v", notFound)
        }
        log.Fatal(err)
    }

    fmt.Printf("space %s: %s\n", space.Id, space.Name)
}

Create a Space

Create issues a POST to create a new space in the given organization, resolving the parent organization by name or ID, and returns the created space. Signature:
func (c *Client) Create(
    ctx context.Context,
    req CreateRequest,
) (*Space, 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/spaces"
)

func main() {
    client, err := arize.NewClient(arize.Config{APIKey: "your-api-key"})
    if err != nil {
        log.Fatal(err)
    }

    space, err := client.Spaces.Create(
        context.Background(),
        spaces.CreateRequest{
            Name:         "your-new-space",
            Organization: "your-org-name-or-id",
        },
    )
    if err != nil {
        var conflict *arize.ConflictError
        if errors.As(err, &conflict) {
            log.Fatalf("space already exists: %v", conflict)
        }
        log.Fatal(err)
    }

    fmt.Printf("created space %s\n", space.Id)
}

Update a Space

Update modifies an existing space, resolving the target by name or ID, and returns the updated space. 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,
) (*Space, 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/spaces"
)

func main() {
    client, err := arize.NewClient(arize.Config{APIKey: "your-api-key"})
    if err != nil {
        log.Fatal(err)
    }

    newName := "renamed-space"
    space, err := client.Spaces.Update(
        context.Background(),
        spaces.UpdateRequest{
            Space: "your-space-name-or-id",
            Name:  &newName,
        },
    )
    if err != nil {
        var notFound *arize.NotFoundError
        if errors.As(err, &notFound) {
            log.Fatalf("space not found: %v", notFound)
        }
        log.Fatal(err)
    }

    fmt.Printf("updated space %s: %s\n", space.Id, space.Name)
}

Delete a Space

Delete irreversibly removes a space and cascades to all child resources (projects, datasets, monitors, custom metrics, 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/spaces"
)

func main() {
    client, err := arize.NewClient(arize.Config{APIKey: "your-api-key"})
    if err != nil {
        log.Fatal(err)
    }

    err = client.Spaces.Delete(
        context.Background(),
        spaces.DeleteRequest{Space: "your-space-name-or-id"},
    )
    if err != nil {
        var notFound *arize.NotFoundError
        if errors.As(err, &notFound) {
            log.Printf("no space to remove: %v", notFound)
            return
        }
        log.Fatal(err)
    }
}

Add a User to a Space

AddUser adds a user to a space, or upserts their role if they are already a member. The user must already belong to the space’s parent organization; auto-enrollment is not performed. Build the Role with AssignPredefinedRole (one of the UserSpaceRole values) or AssignCustomRole (an existing custom role ID). Signature:
func (c *Client) AddUser(
    ctx context.Context,
    req AddUserRequest,
) (*SpaceMembership, 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/spaces"
)

func main() {
    client, err := arize.NewClient(arize.Config{APIKey: "your-api-key"})
    if err != nil {
        log.Fatal(err)
    }

    membership, err := client.Spaces.AddUser(
        context.Background(),
        spaces.AddUserRequest{
            Space:  "your-space-name-or-id",
            UserID: "your-user-id",
            Role:   spaces.AssignPredefinedRole(spaces.UserSpaceRoleMember),
        },
    )
    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 space\n", membership.UserId)
}

Remove a User from a Space

RemoveUser removes a user from a space, clearing both the legacy membership row and any RBAC role bindings for the user on this space. It returns only an error. 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/spaces"
)

func main() {
    client, err := arize.NewClient(arize.Config{APIKey: "your-api-key"})
    if err != nil {
        log.Fatal(err)
    }

    err = client.Spaces.RemoveUser(
        context.Background(),
        spaces.RemoveUserRequest{
            Space:  "your-space-name-or-id",
            UserID: "your-user-id",
        },
    )
    if err != nil {
        var notFound *arize.NotFoundError
        if errors.As(err, &notFound) {
            log.Printf("user not in space: %v", notFound)
            return
        }
        log.Fatal(err)
    }
}