---
title: "Install"
description: "One module, Go 1.24 and up, and nothing outside the standard library."
url: "https://openemail.uk/docs/go/install"
area: "Go"
category: "Getting started"
---

# Install

One module, Go 1.24 and up, and nothing outside the standard library.

## Install

> The current release is `0.0.1`. It has a method for every method of the TypeScript SDK, and the parity check of the module fails the build when one goes missing or sends a different request.

**Install**

_go get_

```bash
go get github.com/bfzli/openemail-go
```

**main.go**

```
package main

import (
	"context"
	"fmt"
	"log"

	"github.com/bfzli/openemail-go"
)

func main() {
	client := openemail.New()

	email, err := client.Emails.Send(context.Background(), openemail.Body{
		"from":    "Acme Billing <billing@acme.com>",
		"to":      "ada@example.com",
		"subject": "Your September invoice",
		"html":    "<p>Invoice attached.</p>",
	})
	if err != nil {
		log.Fatal(err)
	}

	fmt.Println(email.ID(), email.String("status"))
}
```

`openemail.New()` reads the key from `OPENEMAIL_API_KEY`, so the code holds no credential. Pass `openemail.WithAPIKey` when your configuration lives somewhere else. `New` never fails: a missing or malformed key is reported by `client.Err()` and by the first call.

A request body is an `openemail.Body`, a `map[string]any` whose keys keep the names of the API, so `scheduledAt` is written the same way here as in the API reference. A response is an `openemail.Object`, the decoded JSON with readers such as `ID`, `String`, `Int`, `Bool`, `Time` and `Object`.

> `Send` returning does not mean the message has gone. A scheduled or cancellable send comes back `queued` or `scheduled` and settles later. Read `status`, not the fact that the call returned.

## Where it runs

Go 1.24 and up, on every platform Go builds for. Requests go through `net/http`, so connections are reused and `HTTPS_PROXY` is honoured. A client is safe for concurrent use: build one when the program starts and share it between goroutines.

> The client carries a workspace API key that can send mail and read the mailbox, so it belongs on a server, in a job or in a tool that runs on your own machine. Keep the key in an environment variable or your framework’s secrets, never in code.
