{
  "openapi": "3.1.0",
  "info": {
    "title": "CleanMail API",
    "version": "2.1.0",
    "summary": "Email verification for developers.",
    "description": "CleanMail verifies whether an email address is deliverable, and whether the domain behind it is risky.\n\n**Getting a key.** Sign up at https://cleanmail.dev/app.html - the key is emailed to you and is usable straight away. New accounts start on the Starter plan, which is free until further notice (300 verifications a day, no credit card).\n\n**Authentication.** Send your key in the `X-API-Key` header. Every endpoint except `/api/demo/verify`, `/api/features`, `/api/key/{key}` and `/health` needs it.\n\n**Free tier.** `POST /api/demo/verify` needs no key at all - ten requests a minute, a hundred a day and fifteen different email domains a day, per IP address.\n\n**What the allowance limits.** The daily allowance is the limit: a plan may aim at as many different mail servers as it has verifications. We talk to at most 105 mail servers at the same time (100 for paying accounts, 5 for the free validator), and the checks in a list run side by side inside that ceiling, so a large job finishes quickly without flooding anybody's mail server.",
    "termsOfService": "https://cleanmail.dev/terms.html",
    "contact": {
      "name": "CleanMail support",
      "email": "CleanMail.service@gmail.com",
      "url": "https://cleanmail.dev/"
    },
    "license": {
      "name": "CleanMail terms of service",
      "url": "https://cleanmail.dev/terms.html"
    }
  },
  "servers": [
    {
      "url": "https://cleanmail.dev",
      "description": "Production"
    }
  ],
  "tags": [
    {
      "name": "Verification",
      "description": "Check one address or a batch of them."
    },
    {
      "name": "MCP",
      "description": "The Model Context Protocol: one JSON-RPC endpoint an agent connects to."
    },
    {
      "name": "Batch",
      "description": "Upload a CSV and collect the results."
    },
    {
      "name": "Webhooks",
      "description": "Get told when a batch finishes."
    },
    {
      "name": "Account",
      "description": "Sign up, log in, and check what you have used."
    },
    {
      "name": "Free",
      "description": "The no-key demo path."
    },
    {
      "name": "Billing",
      "description": "Subscription state, and the webhook Paddle pays through."
    }
  ],
  "paths": {
    "/mcp": {
      "post": {
        "tags": [
          "MCP"
        ],
        "summary": "Call CleanMail through the Model Context Protocol",
        "description": "One endpoint that speaks JSON-RPC 2.0, the transport the Model Context Protocol uses. An agent connects, sends `initialize`, then `tools/list` to see the tools, then `tools/call` to use one.\n\nThe tools are `verify_email` (check one address) and `check_domain` (the mail setup of a domain - DNS only, no address). A verification goes through the same path as POST /api/verify: the same rate limit, the same daily allowance and the same accounting. An MCP call is not a cheaper way into the service.\n\nThe API key goes in the `X-API-Key` header, or as `Authorization: Bearer <key>`.",
        "operationId": "mcpCall",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "jsonrpc": {
                    "type": "string",
                    "enum": [
                      "2.0"
                    ]
                  },
                  "id": {
                    "type": [
                      "integer",
                      "string",
                      "null"
                    ]
                  },
                  "method": {
                    "type": "string",
                    "examples": [
                      "initialize",
                      "tools/list",
                      "tools/call"
                    ]
                  },
                  "params": {
                    "type": "object"
                  }
                },
                "required": [
                  "jsonrpc",
                  "method"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The JSON-RPC response.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "jsonrpc": {
                      "type": "string"
                    },
                    "id": {
                      "type": [
                        "integer",
                        "string",
                        "null"
                      ]
                    },
                    "result": {
                      "type": "object"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "The body was not a JSON-RPC message.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "No API key was sent.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The key is not valid, the account has not verified its email address, or the origin is not allowed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited, or the daily allowance is used up.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "get": {
        "tags": [
          "MCP"
        ],
        "summary": "The server-to-client stream is not offered",
        "description": "The Model Context Protocol's Streamable HTTP transport lets a client open a GET stream to receive messages from the server. This server is stateless: it never sends messages to the client, so it offers no stream and this route answers 405 with a JSON-RPC error that says so. Use POST /mcp.",
        "operationId": "mcpStream",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "responses": {
          "405": {
            "description": "This server offers no server-to-client stream. Use POST /mcp.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/verify": {
      "post": {
        "tags": [
          "Verification"
        ],
        "summary": "Verify one email address",
        "description": "Runs a full check: SMTP delivery, MX records, DMARC and SPF, domain age, disposable, role-account, free-provider and spam-trap signals, plus a risk score.\n\nCatch-all detection needs the Pro plan or above; on lower plans the `isCatchall` field is omitted rather than reported as false.",
        "operationId": "verifyEmail",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "email": {
                    "type": "string",
                    "format": "email",
                    "examples": [
                      "user@example.com"
                    ]
                  }
                },
                "required": [
                  "email"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The verification result.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VerifyResult"
                }
              }
            },
            "headers": {
              "X-RateLimit-Limit": {
                "description": "The daily allowance of this plan.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "How much of the daily allowance is left.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-Cost": {
                "description": "What this check cost: 1 for an answer, 0 when the mail server did not answer. You only pay for answers.",
                "schema": {
                  "type": "string"
                }
              },
              "Retry-After": {
                "description": "How many seconds to wait before asking again. Present when the reason is 'busy'.",
                "schema": {
                  "type": "integer"
                }
              }
            }
          },
          "400": {
            "description": "Bad request - the body is not valid JSON, or the email or another field is missing or malformed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "The request body is larger than the server accepts.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - the API key is missing.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - the API key is invalid or blocked, the account has not verified its email address, the account itself has been blocked (the code ACCOUNT_BLOCKED, and the body carries the reason), or this client address is on the block list (the code BLOCKED_IP).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited - the per-second limiter or the daily quota was reached. The free validator has its own limits and answers with the code RATE_LIMIT_DOMAINS when one IP address aims at too many different email domains.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "How many seconds to wait before trying again.",
                "schema": {
                  "type": "integer"
                }
              }
            }
          },
          "500": {
            "description": "The verification failed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Temporarily unavailable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/verify/quick": {
      "post": {
        "tags": [
          "Verification"
        ],
        "summary": "Verify one email address, fast",
        "description": "The same check as POST /api/verify with a trimmed response. Use it when you only need `deliverable` and `reason`.",
        "operationId": "quickVerifyEmail",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "email": {
                    "type": "string",
                    "format": "email",
                    "examples": [
                      "user@example.com"
                    ]
                  }
                },
                "required": [
                  "email"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The verification result.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VerifyResult"
                }
              }
            }
          },
          "400": {
            "description": "Bad request - the body is not valid JSON, or the email or another field is missing or malformed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "The request body is larger than the server accepts.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - the API key is missing.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - the API key is invalid or blocked, the account has not verified its email address, the account itself has been blocked (the code ACCOUNT_BLOCKED, and the body carries the reason), or this client address is on the block list (the code BLOCKED_IP).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited - the per-second limiter or the daily quota was reached. The free validator has its own limits and answers with the code RATE_LIMIT_DOMAINS when one IP address aims at too many different email domains.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "How many seconds to wait before trying again.",
                "schema": {
                  "type": "integer"
                }
              }
            }
          },
          "500": {
            "description": "The verification failed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Temporarily unavailable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/verify/batch": {
      "post": {
        "tags": [
          "Verification"
        ],
        "summary": "Verify up to 500 addresses in one request",
        "description": "With `options.webhookId` the batch runs in the background and the response returns immediately with a batch id. Without it the request waits and returns a summary.\n\nThe batch id of a background batch is also the job id: `GET /api/batch/status/{batchId}` shows how the batch went and `GET /api/batch/download/{batchId}` returns the results as a CSV, so the results are still reachable when the callback could not be delivered.",
        "operationId": "verifyBatch",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "emails": {
                    "type": "array",
                    "maxItems": 500,
                    "items": {
                      "type": "string",
                      "format": "email"
                    }
                  },
                  "options": {
                    "type": "object",
                    "properties": {
                      "webhookId": {
                        "type": "string"
                      }
                    }
                  }
                },
                "required": [
                  "emails"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "A summary of the batch, or a batch id when the batch was queued.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "batchId": {
                      "type": "string"
                    },
                    "total": {
                      "type": "integer"
                    },
                    "deliverable": {
                      "type": "integer"
                    },
                    "invalid": {
                      "type": "integer"
                    },
                    "risky": {
                      "type": "integer"
                    },
                    "disposable": {
                      "type": "integer"
                    },
                    "webhookId": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad request - the body is not valid JSON, or the email or another field is missing or malformed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "The request body is larger than the server accepts.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - the API key is missing.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - the API key is invalid or blocked, the account has not verified its email address, the account itself has been blocked (the code ACCOUNT_BLOCKED, and the body carries the reason), or this client address is on the block list (the code BLOCKED_IP).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited - the per-second limiter or the daily quota was reached. The free validator has its own limits and answers with the code RATE_LIMIT_DOMAINS when one IP address aims at too many different email domains.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "How many seconds to wait before trying again.",
                "schema": {
                  "type": "integer"
                }
              }
            }
          },
          "500": {
            "description": "The verification failed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Temporarily unavailable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/demo/verify": {
      "post": {
        "tags": [
          "Free"
        ],
        "summary": "Verify one address without an API key",
        "description": "The free demo path. No API key is needed. It is rate limited to 10 requests per minute, 100 requests per day and 15 different email domains per day, per IP address, and it never reports catch-all detection.\n\nThe address is not stored: it is replaced by a keyed one-way hash. The domain, the result, the IP address and the flags are kept for operational filtering.",
        "operationId": "demoVerifyEmail",
        "security": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "email": {
                    "type": "string",
                    "format": "email",
                    "examples": [
                      "user@example.com"
                    ]
                  }
                },
                "required": [
                  "email"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The verification result.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VerifyResult"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited - ten per minute, one hundred per day, or fifteen different email domains a day, per IP address. The domain limit answers with the code RATE_LIMIT_DOMAINS.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Temporarily unavailable - the service can be paused for maintenance (the code SERVICE_MAINTENANCE) and the free validator can be paused on its own (the code FREE_VALIDATOR_PAUSED). A paused answer carries a Retry-After header.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/usage": {
      "get": {
        "tags": [
          "Account"
        ],
        "summary": "Current usage for the API key",
        "operationId": "getUsage",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Usage and quota.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "plan": {
                      "type": "string"
                    },
                    "totalUsage": {
                      "type": "integer"
                    },
                    "dailyUsage": {
                      "type": "integer"
                    },
                    "dailyLimit": {
                      "type": "integer"
                    },
                    "monthlyLimit": {
                      "type": "integer"
                    },
                    "resetIn": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad request - the body is not valid JSON, or the email or another field is missing or malformed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "The request body is larger than the server accepts.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - the API key is missing.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - the API key is invalid or blocked, the account has not verified its email address, the account itself has been blocked (the code ACCOUNT_BLOCKED, and the body carries the reason), or this client address is on the block list (the code BLOCKED_IP).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited - the per-second limiter or the daily quota was reached. The free validator has its own limits and answers with the code RATE_LIMIT_DOMAINS when one IP address aims at too many different email domains.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "How many seconds to wait before trying again.",
                "schema": {
                  "type": "integer"
                }
              }
            }
          },
          "500": {
            "description": "The verification failed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Temporarily unavailable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/features": {
      "get": {
        "tags": [
          "Account"
        ],
        "summary": "The features this deployment supports",
        "operationId": "getFeatures",
        "security": [],
        "responses": {
          "200": {
            "description": "The feature list.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "version": {
                      "type": "string"
                    },
                    "features": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "name": {
                            "type": "string"
                          },
                          "description": {
                            "type": "string"
                          },
                          "enabled": {
                            "type": "boolean"
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/key/{key}": {
      "get": {
        "tags": [
          "Account"
        ],
        "summary": "Check whether an API key is valid",
        "description": "Returns the plan and usage for the key that is put in the path. The key is the credential here, so it is not sent as a header.",
        "operationId": "inspectApiKey",
        "security": [],
        "parameters": [
          {
            "name": "key",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "The API key to inspect."
          }
        ],
        "responses": {
          "200": {
            "description": "The key's validity, plan and usage.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "valid": {
                      "type": "boolean"
                    },
                    "plan": {
                      "type": "string"
                    },
                    "usage": {
                      "type": "integer"
                    },
                    "dailyUsage": {
                      "type": "integer"
                    },
                    "dailyLimit": {
                      "type": "integer"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad request - the body is not valid JSON, or the email or another field is missing or malformed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "The request body is larger than the server accepts.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - the API key is missing.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - the API key is invalid or blocked, the account has not verified its email address, the account itself has been blocked (the code ACCOUNT_BLOCKED, and the body carries the reason), or this client address is on the block list (the code BLOCKED_IP).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited - the per-second limiter or the daily quota was reached. The free validator has its own limits and answers with the code RATE_LIMIT_DOMAINS when one IP address aims at too many different email domains.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "How many seconds to wait before trying again.",
                "schema": {
                  "type": "integer"
                }
              }
            }
          },
          "500": {
            "description": "The verification failed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Temporarily unavailable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/health": {
      "get": {
        "tags": [
          "Account"
        ],
        "summary": "Liveness check",
        "operationId": "health",
        "security": [],
        "responses": {
          "200": {
            "description": "The service is up.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "string"
                    },
                    "service": {
                      "type": "string"
                    },
                    "version": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/webhooks": {
      "get": {
        "tags": [
          "Webhooks"
        ],
        "summary": "List the webhooks registered for this key",
        "operationId": "listWebhooks",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "The webhook list.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "webhooks": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "url": {
                            "type": "string"
                          },
                          "createdAt": {
                            "type": "integer"
                          },
                          "calls": {
                            "type": "integer",
                            "description": "Deliveries that landed: the receiver answered 2xx."
                          },
                          "attempts": {
                            "type": "integer",
                            "description": "Deliveries tried, successful or not. attempts = calls + failures."
                          },
                          "failures": {
                            "type": "integer",
                            "description": "Deliveries that did not succeed."
                          },
                          "lastCall": {
                            "type": [
                              "integer",
                              "null"
                            ]
                          },
                          "lastStatus": {
                            "type": [
                              "integer",
                              "null"
                            ],
                            "description": "The HTTP status of the last attempt, or null when there was no answer."
                          },
                          "lastError": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Why the last attempt failed, or null after a success."
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad request - the body is not valid JSON, or the email or another field is missing or malformed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "The request body is larger than the server accepts.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - the API key is missing.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - the API key is invalid or blocked, the account has not verified its email address, the account itself has been blocked (the code ACCOUNT_BLOCKED, and the body carries the reason), or this client address is on the block list (the code BLOCKED_IP).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited - the per-second limiter or the daily quota was reached. The free validator has its own limits and answers with the code RATE_LIMIT_DOMAINS when one IP address aims at too many different email domains.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "How many seconds to wait before trying again.",
                "schema": {
                  "type": "integer"
                }
              }
            }
          },
          "500": {
            "description": "The verification failed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Temporarily unavailable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/webhooks/register": {
      "post": {
        "tags": [
          "Webhooks"
        ],
        "summary": "Register a webhook",
        "description": "CleanMail POSTs the finished batch to this URL when a batch that names this webhook id completes.\n\nOnly a batch sent to `POST /api/verify/batch` names a webhook; the CSV upload path does not call a webhook.\n\nThe callback is delivered by CleanMail, from our own network, so the URL has to be reachable from the internet. A URL that points at a loopback, private or link-local address, or at a name like localhost, is refused with 400 PRIVATE_URL. A URL that is not a usable http/https URL, or that carries a username and password, is refused with 400 INVALID_URL.",
        "operationId": "registerWebhook",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "url": {
                    "type": "string",
                    "format": "uri"
                  }
                },
                "required": [
                  "url"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The webhook was registered.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "webhookId": {
                      "type": "string"
                    },
                    "url": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "The callback URL was refused: INVALID_URL when it is not a usable http/https URL, PRIVATE_URL when it points at a loopback, private or link-local address.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "The request body is larger than the server accepts.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - the API key is missing.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - the API key is invalid or blocked, the account has not verified its email address, the account itself has been blocked (the code ACCOUNT_BLOCKED, and the body carries the reason), or this client address is on the block list (the code BLOCKED_IP).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited - the per-second limiter or the daily quota was reached. The free validator has its own limits and answers with the code RATE_LIMIT_DOMAINS when one IP address aims at too many different email domains.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "How many seconds to wait before trying again.",
                "schema": {
                  "type": "integer"
                }
              }
            }
          },
          "500": {
            "description": "The verification failed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Temporarily unavailable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/webhooks/{id}": {
      "delete": {
        "tags": [
          "Webhooks"
        ],
        "summary": "Remove a webhook",
        "operationId": "deleteWebhook",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The webhook was removed.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad request - the body is not valid JSON, or the email or another field is missing or malformed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "The request body is larger than the server accepts.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - the API key is missing.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - the API key is invalid or blocked, the account has not verified its email address, the account itself has been blocked (the code ACCOUNT_BLOCKED, and the body carries the reason), or this client address is on the block list (the code BLOCKED_IP).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited - the per-second limiter or the daily quota was reached. The free validator has its own limits and answers with the code RATE_LIMIT_DOMAINS when one IP address aims at too many different email domains.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "How many seconds to wait before trying again.",
                "schema": {
                  "type": "integer"
                }
              }
            }
          },
          "500": {
            "description": "The verification failed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Temporarily unavailable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/batch/upload": {
      "post": {
        "tags": [
          "Batch"
        ],
        "summary": "Upload a CSV of addresses",
        "description": "Accepts a multipart upload with a CSV file. The job runs in the background and the results are emailed to the account that owns the API key.\n\nThe results email always goes to the authenticated account. A recipient supplied by the client is ignored.\n\nThis path does not call a webhook. A job is followed with `GET /api/batch/status/{jobId}` and collected with `GET /api/batch/download/{jobId}`.",
        "operationId": "uploadBatch",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "properties": {
                  "file": {
                    "type": "string",
                    "format": "binary",
                    "description": "A CSV file with one address per line."
                  }
                },
                "required": [
                  "file"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The job was accepted.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "jobId": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad request - the body is not valid JSON, or the email or another field is missing or malformed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "The request body is larger than the server accepts.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - the API key is missing.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - the API key is invalid or blocked, the account has not verified its email address, the account itself has been blocked (the code ACCOUNT_BLOCKED, and the body carries the reason), or this client address is on the block list (the code BLOCKED_IP).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited - the per-second limiter or the daily quota was reached. The free validator has its own limits and answers with the code RATE_LIMIT_DOMAINS when one IP address aims at too many different email domains.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "How many seconds to wait before trying again.",
                "schema": {
                  "type": "integer"
                }
              }
            }
          },
          "500": {
            "description": "The verification failed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Temporarily unavailable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/batch/status/{jobId}": {
      "get": {
        "tags": [
          "Batch"
        ],
        "summary": "Check a batch job",
        "operationId": "getBatchStatus",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "name": "jobId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The job's progress.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "jobId": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string"
                    },
                    "total": {
                      "type": "integer"
                    },
                    "processed": {
                      "type": "integer"
                    },
                    "valid": {
                      "type": "integer"
                    },
                    "invalid": {
                      "type": "integer"
                    },
                    "queued": {
                      "type": "integer"
                    },
                    "result_url": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad request - the body is not valid JSON, or the email or another field is missing or malformed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "The request body is larger than the server accepts.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - the API key is missing.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - the API key is invalid or blocked, the account has not verified its email address, the account itself has been blocked (the code ACCOUNT_BLOCKED, and the body carries the reason), or this client address is on the block list (the code BLOCKED_IP).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited - the per-second limiter or the daily quota was reached. The free validator has its own limits and answers with the code RATE_LIMIT_DOMAINS when one IP address aims at too many different email domains.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "How many seconds to wait before trying again.",
                "schema": {
                  "type": "integer"
                }
              }
            }
          },
          "500": {
            "description": "The verification failed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Temporarily unavailable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/batch/history": {
      "get": {
        "tags": [
          "Batch"
        ],
        "summary": "List this key's batch jobs",
        "operationId": "getBatchHistory",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "The job list, newest first.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "jobs": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "filename": {
                            "type": "string"
                          },
                          "total": {
                            "type": "integer"
                          },
                          "processed": {
                            "type": "integer"
                          },
                          "valid": {
                            "type": "integer"
                          },
                          "invalid": {
                            "type": "integer"
                          },
                          "status": {
                            "type": "string"
                          },
                          "created_at": {
                            "type": "string"
                          },
                          "result_url": {
                            "type": [
                              "string",
                              "null"
                            ]
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad request - the body is not valid JSON, or the email or another field is missing or malformed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "The request body is larger than the server accepts.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - the API key is missing.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - the API key is invalid or blocked, the account has not verified its email address, the account itself has been blocked (the code ACCOUNT_BLOCKED, and the body carries the reason), or this client address is on the block list (the code BLOCKED_IP).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited - the per-second limiter or the daily quota was reached. The free validator has its own limits and answers with the code RATE_LIMIT_DOMAINS when one IP address aims at too many different email domains.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "How many seconds to wait before trying again.",
                "schema": {
                  "type": "integer"
                }
              }
            }
          },
          "500": {
            "description": "The verification failed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Temporarily unavailable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/batch/download/{jobId}": {
      "get": {
        "tags": [
          "Batch"
        ],
        "summary": "Download the results of a finished job",
        "description": "Returns the results as a CSV file. The key may also be given as a `key` query parameter, which is what the emailed download link uses.",
        "operationId": "downloadBatchResults",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "name": "jobId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The results as CSV.",
            "content": {
              "text/csv": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - the API key is missing.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "The verification failed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/batch/cancel/{jobId}": {
      "post": {
        "tags": [
          "Batch"
        ],
        "summary": "Cancel a running job",
        "operationId": "cancelBatch",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "name": "jobId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The job was cancelled.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad request - the body is not valid JSON, or the email or another field is missing or malformed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "The request body is larger than the server accepts.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - the API key is missing.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - the API key is invalid or blocked, the account has not verified its email address, the account itself has been blocked (the code ACCOUNT_BLOCKED, and the body carries the reason), or this client address is on the block list (the code BLOCKED_IP).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited - the per-second limiter or the daily quota was reached. The free validator has its own limits and answers with the code RATE_LIMIT_DOMAINS when one IP address aims at too many different email domains.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "How many seconds to wait before trying again.",
                "schema": {
                  "type": "integer"
                }
              }
            }
          },
          "500": {
            "description": "The verification failed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Temporarily unavailable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/batch/jobs/{jobId}": {
      "delete": {
        "tags": [
          "Batch"
        ],
        "summary": "Delete one of this key's batch jobs",
        "description": "Removes the job and the files it owns, including the results CSV. The usage history is kept: it is the record of what was verified and it is what the daily quota is counted from.\n\nA job that is still running cannot be deleted. Cancel it first, then delete it.",
        "operationId": "deleteBatchJob",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "name": "jobId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The job was deleted.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "deleted": {
                      "type": "string"
                    },
                    "filesRemoved": {
                      "type": "integer"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad request - the body is not valid JSON, or the email or another field is missing or malformed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "The request body is larger than the server accepts.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - the API key is missing.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - the API key is invalid or blocked, the account has not verified its email address, the account itself has been blocked (the code ACCOUNT_BLOCKED, and the body carries the reason), or this client address is on the block list (the code BLOCKED_IP).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited - the per-second limiter or the daily quota was reached. The free validator has its own limits and answers with the code RATE_LIMIT_DOMAINS when one IP address aims at too many different email domains.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "How many seconds to wait before trying again.",
                "schema": {
                  "type": "integer"
                }
              }
            }
          },
          "500": {
            "description": "The verification failed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Temporarily unavailable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/batch/jobs": {
      "delete": {
        "tags": [
          "Batch"
        ],
        "summary": "Delete every finished job on this key",
        "description": "Removes every job of this key that is not still running, together with their results files. Jobs that are still running are left alone and counted in `skipped`.\n\nThe usage history is kept.",
        "operationId": "deleteBatchJobs",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "The jobs were deleted.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "deleted": {
                      "type": "integer"
                    },
                    "skipped": {
                      "type": "integer"
                    },
                    "jobIds": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad request - the body is not valid JSON, or the email or another field is missing or malformed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "The request body is larger than the server accepts.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - the API key is missing.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - the API key is invalid or blocked, the account has not verified its email address, the account itself has been blocked (the code ACCOUNT_BLOCKED, and the body carries the reason), or this client address is on the block list (the code BLOCKED_IP).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited - the per-second limiter or the daily quota was reached. The free validator has its own limits and answers with the code RATE_LIMIT_DOMAINS when one IP address aims at too many different email domains.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "How many seconds to wait before trying again.",
                "schema": {
                  "type": "integer"
                }
              }
            }
          },
          "500": {
            "description": "The verification failed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Temporarily unavailable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/auth/signup": {
      "post": {
        "tags": [
          "Account"
        ],
        "summary": "Create an account",
        "description": "Creates the account and emails a six digit confirmation code to the address. The account cannot sign in and its API key is refused until that code is confirmed, so nobody can hold an account for an address they do not own. New accounts start on the Starter plan, which is free until further notice.",
        "operationId": "signup",
        "security": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "email": {
                    "type": "string",
                    "format": "email"
                  },
                  "password": {
                    "type": "string",
                    "minLength": 8
                  }
                },
                "required": [
                  "email",
                  "password"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The account was created and a code was sent. The API key is emailed once the code is confirmed.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "message": {
                      "type": "string"
                    },
                    "emailSent": {
                      "type": "boolean"
                    },
                    "requiresVerification": {
                      "type": "boolean"
                    },
                    "userId": {
                      "type": "integer"
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "That address is already registered. The comparison ignores case, so one mailbox is one account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "400": {
            "description": "Bad request - the body is not valid JSON, or the email or another field is missing or malformed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many signups from this connection or for this address. Try again later.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "The verification failed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/auth/verify": {
      "post": {
        "tags": [
          "Account"
        ],
        "summary": "Confirm an account with the emailed code",
        "description": "Confirms the address and then emails the API key to it. The code is valid for ten minutes and five wrong guesses throw it away - ask for a new one after that.",
        "operationId": "verifyAccount",
        "security": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "email": {
                    "type": "string",
                    "format": "email"
                  },
                  "code": {
                    "type": "string"
                  }
                },
                "required": [
                  "email",
                  "code"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The address was confirmed.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad request - the body is not valid JSON, or the email or another field is missing or malformed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "The request body is larger than the server accepts.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - the API key is missing.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - the API key is invalid or blocked, the account has not verified its email address, the account itself has been blocked (the code ACCOUNT_BLOCKED, and the body carries the reason), or this client address is on the block list (the code BLOCKED_IP).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited - the per-second limiter or the daily quota was reached. The free validator has its own limits and answers with the code RATE_LIMIT_DOMAINS when one IP address aims at too many different email domains.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "How many seconds to wait before trying again.",
                "schema": {
                  "type": "integer"
                }
              }
            }
          },
          "500": {
            "description": "The verification failed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Temporarily unavailable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/auth/login": {
      "post": {
        "tags": [
          "Account"
        ],
        "summary": "Log in",
        "description": "Returns the account, its API keys, a session token and the usage counters. The session token is what the dashboard sends as `X-Session-Token`. An account that has not confirmed its email address is refused with 403 and the code `EMAIL_NOT_VERIFIED`.",
        "operationId": "login",
        "security": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "email": {
                    "type": "string",
                    "format": "email"
                  },
                  "password": {
                    "type": "string"
                  }
                },
                "required": [
                  "email",
                  "password"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Logged in.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "sessionToken": {
                      "type": "string"
                    },
                    "user": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "integer"
                        },
                        "email": {
                          "type": "string"
                        },
                        "plan": {
                          "type": "string"
                        }
                      }
                    },
                    "apiKeys": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {}
                      }
                    },
                    "usage": {
                      "type": "object",
                      "properties": {}
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad request - the body is not valid JSON, or the email or another field is missing or malformed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "The request body is larger than the server accepts.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - the API key is missing.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - the API key is invalid or blocked, the account has not verified its email address, the account itself has been blocked (the code ACCOUNT_BLOCKED, and the body carries the reason), or this client address is on the block list (the code BLOCKED_IP).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited - the per-second limiter or the daily quota was reached. The free validator has its own limits and answers with the code RATE_LIMIT_DOMAINS when one IP address aims at too many different email domains.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "How many seconds to wait before trying again.",
                "schema": {
                  "type": "integer"
                }
              }
            }
          },
          "500": {
            "description": "The verification failed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Temporarily unavailable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/auth/resend-code": {
      "post": {
        "tags": [
          "Account"
        ],
        "summary": "Send the confirmation code again",
        "description": "Sends a fresh confirmation code to the address. The code is valid for ten minutes. One code a minute per address, so this cannot be used to flood somebody's inbox.",
        "operationId": "resendCode",
        "security": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "email": {
                    "type": "string",
                    "format": "email"
                  }
                },
                "required": [
                  "email"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "A new code was sent.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad request - the body is not valid JSON, or the email or another field is missing or malformed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "The request body is larger than the server accepts.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - the API key is missing.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - the API key is invalid or blocked, the account has not verified its email address, the account itself has been blocked (the code ACCOUNT_BLOCKED, and the body carries the reason), or this client address is on the block list (the code BLOCKED_IP).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited - the per-second limiter or the daily quota was reached. The free validator has its own limits and answers with the code RATE_LIMIT_DOMAINS when one IP address aims at too many different email domains.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "How many seconds to wait before trying again.",
                "schema": {
                  "type": "integer"
                }
              }
            }
          },
          "500": {
            "description": "The verification failed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Temporarily unavailable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/auth/forgot-password": {
      "post": {
        "tags": [
          "Account"
        ],
        "summary": "Ask for a password reset link",
        "description": "Sends a reset code to the address when the account exists. The same answer is given either way, so the endpoint does not reveal whether an address is registered.",
        "operationId": "forgotPassword",
        "security": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "email": {
                    "type": "string",
                    "format": "email"
                  }
                },
                "required": [
                  "email"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "If the account exists, a reset code has been sent.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad request - the body is not valid JSON, or the email or another field is missing or malformed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "The request body is larger than the server accepts.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - the API key is missing.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - the API key is invalid or blocked, the account has not verified its email address, the account itself has been blocked (the code ACCOUNT_BLOCKED, and the body carries the reason), or this client address is on the block list (the code BLOCKED_IP).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited - the per-second limiter or the daily quota was reached. The free validator has its own limits and answers with the code RATE_LIMIT_DOMAINS when one IP address aims at too many different email domains.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "How many seconds to wait before trying again.",
                "schema": {
                  "type": "integer"
                }
              }
            }
          },
          "500": {
            "description": "The verification failed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Temporarily unavailable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/auth/reset-password": {
      "post": {
        "tags": [
          "Account"
        ],
        "summary": "Set a new password with the reset code",
        "operationId": "resetPassword",
        "security": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "email": {
                    "type": "string",
                    "format": "email"
                  },
                  "code": {
                    "type": "string"
                  },
                  "password": {
                    "type": "string",
                    "minLength": 8
                  }
                },
                "required": [
                  "email",
                  "code",
                  "password"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The password was changed.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad request - the body is not valid JSON, or the email or another field is missing or malformed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "The request body is larger than the server accepts.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - the API key is missing.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - the API key is invalid or blocked, the account has not verified its email address, the account itself has been blocked (the code ACCOUNT_BLOCKED, and the body carries the reason), or this client address is on the block list (the code BLOCKED_IP).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited - the per-second limiter or the daily quota was reached. The free validator has its own limits and answers with the code RATE_LIMIT_DOMAINS when one IP address aims at too many different email domains.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "How many seconds to wait before trying again.",
                "schema": {
                  "type": "integer"
                }
              }
            }
          },
          "500": {
            "description": "The verification failed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Temporarily unavailable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/auth/me": {
      "get": {
        "tags": [
          "Account"
        ],
        "summary": "The signed-in account",
        "operationId": "getMe",
        "security": [
          {
            "SessionToken": []
          }
        ],
        "responses": {
          "200": {
            "description": "The account.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "user": {
                      "type": "object",
                      "properties": {}
                    },
                    "usage": {
                      "type": "object",
                      "properties": {}
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - the API key is missing.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/auth/api-key": {
      "get": {
        "tags": [
          "Account"
        ],
        "summary": "The signed-in account's API key",
        "description": "The active API key of the signed-in account. This is the way back for a customer who lost the key. Takes the session token from POST /auth/login, not an API key. The answer is never cached.",
        "operationId": "getApiKey",
        "security": [
          {
            "SessionToken": []
          }
        ],
        "responses": {
          "200": {
            "description": "The key. apiKey is null when the account has no active key.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "apiKey": {
                      "type": "string",
                      "nullable": true
                    },
                    "keyId": {
                      "type": "integer"
                    },
                    "createdAt": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - the API key is missing.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "The verification failed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/auth/resend-key": {
      "post": {
        "tags": [
          "Account"
        ],
        "summary": "Send the API key to the address on the account",
        "description": "Emails the account's active API key to the address on the account. Capped at three sends an hour, counted in the database so every worker shares the same allowance. Takes the session token from POST /auth/login, not an API key.",
        "operationId": "resendApiKey",
        "security": [
          {
            "SessionToken": []
          }
        ],
        "responses": {
          "200": {
            "description": "The key was sent.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - the API key is missing.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited - the per-second limiter or the daily quota was reached. The free validator has its own limits and answers with the code RATE_LIMIT_DOMAINS when one IP address aims at too many different email domains.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "How many seconds to wait before trying again.",
                "schema": {
                  "type": "integer"
                }
              }
            }
          },
          "502": {
            "description": "The key could not be sent.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "The verification failed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/auth/rotate-key": {
      "post": {
        "tags": [
          "Account"
        ],
        "summary": "Rotate the API key",
        "description": "Deactivates the current key and creates a new one. The new key is returned once and is also emailed to the address on the account. The old key stops working immediately, so anything using it will break. The current password is required. Takes the session token from POST /auth/login, not an API key.",
        "operationId": "rotateApiKey",
        "security": [
          {
            "SessionToken": []
          }
        ],
        "responses": {
          "200": {
            "description": "The new key. It is shown once.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "apiKey": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad request - the body is not valid JSON, or the email or another field is missing or malformed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - the API key is missing.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "The verification failed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/auth/change-password": {
      "post": {
        "tags": [
          "Account"
        ],
        "summary": "Change the password",
        "description": "Changes the password of the signed-in account. The current password is required and the new password must be at least 8 characters. Takes the session token from POST /auth/login, not an API key.",
        "operationId": "changePassword",
        "security": [
          {
            "SessionToken": []
          }
        ],
        "responses": {
          "200": {
            "description": "The password was changed.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad request - the body is not valid JSON, or the email or another field is missing or malformed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - the API key is missing.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "The verification failed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/auth/profile": {
      "put": {
        "tags": [
          "Account"
        ],
        "summary": "Ask for a new email address",
        "description": "Starts a change of address. The current password is required. A 6 digit code is sent to the NEW address and the old address stays on the account until that code is confirmed with POST /auth/profile/confirm. Takes the session token from POST /auth/login, not an API key.",
        "operationId": "startProfileUpdate",
        "security": [
          {
            "SessionToken": []
          }
        ],
        "responses": {
          "200": {
            "description": "The code was sent.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "requiresConfirmation": {
                      "type": "boolean"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad request - the body is not valid JSON, or the email or another field is missing or malformed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - the API key is missing.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "That address already has an account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited - the per-second limiter or the daily quota was reached. The free validator has its own limits and answers with the code RATE_LIMIT_DOMAINS when one IP address aims at too many different email domains.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "How many seconds to wait before trying again.",
                "schema": {
                  "type": "integer"
                }
              }
            }
          },
          "502": {
            "description": "The confirmation code could not be sent.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "The verification failed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/auth/profile/confirm": {
      "post": {
        "tags": [
          "Account"
        ],
        "summary": "Confirm the new email address",
        "description": "Finishes a change of address with the 6 digit code that was sent to the new address. The code expires after 30 minutes and five wrong guesses throw it away. Takes the session token from POST /auth/login, not an API key.",
        "operationId": "confirmProfileUpdate",
        "security": [
          {
            "SessionToken": []
          }
        ],
        "responses": {
          "200": {
            "description": "The address was changed.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "email": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad request - the body is not valid JSON, or the email or another field is missing or malformed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - the API key is missing.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "The verification failed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/auth/export": {
      "get": {
        "tags": [
          "Account"
        ],
        "summary": "Everything we hold about the account",
        "description": "The account details, the API keys, the verification history, the batch jobs, the webhooks, the billing record and the log of the emails sent to this account, as a JSON file. Takes the session token from POST /auth/login, not an API key. The answer is never cached.",
        "operationId": "exportAccount",
        "security": [
          {
            "SessionToken": []
          }
        ],
        "responses": {
          "200": {
            "description": "The export.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "exportedAt": {
                      "type": "string"
                    },
                    "account": {
                      "type": "object",
                      "properties": {}
                    },
                    "apiKeys": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {}
                      }
                    },
                    "usageHistory": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {}
                      }
                    },
                    "batchJobs": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {}
                      }
                    },
                    "webhooks": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {}
                      }
                    },
                    "billing": {
                      "type": "object",
                      "properties": {}
                    },
                    "emailsSent": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {}
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - the API key is missing.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "The verification failed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/auth/account": {
      "delete": {
        "tags": [
          "Account"
        ],
        "summary": "Delete the account and its data",
        "description": "Removes the account, its API keys, its verification history, its batch jobs, the files behind those jobs, its webhooks, its billing record and the log of the emails sent to it. The current password is required and the body has to carry confirm: DELETE. Takes the session token from POST /auth/login, not an API key.",
        "operationId": "deleteAccount",
        "security": [
          {
            "SessionToken": []
          }
        ],
        "responses": {
          "200": {
            "description": "The account was deleted.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "filesRemoved": {
                      "type": "integer"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad request - the body is not valid JSON, or the email or another field is missing or malformed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - the API key is missing.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "The verification failed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/billing/subscription": {
      "get": {
        "tags": [
          "Billing"
        ],
        "summary": "The signed-in account's subscription",
        "description": "The plan on the account and the subscription behind it. The subscription is null when the account has never had one. Takes the session token from POST /auth/login, not an API key.",
        "operationId": "getBillingSubscription",
        "security": [
          {
            "SessionToken": []
          }
        ],
        "responses": {
          "200": {
            "description": "The plan and the subscription for this account.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "plan": {
                      "type": "string"
                    },
                    "subscription": {
                      "type": "object",
                      "properties": {
                        "subscriptionId": {
                          "type": "string"
                        },
                        "plan": {
                          "type": "string"
                        },
                        "priceId": {
                          "type": "string"
                        },
                        "status": {
                          "type": "string"
                        },
                        "nextBilledAt": {
                          "type": "string"
                        },
                        "scheduledAction": {
                          "type": "string"
                        },
                        "scheduledAt": {
                          "type": "string"
                        },
                        "updatedAt": {
                          "type": "string"
                        }
                      }
                    }
                  },
                  "required": [
                    "plan"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - the API key is missing.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "The verification failed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/billing/portal": {
      "get": {
        "tags": [
          "Billing"
        ],
        "summary": "A link to the Paddle customer portal",
        "description": "Links that sign the account into Paddle's customer portal, where the customer can see the subscription, update the payment method, cancel with the cancellation flow and download the invoices. Takes the session token from POST /auth/login, not an API key. The links are signed by Paddle and point at this customer's own subscription. It needs the Paddle API key on the server: when that key is not configured the answer is 503 with code BILLING_PORTAL_UNAVAILABLE, and 404 with code NO_SUBSCRIPTION when the account has never had a subscription.",
        "operationId": "getBillingPortal",
        "security": [
          {
            "SessionToken": []
          }
        ],
        "responses": {
          "200": {
            "description": "The portal links.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "plan": {
                      "type": "string"
                    },
                    "subscription": {
                      "type": "object",
                      "properties": {
                        "subscriptionId": {
                          "type": "string"
                        },
                        "plan": {
                          "type": "string"
                        },
                        "status": {
                          "type": "string"
                        },
                        "nextBilledAt": {
                          "type": "string"
                        },
                        "scheduledAction": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "scheduledAt": {
                          "type": [
                            "string",
                            "null"
                          ]
                        }
                      }
                    },
                    "urls": {
                      "type": "object",
                      "properties": {
                        "overview": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "viewSubscription": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "cancelSubscription": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "updatePaymentMethod": {
                          "type": [
                            "string",
                            "null"
                          ]
                        }
                      }
                    }
                  },
                  "required": [
                    "plan",
                    "urls"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - the API key is missing.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Temporarily unavailable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/billing/webhook": {
      "post": {
        "tags": [
          "Billing"
        ],
        "summary": "The Paddle payment webhook",
        "description": "Called by Paddle, not by you. The body is a Paddle event, and a request is only accepted when it carries a valid Paddle signature - an unsigned or wrongly signed request is refused with 401, and a request that arrives while the webhook secret is not configured is refused with 503. The same event delivered twice is recorded once.",
        "operationId": "paddleWebhook",
        "security": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "event_id": {
                    "type": "string"
                  },
                  "event_type": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The event was accepted.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "received": {
                      "type": "boolean"
                    },
                    "event_id": {
                      "type": "string"
                    },
                    "event_type": {
                      "type": "string"
                    },
                    "action": {
                      "type": "string"
                    },
                    "duplicate": {
                      "type": "boolean"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad request - the body is not valid JSON, or the email or another field is missing or malformed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - the API key is missing.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Temporarily unavailable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "ApiKeyAuth": {
        "type": "apiKey",
        "in": "header",
        "name": "X-API-Key",
        "description": "The API key from your CleanMail dashboard."
      },
      "SessionToken": {
        "type": "apiKey",
        "in": "header",
        "name": "X-Session-Token",
        "description": "The session token returned by POST /auth/login."
      }
    },
    "schemas": {
      "VerifyResult": {
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean",
            "examples": [
              true
            ]
          },
          "email": {
            "type": "string",
            "format": "email",
            "description": "The address that was checked."
          },
          "deliverable": {
            "type": "boolean",
            "description": "True when the mail server accepted the recipient during the SMTP check. Some mail servers accept every recipient without confirming that the mailbox exists - for those, reason is 'accepted' and existenceConfirmed is false."
          },
          "reason": {
            "type": "string",
            "enum": [
              "accepted",
              "blocked",
              "busy",
              "disposable",
              "error",
              "invalid",
              "risky",
              "spam_trap",
              "unknown",
              "valid"
            ],
            "examples": [
              "accepted",
              "blocked",
              "busy",
              "disposable",
              "error",
              "invalid",
              "risky",
              "spam_trap",
              "unknown",
              "valid"
            ],
            "description": "Why the answer is what it is. 'valid' and 'invalid' are facts about the mailbox. 'accepted' means the mail server took the recipient but would not tell us whether the mailbox exists - either the domain accepts every mailbox (catch-all) or the provider answers 250 for every recipient, which Yahoo and AOL do on purpose. 'disposable' means the domain is on the disposable-domain list, and 'spam_trap' means the address is a known probe - both are answers, so both are charged. 'blocked' means the domain is on the block list, so no mail server was contacted: nothing was checked and nothing is charged. 'risky' means the mailbox exists but the signals around it are poor. 'busy' means the mail server asked us to come back later (421/450/451/452) and nobody answered about the mailbox - ask again after retryAfterSeconds. 'unknown' means we got no answer at all, and 'error' means the check itself failed. A 'busy' or 'unknown' check is not charged: you only pay for answers."
          },
          "details": {
            "type": [
              "string",
              "null"
            ],
            "description": "Human readable detail about the outcome."
          },
          "mxRecord": {
            "type": [
              "string",
              "null"
            ],
            "description": "The MX host that was used."
          },
          "mxRecords": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "priority": {
                  "type": "integer"
                },
                "exchange": {
                  "type": "string"
                }
              },
              "required": [
                "priority",
                "exchange"
              ]
            },
            "description": "Every MX record found for the domain, with its priority."
          },
          "responseCode": {
            "type": [
              "integer",
              "null"
            ],
            "description": "The SMTP response code, when one was received."
          },
          "existenceConfirmed": {
            "type": "boolean",
            "description": "True when the answer settles whether the mailbox exists - the server said it exists, or said it does not, or the domain has no mail server at all. False when the server took the recipient without confirming anything (reason 'accepted'), when nobody answered (reason 'busy' or 'unknown'), or when the answer is about the domain rather than the mailbox (reason 'disposable' or 'spam_trap')."
          },
          "exchanger": {
            "type": [
              "string",
              "null"
            ],
            "description": "The mail server that answered."
          },
          "retryAfterSeconds": {
            "type": [
              "integer",
              "null"
            ],
            "description": "How many seconds to wait before asking again. Only present when the reason is 'busy'."
          },
          "isDisposable": {
            "type": "boolean",
            "description": "The domain is on the disposable-domain list."
          },
          "isRoleAccount": {
            "type": "boolean",
            "description": "The local part is a role address such as info@ or admin@. Starter plan and above."
          },
          "isFreeProvider": {
            "type": "boolean",
            "description": "The domain is a free mailbox provider such as Gmail or Yahoo."
          },
          "isSpamTrap": {
            "type": "boolean"
          },
          "isGreylisted": {
            "type": "boolean",
            "description": "The server greylisted the probe. Pro plan and above."
          },
          "hasDMARC": {
            "type": "boolean"
          },
          "dmarcPolicy": {
            "type": [
              "string",
              "null"
            ],
            "examples": [
              "none",
              "quarantine",
              "reject"
            ]
          },
          "hasSPF": {
            "type": "boolean"
          },
          "spfStrict": {
            "type": "boolean"
          },
          "riskScore": {
            "type": "integer",
            "minimum": 0,
            "maximum": 100
          },
          "riskLevel": {
            "type": "string",
            "enum": [
              "low",
              "medium",
              "high"
            ]
          },
          "domainAge": {
            "type": [
              "integer",
              "null"
            ],
            "description": "Domain age in days, when it could be determined."
          },
          "verificationTime": {
            "type": [
              "number",
              "null"
            ],
            "description": "How long the check took, in milliseconds."
          },
          "isCatchall": {
            "type": "boolean",
            "description": "The domain accepts mail for every address. Pro plan and above, and omitted on lower plans."
          },
          "dailyUsage": {
            "type": "integer",
            "description": "Verifications used today. Only on POST /api/verify."
          },
          "dailyLimit": {
            "type": "integer",
            "description": "The daily allowance for the key's plan. Only on POST /api/verify."
          }
        },
        "required": [
          "success",
          "email",
          "deliverable",
          "reason",
          "riskLevel"
        ]
      },
      "Error": {
        "type": "object",
        "properties": {
          "error": {
            "type": "string"
          },
          "code": {
            "type": "string",
            "description": "A stable machine readable code, where the endpoint provides one."
          }
        },
        "required": [
          "error"
        ]
      }
    }
  }
}
