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 apikeys client methods are currently in ALPHA. The API may change without notice. A one-time warning is emitted on first use.
API keys authenticate calls to the Arize platform. Service keys are tied to a bot user with role assignments at the account, organization, and space level; user keys are tied to a specific human user.

List API Keys

List returns a paginated list of API keys. Signature:
func (c *Client) List(ctx context.Context, params ListParams) (*ApiKeyList, error)
Usage Example:
package main

import (
    "context"
    "errors"
    "fmt"
    "log"

    "github.com/Arize-ai/client-go-v2"
    "github.com/Arize-ai/client-go-v2/apikeys"
)

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

    keyType := apikeys.ListParamsKeyTypeService
    resp, err := client.APIKeys.List(context.Background(), apikeys.ListParams{
        KeyType: &keyType,
    })
    if err != nil {
        var unauthorized *arize.UnauthorizedError
        if errors.As(err, &unauthorized) {
            log.Fatalf("unauthorized: %v", unauthorized)
        }
        log.Fatal(err)
    }

    for _, key := range resp.Data {
        fmt.Printf("%s: %s (type=%s status=%s)\n", key.Id, key.Name, key.KeyType, key.Status)
    }
}

Create an API Key

Create issues a POST to create a new API key and returns the created key, including the secret token. The secret is only returned at creation time. Signature:
func (c *Client) Create(
    ctx context.Context,
    req CreateRequest,
) (*ApiKeyCreated, error)
Usage Example:
package main

import (
    "context"
    "errors"
    "fmt"
    "log"

    "github.com/Arize-ai/client-go-v2"
    "github.com/Arize-ai/client-go-v2/apikeys"
)

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

    keyType := apikeys.ApiKeyCreateKeyTypeService
    spaceID := "your-space-id"
    orgRole := apikeys.ApiKeyRolesOrgRoleMember
    created, err := client.APIKeys.Create(
        context.Background(),
        apikeys.CreateRequest{
            Name:    "ci-bot",
            KeyType: &keyType,
            SpaceId: &spaceID,
            Roles: &apikeys.ApiKeyRoles{
                OrgRole: &orgRole,
            },
        },
    )
    if err != nil {
        var badRequest *arize.BadRequestError
        if errors.As(err, &badRequest) {
            log.Fatalf("invalid request: %v", badRequest)
        }
        log.Fatal(err)
    }

    fmt.Printf("created key %s — secret: %s\n", created.Id, created.Key)
}

Refresh an API Key

Refresh rotates the secret on an existing API key and returns the new key value. Signature:
func (c *Client) Refresh(
    ctx context.Context,
    apiKeyID string,
    req RefreshRequest,
) (*ApiKeyCreated, error)
Usage Example:
package main

import (
    "context"
    "errors"
    "fmt"
    "log"

    "github.com/Arize-ai/client-go-v2"
    "github.com/Arize-ai/client-go-v2/apikeys"
)

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

    rotated, err := client.APIKeys.Refresh(
        context.Background(),
        "your-api-key-id",
        apikeys.RefreshRequest{},
    )
    if err != nil {
        var notFound *arize.NotFoundError
        if errors.As(err, &notFound) {
            log.Fatalf("api key not found: %v", notFound)
        }
        log.Fatal(err)
    }

    fmt.Printf("rotated key %s — new secret: %s\n", rotated.Id, rotated.Key)
}

Delete an API Key

Delete removes an API key by ID. It returns only an error. Signature:
func (c *Client) Delete(ctx context.Context, apiKeyID string) error
Usage Example:
package main

import (
    "context"
    "errors"
    "log"

    "github.com/Arize-ai/client-go-v2"
)

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

    err = client.APIKeys.Delete(context.Background(), "your-api-key-id")
    if err != nil {
        var notFound *arize.NotFoundError
        if errors.As(err, &notFound) {
            log.Printf("no api key to remove: %v", notFound)
            return
        }
        log.Fatal(err)
    }
}