> ## Documentation Index
> Fetch the complete documentation index at: https://clumio.reclear.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Use the Go SDK

> Typed Go client for the Clumio API, with controllers and models for every resource.

`clumio-go-sdk` is a typed Go client for the Clumio REST API. It ships controllers for each resource
group and a models package holding the request and response types.

Requires Go 1.20 or later.

## Install

```bash theme={null}
go get github.com/clumio-code/clumio-go-sdk
```

## Authenticate

```go theme={null}
import (
    "fmt"
    "log"

    "github.com/clumio-code/clumio-go-sdk/config"
    "github.com/clumio-code/clumio-go-sdk/controllers"
)

cfg := config.Config{
    Token:   "<your_api_token>",
    BaseUrl: "<base_url>",
}

client := controllers.NewPolicyDefinitionsV1(cfg)
```

`BaseUrl` must match the control plane that issued the token. See
[Authentication](/developer-tools/authentication).

## Use it

```go theme={null}
resp, err := client.ListPolicyDefinitions(nil, nil)
if err != nil {
    log.Fatalf("list policies: %v", err)
}

fmt.Println(resp)
```

<AccordionGroup>
  <Accordion title="Package layout">
    | Package       | Contains                                                     |
    | ------------- | ------------------------------------------------------------ |
    | `config`      | Token, base URL and HTTP client configuration                |
    | `controllers` | One controller per resource group; the entry points you call |
    | `models`      | Request and response types shared across controllers         |
  </Accordion>

  <Accordion title="Response envelopes">
    List responses follow the HAL convention the API uses, so items sit under an embedded collection
    alongside the pagination links. Read the links rather than constructing page offsets yourself.
  </Accordion>

  <Accordion title="Errors">
    Controllers return a standard Go `error` alongside the response. Check it before dereferencing the
    response.
  </Accordion>
</AccordionGroup>

## Next

<CardGroup cols={2}>
  <Card title="REST API reference" icon="square-terminal" href="https://api.commvault.com/docs/latest/api/cv/ClumioAPIs/clumio-rest-api/" arrow>
    The endpoint-level reference behind every controller method.
  </Card>

  <Card title="Source and issues" icon="github" href="https://github.com/clumio-code/clumio-go-sdk" arrow>
    Read the code, report a bug, or open a pull request.
  </Card>
</CardGroup>
