domainkits

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2026 License: MIT Imports: 9 Imported by: 0

README

domainkits-sdk-go

Go client for the DomainKits REST API.

DomainKits is one API with a shared key across every endpoint. This package covers all of them, six domain search types, WHOIS, DNS, reverse nameserver, Certificate Transparency, safety, trends and bulk download, with automatic paging and rate-limit aware retries. 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{
		"keyword":  "shop",
		"tld":      "com",
		"reg_date": "2026-07-10",
		"no_number": "true",
	})
	if err != nil {
		panic(err)
	}

	fmt.Printf("%d matches\n", result.Total)
	for _, d := range result.Data {
		fmt.Println(d.Domain, d.RegisteredDate, d.ExpiryDate)
	}
}
Paging

A single request returns at most 500 results. Paginate walks the whole result set; return false from the callback to stop early:

err := dk.Paginate(ctx, "nrds", domainkits.Params{"keyword": "shop", "tld": "com"}, func(d domainkits.Domain) bool {
	fmt.Println(d.Domain)
	return true
})
Export

Export pulls up to 50,000 rows as CSV in one request:

csv, err := dk.Export(ctx, "expired", domainkits.Params{"tld": "com", "status": "pending_delete"})

This runs on a separate, much smaller quota, 10 per day and 100 per month on Premium, 3 and 9 during the trial. It is for occasional bulk pulls, not for a scheduled job.

Search types

Method What it searches
NRDs Newly registered domains, last 60 days
Expired Domains in the deletion cycle: expired, redemption, pending delete
Aged Domains with 5 to 20+ years of registration history
Active Currently registered domains
Deleted Dropped domains (requires keyword)
Market Domains listed for sale on marketplaces

Filters are passed as Params and match the REST parameter names. length and age_range accept a preset band (5-10), an exact value (10), or a range (8-12). reg_date accepts a day, month, year, or from:to range.

Other endpoints

dk.Whois(ctx, "example.com")
dk.DNS(ctx, "example.com")
dk.Safety(ctx, "example.com")
dk.NSReverse(ctx, "ns1.example.com", domainkits.Params{"tld": "com"})
dk.TLDCheck(ctx, "yourbrand", nil)
dk.Typosquat(ctx, "example.com", nil)
dk.IPLookup(ctx, "8.8.8.8")
dk.Registrar(ctx, "godaddy")
dk.StatusGuide(ctx, "clientHold")
dk.MonitorChanges(ctx, domainkits.Params{"tld": "com", "reason": "transfer"})
dk.CTSubdomains(ctx, "example.com", nil)
dk.CTCerts(ctx, domainkits.Params{"domain": "example.com"})
dk.CTSearch(ctx, "example", nil)
dk.TLDTrends(ctx, "newly", domainkits.Params{"tld": "com"})
dk.KeywordTrends(ctx, "hot", nil)
dk.Usage(ctx)
dk.SearchStatus(ctx)

Coverage

gTLDs only for the domain search endpoints. The index covers generic TLDs: .com, .net, .org, .info, .biz, .xyz, .online, .site, .top, .club, .live, .app, .dev and others. Country-code TLDs are not indexed: a query for .de, .io, .co or .us returns an empty result set, not an error.

Whois, DNS, Safety, IPLookup and the Certificate Transparency endpoints work on any domain, ccTLDs included.

No PII. Responses contain no personal data. WHOIS results are limited to registrar, dates, status codes and nameservers; registrant names, emails, addresses and phone numbers are not returned.

Errors

result, err := dk.Expired(ctx, domainkits.Params{"tld": "com"})
if err != nil {
	var apiErr *domainkits.APIError
	if errors.As(err, &apiErr) {
		if apiErr.IsRateLimit() {
			fmt.Println("quota exhausted, retry in", apiErr.RetryAfter())
		}
		fmt.Println(apiErr.Status, apiErr.Message, apiErr.RateLimit)
	}
}

Every error carries the x-ratelimit-limit, x-ratelimit-remaining and x-ratelimit-reset values as a parsed RateLimit. 429 and 5xx responses are retried automatically, twice by default, waiting until the rate-limit window resets when that is under two minutes. Set MaxRetries to 0 to handle it yourself.

Options

dk := domainkits.New(os.Getenv("DOMAINKITS_API_KEY"))
dk.BaseURL = "https://premium-api.domainkits.com/api/v1"
dk.MaxRetries = 2
dk.HTTPClient = &http.Client{Timeout: 60 * time.Second}

Quotas

Call Usage for the live picture on your account; every endpoint reports its own per-minute, daily and monthly allowance alongside what you have already spent.

Daily quotas reset at 00:00 UTC, monthly quotas on the 1st. Current limits: domainkits.com/dev/api-docs.

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) (map[string]any, 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) NSReverse

func (c *Client) NSReverse(ctx context.Context, ns string, params Params) ([]string, int, 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) (map[string]any, 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) (map[string]any, 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"`
	RegisteredDate string `json:"registered_date,omitempty"`
	ExpiryDate     string `json:"expiry_date,omitempty"`
	Age            int    `json:"age,omitempty"`
	Status         string `json:"status,omitempty"`
	Marketplace    string `json:"marketplace,omitempty"`
	TLD            string `json:"tld,omitempty"`
	TLDCount       int    `json:"tld_count,omitempty"`
}

type ListResult

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

type Params

type Params map[string]string

type RateLimit

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

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