{
  "openapi": "3.1.0",
  "info": {
    "title": "validateemail.io API",
    "version": "1.0.0",
    "description": "Email validation: syntax, domain and MX checks, disposable-domain detection, role accounts and typo suggestions. Each address counts as one lookup. Get a free key with 250 lookups a day at https://validateemail.io/signup.",
    "contact": {
      "url": "https://validateemail.io/docs"
    }
  },
  "externalDocs": {
    "url": "https://validateemail.io/docs"
  },
  "servers": [
    {
      "url": "https://validateemail.io"
    }
  ],
  "security": [
    {
      "bearer": []
    },
    {
      "apiKeyHeader": []
    }
  ],
  "paths": {
    "/v1/validate": {
      "post": {
        "operationId": "validateEmail",
        "summary": "Validate one email address",
        "description": "Prefer POST: an address in a URL ends up in request logs. Also accepts a browser key (pk_…) from one of its allowed origins.",
        "parameters": [
          {
            "$ref": "#/components/parameters/fresh"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "email"
                ],
                "properties": {
                  "email": {
                    "type": "string",
                    "example": "jane@gmial.com"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The result. An invalid address is not an error: it returns 200 with status invalid.",
            "headers": {
              "X-Quota-Limit": {
                "description": "Lifetime lookups on a metered key.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-Quota-Remaining": {
                "description": "Lookups left on a metered key.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ValidationResult"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request, or more than 100 addresses in a batch.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or revoked API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests: more than 120 a minute with one key (rate_limited), or the key's lookups for the current 24 hours are used up (daily_limit_reached) or can't cover this batch (quota_exceeded). Nothing was used. Retry-After says how many seconds to wait; X-Quota-Reset is when the daily allowance renews.",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                }
              },
              "X-Quota-Reset": {
                "description": "Unix time (seconds) when the current 24-hour allowance ends.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "A browser key used from an origin it doesn't allow (origin_not_allowed), or for a batch (browser_key).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "get": {
        "operationId": "validateEmailGet",
        "summary": "Validate one email address (query string)",
        "description": "For quick tests. The address ends up in request logs, so prefer POST.",
        "parameters": [
          {
            "name": "email",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/fresh"
          }
        ],
        "responses": {
          "200": {
            "description": "The result.",
            "headers": {
              "X-Quota-Limit": {
                "description": "Lifetime lookups on a metered key.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-Quota-Remaining": {
                "description": "Lookups left on a metered key.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ValidationResult"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request, or more than 100 addresses in a batch.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or revoked API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests: more than 120 a minute with one key (rate_limited), or the key's lookups for the current 24 hours are used up (daily_limit_reached) or can't cover this batch (quota_exceeded). Nothing was used. Retry-After says how many seconds to wait; X-Quota-Reset is when the daily allowance renews.",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                }
              },
              "X-Quota-Reset": {
                "description": "Unix time (seconds) when the current 24-hour allowance ends.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/validate/batch": {
      "post": {
        "operationId": "validateBatch",
        "summary": "Validate up to 100 email addresses",
        "parameters": [
          {
            "$ref": "#/components/parameters/fresh"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "emails"
                ],
                "properties": {
                  "emails": {
                    "type": "array",
                    "minItems": 1,
                    "maxItems": 100,
                    "items": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Results in the order sent.",
            "headers": {
              "X-Quota-Limit": {
                "description": "Lifetime lookups on a metered key.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-Quota-Remaining": {
                "description": "Lookups left on a metered key.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "results"
                  ],
                  "properties": {
                    "results": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/ValidationResult"
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Malformed request, or more than 100 addresses in a batch.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or revoked API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests: more than 120 a minute with one key (rate_limited), or the key's lookups for the current 24 hours are used up (daily_limit_reached) or can't cover this batch (quota_exceeded). Nothing was used. Retry-After says how many seconds to wait; X-Quota-Reset is when the daily allowance renews.",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                }
              },
              "X-Quota-Reset": {
                "description": "Unix time (seconds) when the current 24-hour allowance ends.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/key/rotate": {
      "post": {
        "operationId": "rotateKey",
        "summary": "Replace the calling key with a new one",
        "description": "Returns a new key with the same plan, allowance and usage. The old key stops working at once.",
        "responses": {
          "201": {
            "description": "The new key. It is shown only once.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "key",
                    "key_id"
                  ],
                  "properties": {
                    "key": {
                      "type": "string"
                    },
                    "key_id": {
                      "type": "string"
                    },
                    "note": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or revoked API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "The key was revoked or rotated by another request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many key changes from this IP (10 a minute).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/keys/browser": {
      "post": {
        "operationId": "createBrowserKey",
        "summary": "Create a browser key",
        "description": "Creates a publishable key (pk_…) for front-end code. It only works from the listed origins, validates one address per request with POST or GET /v1/validate, and uses the lookups of the secret key that created it. Needs your secret key (ev_…).",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "origins"
                ],
                "properties": {
                  "origins": {
                    "type": "array",
                    "minItems": 1,
                    "maxItems": 10,
                    "items": {
                      "type": "string"
                    },
                    "description": "HTTPS origins, e.g. https://app.example.com. http://localhost is allowed for development."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The browser key. It is shown only once.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "id",
                    "key",
                    "origins"
                  ],
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "key": {
                      "type": "string"
                    },
                    "origins": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "note": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Missing or invalid origins.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Not a valid secret key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "The account already has 20 active browser keys (too_many_browser_keys).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many key changes from this IP (10 a minute).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/keys/browser/{id}": {
      "delete": {
        "operationId": "revokeBrowserKey",
        "summary": "Revoke a browser key",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "revoked": {
                      "type": "boolean"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Not a valid secret key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "No active browser key with that id on this account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/feedback": {
      "post": {
        "operationId": "reportDeliveryOutcomes",
        "summary": "Report what happened when you emailed validated addresses",
        "description": "Free: needs your API key but uses no lookups. Reports are matched to each address's current verdict and counted per status and reason; the addresses themselves aren't stored. The same report (address and outcome) counts once a day, and each key counts at most 10,000 reports a day.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "oneOf": [
                  {
                    "type": "object",
                    "required": [
                      "email",
                      "outcome"
                    ],
                    "properties": {
                      "email": {
                        "type": "string"
                      },
                      "outcome": {
                        "type": "string",
                        "enum": [
                          "delivered",
                          "hard_bounce",
                          "soft_bounce",
                          "complaint"
                        ]
                      }
                    }
                  },
                  {
                    "type": "object",
                    "required": [
                      "feedback"
                    ],
                    "properties": {
                      "feedback": {
                        "type": "array",
                        "minItems": 1,
                        "maxItems": 100,
                        "items": {
                          "type": "object",
                          "required": [
                            "email",
                            "outcome"
                          ],
                          "properties": {
                            "email": {
                              "type": "string"
                            },
                            "outcome": {
                              "type": "string",
                              "enum": [
                                "delivered",
                                "hard_bounce",
                                "soft_bounce",
                                "complaint"
                              ]
                            }
                          }
                        }
                      }
                    }
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Accepted.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "accepted"
                  ],
                  "properties": {
                    "accepted": {
                      "type": "integer"
                    },
                    "ignored": {
                      "type": "integer",
                      "description": "Reports not counted: already reported today, or past the key's daily allowance. Present only when more than 0."
                    },
                    "note": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Malformed report, or more than 100.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid or revoked API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "More than 120 requests a minute with one key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearer": {
        "type": "http",
        "scheme": "bearer",
        "description": "Authorization: Bearer <key>"
      },
      "apiKeyHeader": {
        "type": "apiKey",
        "in": "header",
        "name": "X-API-Key"
      }
    },
    "parameters": {
      "fresh": {
        "name": "fresh",
        "in": "query",
        "required": false,
        "schema": {
          "type": "boolean"
        },
        "description": "true skips the cache and re-runs every check."
      }
    },
    "schemas": {
      "ValidationResult": {
        "type": "object",
        "required": [
          "email",
          "normalized",
          "user",
          "domain",
          "status",
          "reason",
          "score",
          "did_you_mean",
          "checks",
          "mx_records",
          "checked_at"
        ],
        "properties": {
          "email": {
            "type": "string",
            "description": "The address as sent."
          },
          "normalized": {
            "type": [
              "string",
              "null"
            ],
            "description": "Lower-cased, punycode-domain form; null when the syntax is invalid."
          },
          "user": {
            "type": [
              "string",
              "null"
            ],
            "description": "The local part (before the @)."
          },
          "domain": {
            "type": [
              "string",
              "null"
            ],
            "description": "The domain in ASCII (punycode) form."
          },
          "status": {
            "type": "string",
            "enum": [
              "valid",
              "invalid",
              "risky",
              "unknown"
            ],
            "description": "valid: accepts mail, nothing risky found. invalid: won't receive mail. risky: may receive mail but is disposable, a likely typo, a role account or has no MX records. unknown: DNS failed temporarily; retry later."
          },
          "reason": {
            "type": "string",
            "description": "Why the status was chosen, e.g. mail_server_found, domain_not_found, no_mail_server, domain_rejects_mail, disposable, possible_typo, role_based, no_mx_records, dns_error, or a syntax reason such as missing_at_or_part."
          },
          "score": {
            "type": "number",
            "minimum": 0,
            "maximum": 1,
            "description": "0 (certainly bad) to 1 (very likely good)."
          },
          "did_you_mean": {
            "type": [
              "string",
              "null"
            ],
            "description": "Suggested correction for a likely typo, e.g. jane@gmail.com for jane@gmial.com."
          },
          "checks": {
            "type": "object",
            "required": [
              "syntax",
              "domain_exists",
              "mx_found",
              "disposable",
              "role_based",
              "free_provider",
              "parked",
              "catch_all",
              "smtp"
            ],
            "properties": {
              "syntax": {
                "type": "boolean"
              },
              "domain_exists": {
                "type": [
                  "boolean",
                  "null"
                ]
              },
              "mx_found": {
                "type": [
                  "boolean",
                  "null"
                ]
              },
              "disposable": {
                "type": [
                  "boolean",
                  "null"
                ]
              },
              "role_based": {
                "type": [
                  "boolean",
                  "null"
                ]
              },
              "free_provider": {
                "type": [
                  "boolean",
                  "null"
                ]
              },
              "parked": {
                "type": [
                  "boolean",
                  "null"
                ],
                "description": "The domain is parked with a domain-parking network (for sale or showing ads), so nobody reads its mail."
              },
              "catch_all": {
                "type": [
                  "boolean",
                  "null"
                ],
                "description": "The domain accepts mail for any address, so this mailbox can't be confirmed. null when it wasn't checked or couldn't be told."
              },
              "smtp": {
                "type": [
                  "boolean",
                  "null"
                ],
                "description": "Mailbox-level SMTP checks are not performed; always null."
              }
            }
          },
          "mx_records": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "exchange",
                "priority"
              ],
              "properties": {
                "exchange": {
                  "type": "string"
                },
                "priority": {
                  "type": "integer"
                }
              }
            }
          },
          "checked_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "Error": {
        "type": "object",
        "required": [
          "error"
        ],
        "properties": {
          "error": {
            "type": "object",
            "required": [
              "code",
              "message"
            ],
            "properties": {
              "code": {
                "type": "string"
              },
              "message": {
                "type": "string"
              },
              "remaining": {
                "type": "integer"
              },
              "upgrade_url": {
                "type": "string"
              }
            }
          }
        }
      }
    }
  }
}
