---
title: "Go SDK Authentication"
description: "Authenticate with the TraceRTM Go SDK"
keywords: [go, sdk, authentication, api keys, tokens]
---

# Go SDK Authentication

The TraceRTM Go SDK supports multiple authentication methods.

## API Key Authentication

```go
import "github.com/tracertm/tracertm-go"

client := tracertm.NewClient(
    tracertm.WithAPIKey("rtm_live_abc123..."),
)
```

## From Environment Variable

```go
import (
    "os"
    "github.com/tracertm/tracertm-go"
)

client := tracertm.NewClient(
    tracertm.WithAPIKey(os.Getenv("TRACERTM_API_KEY")),
)
```

## Token Authentication

```go
client := tracertm.NewClient(
    tracertm.WithAccessToken("eyJhbGciOiJSUzI1NiIs..."),
)
```

## Error Handling

```go
projects, err := client.Projects.List()
if err != nil {
    if tracertm.IsAuthError(err) {
        log.Fatal("Authentication failed")
    }
    log.Fatal(err)
}
```

## Next Steps

- [Artifacts](./04-artifacts) - Working with items
- [Examples](./06-examples) - Code examples
