[ All integrations ](https://ohdear.app/third-party-integrations)

# JavaScript SDK

Needs updating

A JavaScript SDK to easily interact with the Oh Dear API from your Node.js or browser applications.

[ mohammedmanssour/ohdear-js-sdk ](https://github.com/mohammedmanssour/ohdear-js-sdk)

by [ Mohammed Manssour ](https://mohammedmanssour.me/)

The JavaScript SDK provides a convenient way to interact with the Oh Dear API from Node.js applications. Built and maintained by the community, it offers full access to Oh Dear's monitoring capabilities.

## Installation [\#](#installation)

```
<span class="hl-keyword">npm</span> install ohdear-js-sdk
```

## Features [\#](#features)

The SDK supports all major Oh Dear API operations:

- **Site Management**: List, retrieve, create, and delete monitored websites
- **Check Operations**: Enable/disable health checks and request immediate check runs
- **Uptime Monitoring**: Retrieve uptime percentages across configurable time periods
- **Downtime Tracking**: Identify outage windows within specified date ranges
- **Link Validation**: Detect broken links across monitored sites
- **Security Audits**: Check for mixed content issues and SSL certificate health

## Usage [\#](#usage)

```
<span class="hl-keyword">import</span> OhDear <span class="hl-keyword">from</span> <span class="hl-value">'ohdear-js-sdk'</span>

<span class="hl-keyword">const</span> ohdear = <span class="hl-keyword">new</span> <span class="hl-type">OhDear</span>(<span class="hl-value">'your-api-token'</span>)

<span class="hl-comment">// Get all sites</span>
<span class="hl-keyword">const</span> sites = <span class="hl-keyword">await</span> ohdear.<span class="hl-property">sites</span>()

<span class="hl-comment">// Get uptime data</span>
<span class="hl-keyword">const</span> uptime = <span class="hl-keyword">await</span> ohdear.<span class="hl-property">uptime</span>(siteId, startDate, endDate, <span class="hl-value">'day'</span>)

<span class="hl-comment">// Check SSL certificate health</span>
<span class="hl-keyword">const</span> cert = <span class="hl-keyword">await</span> ohdear.<span class="hl-property">certificateHealth</span>(siteId)
```

For more details, see the [GitHub repository](https://github.com/mohammedmanssour/ohdear-js-sdk).
