Select programming language for code examples

linkConnectivity

You can detect network connectivity and check if our licensing servers are accessible for the current network environment by sending a GET request to the ping endpoint. The API endpoint will respond with a 200 HTTP status code.

linkPing

Ping our servers. Returns a 200 status code. If the ping fails, you may need to whitelist our domain api.keygen.sh (or a custom domain, if you're using one) in the system's firewall. We do not have static IPs for our API, so our IPs cannot and should not be whitelisted. If you need a static IP, please visit this page.

In case you're unable to reach our servers, here are some things to try:

  1. Check your internet connectivity to another domain. This will ensure that the issue is between the device and Keygen, and not the entire internet.
  2. Whitelist api.keygen.sh in the system's firewall. Your system's firewall may be too strict, causing blocked connections.
  3. Update your operating system to the latest version. Your certificate chain may be out of date, causing a TLS failure.
  4. Try a different DNS provider (e.g. 1.1.1.1). Sometimes DNS providers can block certain requests, especially if you're outside of the USA.
  5. Set up Keygen under a custom domain. Sometimes our keygen.sh domain name is erroneously blocked by overzealous firewalls. Using Keygen under your own domain, e.g. licensing.example.com, may help remedy this in some situations.
  6. See the Let's Encrypt notice below.

Note on Let's Encrypt: on September 30th, 2021 a root certificate used by Let's Encrypt expired. As a temporary stop-gap to the various connectivity issues that ensued, Keygen moved away from Let's Encrypt to a Comodo certificate, in order to give our customers more time to resolve any connection issues.

On January 31st, 2022, Keygen has moved back to Let's Encrypt to support new features, such as custom domains. This may effect your Keygen integration.

If you or your clients are receiving a CERT_HAS_EXPIRED TLS/SSL error, then you will need to do one or more of the following:

  1. For server-based apps, please upgrade your ca-certificate bundle so that you have the latest Let's Encrypt root certificate.
  2. For Electron-based apps, please upgrade Electron. Older versions of Electron bundled an outdated certificate bundle. (See this issue for more information.)
  3. For apps built on Node v9 or older, please upgrade Node. Node statically links the OpenSSL library and the version linked for old versions is not supported.
  4. For other apps using OpenSSL, please upgrade to a version of OpenSSL at least as recent as v1.1.0. Older OpenSSL versions are no longer supported.
  5. Upgrade your operating system to a more recent version.

Unfortunately, this is a client issue, not a server issue.

As a last resort, you can disable TLS/SSL verification for the requests to our API. These requests will still be encrypted, but the certificate chain will not be verified — which is a good thing, since the device is unable to verify the chain due to missing root certificates. With Node, this can be done by setting the NODE_TLS_REJECT_UNAUTHORIZED environment variable to 0.

Definition

https://api.keygen.sh/v1/ping

Example request

Ping our licensing servers.

const fetch = require("node-fetch")
 
const response = await fetch("https://api.keygen.sh/v1/ping", { method: "GET" })
import requests
 
res = requests.get("https://api.keygen.sh/v1/ping")
import SwiftyJSON
import Alamofire
 
Alamofire.request("https://api.keygen.sh/v1/ping", method: .get)
using RestSharp;
 
var client = new RestClient("https://api.keygen.sh");
var request = new RestRequest("/v1/ping", Method.GET);
var response = client.Execute(request);
import com.mashape.unirest.http.exceptions.*
import com.mashape.unirest.http.*
 
val res = Unirest.get("https://api.keygen.sh/v1/ping")
import com.mashape.unirest.http.exceptions.*;
import com.mashape.unirest.http.*;
 
HttpResponse<JsonNode> res = Unirest.get("https://api.keygen.sh/v1/ping");
#include <iostream>
#include <string>
#include <cpprest/http_client.h>
#include <cpprest/filestream.h>
 
using namespace std;
using namespace web;
using namespace web::http;
using namespace web::http::client;
using namespace utility;
 
http_client client("https://api.keygen.sh");
http_request req;
 
req.set_request_uri("/v1/ping");
req.set_method(methods::GET);
 
client.request(req).wait();
curl -X GET https://api.keygen.sh/v1/ping

Example response / 200 OK

No content