Requirements
- Go 1.21 or higher
Installation
Setup
Get an API token
Obtain your API token from the Hatchet Cloud dashboard or your self-hosted Hatchet instance.The token is a JWT that embeds your tenant ID and server addresses so the SDK can read them automatically.
Set environment variables
Export your token so the SDK picks it up automatically:For self-hosted deployments, also set the host and port:
Initialize the client
Import the SDK and call
hatchet.NewClient(). The client reads HATCHET_CLIENT_TOKEN from the environment automatically:main.go
Environment variable reference
| Variable | Description | Default |
|---|---|---|
HATCHET_CLIENT_TOKEN | API token (required) | — |
HATCHET_CLIENT_HOST_PORT | gRPC server host and port | Read from token |
HATCHET_CLIENT_NAMESPACE | Namespace prefix for workflow and event names | "" |
The SDK validates that
HATCHET_CLIENT_TOKEN is a valid JWT. Tokens from the dashboard start with ey — if you see an error about the token format, make sure you are copying the full token value.