AstroWay/api v2.325.2 · sdks
all systems operational
// sdk · Go

Go SDK for the AstroWay API

The official AstroWay Go module: every API endpoint as a method, such as aw.Chart.Compute, with a context on every call. Retries on 408/409/429/5xx honour Retry-After, and a POST keeps one Idempotency-Key, so a retried call is not charged twice. Errors are tested with errors.Is, and the response decodes into your own type. Standard library only, Go 1.22+.

// 01 / install

Install

go get github.com/astroway/astroway-go

import: astroway "github.com/astroway/astroway-go"

// 02 / highlights

Highlights

// 03 / first request

Make your first request

package main

import (
    "context"
    "fmt"
    "log"
    "os"

    astroway "github.com/astroway/astroway-go"
)

func main() {
    aw := astroway.New(os.Getenv("ASTROWAY_API_KEY"))

    res, err := aw.Chart.Compute(context.Background(), map[string]any{
        "date": "1990-07-14", "time": "14:30:00", "timezoneOffset": 3,
        "latitude": 50.4501, "longitude": 30.5234, "houseSystem": "P",
    })
    if err != nil {
        log.Fatal(err)
    }

    var chart struct {
        Houses struct {
            Ascendant float64 `json:"ascendant"`
        } `json:"houses"`
    }
    if err := res.Decode(&chart); err != nil {
        log.Fatal(err)
    }
    fmt.Println(chart.Houses.Ascendant) // 212.0952574979425
}

Start building with Go

10,000 credits free per month. Open-source SDK, generated from OpenAPI 3.1, always in sync with the backend.

99.9% SLA · paid plans · 30d status →