# Monitoring domain expiry

**URL:** <https://community.squaredup.com/t/monitoring-domain-expiry/2151>\
**Category:** Gists\
**Tags:** web-api, squaredup-cloud\
**Created:** [March 8, 2024, 8:09pm UTC](https://community.squaredup.com/t/monitoring-domain-expiry/2151 "2024-03-08T20:09:16Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![agt](https://community.squaredup.com/letter_avatar_proxy/v4/letter/a/7feea3/32.png) [@agt](https://community.squaredup.com/u/agt)\
**Post date:** [March 8, 2024, 8:09pm UTC](https://community.squaredup.com/t/monitoring-domain-expiry/2151/1 "2024-03-08T20:09:16Z")

</div>

I was looking for a way to monitor domain expiry dates with SquaredUp – to avoid the most embarrassing of failures 🙂

I found this JSON API for domain info. It requires a sign-up to get an API key, but the free tier includes 1000 requests/month – enough for 30 or so domain monitors (don’t forget to set the monitor frequency to daily in SquaredUp).

> **[Whois API in JSON format | Bulk Whois API | Try Whois API for free](https://whoisjsonapi.com/)**
>
> Whois lookup API provides information about domains, also known as WHOIS, in JSON format. Whois JSON API is a rest API for python, javascript, PHP and other languages.

It’s really simple to connect to this API and add domain info to your dashboards.

Web API settings:

- Base URL: `https://whoisjsonapi.com/v1/`
- Authentication: `None`
- Headers: `Authorization: Bearer <API_KEY>`

And then for the HTTP request:

- Endpoint: `<the domain name of interest>`
- HTTP method: `GET`
- Path to data: `domain`
- Check `Expand inner objects` to see all data in the result

I then used a script to setup a monitor on the `Expiration Date In Time` column.

The monitor script:

> [@Monitoring an expiry date](https://community.squaredup.com/t/monitoring-an-expiry-date/2150):
>
> In case it’s useful to anyone else, here’s a script I use to monitor an expiry date or some other due date. The script assumes a single row dataset, with a column containing a date. /\* Example config: { columnName: "expiry", errorDays: 60, warningDays: 30 } \*/ async function getState(params, api) { if(!params.config.columnName || typeof params.config.columnName !== 'string') { throw new Error("Missing config property: columnName (string)") } if(!params.config.errorDays || t…

Script config:

```auto
{
  "columnName": "expiration_date_in_time",
  "errorDays": 30,
  "warningDays": 60
}

```

Don’t forget to set Advanced \> Frequency to Daily to avoid blowing through the API quota!
