Email Validator: Walidacja

Zweryfikuj e-maile

Waliduj do 50 adresów w jednym poleceniu. Są sprawdzane równolegle i wracają w kolejności, w jakiej je wysłałeś.

POSThttps://g.sendcorex.com/v1/tool/validatecommand: validate_emails

Wymaga scope tools:validate w twoim API key.

1 kredyt na unikalny adres. Powtórzone adresy są walidowane i liczone raz, i pojawiają się raz w results.

Jeśli twoje kredyty nie pokrywają całej listy, nic nie jest walidowane: dostajesz INSUFFICIENT_CREDITS z informacją, ile potrzebujesz i ile masz.

Argumenty

  • emailsstring[]wymagane

    Od 1 do 50 adresów.

    np. ["ana@acme.com", "jhon@gmial.com"]

Szybki start

import axios from 'axios';

const response = await axios.post(
  'https://g.sendcorex.com/v1/tool/validate',
  {
    commands: [
      {
        command: "validate_emails",
        args: {
          emails: [
            "ana@acme.com",
            "jhon@gmial.com"
          ]
        }
      }
    ]
  },
  { headers: { Authorization: process.env.SENDCOREX_API_KEY } },
);

const [result] = response.data.results;
if (result.type !== 'SUCCESS') throw new Error(`${result.code}: ${result.message}`);
console.log(result.data);

Odpowiedź

{
  "type": "SUCCESS",
  "results": [
    {
      "command": "validate_emails",
      "id": "0",
      "type": "SUCCESS",
      "took_ms": 18,
      "data": {
        "results": [
          {
            "email": "ana@acme.com",
            "valid": true,
            "checks": [
              {
                "check": "Format Validation",
                "status": "Passed",
                "details": "Valid email format"
              },
              {
                "check": "Local Part Validation",
                "status": "Passed",
                "details": "Local part is RFC compliant"
              },
              {
                "check": "Role-based Email Check",
                "status": "Passed",
                "details": "Not a role-based address"
              },
              {
                "check": "No-reply Email Check",
                "status": "Passed",
                "details": "Not a no-reply address"
              },
              {
                "check": "Temporary Email Check",
                "status": "Passed",
                "details": "Not a temporary email"
              },
              {
                "check": "Misspelled Domain Check",
                "status": "Passed",
                "details": "Correct"
              },
              {
                "check": "Spam Trap Check",
                "status": "Passed",
                "details": "Not a spam trap"
              },
              {
                "check": "Provider Type",
                "status": "Passed",
                "details": "Corporate or custom domain"
              },
              {
                "check": "Domain Validation",
                "status": "Passed",
                "details": "Domain is valid and has MX records"
              },
              {
                "check": "Null MX Check",
                "status": "Passed",
                "details": "Domain accepts email"
              },
              {
                "check": "Email Provider Detection",
                "status": "Passed",
                "details": "Domain is hosted on a known provider: Google Workspace",
                "providerId": 1,
                "providerName": "Google Workspace"
              },
              {
                "check": "Email Deliverability",
                "status": "Passed",
                "details": "Mailbox exists",
                "fullResponse": "250 2.1.5 OK"
              },
              {
                "check": "Catch-all Mail Exchanger Check",
                "status": "Passed",
                "details": "Mail exchanger correctly rejects nonexistent addresses"
              }
            ]
          },
          {
            "email": "jhon@gmial.com",
            "valid": false,
            "checks": [
              {
                "check": "Format Validation",
                "status": "Passed",
                "details": "Valid email format"
              },
              {
                "check": "Local Part Validation",
                "status": "Passed",
                "details": "Local part is RFC compliant"
              },
              {
                "check": "Role-based Email Check",
                "status": "Passed",
                "details": "Not a role-based address"
              },
              {
                "check": "No-reply Email Check",
                "status": "Passed",
                "details": "Not a no-reply address"
              },
              {
                "check": "Temporary Email Check",
                "status": "Passed",
                "details": "Not a temporary email"
              },
              {
                "check": "Misspelled Domain Check",
                "status": "Failed",
                "details": "Possible typo. Suggested correction: jhon@gmail.com"
              },
              {
                "check": "Spam Trap Check",
                "status": "Passed",
                "details": "Not a spam trap"
              },
              {
                "check": "Provider Type",
                "status": "Passed",
                "details": "Corporate or custom domain"
              },
              {
                "check": "Domain Validation",
                "status": "Failed",
                "details": "Invalid domain or no MX records"
              }
            ]
          }
        ],
        "count": 2,
        "valid_count": 1,
        "invalid_count": 1,
        "credits_used": 2
      }
    }
  ]
}

Pola odpowiedzi

  • results

    Jeden wynik na unikalny adres, w kolejności, w jakiej je wysłałeś.

  • count / valid_count / invalid_count

    Ile sprawdzono oraz ile okazało się prawidłowych i nieprawidłowych.

  • credits_used

    Kredyty zużyte przez to polecenie.

  • results[].email

    Adres, bez spacji i małymi literami.

  • results[].valid

    true tylko wtedy, gdy każda kontrola została zaliczona. Provider Type i Email Provider Detection są informacyjne i nigdy nie zmieniają tego na false.

  • results[].checks[].check

    Nazwa kontroli. Zobacz Kontrole poniżej.

  • results[].checks[].status

    Passed lub Failed.

  • results[].checks[].details

    Zdanie wyjaśniające wynik, gotowe do pokazania użytkownikowi.

  • results[].checks[].fullResponse

    Tylko przy Email Deliverability: dokładna odpowiedź serwera skrzynki.

  • results[].checks[].providerId / providerName

    Tylko przy Email Provider Detection: dostawca poczty hostujący domenę.

Duże listy

Dla tysięcy adresów wywołuj to polecenie porcjami po 50, jedno po drugim, albo prześlij plik w dashboardzie (Email Validator → Lists): jest walidowany w tle, a po zakończeniu dostajesz e-mail z plikiem CSV.

Błędy

Błędy na poziomie HTTP zwracają type, code i message. Błędy oznaczone CMD wracają w wyniku polecenia, z HTTP 200.

  • 401INVALID_API_KEY

    API key nie istnieje, został unieważniony lub wyłączony w panelu.

  • 429RATE_LIMITED

    Ponad 75 żądań/s lub 75 w toku dla tego samego IP + API key. Odczekaj liczbę sekund z Retry-After.

  • CMDMISSING_SCOPE

    API key nie ma `tools:validate`.

  • CMDINVALID_ARGS

    Argument jest nieprawidłowy: brak email (lub domain dla `check_disposable`), ponad 50 e-maili, adres dłuższy niż 254 znaki, limit poza zakresem…

  • CMDINSUFFICIENT_CREDITS

    Nie masz dość kredytów na całe polecenie (kredyty walidacji dla `validate_*`, kredyty sprawdzania jednorazowych adresów dla `check_disposable`). Nic nie zostało sprawdzone i nic nie zostało pobrane.

  • CMDCREDITS_UNAVAILABLE

    Nie udało się teraz odczytać twoich kredytów. Nic nie zostało pobrane. Spróbuj ponownie.

  • CMDNO_SERVERS_AVAILABLE

    Żaden serwer walidacji nie jest teraz dostępny. Nic nie zostało pobrane. Spróbuj ponownie za chwilę.

  • CMDVALIDATION_FAILED

    Serwery walidacji nie odpowiedziały na czas. Twoje kredyty zostały zwrócone. Spróbuj ponownie.

  • CMDINTERNAL

    Błąd serwera. Szczegóły trafiają tylko do logu serwera.