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

# Annotation Configs

> List, get, create, and delete annotation configs (categorical, continuous, freeform) using the Arize Go SDK.

<Note>
  The `annotationconfigs` client methods are currently in **ALPHA**. The API may change without notice. A one-time warning is emitted on first use.
</Note>

An annotation config defines the shape of human annotations attached to spans or dataset examples. Each config is one of three types: `categorical` (a fixed set of labels), `continuous` (a numeric score range), or `freeform` (open text). The `Get` and `Delete` methods accept either a config name or an ID — when a name is passed, the parent `Space` (name or ID) is also required.

## List Annotation Configs

`List` returns a paginated list of annotation configs. `Space`, when non-empty, filters configs to a single space.

**Signature:**

```go theme={null}
func (c *Client) List(ctx context.Context, req ListRequest) (*AnnotationConfigList, error)
```

**Usage Example:**

```go theme={null}
package main

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

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

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

    resp, err := client.AnnotationConfigs.List(context.Background(), annotationconfigs.ListRequest{
        Space: "your-space-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 _, ac := range resp.AnnotationConfigs {
        if d, err := ac.Discriminator(); err == nil {
            fmt.Printf("annotation config (type=%s)\n", d)
        }
    }
}
```

## Get an Annotation Config

`Get` returns a single annotation config, resolving by name or ID. The returned `AnnotationConfig` is a discriminated union — call `ac.AsCategoricalAnnotationConfig()`, `AsContinuousAnnotationConfig()`, or `AsFreeformAnnotationConfig()` to extract the typed variant after checking the discriminator.

**Signature:**

```go theme={null}
func (c *Client) Get(ctx context.Context, req GetRequest) (*AnnotationConfig, error)
```

**Usage Example:**

```go theme={null}
package main

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

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

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

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

    if d, err := ac.Discriminator(); err == nil && d == string(annotationconfigs.AnnotationConfigTypeCategorical) {
        cat, err := ac.AsCategoricalAnnotationConfig()
        if err != nil {
            log.Fatal(err)
        }
        fmt.Printf("categorical %s with %d values\n", cat.Name, len(cat.Values))
    }
}
```

## Create an Annotation Config

`Create` creates a new annotation config, resolving the parent space by name or ID. The annotation config body is a discriminated union — set `Type` to one of `AnnotationConfigTypeCategorical`, `AnnotationConfigTypeContinuous`, or `AnnotationConfigTypeFreeform`, then fill the matching type-specific fields:

* `Categorical`: `Values` is required.
* `Continuous`: `MinimumScore` and `MaximumScore` are required.
* `Freeform`: no extra fields.

**Signature:**

```go theme={null}
func (c *Client) Create(ctx context.Context, req CreateRequest) (*AnnotationConfig, error)
```

**Usage Example:**

```go theme={null}
package main

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

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

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

    ac, err := client.AnnotationConfigs.Create(
        context.Background(),
        annotationconfigs.CreateRequest{
            Space: "your-space-name-or-id",
            Name:  "quality",
            Type:  annotationconfigs.AnnotationConfigTypeCategorical,
            Values: []annotationconfigs.CategoricalAnnotationValue{
                {Label: "correct"},
                {Label: "incorrect"},
            },
        },
    )
    if err != nil {
        var conflict *arize.ConflictError
        if errors.As(err, &conflict) {
            log.Fatalf("annotation config already exists: %v", conflict)
        }
        log.Fatal(err)
    }

    if cat, err := ac.AsCategoricalAnnotationConfig(); err == nil {
        fmt.Printf("created annotation config %s\n", cat.Name)
    }
}
```

## Delete an Annotation Config

`Delete` removes an annotation config, resolving by name or ID. It returns only an error.

**Signature:**

```go theme={null}
func (c *Client) Delete(ctx context.Context, req DeleteRequest) error
```

**Usage Example:**

```go theme={null}
package main

import (
    "context"
    "errors"
    "log"

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

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

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