go-spaceship-sdk

module
v0.2.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 13, 2026 License: Apache-2.0

README ΒΆ

Go Spaceship SDK

Go Reference CI License

Go client for the Spaceship domain & DNS API.

Install

go get github.com/namecheap/go-spaceship-sdk

Usage

import "github.com/namecheap/go-spaceship-sdk/client"

c, err := client.NewClient("https://spaceship.dev/api/v1", apiKey, apiSecret)
if err != nil {
    log.Fatal(err)
}

// List domains
domains, err := c.GetDomainList(ctx)

// Add a DNS record
err = c.CreateDNSRecord(ctx, "example.com", client.DNSRecord{
    Type:    "A",
    Name:    "www",
    Address: "11.12.13.14",
    TTL:     3600,
})

Authentication uses the X-API-Key / X-API-Secret headers; credentials are created in the Spaceship API Manager. The library takes credentials explicitly β€” it does not read environment variables.

API coverage

The SDK implements Domains, DNS records, and Personal Nameservers. DNS records are managed in the custom group only (records owned by Spaceship products are read-only and left untouched); the create/upsert/delete methods do per-type validation for A, AAAA, ALIAS, CAA, CNAME, HTTPS, MX, NS, PTR, SRV, SVCB, TLSA, and TXT.

The table below maps every published Spaceship API endpoint to its status and the backing SDK method(s). Verified against the Spaceship API as of 2026-06-30 (SDK v0.1.0). See the client package reference for full method signatures and godoc.

Legend: βœ… implemented Β· 🚧 not yet implemented Β· β›” not available in API (endpoint returns HTTP 501).

Domains

Endpoint Status SDK method(s)
GET /domains βœ… GetDomainList
GET /domains/{domain} βœ… GetDomainInfo (falls back to the list endpoint on HTTP 429)
POST /domains/{domain} (register) 🚧 β€”
POST /domains/{domain}/renew 🚧 β€”
POST /domains/{domain}/restore 🚧 β€”
DELETE /domains/{domain} β›” β€”
PUT /domains/{domain}/autorenew βœ… UpdateAutoRenew
PUT /domains/{domain}/nameservers βœ… UpdateDomainNameServers
PUT /domains/{domain}/contacts 🚧 β€”
PUT /domains/{domain}/privacy/preference 🚧 β€”
PUT /domains/{domain}/privacy/email-protection-preference 🚧 β€”

Domain availability

Endpoint Status SDK method(s)
POST /domains/available (batch) 🚧 β€”
GET /domains/{domain}/available 🚧 β€”

Domain transfer

Endpoint Status SDK method(s)
POST /domains/{domain}/transfer 🚧 β€”
GET /domains/{domain}/transfer 🚧 β€”
GET /domains/{domain}/transfer/auth-code 🚧 β€”
PUT /domains/{domain}/transfer/lock 🚧 β€”

Personal nameservers

Endpoint Status SDK method(s)
GET /domains/{domain}/personal-nameservers βœ… ListPersonalNameservers, FindPersonalNameserver
PUT /domains/{domain}/personal-nameservers/{currentHost} βœ… UpsertPersonalNameserver
DELETE /domains/{domain}/personal-nameservers/{currentHost} βœ… DeletePersonalNameserver
GET /domains/{domain}/personal-nameservers/{currentHost} β›” β€”

DNS records

Endpoint Status SDK method(s)
GET /dns/records/{domain} βœ… GetDNSRecords, FindDNSRecord
PUT /dns/records/{domain} βœ… UpsertDNSRecords, CreateDNSRecord
DELETE /dns/records/{domain} βœ… DeleteDNSRecord, DeleteDNSRecords, ClearDNSRecords

Contacts

Endpoint Status SDK method(s)
PUT /contacts 🚧 β€”
GET /contacts/{contact} 🚧 β€”
PUT /contacts/attributes 🚧 β€”
GET /contacts/attributes/{contact} 🚧 β€”

Async operations

Endpoint Status SDK method(s)
GET /async-operations/{operationId} 🚧 β€”

SellerHub

Endpoint Status SDK method(s)
GET /sellerhub/domains 🚧 β€”
POST /sellerhub/domains 🚧 β€”
GET /sellerhub/domains/{domain} 🚧 β€”
PATCH /sellerhub/domains/{domain} 🚧 β€”
DELETE /sellerhub/domains/{domain} 🚧 β€”
GET /sellerhub/domains/reports/sold 🚧 β€”
GET /sellerhub/domains/verification-records 🚧 β€”
POST /sellerhub/checkout-links 🚧 β€”

Testing

Unit tests run with no credentials and are what CI executes:

make test

The SDK also ships live acceptance tests (TestAcc*) that exercise the real Spaceship API. They are skipped unless credentials are set, and the DNS tests create and delete records on a real domain. Copy .env.example to .env and fill it in β€” make testacc loads .env automatically:

cp .env.example .env   # then set SPACESHIP_API_KEY, SPACESHIP_API_SECRET, SPACESHIP_TEST_DOMAIN
make testacc

Exporting the same variables in your shell works too. SPACESHIP_TEST_DOMAIN is required only for the DNS tests; without it they skip rather than fail.

⚠️ Acceptance tests mutate real DNS records on SPACESHIP_TEST_DOMAIN. Point them at a throwaway domain you control, never a production domain.

See CONTRIBUTING.md for the full test strategy.

Contributing

See CONTRIBUTING.md for the development workflow, test layers, commit conventions, and DCO sign-off.

Security

See SECURITY.md for how to report a vulnerability.

License

Apache 2.0 β€” see LICENSE.

Directories ΒΆ

Path Synopsis
Package client is a Go SDK for the Spaceship domain & DNS API.
Package client is a Go SDK for the Spaceship domain & DNS API.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL