.PK Domain WHOIS

Finally an easy & universal API to Lookup .PK Domains

        WHOISapi ~ $ 
      

Fast & Light

Simple and optimized WHOIS API Lookup with quick response time of under 400ms over HTTP, & under 700ms over HTTPS protocols.

Free & Unlimited

The API is designed to handle a high volume of Un-authenticated parallel requests without any usage restrictions on API calls.

Secure Access

Access API over SSL based Internet security protocol encrypted URLs for making .PK Domain Lookup requests.

Easy to Use & Integrate

The Lookup API for PK Domains provides Standardized WHOIS record for easy integration with any application.

Multiple Output Formats

Choose from the Industry-Standard and widely used formats of JSON & XML for quick and easy implementation.

Robust & Clean

Developed using latest technologies and thoroughly tested to deliver performance and availability.

API Endpoint

            	
            		https://pknic.domainwhois.pk/api/json
            	
          	

Read the documentation below for easy to follow details of the API.
For any queries, contact us at support@domainwhois.pk

Documentation

Get Started

Our Hosted Web Service for PK Domain names provides status and registration details, also known as WHOIS/Lookup Record of a domain names.

domainWHOIS.pk provides RESTful APIs. It is designed for server-to-server communication between your system and the domainWHOIS.pk network using HTTPs protocol. Query responses are delivered in either JSON or XML format based on your requests which are made via GET/POST methods.

Follow the easy to follow documentation and sample codes below to get started. The WHOis API for PK domain names is provided free of cost and without any restrictions.


Making Request

Choose an API endpoint depending on the desired output format from among JSON or XML.

API Endpoint

  • json
  • xml
            GET | POST    https://pknic.domainwhois.pk/api/json
            GET | POST    https://pknic.domainwhois.pk/api/xml
          

Input parameters

Name Description
domain Required
The .PK ccTLD Domain name for which the WHOIS data is queried.

Sample Query

              
               METHOD: GET
                https://pknic.domainwhois.pk/api/json?domain=DOMAIN-NAME-TO-QUERY
              
            

Getting API Response/Output

Irrespective of the choosen API Output Format, the WHOIS Schema/Response remains the same, as follows:

Response/Output Parameters

Name Details Sample Output
domain_name The queried domain name input string is returned as-is to identify the response. google.pk
status Domain status indicate Registration staus of the queried domain name. Registered, Available,
Expired, Reserved,
Invalid
registration_date - Format: YYYY-MM-DD
The registration/creation date of the domain.
This information is only returned if the domain status is Registered or Expired.
2000-02-28
expiry_date - Format: YYYY-MM-DD
The date on which the domain has either expired or is set to expire.
This information is only returned if the domain status is Registered or Expired.
2010-02-28
nameservers - Format: String
Array of upto 4 Nameservers set for the queried domain.
An empty record is returned if no Nameservers are set.
ns1.domain.com
ns2.domain.com
release_date - Format: YYYY-MM-DD HH:MM:SS
- Timezone: Pakistan Standard Time
The date/time on which an Expired domain is available for open registration.
This information is only returned if the domain status is 'Expired'.
2020-02-28 12:00:00
information A brief summary of the returned response containing details about the queried domain name. google.pk is Registered.

Sample Response/Output Schema

  • json
  • xml
            
{
	"domain_name": "google.pk",
	"status": "Registered",
	"registration_date": "2005-12-01",
	"expiry_date": "2022-12-01",
	"nameservers": [
		"ns1.google.com",
		"ns2.google.com",
		"ns3.google.com",
		"ns4.google.com"
	],
	"information": "google.pk is Registered"
}
<?xml version="1.0"?>
<whois>
	<domain_name>google.pk</domain_name>
	<status>Registered</status>
	<registration_date>2005-12-01</registration_date>
	<expiry_date>2022-12-01</expiry_date>
	<nameservers>
		<0>ns1.google.com</0>
		<1>ns2.google.com</1>
		<2>ns3.google.com</2>
		<3>ns4.google.com</3>
	</nameservers>
	<information>Domain is already Registered</information>
</whois>

'Invalid' Domain Status

A Queried domain name which does not comply to the following PKNIC guidelines is returned as Invalid:

  • Maximum length of 63 characters (excluding the .pk portion), and the maximum length is 67 characters including .pk suffix.
  • Minimum length of 4 characters for second level .PK domains (excluding .pk portion)
  • A four character name before .pk must not start or contain any of the PKNIC second level sub-domains (e.g. com, net, org, biz, fam, web, edu, info, gov, gop, gob, gog, gkb, gos gok etc.)
  • Domain name can not contain special characters e.g. !@#$%^&*() etc.
  • A domain name can not begin with a dash "-", and can not have two consecutive dashes "--"in it.
  • A second level domain can not end with one of the PKNIC second level sub-domains (e.g. com, net, edu, org, biz, web, fam, gov, gop, gos, etc.) Exceptions can be made for longer names whose meaning are not easily confused with second level sub-domain space.


Sample Code

A variety of different tools & techniques can be used to connect and communicate with the .PK WHOIS API. The below are sample codes for some of the widely used methods for Server-to-Server and Client-Server communication.

  • PHP cURL (GET)
  • PHP cURL (POST)
  • ajax
            
$domain_name = "google.pk";
$api_url = "https://pknic.domainwhois.pk/api/json";

$postRequest = array(
	'domain' => $domain_name
);

// create curl resource
$ch = curl_init($api_url);

//Set options for cURL transfer

// The data/domain name to post in a HTTP "POST" operation. 
curl_setopt($ch, CURLOPT_POSTFIELDS, $postRequest);

//return the transfer as a string
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

// false to stop cURL from verifying the peer's certificate
// curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);

// false to disable cURL from verifying
// the common name in the SSL peer's certificate
// curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);

// Executing the CURL request and getting the output string
$api_response = curl_exec($ch);

// close curl resource to free up system resources
curl_close($ch);

echo $api_response;	
$domain_name = "google.pk";
$api_url = "https://pknic.domainwhois.pk/api/json";
    
$postRequest = array(
	'domain' => $domain_name
);

// create curl resource
$ch = curl_init($api_url);

//Set options for cURL transfer

// The data/domain name to post in a HTTP "POST" operation. 
curl_setopt($ch, CURLOPT_POSTFIELDS, $postRequest);

//return the transfer as a string
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

// false to stop cURL from verifying the peer's certificate
// curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);

// false to disable cURL from verifying
// the common name in the SSL peer's certificate
// curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);

// Executing the CURL request and getting the output string
$api_response = curl_exec($ch);

// close curl resource to free up system resources
curl_close($ch);

echo $api_response;	

var domainName = "google.pk";
var apiURL="https://pknic.domainwhois.pk/api/json";

$.ajax({
	type: "GET",
	dataType: 'json',
	crossDomain: true,
	url: apiURL+"?domain="+domainName, 
	success: function(data)
	{
		alert(data);
	},
	error: function(jqXHR, textStatus, errorThrown)
	{
		alert(textStatus);
	}
});

Disclaimer / Terms of Use

domainWHOIS.pk's API for .PK Domain Name Lookup is a Third Party API and it is in no way associated with PKNIC, which is responsible for the administration of the .PK domain name space, including the operation of the DNS for the Root-Servers for .PK domains, and registration and maintenance of all .PK domain names. PKNIC provides domain names in the .PK ccTLD (country code Top Level Domain) namespace.

This API is provided without any liabiliy or guarantees. domainWHOIS.pk or its team are not liable for any issues arising from the use of this API.


Support

We are here to listen and assist.
For a quick response, please Contact us at support@domainwhois.pk

Changelog

v1.1

2021/06/29
  • Support for making request with POST method.
  • Addition of domain_name parameter in output schema for invalid domains.

v1.0

2021/06/21
  • Alpha launch of quick & easy to use WHOIS API.
  • Multiple output formats to choose from json and xml.
  • Secure access over HTTPS.
  • Standardized output.
  • Robust & Bug free.
  • Superfast architecture for quick response.