DEV Community

Arnaud DE SAINT JEAN
Arnaud DE SAINT JEAN

Posted on

Building a Better Way to Track Domain Prices: My Journey Creating TLDSpy API

Hey everyone,

I wanted to share a side project I've been working on, something born out of my own frustration and, hopefully, something that might be useful to others here in the dev community.

The Backstory: A Domain Portfolio Manager Needs Accurate Data

I'm building a domain portfolio manager (it's still a work in progress!). As part of that project, I needed a reliable source of domain pricing data, specifically for comparing prices across different registrars. I was surprised at how difficult it was to find something that met my needs. Scraping was a nightmare (constantly breaking!), existing APIs were either incomplete, provided wrong data, or didn't offer the specific endpoints I was looking for.

So, like any indie hacker, I decided to build my own. That's how TLDSpy API came to life. I've now decided to make this stand-alone and provide this as a service.

TLDSpy API: What It Does

TLDSpy API is designed to provide accurate and comprehensive domain pricing and information. Here's a quick overview of what it offers:

  • Price Comparison: Compare registration, renewal, and transfer prices across multiple registrars.
  • Domain Info: Access WHOIS, DNS, SSL, and domain status data.
  • Price History Tracking: Since February 2025 for historical insights.

A Little Technical Dive: Getting Started

The API is pretty straightforward to use. Here's an example of how you can find the cheapest registrars for a .com domain using curl:

curl -X GET "https://api.tldspy.com/api/v1/prices/cheapest?tlds=com&limit=3"
-H "X-API-Key: YOUR_API_KEY"
Enter fullscreen mode Exit fullscreen mode

This returns a JSON response like this:

{
  "results": {
    "com": {
      "registrar_count": 42,
      "avg_prices": {
        "register": 12.99,
        "renew": 14.99,
        "transfer": 12.99
      },
      "cheapest_register": [
        {
          "rank": 1,
          "registrar_name": "Cloudflare",
          "register_price": 8.57,
          "renew_price": 8.57,
          "transfer_price": 8.57,
          "total_cost_1_year": 8.57,
          "total_cost_3_year": 25.71,
          "total_cost_5_year": 42.85
        },
        {
          "rank": 2,
          "registrar_name": "Porkbun",
          "register_price": 8.88,
          "renew_price": 9.48,
          "transfer_price": 8.88,
          "total_cost_1_year": 8.88,
          "total_cost_3_year": 27.84,
          "total_cost_5_year": 46.80
        }
      ]
    }
  }
}
Enter fullscreen mode Exit fullscreen mode

Here's another example to compare registrar prices for multiple TLDs:

curl -X GET "https://api.tldspy.com/api/v1/prices?tlds=com,net,org&registrars=namecheap,cloudflare" \
  -H "X-API-Key: YOUR_API_KEY"
Enter fullscreen mode Exit fullscreen mode

This call would give you a JSON response like this:

{
  "results": {
    "com": {
      "namecheap": {
        "register_price": 9.99,
        "renew_price": 12.99,
        "transfer_price": 9.99,
        "last_updated": "2024-01-15T10:30:00Z"
      },
      "cloudflare": {
        "register_price": 8.57,
        "renew_price": 8.57,
        "transfer_price": 8.57,
        "last_updated": "2024-01-16T12:00:00Z"
      }
    },
    "net": {
      "namecheap": {
        "register_price": 11.99,
        "renew_price": 14.99,
        "transfer_price": 11.99,
        "last_updated": "2024-01-15T10:30:00Z"
      },
      "cloudflare": null
    },
    "org": {
      "namecheap": {
        "register_price": 10.99,
        "renew_price": 13.99,
        "transfer_price": 10.99,
        "last_updated": "2024-01-15T10:30:00Z"
      },
      "cloudflare": null
    }
  },
  "stats": {
    "total_tlds": 3,
    "time_elapsed": "2.186208ms",
    "last_updated": "2024-01-16T12:00:00Z"
  },
  "unsupported_registrars": [],
  "meta": {
    "restricted_tlds": [],
    "upgrade_message": null
  }
}
Enter fullscreen mode Exit fullscreen mode

For those needing to perform bulk lookups, the API offers a batch domain lookup endpoint. Here's an example of how to check WHOIS and SSL information for multiple domains:

curl -X POST "https://api.tldspy.com/api/v1/domains" \
  -H "Content-Type: application/json" \
  -H "X-API-Key: YOUR_API_KEY" \
  -d '{
    "domains": ["example.com", "example.net"],
    "options": {
      "whois": true,
      "ssl": true
    }
  }'
Enter fullscreen mode Exit fullscreen mode
{
  "results": {
    "example.com": {
      "domain": "example.com",
      "whois": {
        "domain": "example.com",
        "registrar": "Namecheap, Inc.",
        "registrar_key": "namecheap",
        "registrar_iana_id": "1068",
        "registrar_url": "https://www.namecheap.com",
        "creation_date": "1995-03-16T05:00:00Z",
        "expiry_date": "2025-03-17T05:00:00Z",
        "last_updated": "2024-02-28T14:48:12Z",
        "status": [
          "clientTransferProhibited"
        ],
        "nameservers": [
          "ns1.example.com",
          "ns2.example.com"
        ],
        "source_library": "whois-go",
        "is_available": false
      },
      "dns": {
        "a_records": [
          "93.184.216.34"
        ],
        "aaaa_records": [
          "2606:2800:220:1:248:1893:25c8:1946"
        ],
        "mx_records": [
          "10 mail.example.com"
        ],
        "txt_records": [
          "v=spf1 -all"
        ],
        "ns_records": [
          "ns1.example.com",
          "ns2.example.com"
        ],
        "cname_records": [
          "www.example.com"
        ],
        "dnssec": {
          "enabled": true,
          "ds_records": [
            "12345 13 2 ABCDEF123456789..."
          ]
        }
      },
      "ssl": {
        "valid": true,
        "issuer": "DigiCert Inc",
        "subject": "example.com",
        "version": "3",
        "serial_number": "0123456789ABCDEF",
        "not_before": "2024-01-01T00:00:00Z",
        "not_after": "2025-01-01T23:59:59Z",
        "san_list": [
          "example.com",
          "www.example.com"
        ]
      },
      "status": {
        "available": true,
        "status_code": 200,
        "response_time_ms": 245,
        "protocol": "https",
        "checked_at": "2024-01-15T10:30:00Z",
        "error": null
      },
      "available": false,
      "errors": null
    },
    "example.net": {
      "domain": "example.net",
      "whois": {
        "domain": "example.net",
        "registrar": "Namecheap, Inc.",
        "registrar_key": "namecheap",
        "registrar_iana_id": "1068",
        "registrar_url": "https://www.namecheap.com",
        "creation_date": "1997-01-29T05:00:00Z",
        "expiry_date": "2025-01-30T05:00:00Z",
        "last_updated": "2024-02-28T14:48:12Z",
        "status": [
          "clientTransferProhibited"
        ],
        "nameservers": [
          "ns1.example.net",
          "ns2.example.net"
        ],
        "source_library": "whois-go",
        "is_available": false
      },
      "dns": {
        "a_records": [
          "93.184.216.34"
        ],
        "aaaa_records": [
          "2606:2800:220:1:248:1893:25c8:1946"
        ],
        "mx_records": [
          "10 mail.example.net"
        ],
        "txt_records": [
          "v=spf1 -all"
        ],
        "ns_records": [
          "ns1.example.net",
          "ns2.example.net"
        ],
        "cname_records": [
          "www.example.net"
        ],
        "dnssec": {
          "enabled": true,
          "ds_records": [
            "12345 13 2 ABCDEF123456789..."
          ]
        }
      },
      "ssl": {
        "valid": true,
        "issuer": "DigiCert Inc",
        "subject": "example.net",
        "version": "3",
        "serial_number": "0123456789ABCDEF",
        "not_before": "2024-01-01T00:00:00Z",
        "not_after": "2025-01-01T23:59:59Z",
        "san_list": [
          "example.net",
          "www.example.net"
        ]
      },
      "status": {
        "available": true,
        "status_code": 200,
        "response_time_ms": 245,
        "protocol": "https",
        "checked_at": "2024-01-15T10:30:00Z",
        "error": null
      },
      "available": false,
      "errors": null
    }
  },
  "stats": {
    "total_domains": 2,
    "successful": 2,
    "failed": 0,
    "time_elapsed": "1.234s"
  }
}
Enter fullscreen mode Exit fullscreen mode

More examples

You can find more detailed documentation, including endpoints for WHOIS, DNS lookups, and more examples in multiple languages (Python, JavaScript, Go, Ruby) here: https://api.tldspy.com/docs

Why I'm Sharing (and Asking for Feedback)

I've reached a point where I think TLDSpy API could be valuable to others, especially those working on domain-related projects, tools, or even just trying to make informed decisions about domain registration.

I'd love to get your feedback on this:

  • Is this something you'd find useful in your projects?
  • Are there any features or endpoints you'd like to see added?
  • Any thoughts on the pricing structure?

I'm currently offering a free tier with access to several popular TLDs. You can get started here: https://tldspy.com No credit card required.

I'm really eager to hear your thoughts and suggestions. Thanks for taking the time to read about my project!

Happy coding,

Arnaud

Sentry image

Hands-on debugging session: instrument, monitor, and fix

Join Lazar for a hands-on session where you’ll build it, break it, debug it, and fix it. You’ll set up Sentry, track errors, use Session Replay and Tracing, and leverage some good ol’ AI to find and fix issues fast.

RSVP here →

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay