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

# Go SDK v2

> Use the Arize AX Go client for platform interactions such as managing resource restrictions. This SDK is currently in pre-release.

## Installation

This package is currently pre-release. Add the module to your project:

```bash theme={null}
go get github.com/Arize-ai/client-go-v2
```

The module root contains no Go code; all packages live under `arize/`. Import the public `arize` package and any per-subclient packages you need:

```go theme={null}
import (
    "github.com/Arize-ai/client-go-v2/arize"
    "github.com/Arize-ai/client-go-v2/arize/resourcerestrictions"
)
```

## Configuration

Authenticate using API keys obtained from the Arize Platform. The API key is required for all operations and can be provided via `Config` or the `ARIZE_API_KEY` environment variable. The API host is also configurable via `Config.APIHost` or the `ARIZE_API_HOST` environment variable.

Refer to the [API Hosts and Regions documentation](https://arize.com/docs/ax/rest-reference#api-hosts-&-regions) for base URL configuration, which defaults to the global environment.

<Tabs>
  <Tab title="In Code">
    ```go theme={null}
    package main

    import (
        "log"

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

    func main() {
        client, err := arize.NewClient(arize.Config{
            APIKey:  "your-api-key",
            APIHost: "api.arize.com",
        })
        if err != nil {
            log.Fatal(err)
        }
        _ = client
    }
    ```
  </Tab>

  <Tab title="Environment Variables">
    ```bash theme={null}
    export ARIZE_API_KEY="your-api-key"
    export ARIZE_API_HOST="api.arize.com"
    ```

    ```go theme={null}
    package main

    import (
        "log"

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

    func main() {
        // Config fields default from ARIZE_* env vars during Resolve.
        client, err := arize.NewClient(arize.Config{})
        if err != nil {
            log.Fatal(err)
        }
        _ = client
    }
    ```
  </Tab>
</Tabs>

## Regions

Use `Config.Region` to point the client at a specific Arize deployment region. Setting `Region` overrides `APIHost`, `OTLPHost`, `FlightHost`, and `FlightPort`. `Region` is mutually exclusive with `SingleHost`/`SinglePort` and `BaseDomain`.

```go theme={null}
client, err := arize.NewClient(arize.Config{
    APIKey: "your-api-key",
    Region: arize.RegionUSCentral,
})
```

| Region Constant   | Identifier      |
| ----------------- | --------------- |
| `RegionUSCentral` | `us-central-1a` |
| `RegionEUWest`    | `eu-west-1a`    |
| `RegionCACentral` | `ca-central-1a` |
| `RegionUSEast`    | `us-east-1b`    |

## Error Handling

The SDK returns typed errors for non-2xx HTTP responses. Compare against typed errors with `errors.As` and against sentinel errors with `errors.Is`.

```go theme={null}
import (
    "context"
    "errors"
    "log"

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

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

    _, err = client.ResourceRestrictions.Restrict(context.Background(), resourcerestrictions.RestrictRequest{
        ResourceID: "your-project-id",
    })

    var notFound *arize.NotFoundError
    var unauthorized *arize.UnauthorizedError
    switch {
    case errors.As(err, &notFound):
        log.Printf("resource not found: %v", notFound)
    case errors.As(err, &unauthorized):
        log.Printf("unauthorized: %v", unauthorized)
    case err != nil:
        log.Fatal(err)
    }
}
```

Available typed errors (re-exported from the public `arize` package):

* `arize.APIError`
* `arize.BadRequestError`
* `arize.UnauthorizedError`
* `arize.ForbiddenError`
* `arize.NotFoundError`
* `arize.ConflictError`
* `arize.UnprocessableEntityError`
* `arize.RateLimitError`
* `arize.ServerError`
* `arize.ResourceNotFoundError`
* `arize.AmbiguousNameError`

Sentinel errors:

* `arize.ErrMissingAPIKey`
* `arize.ErrMultipleEndpointOverrides`

## Subclients

The `Client` exposes typed subclients as exported fields. Each subclient lives in its own package and is documented on its own page:

* [AI Integrations](/api-clients/go/version-2/client-resources/ai-integrations) - `client.AIIntegrations`
* [Annotation Configs](/api-clients/go/version-2/client-resources/annotation-configs) - `client.AnnotationConfigs`
* [Annotation Queues](/api-clients/go/version-2/client-resources/annotation-queues) - `client.AnnotationQueues`
* [API Keys](/api-clients/go/version-2/client-resources/api-keys) - `client.APIKeys`
* [Datasets](/api-clients/go/version-2/client-resources/datasets) - `client.Datasets`
* [Evaluators](/api-clients/go/version-2/client-resources/evaluators) - `client.Evaluators`
* [Experiments](/api-clients/go/version-2/client-resources/experiments) - `client.Experiments`
* [Organizations](/api-clients/go/version-2/client-resources/organizations) - `client.Organizations`
* [Projects](/api-clients/go/version-2/client-resources/projects) - `client.Projects`
* [Prompts](/api-clients/go/version-2/client-resources/prompts) - `client.Prompts`
* [Resource Restrictions](/api-clients/go/version-2/client-resources/resource-restrictions) - `client.ResourceRestrictions`
* [Role Bindings](/api-clients/go/version-2/client-resources/role-bindings) - `client.RoleBindings`
* [Roles](/api-clients/go/version-2/client-resources/roles) - `client.Roles`
* [Spaces](/api-clients/go/version-2/client-resources/spaces) - `client.Spaces`
* [Spans](/api-clients/go/version-2/client-resources/spans) - `client.Spans`
* [Tasks](/api-clients/go/version-2/client-resources/tasks) - `client.Tasks`
* [Users](/api-clients/go/version-2/client-resources/users) - `client.Users`

## Pre-Release API Warnings

Pre-release APIs (ALPHA and BETA) are actively evolving based on user feedback. The SDK emits a one-time warning via the standard `log` package the first time you call a pre-release endpoint:

```go theme={null}
client.ResourceRestrictions.Restrict(ctx, body)
// [ALPHA] resourcerestrictions.restrict is an alpha API and may change without notice.
```

Subsequent calls to the same endpoint do not re-emit the warning.

<Note>
  For detailed information about API version stages, stability guarantees, and recommendations, see [API Version Stages](/ax/rest-reference#api-version-stages) in the REST API reference.
</Note>
