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

# Go SDK

> The official Loops SDK for Go.

## Installation

Install the package with `go get`:

```bash theme={"dark"}
go get github.com/loops-so/loops-go
```

<Tip>
  You can install [Loops skills](/skills) to help your coding agents use the Loops CLI, API and SDKs to create campaigns, manage contacts, send events, and send transactional emails.
</Tip>

You will need a Loops API key to use the SDK.

In your Loops account, go to the [API Settings page](https://app.loops.so/settings?page=api) and click **Generate key**.

Copy this key and save it in your application code (for example as `LOOPS_API_KEY` in an environment variable).

## Usage

```go theme={"dark"}
package main

import (
	"log"

	loops "github.com/loops-so/loops-go"
)

func main() {
	client := loops.NewClient("YOUR_API_KEY")

	err := client.SendEvent(loops.SendEventRequest{
		Email:     "user@example.com",
		EventName: "signup",
		EventProperties: map[string]any{
			"plan": "pro",
		},
	})
	if err != nil {
		log.Fatal(err)
	}
}
```

API errors are returned as `*loops.APIError` with `StatusCode` and `Message`. See the [SDK README on GitHub](https://github.com/loops-so/loops-go) for error handling, retries, pagination, uploads, and the full method list.

See the API documentation to learn more about [rate limiting](/api-reference/intro#rate-limiting) and [error handling](/api-reference/intro#debugging).

<CardGroup>
  <Card title="pkg.go.dev reference" icon="golang" href="https://pkg.go.dev/github.com/loops-so/loops-go">
    Browse types, methods, and package documentation.
  </Card>

  <Card title="GitHub" icon="github" href="https://github.com/loops-so/loops-go">
    View the source code and release notes.
  </Card>

  <Card title="Loops API" icon="rectangle-terminal" href="/api-reference/intro">
    Read the Loops API reference.
  </Card>
</CardGroup>
