Docs API Reference

POST /verify

Verify an email address before sending.

Overview

The /verify endpoint validates an email address format and checks if the domain can receive emails. Use this to clean your lists or validate user input before sending.

Endpoint

POST /v1/verify

Request Body

FieldTypeRequiredDescription
emailstringYesThe email address to verify

Example Request

curl -X POST https://api.mailsh.it/v1/verify \
  -H "Authorization: Bearer your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "email": "alice@example.com"
  }'

Response

Success (200)

{
  "email": "alice@example.com",
  "verification": {
    "valid": true,
    "format": true,
    "domain": true,
    "mxRecords": true,
    "disposable": false,
    "role": false
  }
}

Verification Fields

FieldTypeDescription
validbooleanOverall validity (true if all checks pass)
formatbooleanEmail format is valid
domainbooleanDomain exists
mxRecordsbooleanDomain has MX records
disposablebooleanWhether the domain is a known disposable email provider
rolebooleanWhether it’s a role-based address (e.g., info@, support@)

Invalid Format (400)

{
  "error": "Invalid email format"
}

Missing Email (400)

{
  "error": "email is required"
}

Verification Checks

Format Check

Validates that the email matches a valid email pattern:

  • Contains exactly one @ symbol
  • Has a valid local part (before @)
  • Has a valid domain part (after @)

Domain Check

Verifies the domain exists and is reachable.

MX Records Check

Confirms the domain has mail exchange (MX) records configured, indicating it can receive email.

Disposable Check

Detects temporary/disposable email services like:

  • Mailinator
  • Guerrilla Mail
  • 10 Minute Mail
  • And many others

Role-Based Check

Identifies role-based addresses that typically shouldn’t receive marketing emails:

  • info@
  • support@
  • admin@
  • webmaster@

Code Examples

JavaScript

async function verifyEmail(email: string) {
  const response = await fetch('https://api.mailsh.it/v1/verify', {
    method: 'POST',
    headers: {
      'Authorization': `Bearer ${process.env.MAILSHIT_API_KEY}`,
      'Content-Type': 'application/json',
    },
    body: JSON.stringify({ email }),
  })

  const result = await response.json()

  if (result.verification?.valid) {
    console.log('Email is valid')
  } else {
    console.log('Email is invalid or risky')
  }

  return result
}

Python

def verify_email(email: str):
    response = requests.post(
        'https://api.mailsh.it/v1/verify',
        headers={
            'Authorization': f'Bearer {api_key}',
            'Content-Type': 'application/json',
        },
        json={'email': email},
    )

    result = response.json()
    verification = result.get('verification', {})

    if verification.get('valid'):
        print('Email is valid')
    else:
        print('Email is invalid or risky')

    return result

Use Cases

  1. Form Validation - Verify emails at signup before sending welcome emails
  2. List Cleaning - Validate your email list before a campaign
  3. Import Validation - Check emails when importing contacts
  4. Pre-Send Check - Verify before each transactional send

Rate Limits

Email verification counts against your API rate limit. For bulk verification, consider:

  • Batch requests with delays
  • Caching verification results
  • Using verification in your flow instead of separate API calls