# CleanMail API reference > Everything needed to use the CleanMail email verification API: the > endpoints, the response fields, the plans, the limits and what each > check actually means. Base URL: `https://cleanmail.dev` Authentication: `X-API-Key: ` Content type: `application/json` Specification: [https://cleanmail.dev/openapi.json](https://cleanmail.dev/openapi.json) (OpenAPI 3.1.0, CleanMail API 2.1.0) ## Quick start ```bash export CLEANMAIL_API_KEY="your_api_key_here" curl -X POST https://cleanmail.dev/api/verify \ -H "Content-Type: application/json" \ -H "X-API-Key: $CLEANMAIL_API_KEY" \ -d '{"email":"user@example.com"}' ``` The answer carries the reason and the risk score: ```json { "success": true, "email": "user@example.com", "deliverable": true, "reason": "valid", "riskLevel": "low", "mxRecord": "mx.example.com" } ``` The reason is one of `accepted`, `blocked`, `busy`, `disposable`, `error`, `invalid`, `risky`, `spam_trap`, `unknown`, `valid`. `busy` means the mail server asked us to come back later (421/450/451/452) and nobody answered about the mailbox: the response carries `retryAfterSeconds` and a `Retry-After` header, and the check is not charged. A `busy` or `unknown` check is never charged - you only pay for answers. Every check carries the headers an integrator needs: `X-RateLimit-Limit`, `X-RateLimit-Remaining`, `X-Cost` (1 for an answer, 0 when the mail server did not answer) and `Retry-After` when the server was busy. ## Plans and limits | Plan | Verifications a day | Price | Single requests | Burst | Batch requests | Batch burst | | --- | --- | --- | --- | --- | --- | --- | | free | 50 | $0 | 1 req/s | 3 | 5 req/s | 20 | | starter | 300 | $9 | 2 req/s | 5 | 10 req/s | 50 | | pro | 1,500 | $39 | 3 req/s | 10 | 25 req/s | 100 | | business | 5,000 | $99 | 20 req/s | 50 | 50 req/s | 200 | | enterprise | 20,000 | $199 | 20 req/s | 50 | 50 req/s | 200 | The rate limits above are enforced per worker process. The service runs 4 worker processes, so a burst can briefly be 4 times the table - 4 requests a second for the free plan across the service. - A single verification is one unit of the daily allowance. - Batch uploads do not count against the daily allowance. - The daily allowance is kept in the database, so it survives a restart. - The inline batch limit is 500 addresses; a CSV upload takes 5,000 rows. - The demo endpoint allows 10 requests a minute, 100 a day and 15 different email domains a day per IP address; an IPv6 address is counted per /64. - The daily allowance is the limit: a plan may aim at as many different mail servers as it has verifications. There is no separate cap on destinations. - We talk to at most 105 mail servers at the same time (5 for the free validator, 100 for paying accounts), so a large job waits its turn instead of flooding anybody's mail server. ## What is checked - **MX records** - every plan - **SMTP verification** - every plan - **Disposable domain detection** - every plan - **Risk scoring** - every plan - **Role account detection** - Starter plan and above - **Greylist detection** - Pro plan and above - **Catch-all detection** - Pro plan and above on /api/verify, always on batch, never on /api/verify/quick or the demo endpoint `deliverable` is true when the mailbox accepted a connection during the SMTP check. The catch-all probe is the one check that is plan-gated, so on a lower plan the `isCatchall` field is omitted rather than reported as false. ## Response fields | Field | Meaning | | --- | --- | | `success` | | | `email` | The address that was checked. | | `deliverable` | 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` | 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` | Human readable detail about the outcome. | | `mxRecord` | The MX host that was used. | | `mxRecords` | Every MX record found for the domain, with its priority. | | `responseCode` | The SMTP response code, when one was received. | | `existenceConfirmed` | 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` | The mail server that answered. | | `retryAfterSeconds` | How many seconds to wait before asking again. Only present when the reason is 'busy'. | | `isDisposable` | The domain is on the disposable-domain list. | | `isRoleAccount` | The local part is a role address such as info@ or admin@. Starter plan and above. | | `isFreeProvider` | The domain is a free mailbox provider such as Gmail or Yahoo. | | `isSpamTrap` | | | `isGreylisted` | The server greylisted the probe. Pro plan and above. | | `hasDMARC` | | | `dmarcPolicy` | | | `hasSPF` | | | `spfStrict` | | | `riskScore` | | | `riskLevel` | | | `domainAge` | Domain age in days, when it could be determined. | | `verificationTime` | How long the check took, in milliseconds. | | `isCatchall` | The domain accepts mail for every address. Pro plan and above, and omitted on lower plans. | | `dailyUsage` | Verifications used today. Only on POST /api/verify. | | `dailyLimit` | The daily allowance for the key's plan. Only on POST /api/verify. | ## Endpoints ### Account #### `GET /api/features` The features this deployment supports No authentication needed. Responses: - `200` The feature list. #### `GET /api/key/{key}` Check whether an API key is valid 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. No authentication needed. Responses: - `200` The key's validity, plan and usage. - `400` Bad request - the body is not valid JSON, or the email or another field is missing or malformed. - `401` Unauthorized - the API key is missing. - `403` 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). - `404` Not found. - `413` The request body is larger than the server accepts. - `429` 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. - `500` The verification failed. - `503` Temporarily unavailable. #### `GET /api/usage` Current usage for the API key Authentication: ApiKeyAuth. Responses: - `200` Usage and quota. - `400` Bad request - the body is not valid JSON, or the email or another field is missing or malformed. - `401` Unauthorized - the API key is missing. - `403` 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). - `404` Not found. - `413` The request body is larger than the server accepts. - `429` 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. - `500` The verification failed. - `503` Temporarily unavailable. #### `DELETE /auth/account` Delete the account and its data 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. Authentication: SessionToken. Responses: - `200` The account was deleted. - `400` Bad request - the body is not valid JSON, or the email or another field is missing or malformed. - `401` Unauthorized - the API key is missing. - `500` The verification failed. #### `GET /auth/api-key` The signed-in account's API key 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. Authentication: SessionToken. Responses: - `200` The key. apiKey is null when the account has no active key. - `401` Unauthorized - the API key is missing. - `500` The verification failed. #### `POST /auth/change-password` Change the password 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. Authentication: SessionToken. Responses: - `200` The password was changed. - `400` Bad request - the body is not valid JSON, or the email or another field is missing or malformed. - `401` Unauthorized - the API key is missing. - `500` The verification failed. #### `GET /auth/export` Everything we hold about the account 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. Authentication: SessionToken. Responses: - `200` The export. - `401` Unauthorized - the API key is missing. - `500` The verification failed. #### `POST /auth/forgot-password` Ask for a password reset link 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. No authentication needed. Request body: - `email`: string (required) Responses: - `200` If the account exists, a reset code has been sent. - `400` Bad request - the body is not valid JSON, or the email or another field is missing or malformed. - `401` Unauthorized - the API key is missing. - `403` 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). - `404` Not found. - `413` The request body is larger than the server accepts. - `429` 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. - `500` The verification failed. - `503` Temporarily unavailable. #### `POST /auth/login` Log in 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`. No authentication needed. Request body: - `email`: string (required) - `password`: string (required) Responses: - `200` Logged in. - `400` Bad request - the body is not valid JSON, or the email or another field is missing or malformed. - `401` Unauthorized - the API key is missing. - `403` 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). - `404` Not found. - `413` The request body is larger than the server accepts. - `429` 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. - `500` The verification failed. - `503` Temporarily unavailable. #### `GET /auth/me` The signed-in account Authentication: SessionToken. Responses: - `200` The account. - `401` Unauthorized - the API key is missing. #### `PUT /auth/profile` Ask for a new email address 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. Authentication: SessionToken. Responses: - `200` The code was sent. - `400` Bad request - the body is not valid JSON, or the email or another field is missing or malformed. - `401` Unauthorized - the API key is missing. - `409` That address already has an account. - `429` 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. - `500` The verification failed. - `502` The confirmation code could not be sent. #### `POST /auth/profile/confirm` Confirm the new email address 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. Authentication: SessionToken. Responses: - `200` The address was changed. - `400` Bad request - the body is not valid JSON, or the email or another field is missing or malformed. - `401` Unauthorized - the API key is missing. - `500` The verification failed. #### `POST /auth/resend-code` Send the confirmation code again 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. No authentication needed. Request body: - `email`: string (required) Responses: - `200` A new code was sent. - `400` Bad request - the body is not valid JSON, or the email or another field is missing or malformed. - `401` Unauthorized - the API key is missing. - `403` 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). - `404` Not found. - `413` The request body is larger than the server accepts. - `429` 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. - `500` The verification failed. - `503` Temporarily unavailable. #### `POST /auth/resend-key` Send the API key to the address on the account 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. Authentication: SessionToken. Responses: - `200` The key was sent. - `401` Unauthorized - the API key is missing. - `404` Not found. - `429` 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. - `500` The verification failed. - `502` The key could not be sent. #### `POST /auth/reset-password` Set a new password with the reset code No authentication needed. Request body: - `email`: string (required) - `code`: string (required) - `password`: string (required) Responses: - `200` The password was changed. - `400` Bad request - the body is not valid JSON, or the email or another field is missing or malformed. - `401` Unauthorized - the API key is missing. - `403` 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). - `404` Not found. - `413` The request body is larger than the server accepts. - `429` 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. - `500` The verification failed. - `503` Temporarily unavailable. #### `POST /auth/rotate-key` Rotate the API key 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. Authentication: SessionToken. Responses: - `200` The new key. It is shown once. - `400` Bad request - the body is not valid JSON, or the email or another field is missing or malformed. - `401` Unauthorized - the API key is missing. - `500` The verification failed. #### `POST /auth/signup` Create an account 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. No authentication needed. Request body: - `email`: string (required) - `password`: string (required) Responses: - `200` The account was created and a code was sent. The API key is emailed once the code is confirmed. - `400` Bad request - the body is not valid JSON, or the email or another field is missing or malformed. - `409` That address is already registered. The comparison ignores case, so one mailbox is one account. - `429` Too many signups from this connection or for this address. Try again later. - `500` The verification failed. #### `POST /auth/verify` Confirm an account with the emailed code 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. No authentication needed. Request body: - `email`: string (required) - `code`: string (required) Responses: - `200` The address was confirmed. - `400` Bad request - the body is not valid JSON, or the email or another field is missing or malformed. - `401` Unauthorized - the API key is missing. - `403` 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). - `404` Not found. - `413` The request body is larger than the server accepts. - `429` 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. - `500` The verification failed. - `503` Temporarily unavailable. #### `GET /health` Liveness check No authentication needed. Responses: - `200` The service is up. ### Batch #### `POST /api/batch/cancel/{jobId}` Cancel a running job Authentication: ApiKeyAuth. Responses: - `200` The job was cancelled. - `400` Bad request - the body is not valid JSON, or the email or another field is missing or malformed. - `401` Unauthorized - the API key is missing. - `403` 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). - `404` Not found. - `413` The request body is larger than the server accepts. - `429` 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. - `500` The verification failed. - `503` Temporarily unavailable. #### `GET /api/batch/download/{jobId}` Download the results of a finished job 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. Authentication: ApiKeyAuth. Responses: - `200` The results as CSV. - `401` Unauthorized - the API key is missing. - `404` Not found. - `500` The verification failed. #### `GET /api/batch/history` List this key's batch jobs Authentication: ApiKeyAuth. Responses: - `200` The job list, newest first. - `400` Bad request - the body is not valid JSON, or the email or another field is missing or malformed. - `401` Unauthorized - the API key is missing. - `403` 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). - `404` Not found. - `413` The request body is larger than the server accepts. - `429` 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. - `500` The verification failed. - `503` Temporarily unavailable. #### `DELETE /api/batch/jobs` Delete every finished job on this key 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`. The usage history is kept. Authentication: ApiKeyAuth. Responses: - `200` The jobs were deleted. - `400` Bad request - the body is not valid JSON, or the email or another field is missing or malformed. - `401` Unauthorized - the API key is missing. - `403` 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). - `404` Not found. - `413` The request body is larger than the server accepts. - `429` 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. - `500` The verification failed. - `503` Temporarily unavailable. #### `DELETE /api/batch/jobs/{jobId}` Delete one of this key's batch jobs 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. A job that is still running cannot be deleted. Cancel it first, then delete it. Authentication: ApiKeyAuth. Responses: - `200` The job was deleted. - `400` Bad request - the body is not valid JSON, or the email or another field is missing or malformed. - `401` Unauthorized - the API key is missing. - `403` 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). - `404` Not found. - `413` The request body is larger than the server accepts. - `429` 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. - `500` The verification failed. - `503` Temporarily unavailable. #### `GET /api/batch/status/{jobId}` Check a batch job Authentication: ApiKeyAuth. Responses: - `200` The job's progress. - `400` Bad request - the body is not valid JSON, or the email or another field is missing or malformed. - `401` Unauthorized - the API key is missing. - `403` 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). - `404` Not found. - `413` The request body is larger than the server accepts. - `429` 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. - `500` The verification failed. - `503` Temporarily unavailable. #### `POST /api/batch/upload` Upload a CSV of addresses 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. The results email always goes to the authenticated account. A recipient supplied by the client is ignored. This path does not call a webhook. A job is followed with `GET /api/batch/status/{jobId}` and collected with `GET /api/batch/download/{jobId}`. Authentication: ApiKeyAuth. Responses: - `200` The job was accepted. - `400` Bad request - the body is not valid JSON, or the email or another field is missing or malformed. - `401` Unauthorized - the API key is missing. - `403` 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). - `404` Not found. - `413` The request body is larger than the server accepts. - `429` 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. - `500` The verification failed. - `503` Temporarily unavailable. ### Billing #### `GET /api/billing/portal` A link to the Paddle customer portal 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. Authentication: SessionToken. Responses: - `200` The portal links. - `401` Unauthorized - the API key is missing. - `404` Not found. - `503` Temporarily unavailable. #### `GET /api/billing/subscription` The signed-in account's subscription 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. Authentication: SessionToken. Responses: - `200` The plan and the subscription for this account. - `401` Unauthorized - the API key is missing. - `500` The verification failed. #### `POST /api/billing/webhook` The Paddle payment webhook 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. No authentication needed. Request body: - `event_id`: string - `event_type`: string Responses: - `200` The event was accepted. - `400` Bad request - the body is not valid JSON, or the email or another field is missing or malformed. - `401` Unauthorized - the API key is missing. - `503` Temporarily unavailable. ### Free #### `POST /api/demo/verify` Verify one address without an API key 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. The 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. No authentication needed. Request body: - `email`: string (required) Responses: - `200` The verification result. - `429` 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. - `503` 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. ### MCP #### `GET /mcp` The server-to-client stream is not offered 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. Authentication: ApiKeyAuth. Responses: - `405` This server offers no server-to-client stream. Use POST /mcp. #### `POST /mcp` Call CleanMail through the Model Context Protocol 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. The 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. The API key goes in the `X-API-Key` header, or as `Authorization: Bearer `. Authentication: ApiKeyAuth. Request body: - `jsonrpc`: string (required) - `id`: ['integer', 'string', 'null'] - `method`: string (required) - `params`: object Responses: - `200` The JSON-RPC response. - `400` The body was not a JSON-RPC message. - `401` No API key was sent. - `403` The key is not valid, the account has not verified its email address, or the origin is not allowed. - `429` Rate limited, or the daily allowance is used up. ### Verification #### `POST /api/verify` Verify one email address 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. Catch-all detection needs the Pro plan or above; on lower plans the `isCatchall` field is omitted rather than reported as false. Authentication: ApiKeyAuth. Request body: - `email`: string (required) Responses: - `200` The verification result. - `400` Bad request - the body is not valid JSON, or the email or another field is missing or malformed. - `401` Unauthorized - the API key is missing. - `403` 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). - `404` Not found. - `413` The request body is larger than the server accepts. - `429` 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. - `500` The verification failed. - `503` Temporarily unavailable. #### `POST /api/verify/batch` Verify up to 500 addresses in one request 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. The 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. Authentication: ApiKeyAuth. Request body: - `emails`: array of string (required) - `options`: object Responses: - `200` A summary of the batch, or a batch id when the batch was queued. - `400` Bad request - the body is not valid JSON, or the email or another field is missing or malformed. - `401` Unauthorized - the API key is missing. - `403` 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). - `404` Not found. - `413` The request body is larger than the server accepts. - `429` 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. - `500` The verification failed. - `503` Temporarily unavailable. #### `POST /api/verify/quick` Verify one email address, fast The same check as POST /api/verify with a trimmed response. Use it when you only need `deliverable` and `reason`. Authentication: ApiKeyAuth. Request body: - `email`: string (required) Responses: - `200` The verification result. - `400` Bad request - the body is not valid JSON, or the email or another field is missing or malformed. - `401` Unauthorized - the API key is missing. - `403` 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). - `404` Not found. - `413` The request body is larger than the server accepts. - `429` 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. - `500` The verification failed. - `503` Temporarily unavailable. ### Webhooks #### `GET /api/webhooks` List the webhooks registered for this key Authentication: ApiKeyAuth. Responses: - `200` The webhook list. - `400` Bad request - the body is not valid JSON, or the email or another field is missing or malformed. - `401` Unauthorized - the API key is missing. - `403` 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). - `404` Not found. - `413` The request body is larger than the server accepts. - `429` 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. - `500` The verification failed. - `503` Temporarily unavailable. #### `POST /api/webhooks/register` Register a webhook CleanMail POSTs the finished batch to this URL when a batch that names this webhook id completes. Only a batch sent to `POST /api/verify/batch` names a webhook; the CSV upload path does not call a webhook. The 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. Authentication: ApiKeyAuth. Request body: - `url`: string (required) Responses: - `200` The webhook was registered. - `400` 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. - `401` Unauthorized - the API key is missing. - `403` 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). - `404` Not found. - `413` The request body is larger than the server accepts. - `429` 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. - `500` The verification failed. - `503` Temporarily unavailable. #### `DELETE /api/webhooks/{id}` Remove a webhook Authentication: ApiKeyAuth. Responses: - `200` The webhook was removed. - `400` Bad request - the body is not valid JSON, or the email or another field is missing or malformed. - `401` Unauthorized - the API key is missing. - `403` 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). - `404` Not found. - `413` The request body is larger than the server accepts. - `429` 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. - `500` The verification failed. - `503` Temporarily unavailable. ## Errors Every error is a JSON object with `error` and a stable `code`: ```json { "error": "Invalid API key", "code": "INVALID_KEY" } ``` The daily allowance is refused with `429` and the code `DAILY_LIMIT_EXCEEDED`; a missing or malformed key is `401`. ## Links - [API documentation](https://cleanmail.dev/docs.html) - [The email validator](https://cleanmail.dev/email-validator.html) - [The FAQ](https://cleanmail.dev/faq.html) - [Pricing](https://cleanmail.dev/#pricing) - [Terms](https://cleanmail.dev/terms.html), [Privacy](https://cleanmail.dev/privacy.html), [Disclaimer](https://cleanmail.dev/disclaimer.html) - [cleanmail-sdk on npm](https://www.npmjs.com/package/cleanmail-sdk) - [The SDK repository](https://github.com/skyradical/CleanMail-SDK)