> For the complete documentation index, see [llms.txt](https://kevins-organization-58.gitbook.io/smtp-ghost-api/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://kevins-organization-58.gitbook.io/smtp-ghost-api/domain-search.md).

# Domain Search

Retrieves all stored mailbox addresses for a domain along with detailed validation info, paginated.

### Endpoint

**POST** `/api/v1/domain_search`

### Base URL

```
https://smtpghost.com/api/v1/domain_search
```

### Headers

| Header         | Value                         | Required |
| -------------- | ----------------------------- | -------- |
| `Content-Type` | `application/json`            | Yes      |
| `X-KEY`        | `<your-organization-api-key>` | Yes      |

### Request Body

```json
{
  "domain": "voymedia.com",
  "page": 1,
  "items": 20
}
```

### Success Response (200 OK)

#### Domain Found & Emails Returned

```json
{
  "status": "success",
  "domain": "voymedia.com",
  "domain_found_in_db": true,
  "email_count": 2,
  "pagination": {
    "current_page": 1,
    "per_page": 20,
    "total_items": 2,
    "total_pages": 1,
    "next_page": null,
    "prev_page": null
  },
  "emails": [
    {
      "email": "kevin@voymedia.com",
      "validation": {
        "status": "VALID",
        "account_type": "professional",
        "is_role_account": false,
        "is_disposable": false,
        "is_catch_all": false,
        "last_verified_at": "2025-05-16T11:00:00-04:00",
        "mx_records": ["mx1.voymedia.com", "mx2.voymedia.com"]
      }
    },
    {
      "email": "support@voymedia.com",
      "validation": {
        "status": "VALID",
        "account_type": "professional",
        "is_role_account": false,
        "is_disposable": false,
        "is_catch_all": false,
        "last_verified_at": "2025-05-16T10:30:00-04:00",
        "mx_records": ["mx1.voymedia.com", "mx2.voymedia.com"]
      }
    }
  ]
}
```

#### No Emails Found

```json
{
  "status": "not_found",
  "domain": "voymedia.com",
  "domain_found_in_db": true,
  "message": "No valid or risky emails found for the given domain in our database.",
  "email_count": 0,
  "emails": []
}
```

#### Domain Not in Database

```json
{
  "status": "domain_not_in_db",
  "domain": "unknown.com",
  "domain_found_in_db": false,
  "message": "Domain not found in our database.",
  "email_count": 0,
  "emails": []
}
```

You will never receive a 404 for a missing endpoint—only structured JSON responses with the above statuses.

### Error Responses

#### 400 Bad Request

```json
{
  "error": "Please provide a domain."
}
```

#### 402 Payment Required

```json
{
  "error": "Insufficient credits. You need 1 credit to perform domain email lookup."
}
```

#### 500 Internal Server Error

```json
{
  "status": "error",
  "error": "An internal error occurred during domain search: <details>"
}
```

On any unexpected exception, your credits are refunded and a 500 is returned with `status: "error"`.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://kevins-organization-58.gitbook.io/smtp-ghost-api/domain-search.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
