سندونه

د دومین شتون API سندونه

هر هغه شی چې د خپل اپلیکیشن کې د دومین بررسي یوځای کولو لپاره اړتیا لرئ.

Step 1

Domain Availability — API Endpoint

All domain availability checks go through a single GET endpoint. HTTPS is required in production.

HTTP GET
GET https://api.pamirwebhost.com/v1/domains/check?client_key=YOUR_CLIENT_KEY&domain=example.com

The endpoint accepts GET requests only. All parameters are passed as URL query strings. Responses are always application/json. CORS headers are included so you can call the API directly from browser JavaScript.

Step 2

Request Parameters

Two parameters are required on every request. The rest are optional and enable pricing, checkout, and demo-mode features.

Required Parameters

ParameterTypeDescription
client_key required Your unique API client key. Automatically created when you log in with your PWH CRM account or register a new account via the API Portal.
domain required Full domain name to check, e.g. example.com or mybrand.af. Must include TLD.

Optional Parameters

ParameterTypeDescription
commission_percent optional Numeric percentage markup to add to domain pricing, e.g. 18 for 18%. Overrides the admin-configured default for this request.
redirect_url optional Custom checkout URL. domain, sld, and tld parameters are automatically appended to this URL.
redirect_checkout optional Set to 1 to force the platform checkout URL in the purchase.url response field.
Step 3

Embed the Domain Search Widget

Add a fully-functional domain availability search box to any HTML page with two tags — no backend code required on your side.

HTML
<div
  data-dsa-widget
  data-client-key="YOUR_CLIENT_KEY"
  data-api-url="https://api.pamirwebhost.com/v1/domains/check"
  data-redirect-checkout="1"
  data-commission-percent="18"
></div>
<script src="https://api.pamirwebhost.com/widget.js"></script>

Widget data attributes

AttributeRequiredDescription
data-dsa-widgetrequiredMarks the element for widget injection. No value needed.
data-client-keyrequiredYour embed client key.
data-api-urloptionalAPI endpoint URL. Defaults to the production endpoint.
data-redirect-checkoutoptionalSet to 1 to use platform checkout URL format.
data-commission-percentoptionalMarkup percentage added to displayed pricing.
data-redirect-urloptionalCustom checkout destination URL.
Step 4

JSON Response Format

Every successful request returns a JSON object. The shape varies slightly depending on whether the domain is available and whether pricing is enabled.

Available domain (with pricing + commission)

JSON — available, pricing enabled
{
  "success": true,
  "domain": "example.com",
  "available": true,
  "message": "Available",
  "pricing": {
    "currency": "USD",
    "base_register": 12.00,
    "display_register": 14.16,
    "pricing_mode": "with_commission",
    "commission_percent": 18.0
  },
  "purchase": {
    "show_button": true,
    "url": "https://pamirwebhost.com/crm/cart.php?a=add&domain=register&query=example.com",
    "source": "url"
  }
}

Available domain (base pricing, no commission)

JSON — available, base pricing
{
  "success": true,
  "domain": "mybrand.af",
  "available": true,
  "message": "Available",
  "pricing": {
    "currency": "USD",
    "base_register": 20.00,
    "display_register": 20.00,
    "pricing_mode": "base",
    "commission_percent": 0.0
  },
  "purchase": {
    "show_button": true,
    "url": "https://pamirwebhost.com/crm/cart.php?a=add&domain=register&query=mybrand.af",
    "source": "url"
  }
}

Available domain (custom redirect_url)

JSON — available, custom checkout
{
  "success": true,
  "domain": "example.com",
  "available": true,
  "message": "Available",
  "pricing": { /* ... */ },
  "purchase": {
    "show_button": true,
    "url": "https://yoursite.com/buy?domain=example.com&sld=example&tld=com",
    "source": "client_url"
  }
}

Taken / unavailable domain

JSON — taken
{
  "success": true,
  "domain": "google.com",
  "available": false,
  "message": "Taken"
  /* pricing and purchase are absent when domain is taken */
}

Pricing disabled on this client key

JSON — available, no pricing
{
  "success": true,
  "domain": "example.com",
  "available": true,
  "message": "Available"
  /* pricing and purchase keys are absent when pricing_enabled = 0 */
}

Response field reference

FieldTypeAlways presentDescription
successbooleanYestrue on a successful check; false on any error.
domainstringYesNormalised domain that was checked, e.g. example.com.
availablebooleanYes (success)true if available for registration, false if taken.
messagestringYes (success)Human-readable status: "Available" or "Taken".
pricingobject|absentNoPresent only when pricing is enabled for the client key and pricing data is available for the TLD.
pricing.currencystringISO 4217 currency code, e.g. USD.
pricing.base_registerfloatRaw registration price before any commission markup is applied.
pricing.display_registerfloatRegistration price shown to end users. Equals base_register when mode is base; includes markup when with_commission.
pricing.pricing_modestring"base" — no markup. "with_commission" — markup applied.
pricing.commission_percentfloatCommission percentage that was applied, e.g. 18.0. Is 0.0 in base mode.
purchaseobject|absentNoPresent only when available = true AND show_purchase_button is enabled AND a purchase URL resolves.
purchase.show_buttonbooleanAlways true when the purchase object is present.
purchase.urlstringReady-to-use checkout URL with domain, sld, and tld query params appended.
purchase.sourcestring"client_url" — came from the redirect_url param. "url" — came from the client's configured purchase URL.
errorstringNoPresent only on error responses (success: false). Human-readable reason.
API Endpoint — 2 credits

WHOIS Lookup

Query live WHOIS data for any domain. Returns registrar, registrant country, creation/expiry dates, nameservers, and DNSSEC status as structured JSON.

GET https://api.pamirwebhost.com/v1/whois

Parameters

ParameterRequiredDescription
client_keyRequiredYour API key (embed or server key)
domainRequiredDomain name to look up (e.g. example.com)

Example Response

{
  "success": true,
  "domain": "example.com",
  "whois": {
    "domain": "example.com",
    "status": ["client delete prohibited", "client transfer prohibited"],
    "registrar": "RESERVED-Internet Assigned Numbers Authority",
    "registrant": { "org": "IANA", "country": "US" },
    "nameservers": ["a.iana-servers.net", "b.iana-servers.net"],
    "created_at": "1995-08-14T04:00:00Z",
    "updated_at": "2024-08-14T07:01:34Z",
    "expires_at": "2025-08-13T04:00:00Z",
    "dnssec": false,
    "source": "whmcs_domain_whois"
  },
  "credits_cost": 2,
  "credits_remaining": 498,
  "checked_at": "2025-01-15T10:23:45Z"
}
API Endpoint — 1 credit

DNS Lookup

Resolve DNS records for any domain. Query A, AAAA, MX, NS, TXT, CNAME, SOA, CAA, or SRV records — multiple types in one request.

GET https://api.pamirwebhost.com/v1/dns

Parameters

ParameterRequiredDescription
client_keyRequiredYour API key
domainRequiredDomain to query
typesOptionalComma-separated record types. Default: A,MX,NS,TXT. Allowed: A AAAA MX NS TXT CNAME SOA CAA SRV

Example Request

GET /v1/dns?client_key=YOUR_KEY&domain=pamirwebhost.com&types=A,MX,NS

Example Response

{
  "success": true,
  "domain": "pamirwebhost.com",
  "types_queried": ["A", "MX", "NS"],
  "records": {
    "A":  [{ "type": "A",  "ttl": 300, "value": "185.230.63.107" }],
    "MX": [{ "type": "MX", "ttl": 300, "target": "mail.pamirwebhost.com", "priority": 10 }],
    "NS": [{ "type": "NS", "ttl": 3600, "target": "ns1.pamirwebhost.com" }]
  },
  "credits_cost": 1,
  "credits_remaining": 497,
  "checked_at": "2025-01-15T10:24:00Z"
}
API Endpoint — 1 credit per domain

Bulk Domain Check

Check up to 10 domains in a single request. Accepts a comma-separated GET list or a JSON array via POST.

GET POST https://api.pamirwebhost.com/v1/domains/bulk

GET Usage

GET /v1/domains/bulk?client_key=KEY&domains=example.com,test.io,mysite.af

POST Usage (JSON body)

POST /v1/domains/bulk?client_key=KEY
Content-Type: application/json

{ "domains": ["example.com", "test.io", "mysite.af"] }

Example Response

{
  "success": true,
  "total": 3,
  "domains": [
    { "success": true, "domain": "example.com", "available": false, "message": "Taken" },
    { "success": true, "domain": "test.io",      "available": true,  "message": "Available" },
    { "success": true, "domain": "mysite.af",    "available": true,  "message": "Available" }
  ],
  "invalid": [],
  "credits_cost": 3,
  "credits_remaining": 497,
  "checked_at": "2025-01-15T10:25:00Z"
}
API Endpoint — 5 credits

Domain Suggestions

Enter a keyword and receive up to 20 smart domain name suggestions — including prefixes (getpamir), suffixes (pamirapp), splits, and .af variants.

GET https://api.pamirwebhost.com/v1/domains/suggest

Parameters

ParameterRequiredDescription
client_keyRequiredYour API key
keywordRequiredThe brand/word to generate suggestions from (2–63 characters)
tldsOptionalComma-separated TLD list for exact suggestions. Default: .com,.net,.org,.io,.co,.ai,.dev,.app,.af,.com.af
limitOptionalMax suggestions to return (5–20). Default: 20

Example Response

{
  "success": true,
  "keyword": "pamir",
  "base": "pamir",
  "tlds_used": [".com", ".net", ".io", ".ai", ".af", ".com.af"],
  "suggestions": [
    { "domain": "pamir.com",     "variant": "exact",  "sld": "pamir",    "tld": ".com" },
    { "domain": "pamir.io",      "variant": "exact",  "sld": "pamir",    "tld": ".io" },
    { "domain": "getpamir.com",  "variant": "prefix", "sld": "getpamir", "tld": ".com" },
    { "domain": "pamirapp.com",  "variant": "suffix", "sld": "pamirapp", "tld": ".com" },
    { "domain": "pamir.af",      "variant": "af_cctld","sld": "pamir",   "tld": ".af" }
  ],
  "total": 20,
  "credits_cost": 5,
  "credits_remaining": 495,
  "generated_at": "2025-01-15T10:26:00Z"
}
Reference

API Credits

All API endpoints consume credits from your monthly allowance. Credits reset on the 1st of each month. Each response includes credits_cost and credits_remaining fields.

EndpointCredit Cost
Domain Availability Check (/v1/domains/check)1 credit
DNS Lookup (/v1/dns)1 credit
WHOIS Lookup (/v1/whois)2 credits
Bulk Domain Check (/v1/domains/bulk)1 credit per domain
Domain Suggestions (/v1/domains/suggest)5 credits
Free Developer plan: 500 credits/month. Starter: 5,000. PRO: 25,000. PWH Resellers: 50,000. When credits run out, the API returns HTTP 429 with "error": "Monthly credit limit reached". Upgrade your plan →
Reference

Error Codes & Handling

The API uses standard HTTP status codes. All error responses include a JSON body with a human-readable error field.

  • 400
    Bad Request. Invalid domain format, missing required parameter (client_key or domain), unsupported TLD, or malformed input.
  • 403
    Forbidden. Client key not found, disabled, or suspended. Also returned when the request origin is not in the client's allowed-origins whitelist.
  • 429
    Too Many Requests. Per-client rate limit exceeded. Wait until the next minute window. Also returned when the demo free-tier limit (2 checks/session) is exhausted.
  • 500
    Internal Server Error. Unexpected server-side error. Retry the request after a short delay. If persistent, contact support.
  • 502
    Bad Gateway. Upstream WHOIS/registry service is temporarily unavailable. Implement exponential backoff and surface a fallback message to your users.

Error response shape

JSON — error
{
  "success": false,
  "error": "Invalid or disabled client key."
}
Step 6

Code Examples

Ready-to-use snippets for common languages and environments.

JavaScript (fetch)
async function checkDomain(domain) {
  const url = `https://api.pamirwebhost.com/v1/domains/check?client_key=YOUR_KEY&domain=${encodeURIComponent(domain)}`;
  const res = await fetch(url);
  if (!res.ok) throw new Error(`HTTP ${res.status}`);
  const data = await res.json();
  if (data.available) {
    console.log(`${domain} is available! Price: ${data.pricing?.display_register}`);
  } else {
    console.log(`${domain} is taken.`);
  }
}

checkDomain('mybrand.af');
PHP (cURL)
<?php
function checkDomain(string $domain): array {
    $url = 'https://api.pamirwebhost.com/v1/domains/check?'
         . http_build_query(['client_key' => 'YOUR_KEY', 'domain' => $domain]);
    $ch = curl_init($url);
    curl_setopt_array($ch, [
        CURLOPT_RETURNTRANSFER => true,
        CURLOPT_TIMEOUT        => 10,
        CURLOPT_HTTPHEADER     => ['Accept: application/json'],
    ]);
    $raw = curl_exec($ch);
    $status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
    curl_close($ch);
    if ($status !== 200) throw new RuntimeException("HTTP $status");
    return json_decode($raw, true);
}

$result = checkDomain('mybrand.af');
if ($result['available']) {
    echo "Available! Register for: " . ($result['pricing']['display_register'] ?? 'N/A');
}
Python (requests)
import requests

def check_domain(domain: str) -> dict:
    url = "https://api.pamirwebhost.com/v1/domains/check"
    params = {"client_key": "YOUR_KEY", "domain": domain}
    r = requests.get(url, params=params, timeout=10)
    r.raise_for_status()
    return r.json()

result = check_domain("mybrand.af")
if result["available"]:
    price = result.get("pricing", {}).get("display_register")
    print(f"Available! Price: {price}")
else:
    print("Domain is taken.")
cURL
# Basic availability check
curl "https://api.pamirwebhost.com/v1/domains/check?client_key=YOUR_KEY&domain=example.af"

# With commission markup and checkout redirect
curl "https://api.pamirwebhost.com/v1/domains/check?\
  client_key=YOUR_KEY&\
  domain=example.com&\
  commission_percent=18&\
  redirect_checkout=1"
Best Practices

Production Checklist

Follow these steps before going live to ensure a smooth, secure integration.

  • Keep your server_key secret. Never expose it in front-end code. Use the embed_key for browser-side requests.
  • Always use HTTPS. The API requires HTTPS in production. HTTP requests will fail or be redirected.
  • Validate the domain on your end before sending a request. Check for a valid format (label.tld) to avoid wasting API calls on obviously invalid input.
  • Handle HTTP 429 gracefully. Show a friendly "please wait" message and disable the search button temporarily rather than showing a raw error.
  • Implement a network timeout fallback. Wrap API calls with a try/catch and show a user-friendly fallback if the request times out.
  • Test with demo mode first. Use the live demo on the home page to verify checkout flow and pricing before adding your production key.
  • Set an allowed-origins list on your client key. Log in to the API Portal, open Allowed Origins, and add every domain that should be allowed to use your embed key.
  • Use redirect_url for custom checkout flows. Append your own cart URL to send buyers directly to your platform rather than the default platform checkout flow.

آیا چمتو یاست چې خپل سایټ ته د دومین لټون اضافه کړئ؟

د لږو دقیقو کې یو وړیا API کیلي ترلاسه کړئ — کریډیټ کارت اړین نه دی.