# Domain checks

> How scoring screens every domain, and the one-word reason returned for each kind of rejected input.

Before anything is scored or charged, every company domain is screened, whether you send it to [`/score/domain`](/score-domain) or we find it from an [email](/score-email) or [LinkedIn URL](/score-social). Inputs that aren't a company's own website are rejected with HTTP `400` and **a one-word `reason`** you can switch on in code:

```json
{ "error": "invalid_domain", "reason": "social_media" }
```

In a bulk call, each rejected domain is listed in `rejected` with its reason, and the rest are still scored:

```json
{ "rejected": [ { "domain": "logo.png", "reason": "file_name" } ] }
```

**Rejected domains are never charged.**

## Reasons

### Instant checks

| `reason` | Rejected input | Examples |
|---|---|---|
| `empty` | Nothing entered | `""`, `"   "` |
| `invalid_format` | Not shaped like a domain | `acme`, `hello world.com`, `-bad-.com` |
| `invalid_tld` | The ending isn't a real domain ending | `acme.con`, `acme.comm` |
| `email` | An email address | `jane@acme.com` |
| `ip_address` | An IP address, with or without a port or path | `192.168.1.1`, `http://10.0.0.1:8080/x`, `2001:db8::1` |
| `file_name` | A file name or path | `logo.png`, `Document.pdf`, `Presentation.pptx`, `C:\files\deck.pptx` |
| `social_media` | A social network | `linkedin.com/company/acme`, `instagram.com/acme`, `facebook.com`, `x.com`, `youtube.com` |
| `messaging` | A chat or meeting link | `wa.me/9198…`, `chat.whatsapp.com/…`, `t.me/acme`, `discord.gg/…` |
| `common_site` | A well-known site, not a prospect | `google.com`, `google.co.in`, `wikipedia.org`, `chatgpt.com`, `example.com` |
| `email_provider` | A generic or temporary email service | `gmail.com`, `outlook.com`, `mailinator.com` |
| `link_shortener` | A short-link or link-in-bio service | `bit.ly/x`, `tinyurl.com/x`, `linktr.ee/acme` |
| `marketplace` | A marketplace, directory or app store | `indiamart.com`, `amazon.de`, `crunchbase.com`, `play.google.com` |
| `free_host` | A free website on a hosting or site-builder domain | `acme.myshopify.com`, `acme.wixsite.com`, `acme.vercel.app` |

### Live checks

These look at the domain on the internet before scoring.

| `reason` | Rejected input |
|---|---|
| `unregistered` | The domain doesn't exist: expired or never registered |
| `no_website` | Registered, but no website answers, the page is blank, or it shows a default server page |
| `parked` | Parked or for sale (redirects to a domain marketplace, or a "this domain is for sale" page) |
| `coming_soon` | A "Coming soon" or "Under construction" page |

### Bulk only

| `reason` | Meaning |
|---|---|
| `already_processing` | A single scoring job for this domain is already running |
| `none_valid` | Whole call: no domain in the list passed the checks |

## How the checks work

- **Cleaning first:** `https://www.Acme.com/about?x=1` is checked as `acme.com`. Paths and `www.` are fine.
- **Subdomains count:** `in.linkedin.com`, `m.facebook.com` and `x.tradeindia.com` are recognised as their parent site.
- **Real endings only:** the domain ending is checked against the official list of every top-level domain.
- **File names vs. domains:** endings that are both a file type and a real domain ending, such as `.ai` and `.app`, are treated as domains, so `x.ai` passes.
- **Live checks never block a real company by accident:** a slow site, a site behind bot protection, or a site with a temporary server error is **accepted**. A domain is rejected only on clear evidence.

## Handling reasons in code

```javascript
const res = await fetch(`${BASE}/score/domain`, { method: "POST", headers, body: JSON.stringify({ domain, template_id }) });
const body = await res.json();
if (res.status === 400 && body.error === "invalid_domain") {
  switch (body.reason) {
    case "social_media": case "messaging": return "That's a social or chat link. Enter the company's website.";
    case "file_name": return "That looks like a file name.";
    case "unregistered": case "no_website": return "This domain has no website.";
    case "parked": return "This domain is parked or for sale.";
    case "coming_soon": return "This website isn't live yet.";
    default: return "Enter the company's own website, like acme.com.";
  }
}
```
