> ## Documentation Index
> Fetch the complete documentation index at: https://docs.mailglyph.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Email Validation

> Validate email addresses, run bulk validation jobs, and inspect credits with the MailGlyph Node.js SDK.

Use a **secret key** client for Email Validation.

```ts theme={null}
import MailGlyph from 'mailglyph';

const client = new MailGlyph(process.env.MAILGLYPH_SECRET_KEY as string);
```

## Validate one address

```ts theme={null}
const result = await client.verification.validate('user@example.com');

console.log(result.data.valid);
console.log(result.data.validationMethod);
console.log(result.data.smtpStatus);
console.log(result.data.creditsConsumed);
console.log(result.data.reasons);
```

`client.emails.verify(email)` is also available as a convenience method for single-address validation.

## Handle typo suggestions

```ts theme={null}
const result = await client.verification.validate('user@gmial.com');

if (result.data.isTypo && result.data.suggestedEmail) {
  console.log('Did you mean:', result.data.suggestedEmail);
}
```

## Create a bulk validation job

```ts theme={null}
const bulk = await client.verification.createBulk({
  file: new Blob(['email\nalice@example.com\nbob@example.com\n'], {
    type: 'text/csv'
  }),
  filename: 'emails.csv'
});

console.log(bulk.data.id);
console.log(bulk.data.status);
console.log(bulk.data.reservedCredits);
```

## List and poll jobs

```ts theme={null}
const jobs = await client.verification.listBulk({
  limit: 20,
  status: 'COMPLETED'
});

const job = await client.verification.getBulk(bulk.data.id);

console.log(jobs.data.nextCursor);
console.log(job.data.status, job.data.readyForDownload);
```

If a job pauses because more credits are required, continue it after adding credits:

```ts theme={null}
if (job.data.status === 'ACTION_REQUIRED') {
  await client.verification.continueBulk(job.data.id);
}
```

## Download results

```ts theme={null}
if (job.data.readyForDownload) {
  const file = await client.verification.downloadBulk(job.data.id, {
    filter: 'valid',
    format: 'csv'
  });

  console.log(file.byteLength);
}
```

Download filters are `all`, `valid`, `invalid`, `unknown`, and `catchall`. Filtered downloads are CSV only. XLS is available only when `filter` is `all`.

## Delete a job

```ts theme={null}
const deleted = await client.verification.deleteBulk(job.data.id);

console.log(deleted.data.refundedCredits);
```

Jobs can be deleted only when they are not actively uploading or processing.

## Check credits

```ts theme={null}
const credits = await client.verification.getCredits();
const ledger = await client.verification.listCreditLedger({ limit: 25 });

console.log(credits.data.balance, credits.data.lowCredits);
console.log(ledger.data.items.length, ledger.data.nextCursor);
```

See full endpoint details in the [Email Validation API reference](https://docs.mailglyph.com/api-reference/verifications/verifyEmail.md).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.