`lumail@2.1.0` · [`lumail.emails`](/docs/sdk/v2/emails)

```typescript
emails.verify({ email: string }): Promise<LumailResult<VerifyEmailResponse>>
```

Syntax and deliverability check. A timeout is `{ data: null, error: { name: "timeout" } }`, never a successful verify. `{ valid: false, error, code }` is still HTTP 200 and lands in `data`.

## Body Parameters

| Name | Type | Description |
| ------- | ------ | ------------------------------- |
| `email` | string | **Required.** Address to check. |

## Response Fields

| Field | Type | Description |
| ------------ | ---------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------- |
| `valid` | boolean | `true` when the address passes. `false` on a completed check that failed. |
| `warnings` | string[] | Optional warnings on either outcome. |
| `error` | string | Present when `valid` is `false`. Human-readable reason. |
| `code` | `"invalid_format"` / `"disposable_email"` / `"spam_domain"` / `"invalid_domain"` / `"test_email"` / `"internal_error"` | Present when `valid` is `false`. |
| `suggestion` | string | Optional correction when `valid` is `false`. |

`data` is `{ valid: true }` or `{ valid: false, error, code, ... }`. Transport failures, including timeout, return `{ data: null, error }`.


## API Reference
**Method:** POST
**Endpoint:** /api/v2/emails/verify

### SDK
```ts
import { Lumail } from "lumail";

const lumail = new Lumail({ apiKey: process.env.LUMAIL_API_KEY });
const { data, error } = await lumail.emails.verify({
  email: "user@example.com",
});
if (error) {
  throw error;
}
console.log(data.valid);
```

### cURL
```bash
curl -X POST https://lumail.io/api/v2/emails/verify \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"email":"user@example.com"}'
```

### JavaScript
```javascript
const response = await fetch("https://lumail.io/api/v2/emails/verify", {
  method: "POST",
  headers: {
    Authorization: "Bearer YOUR_API_TOKEN",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({ email: "user@example.com" }),
});
const data = await response.json();
```

### Success Response
```json
{ "valid": true }
```

### Error Response
```json
{
  "name": "validation_error",
  "message": "email is required",
  "statusCode": 422
}
```
