مستندات API دسترسیپذیری دامنه
همه آنچه برای یکپارچهسازی بررسی دامنه در اپلیکیشن خود نیاز دارید.
Domain Availability — API Endpoint
All domain availability checks go through a single GET endpoint. HTTPS is required in production.
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.
Request Parameters
Two parameters are required on every request. The rest are optional and enable pricing, checkout, and demo-mode features.
Required Parameters
| Parameter | Type | Description |
|---|---|---|
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
| Parameter | Type | Description |
|---|---|---|
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. |
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.
<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
| Attribute | Required | Description |
|---|---|---|
data-dsa-widget | required | Marks the element for widget injection. No value needed. |
data-client-key | required | Your embed client key. |
data-api-url | optional | API endpoint URL. Defaults to the production endpoint. |
data-redirect-checkout | optional | Set to 1 to use platform checkout URL format. |
data-commission-percent | optional | Markup percentage added to displayed pricing. |
data-redirect-url | optional | Custom checkout destination URL. |
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)
{
"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)
{
"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)
{
"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
{
"success": true,
"domain": "google.com",
"available": false,
"message": "Taken"
/* pricing and purchase are absent when domain is taken */
}
Pricing disabled on this client key
{
"success": true,
"domain": "example.com",
"available": true,
"message": "Available"
/* pricing and purchase keys are absent when pricing_enabled = 0 */
}
Response field reference
| Field | Type | Always present | Description |
|---|---|---|---|
success | boolean | Yes | true on a successful check; false on any error. |
domain | string | Yes | Normalised domain that was checked, e.g. example.com. |
available | boolean | Yes (success) | true if available for registration, false if taken. |
message | string | Yes (success) | Human-readable status: "Available" or "Taken". |
pricing | object|absent | No | Present only when pricing is enabled for the client key and pricing data is available for the TLD. |
pricing.currency | string | — | ISO 4217 currency code, e.g. USD. |
pricing.base_register | float | — | Raw registration price before any commission markup is applied. |
pricing.display_register | float | — | Registration price shown to end users. Equals base_register when mode is base; includes markup when with_commission. |
pricing.pricing_mode | string | — | "base" — no markup. "with_commission" — markup applied. |
pricing.commission_percent | float | — | Commission percentage that was applied, e.g. 18.0. Is 0.0 in base mode. |
purchase | object|absent | No | Present only when available = true AND show_purchase_button is enabled AND a purchase URL resolves. |
purchase.show_button | boolean | — | Always true when the purchase object is present. |
purchase.url | string | — | Ready-to-use checkout URL with domain, sld, and tld query params appended. |
purchase.source | string | — | "client_url" — came from the redirect_url param. "url" — came from the client's configured purchase URL. |
error | string | No | Present only on error responses (success: false). Human-readable reason. |
WHOIS Lookup
Query live WHOIS data for any domain. Returns registrar, registrant country, creation/expiry dates, nameservers, and DNSSEC status as structured JSON.
https://api.pamirwebhost.com/v1/whois
Parameters
| Parameter | Required | Description |
|---|---|---|
client_key | Required | Your API key (embed or server key) |
domain | Required | Domain 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"
}
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.
https://api.pamirwebhost.com/v1/dns
Parameters
| Parameter | Required | Description |
|---|---|---|
client_key | Required | Your API key |
domain | Required | Domain to query |
types | Optional | Comma-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"
}
Bulk Domain Check
Check up to 10 domains in a single request. Accepts a comma-separated GET list or a JSON array via 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"
}
Domain Suggestions
Enter a keyword and receive up to 20 smart domain name suggestions — including prefixes (getpamir), suffixes (pamirapp), splits, and .af variants.
https://api.pamirwebhost.com/v1/domains/suggest
Parameters
| Parameter | Required | Description |
|---|---|---|
client_key | Required | Your API key |
keyword | Required | The brand/word to generate suggestions from (2–63 characters) |
tlds | Optional | Comma-separated TLD list for exact suggestions. Default: .com,.net,.org,.io,.co,.ai,.dev,.app,.af,.com.af |
limit | Optional | Max 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"
}
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.
| Endpoint | Credit 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 |
HTTP 429 with "error": "Monthly credit limit reached". Upgrade your plan →
Error Codes & Handling
The API uses standard HTTP status codes. All error responses include a JSON body with a human-readable error field.
-
400Bad Request. Invalid domain format, missing required parameter (
client_keyordomain), unsupported TLD, or malformed input. -
403Forbidden. Client key not found, disabled, or suspended. Also returned when the request origin is not in the client's allowed-origins whitelist.
-
429Too 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.
-
500Internal Server Error. Unexpected server-side error. Retry the request after a short delay. If persistent, contact support.
-
502Bad Gateway. Upstream WHOIS/registry service is temporarily unavailable. Implement exponential backoff and surface a fallback message to your users.
Error response shape
{
"success": false,
"error": "Invalid or disabled client key."
}
Code Examples
Ready-to-use snippets for common languages and environments.
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 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'); }
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.")
# 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"
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_urlfor custom checkout flows. Append your own cart URL to send buyers directly to your platform rather than the default platform checkout flow.
آمادهاید جستجوی دامنه را به سایت خود اضافه کنید؟
در چند دقیقه یک کلید API رایگان دریافت کنید — بدون کارت اعتباری.