Go SDK

Last updated February 19, 2026

Installation

go get github.com/administrate-dev/administrate-go-sdk

Requires Go 1.22 or later. Zero external dependencies — stdlib only.

Authentication

Create an API key in Settings > Developers, then pass it when initializing the client:

import administrate "github.com/administrate-dev/administrate-go-sdk"

client, err := administrate.NewClient("sk_live_...")

Quick start

ctx := context.Background()

// Get account info
account, err := client.Account.Get(ctx)
fmt.Println(account.Name, account.Plan)

// List all companies with auto-pagination
iter := client.Companies.List(ctx, nil)
for iter.Next() {
    c := iter.Value()
    fmt.Println(c.Name, c.N8NInstancesCount)
}

// Get failed executions
execIter := client.Executions.List(ctx, &administrate.ExecutionListParams{
    ErrorsOnly: administrate.Bool(true),
})
for execIter.Next() {
    ex := execIter.Value()
    fmt.Printf("%s: %s\n", ex.WorkflowName, *ex.ErrorCategory)
}

Configuration

client, err := administrate.NewClient(
    "sk_live_...",
    administrate.WithTimeout(10 * time.Second),
    administrate.WithMaxRetries(5),
)

You can also pass a custom *http.Client for full control over the HTTP layer (proxies, custom TLS, etc.):

client, err := administrate.NewClient("sk_live_...", administrate.WithHTTPClient(httpClient))

Common operations

Monitor failing workflows

iter := client.Executions.List(ctx, &administrate.ExecutionListParams{
    Status:    administrate.String("failed"),
    StartDate: administrate.String("2026-01-01"),
    EndDate:   administrate.String("2026-01-31"),
})
for iter.Next() {
    ex := iter.Value()
    fmt.Printf("%s: %s\n", ex.WorkflowName, *ex.ErrorCategory)
}

Trigger a sync

result, err := client.Instances.Sync(ctx, "n8n_abc123", &administrate.InstanceSyncParams{
    SyncType: administrate.String("all"),
})

Check sync health

entries, err := client.SyncRuns.Health(ctx)
for _, entry := range entries {
    fmt.Println(entry.InstanceName, entry.SyncStatus)
}

Track LLM costs

costs, err := client.LLMCosts.Summary(ctx, nil)
fmt.Printf("Total: $%.2f\n", float64(costs.Data.Summary.TotalCostCents)/100)

Pagination

All .List() methods return an Iterator[T] that handles pagination automatically:

// Auto-paginate through all results
for iter := client.Companies.List(ctx, nil); iter.Next(); {
    fmt.Println(iter.Value().Name)
}

// Collect all results into a slice
companies, err := client.Companies.List(ctx, nil).Collect()

Error handling

The SDK returns typed errors compatible with errors.As():

import "errors"

company, err := client.Companies.Get(ctx, "com_nonexistent")
if err != nil {
    var notFound *administrate.NotFoundError
    var authErr *administrate.AuthenticationError
    var rateLimited *administrate.RateLimitError

    switch {
    case errors.As(err, &notFound):
        fmt.Printf("Not found: %s\n", notFound.Message)
    case errors.As(err, &authErr):
        fmt.Println("Invalid API key")
    case errors.As(err, &rateLimited):
        fmt.Printf("Rate limited. Retry after %v\n", rateLimited.RetryAfter)
    }
}

Retries

The SDK automatically retries failed requests with exponential backoff for 429, 5xx, connection errors, and timeouts. Default: 3 retries.

client, err := administrate.NewClient("sk_live_...", administrate.WithMaxRetries(0)) // disable retries

Links

Still need help?

Can't find what you're looking for? Get in touch with our support team.