domainkits

package module
v0.3.9 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2026 License: MIT Imports: 9 Imported by: 0

README

domainkits-sdk-go

Go client for the DomainKits REST API.

This is the official Go SDK for the DomainKits API, published and maintained by the DomainKits team. DomainKits is built and operated by Lyalpha GmbH, with domain data and infrastructure provided by ABTdomain, our domain intelligence and data aggregation platform. This repository is hosted under the ABTdomain GitHub organisation. Learn more about the relationship at domainkits.com/about.

Every parameter, response field and current limit is documented in the API reference and the OpenAPI spec. This README only lists what the SDK covers. No dependencies outside the standard library.

Requirements

The REST API is for Premium and Platinum accounts; unauthenticated requests are rejected with 401. Keys start with dk_ and come from domainkits.com.

Install

go get github.com/ABTdomain/domainkits-sdk-go

Usage

package main

import (
	"context"
	"fmt"
	"os"

	domainkits "github.com/ABTdomain/domainkits-sdk-go"
)

func main() {
	dk := domainkits.New(os.Getenv("DOMAINKITS_API_KEY"))

	result, err := dk.NRDs(context.Background(), domainkits.Params{
		"query": "shop",
		"tld":   "com",
	})
	if err != nil {
		panic(err)
	}
	fmt.Println(result.Total, "matches")
	for _, d := range result.Data {
		fmt.Println(d.Domain, d.Created)
	}
}

Filters are passed as Params with the REST parameter names, verbatim.

Endpoints

Search, each returning *SearchResult; Paginate and Export take the resource name as a string ("nrds", "expired", ...):

Method Endpoint
Expired /search/expired
NRDs /search/nrds
NRDsLive /search/nrds-live
Aged /search/aged
Active /search/active
Deleted /search/deleted
Market /search/market

Lookups and reports:

Method Endpoint
Whois /whois
DNS /dns
Safety /safety
IPLookup /ip-lookup
Registrar /registrar
StatusGuide /status-guide
TLDCheck /tld-check
Typosquat /typosquat
NSReverse /ns-reverse
MonitorChanges /monitor/changes
CTSubdomains /ct/subdomains
CTCerts /ct/certs
CTSearch /ct/search
TLDTrends /trends/tlds/*
KeywordTrends /trends/keywords/*
NRDsDownload /nrds/download
Usage /usage
SearchStatus /search/status
Health /health

IPLookup returns *IPInfo, Registrar returns *RegistrarResult and takes Params for paging, StatusGuide returns []EPPStatus, NSReverse returns *NSReverseResult. The rest return *ListResult or map[string]any.

The API reference is the authority on every filter, field and limit.

No PII. Responses contain no registrant personal data.

Errors

Failures come back as *APIError with Status, Message and the rate-limit headers. IsRateLimit(), IsAuth() and RetryAfter() cover the usual branches; the client retries 429 and 5xx responses on its own up to MaxRetries before returning the error.

result, err := dk.Expired(ctx, domainkits.Params{"tld": "com"})
if err != nil {
	var apiErr *domainkits.APIError
	if errors.As(err, &apiErr) && apiErr.IsRateLimit() {
		time.Sleep(apiErr.RetryAfter())
	}
}

Options

dk := domainkits.New("dk_...")
dk.BaseURL = domainkits.DefaultBaseURL
dk.HTTPClient = &http.Client{Timeout: 60 * time.Second}
dk.MaxRetries = 2

Resources

License

MIT

Documentation

Index

Constants

View Source
const (
	DefaultBaseURL = "https://premium-api.domainkits.com/api/v1"
	MaxLimit       = 500
)

Variables

This section is empty.

Functions

This section is empty.

Types

type APIError

type APIError struct {
	Status    int
	Message   string
	RateLimit RateLimit
}

func (*APIError) Error

func (e *APIError) Error() string

func (*APIError) IsAuth

func (e *APIError) IsAuth() bool

func (*APIError) IsRateLimit

func (e *APIError) IsRateLimit() bool

func (*APIError) RetryAfter

func (e *APIError) RetryAfter() time.Duration

type Client

type Client struct {
	APIKey     string
	BaseURL    string
	HTTPClient *http.Client
	MaxRetries int
}

func New

func New(apiKey string) *Client

func (*Client) Active

func (c *Client) Active(ctx context.Context, params Params) (*SearchResult, error)

func (*Client) Aged

func (c *Client) Aged(ctx context.Context, params Params) (*SearchResult, error)

func (*Client) CTCerts

func (c *Client) CTCerts(ctx context.Context, params Params) (*ListResult, error)

func (*Client) CTSearch

func (c *Client) CTSearch(ctx context.Context, keyword string, params Params) (*ListResult, error)

func (*Client) CTSubdomains

func (c *Client) CTSubdomains(ctx context.Context, domain string, params Params) (*ListResult, error)

func (*Client) DNS

func (c *Client) DNS(ctx context.Context, domain string) (map[string]any, error)

func (*Client) Deleted

func (c *Client) Deleted(ctx context.Context, params Params) (*SearchResult, error)

func (*Client) Expired

func (c *Client) Expired(ctx context.Context, params Params) (*SearchResult, error)

func (*Client) Export

func (c *Client) Export(ctx context.Context, resource string, params Params) ([]byte, error)

func (*Client) Health

func (c *Client) Health(ctx context.Context) (map[string]any, error)

func (*Client) IPLookup

func (c *Client) IPLookup(ctx context.Context, query string) (*IPInfo, error)

func (*Client) KeywordTrends

func (c *Client) KeywordTrends(ctx context.Context, trendType string, params Params) ([]map[string]any, error)

func (*Client) Market

func (c *Client) Market(ctx context.Context, params Params) (*SearchResult, error)

func (*Client) MonitorChanges

func (c *Client) MonitorChanges(ctx context.Context, params Params) (*ListResult, error)

func (*Client) NRDs

func (c *Client) NRDs(ctx context.Context, params Params) (*SearchResult, error)

func (*Client) NRDsDownload

func (c *Client) NRDsDownload(ctx context.Context, params Params) ([]byte, error)

func (*Client) NRDsLive added in v0.3.5

func (c *Client) NRDsLive(ctx context.Context, params Params) (*SearchResult, error)

func (*Client) NSReverse

func (c *Client) NSReverse(ctx context.Context, ns string, params Params) (*NSReverseResult, error)

func (*Client) Object

func (c *Client) Object(ctx context.Context, path string, params Params) (map[string]any, error)

func (*Client) Paginate

func (c *Client) Paginate(ctx context.Context, resource string, params Params, fn func(Domain) bool) error

func (*Client) Registrar

func (c *Client) Registrar(ctx context.Context, query string, params Params) (*RegistrarResult, error)

func (*Client) RequestRaw

func (c *Client) RequestRaw(ctx context.Context, path string, params Params) ([]byte, http.Header, error)

func (*Client) Safety

func (c *Client) Safety(ctx context.Context, domain string) (map[string]any, error)

func (*Client) SearchStatus

func (c *Client) SearchStatus(ctx context.Context) (map[string]any, error)

func (*Client) StatusGuide

func (c *Client) StatusGuide(ctx context.Context, query string) ([]EPPStatus, error)

func (*Client) TLDCheck

func (c *Client) TLDCheck(ctx context.Context, prefix string, params Params) (map[string]any, error)

func (*Client) TLDTrends

func (c *Client) TLDTrends(ctx context.Context, trendType string, params Params) ([]map[string]any, error)

func (*Client) Typosquat

func (c *Client) Typosquat(ctx context.Context, domain string, params Params) (*ListResult, error)

func (*Client) Usage

func (c *Client) Usage(ctx context.Context) (map[string]any, error)

func (*Client) Whois

func (c *Client) Whois(ctx context.Context, domain string) (map[string]any, error)

type Domain

type Domain struct {
	Domain      string   `json:"domain"`
	TLD         string   `json:"tld,omitempty"`
	Created     string   `json:"created,omitempty"`
	Expires     string   `json:"expires,omitempty"`
	Period      int      `json:"period,omitempty"`
	Age         int      `json:"age,omitempty"`
	Length      int      `json:"length,omitempty"`
	Components  []string `json:"components,omitempty"`
	ForSale     string   `json:"for_sale,omitempty"`
	Platform    string   `json:"platform,omitempty"`
	ListedDays  *int     `json:"listed_days,omitempty"`
	Status      string   `json:"status,omitempty"`
	AuctionDate string   `json:"auction_date,omitempty"`
	FoundDate   string   `json:"found_date,omitempty"`
	Category    string   `json:"category,omitempty"`
	Majestic    *int     `json:"majestic,omitempty"`
	Backlinks   *int     `json:"backlinks,omitempty"`
	Hold        string   `json:"hold,omitempty"`
	RegYear     string   `json:"reg_year,omitempty"`
	ExpYear     string   `json:"exp_year,omitempty"`
	TLDCount    int      `json:"tld_count,omitempty"`
	Live        *bool    `json:"live,omitempty"`
}

type EPPStatus added in v0.3.9

type EPPStatus struct {
	Status          string   `json:"status"`
	Aliases         []string `json:"aliases"`
	Category        string   `json:"category"`
	Description     string   `json:"description"`
	Action          string   `json:"action"`
	Severity        string   `json:"severity"`
	PossibleReasons string   `json:"possible_reasons"`
}

type IPInfo added in v0.3.9

type IPInfo struct {
	IP             string   `json:"ip"`
	Type           string   `json:"type"`
	ASN            *int     `json:"asn"`
	ASOrganization string   `json:"as_organization"`
	Continent      string   `json:"continent"`
	ContinentCode  string   `json:"continent_code"`
	Country        string   `json:"country"`
	CountryCode    string   `json:"country_code"`
	IsEU           bool     `json:"is_eu"`
	Region         string   `json:"region"`
	RegionCode     string   `json:"region_code"`
	City           string   `json:"city"`
	Postal         string   `json:"postal"`
	Latitude       *float64 `json:"latitude"`
	Longitude      *float64 `json:"longitude"`
	Timezone       string   `json:"timezone"`
}

type ListResult

type ListResult struct {
	Data  []map[string]any
	Total int
}

type NSDomain added in v0.3.5

type NSDomain struct {
	Domain string `json:"domain"`
	TLD    string `json:"tld"`
	Length int    `json:"length"`
}

type NSReverseResult added in v0.3.5

type NSReverseResult struct {
	Data    []NSDomain
	Total   int
	NSTotal int
}

type Params

type Params map[string]string

type RateLimit

type RateLimit struct {
	Limit     int
	Remaining int
	ResetAt   time.Time
}

type RegistrarRecord added in v0.3.9

type RegistrarRecord struct {
	ID          string `json:"id"`
	Name        string `json:"name"`
	Status      string `json:"status"`
	RdapURL     string `json:"rdap_url"`
	IsDropCatch bool   `json:"is_drop_catch"`
	ParentID    string `json:"parent_id"`
	ParentName  string `json:"parent_name"`
	Country     string `json:"country"`
	Contact     string `json:"contact"`
	Website     string `json:"website"`
	Address     string `json:"address"`
	Phone       string `json:"phone"`
	Email       string `json:"email"`
	RdapFetched bool   `json:"rdap_fetched"`
}

type RegistrarResult added in v0.3.9

type RegistrarResult struct {
	Data   []RegistrarRecord
	Total  int
	Limit  int
	Offset int
}

type SearchResult

type SearchResult struct {
	Data  []Domain
	Total int
}

Jump to

Keyboard shortcuts

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