{
  "info": {
    "name": "CleanMail API",
    "_postman_id": "b7f1c3d2-6f1a-4c58-9d3e-0a5c2f9e7d41",
    "description": "Every public CleanMail endpoint. Set `baseUrl` and `apiKey` in the environment, or edit the collection variables.\n\nThe `apiKey` variable is the only thing you need to change for the paid endpoints - the free demo request needs no key.",
    "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
  },
  "variable": [
    {
      "key": "baseUrl",
      "value": "https://cleanmail.dev",
      "type": "string"
    },
    {
      "key": "apiKey",
      "value": "",
      "type": "string"
    },
    {
      "key": "sessionToken",
      "value": "",
      "type": "string"
    }
  ],
  "auth": {
    "type": "apikey",
    "apikey": [
      {
        "key": "value",
        "value": "{{apiKey}}",
        "type": "string"
      },
      {
        "key": "key",
        "value": "X-API-Key",
        "type": "string"
      }
    ]
  },
  "item": [
    {
      "name": "MCP",
      "item": [
        {
          "name": "Say hello (initialize)",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Accept",
                "value": "application/json"
              },
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/mcp",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "mcp"
              ]
            },
            "description": "The Model Context Protocol. Send this first: it tells the server which version of the protocol you speak.",
            "body": {
              "mode": "raw",
              "raw": "{\n  \"jsonrpc\": \"2.0\",\n  \"id\": 1,\n  \"method\": \"initialize\",\n  \"params\": {\n    \"protocolVersion\": \"2025-06-18\",\n    \"capabilities\": {},\n    \"clientInfo\": {\n      \"name\": \"postman\",\n      \"version\": \"1.0.0\"\n    }\n  }\n}"
            }
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('status is 200', () => pm.response.to.have.status(200));",
                  "const b = pm.response.json();",
                  "pm.test('the protocol version came back', () => pm.expect(b.result.protocolVersion).to.be.a('string'));"
                ]
              }
            }
          ]
        },
        {
          "name": "List the tools",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Accept",
                "value": "application/json"
              },
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/mcp",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "mcp"
              ]
            },
            "description": "What the server can do: the tools an agent may call.",
            "body": {
              "mode": "raw",
              "raw": "{\n  \"jsonrpc\": \"2.0\",\n  \"id\": 2,\n  \"method\": \"tools/list\"\n}"
            }
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('status is 200', () => pm.response.to.have.status(200));",
                  "const b = pm.response.json();",
                  "pm.test('the tools are listed', () => pm.expect(b.result.tools).to.be.an('array').that.is.not.empty);"
                ]
              }
            }
          ]
        },
        {
          "name": "Verify an email (tools/call)",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Accept",
                "value": "application/json"
              },
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/mcp",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "mcp"
              ]
            },
            "description": "The same check as POST /api/verify, through the tool an agent calls.",
            "body": {
              "mode": "raw",
              "raw": "{\n  \"jsonrpc\": \"2.0\",\n  \"id\": 3,\n  \"method\": \"tools/call\",\n  \"params\": {\n    \"name\": \"verify_email\",\n    \"arguments\": {\n      \"email\": \"user@example.com\"\n    }\n  }\n}"
            }
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('status is 200', () => pm.response.to.have.status(200));",
                  "const b = pm.response.json();",
                  "pm.test('the tool answered', () => pm.expect(b.result.content).to.be.an('array').that.is.not.empty);"
                ]
              }
            }
          ]
        }
      ]
    },
    {
      "name": "Verification",
      "item": [
        {
          "name": "Verify an email",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Accept",
                "value": "application/json"
              },
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/api/verify",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "verify"
              ]
            },
            "description": "The full check. Needs an API key.",
            "body": {
              "mode": "raw",
              "raw": "{\n  \"email\": \"user@example.com\"\n}"
            }
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('status is 200', () => pm.response.to.have.status(200));",
                  "const b = pm.response.json();",
                  "pm.test('deliverable is a boolean', () => pm.expect(b).to.have.property('deliverable').that.is.a('boolean'));",
                  "pm.test('riskLevel is present', () => pm.expect(b.riskLevel).to.be.oneOf(['low', 'medium', 'high']));"
                ]
              }
            }
          ]
        },
        {
          "name": "Quick verify",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Accept",
                "value": "application/json"
              },
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/api/verify/quick",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "verify",
                "quick"
              ]
            },
            "description": "The fast path - deliverable and reason only.",
            "body": {
              "mode": "raw",
              "raw": "{\n  \"email\": \"user@example.com\"\n}"
            }
          }
        },
        {
          "name": "Free demo (no key)",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Accept",
                "value": "application/json"
              },
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/api/demo/verify",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "demo",
                "verify"
              ]
            },
            "description": "No API key. Ten per minute, a hundred per day and fifteen different email domains a day, per IP address.",
            "body": {
              "mode": "raw",
              "raw": "{\n  \"email\": \"user@example.com\"\n}"
            },
            "auth": {
              "type": "noauth"
            }
          }
        }
      ]
    },
    {
      "name": "Account",
      "item": [
        {
          "name": "Usage",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "Accept",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/api/usage",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "usage"
              ]
            },
            "description": "What you have used today and what your allowance is."
          }
        },
        {
          "name": "Features",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "Accept",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/api/features",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "features"
              ]
            },
            "description": "What this deployment supports. No key needed.",
            "auth": {
              "type": "noauth"
            }
          }
        },
        {
          "name": "Check a key",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "Accept",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/api/key/{{apiKey}}",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "key",
                "{{apiKey}}"
              ]
            },
            "description": "Is this key valid, and what plan is it on?",
            "auth": {
              "type": "noauth"
            }
          }
        },
        {
          "name": "Health",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "Accept",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/health",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "health"
              ]
            },
            "description": "Liveness check. No key needed.",
            "auth": {
              "type": "noauth"
            }
          }
        },
        {
          "name": "Sign up",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Accept",
                "value": "application/json"
              },
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/auth/signup",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "auth",
                "signup"
              ]
            },
            "description": "Create an account. A confirmation code is emailed; the account and its API key stay locked until that code is confirmed.",
            "body": {
              "mode": "raw",
              "raw": "{\n  \"email\": \"you@example.com\",\n  \"password\": \"a-long-password\"\n}"
            },
            "auth": {
              "type": "noauth"
            }
          }
        },
        {
          "name": "Confirm the signup code",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Accept",
                "value": "application/json"
              },
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/auth/verify",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "auth",
                "verify"
              ]
            },
            "description": "Confirm the address with the code from the email. The API key is emailed once the code is right.",
            "body": {
              "mode": "raw",
              "raw": "{\n  \"email\": \"you@example.com\",\n  \"code\": \"123456\"\n}"
            },
            "auth": {
              "type": "noauth"
            }
          }
        },
        {
          "name": "Log in",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Accept",
                "value": "application/json"
              },
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/auth/login",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "auth",
                "login"
              ]
            },
            "description": "Returns the account, the API keys and a session token.",
            "body": {
              "mode": "raw",
              "raw": "{\n  \"email\": \"you@example.com\",\n  \"password\": \"a-long-password\"\n}"
            },
            "auth": {
              "type": "noauth"
            }
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('status is 200', () => pm.response.to.have.status(200));",
                  "const b = pm.response.json();",
                  "if (b.sessionToken) { pm.collectionVariables.set('sessionToken', b.sessionToken); }",
                  "pm.test('a session token came back', () => pm.expect(b).to.have.property('sessionToken'));"
                ]
              }
            }
          ]
        }
      ]
    },
    {
      "name": "Batch",
      "item": [
        {
          "name": "Verify a batch (up to 500)",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Accept",
                "value": "application/json"
              },
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/api/verify/batch",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "verify",
                "batch"
              ]
            },
            "description": "Verify up to 500 addresses in one call.",
            "body": {
              "mode": "raw",
              "raw": "{\n  \"emails\": [\n    \"user@example.com\",\n    \"second@example.com\"\n  ]\n}"
            }
          }
        },
        {
          "name": "Upload a CSV",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Accept",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/api/batch/upload",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "batch",
                "upload"
              ]
            },
            "description": "Upload a CSV. The results are emailed to the account that owns the key.",
            "body": {
              "mode": "formdata",
              "formdata": [
                {
                  "key": "file",
                  "type": "file",
                  "src": [],
                  "description": "A CSV file with one address per line."
                }
              ]
            }
          }
        },
        {
          "name": "Batch status",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "Accept",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/api/batch/status/{{jobId}}",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "batch",
                "status",
                "{{jobId}}"
              ]
            },
            "description": "How far a job has got."
          }
        },
        {
          "name": "Batch history",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "Accept",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/api/batch/history",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "batch",
                "history"
              ]
            },
            "description": "Every job on this key."
          }
        },
        {
          "name": "Download results",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "Accept",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/api/batch/download/{{jobId}}",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "batch",
                "download",
                "{{jobId}}"
              ]
            },
            "description": "The results CSV for a finished job."
          }
        },
        {
          "name": "Cancel a job",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Accept",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/api/batch/cancel/{{jobId}}",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "batch",
                "cancel",
                "{{jobId}}"
              ]
            },
            "description": "Stop a running job."
          }
        },
        {
          "name": "Delete a job",
          "request": {
            "method": "DELETE",
            "header": [
              {
                "key": "Accept",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/api/batch/jobs/{{jobId}}",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "batch",
                "jobs",
                "{{jobId}}"
              ]
            },
            "description": "Remove a job and the results file it owns."
          }
        },
        {
          "name": "Delete all finished jobs",
          "request": {
            "method": "DELETE",
            "header": [
              {
                "key": "Accept",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/api/batch/jobs",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "batch",
                "jobs"
              ]
            },
            "description": "Remove every finished job on this key."
          }
        }
      ]
    },
    {
      "name": "Billing",
      "item": [
        {
          "name": "Subscription",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "Accept",
                "value": "application/json"
              },
              {
                "key": "X-Session-Token",
                "value": "{{sessionToken}}"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/api/billing/subscription",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "billing",
                "subscription"
              ]
            },
            "description": "The plan and the subscription for the logged-in account. Put the sessionToken from POST /auth/login in the environment first.",
            "auth": {
              "type": "noauth"
            }
          }
        },
        {
          "name": "Billing portal",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "Accept",
                "value": "application/json"
              },
              {
                "key": "X-Session-Token",
                "value": "{{sessionToken}}"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/api/billing/portal",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "billing",
                "portal"
              ]
            },
            "description": "Links into Paddle's customer portal, where the customer can update the card, cancel and download the invoices. It needs the Paddle API key on the server, so it answers 503 with code BILLING_PORTAL_UNAVAILABLE when that key is not configured.",
            "auth": {
              "type": "noauth"
            }
          }
        }
      ]
    },
    {
      "name": "Webhooks",
      "item": [
        {
          "name": "Register a webhook",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Accept",
                "value": "application/json"
              },
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/api/webhooks/register",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "webhooks",
                "register"
              ]
            },
            "description": "CleanMail POSTs the finished batch here.",
            "body": {
              "mode": "raw",
              "raw": "{\n  \"url\": \"https://example.com/hooks/cleanmail\"\n}"
            }
          }
        },
        {
          "name": "List webhooks",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "Accept",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/api/webhooks",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "webhooks"
              ]
            },
            "description": "The webhooks on this key."
          }
        },
        {
          "name": "Delete a webhook",
          "request": {
            "method": "DELETE",
            "header": [
              {
                "key": "Accept",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/api/webhooks/{{webhookId}}",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "webhooks",
                "{{webhookId}}"
              ]
            },
            "description": "Remove one."
          }
        }
      ]
    }
  ]
}
