Logo
Docs

Before.sh API - Domain Availability Check

Simple API to check domain name availability. Check one name across many TLDs or run bulk checks. Supports compact or detailed responses and optional name encoding. Authentication via API key is required.

Domain Check

Check domain availability

GET
/check
X-API-Key<token>

API key authentication via header (recommended)

In: header

Query Parameters

domainstring

Single domain name to check (without TLD)

Length1 <= length <= 63
tldsstring

Comma-separated list of TLDs to check (without dots)

format?string

Response format - compact (default) or detailed

Default"compact"
Value in"compact" | "detailed"
encoding?string

Domain name encoding in response - original (default), lowercase, or punycode

Default"original"
Value in"original" | "lowercase" | "punycode"
token?string

API key for authentication (alternative to X-API-Key header)

Response Body

<?phprequire 'vendor/autoload.php';use GuzzleHttp\Client;use GuzzleHttp\Exception\GuzzleException;$client = new Client();$options = [  'headers' => [  ],] ;try {  $response = $client->request('GET', 'https://testapi.before.sh/v1/check?domain=test&tlds=com%2Cde%2Cai&format=compact&encoding=original&token=string', $options);  echo (string) $response->getBody();} catch (GuzzleException $e) {  echo $e->getMessage();}

{
  "status": "success",
  "timestamp": "2025-10-10T22:06:04.014Z",
  "domain": "test",
  "results": {
    ".com": false,
    ".de": true,
    ".ai": false
  }
}

{
  "success": false,
  "error": {
    "code": "VALIDATION_ERROR",
    "message": "Validation failed",
    "validation_errors": [
      {
        "field": "domain",
        "message": "The 'domain' parameter is required",
        "code": "MISSING_REQUIRED_FIELD"
      }
    ]
  }
}

{
  "success": false,
  "error": {
    "code": "MISSING_API_KEY",
    "message": "Please provide an API key via the 'X-API-Key' header or 'token' query parameter"
  }
}

{
  "success": false,
  "error": {
    "code": "TIMEOUT",
    "message": "Domain check timed out",
    "details": "Check exceeded 10000ms timeout"
  }
}

{
  "success": false,
  "error": {
    "code": "RATE_LIMIT_EXCEEDED",
    "message": "Rate limit exceeded"
  },
  "retry_after": 3600
}

Check domain availability (POST)

POST
/check
X-API-Key<token>

API key authentication via header (recommended)

In: header

domainstring

Single domain name to check (without TLD)

Length1 <= length <= 63
tldsstring

Comma-separated list of TLDs to check (without dots)

format?string

Response format

Default"compact"
Value in"compact" | "detailed"
encoding?string

Domain name encoding in response

Default"original"
Value in"original" | "lowercase" | "punycode"

Response Body

<?phprequire 'vendor/autoload.php';use GuzzleHttp\Client;use GuzzleHttp\Exception\GuzzleException;$client = new Client();$options = [  'headers' => [    'Content-Type' => 'application/json',  ],    'json' => json_decode('{"domain":"test","tlds":"com,de,ai","format":"compact","encoding":"original"}', true),] ;try {  $response = $client->request('POST', 'https://testapi.before.sh/v1/check', $options);  echo (string) $response->getBody();} catch (GuzzleException $e) {  echo $e->getMessage();}
{
  "status": "success",
  "timestamp": "2025-10-10T22:06:04.014Z",
  "domain": "test",
  "results": {
    ".com": false,
    ".de": true,
    ".ai": false
  }
}

{
  "success": false,
  "error": {
    "code": "VALIDATION_ERROR",
    "message": "Validation failed",
    "validation_errors": [
      {
        "field": "domain",
        "message": "The 'domain' parameter is required",
        "code": "MISSING_REQUIRED_FIELD"
      }
    ]
  }
}

{
  "success": false,
  "error": {
    "code": "MISSING_API_KEY",
    "message": "Please provide an API key via the 'X-API-Key' header or 'token' query parameter"
  }
}

{
  "success": false,
  "error": {
    "code": "TIMEOUT",
    "message": "Domain check timed out",
    "details": "Check exceeded 10000ms timeout"
  }
}

{
  "success": false,
  "error": {
    "code": "RATE_LIMIT_EXCEEDED",
    "message": "Rate limit exceeded"
  },
  "retry_after": 3600
}