{
    "openapi": "3.1.0",
    "info": {
        "title": "MailTester agent API",
        "version": "1.0.0",
        "description": "Account-free email verification API for AI agents. Register once, then call with Bearer auth."
    },
    "servers": [
        {
            "url": "https://app.mailtester.com"
        }
    ],
    "components": {
        "securitySchemes": {
            "bearer": {
                "type": "http",
                "scheme": "bearer"
            }
        },
        "schemas": {
            "Error": {
                "type": "object",
                "properties": {
                    "success": {
                        "type": "boolean"
                    },
                    "error": {
                        "type": "string"
                    }
                }
            },
            "Verdict": {
                "type": "string",
                "enum": [
                    "valid",
                    "invalid",
                    "risky",
                    "unknown"
                ]
            }
        }
    },
    "paths": {
        "/agent-gateway/register": {
            "post": {
                "operationId": "registerAgent",
                "summary": "Create an API key for an AI agent (no account needed).",
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "name": {
                                        "type": "string",
                                        "maxLength": 80
                                    },
                                    "purpose": {
                                        "type": "string",
                                        "maxLength": 500
                                    },
                                    "contact": {
                                        "type": "string",
                                        "maxLength": 255
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Key created (shown once).",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "api_key": {
                                            "type": "string"
                                        },
                                        "expires_at": {
                                            "type": "string",
                                            "format": "date-time"
                                        },
                                        "daily_free_credits": {
                                            "type": "integer"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Registration limit reached.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/api/v1/verify": {
            "post": {
                "operationId": "verifyEmail",
                "summary": "Verify one email address (1 credit).",
                "security": [
                    {
                        "bearer": []
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "required": [
                                    "email"
                                ],
                                "properties": {
                                    "email": {
                                        "type": "string",
                                        "format": "email"
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Verdict.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "email": {
                                                    "type": "string"
                                                },
                                                "result": {
                                                    "$ref": "#/components/schemas/Verdict"
                                                },
                                                "reason": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "score": {
                                                    "type": "integer"
                                                },
                                                "disposable": {
                                                    "type": "boolean"
                                                },
                                                "role": {
                                                    "type": "boolean"
                                                },
                                                "free": {
                                                    "type": "boolean"
                                                },
                                                "accept_all": {
                                                    "type": "boolean"
                                                },
                                                "did_you_mean": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "402": {
                        "description": "Daily free credits used up.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Rate limit or shared daily capacity reached.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/api/v1/verify/batch": {
            "post": {
                "operationId": "verifyBatch",
                "summary": "Submit up to 25 emails (1 credit each).",
                "security": [
                    {
                        "bearer": []
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "required": [
                                    "emails"
                                ],
                                "properties": {
                                    "emails": {
                                        "type": "array",
                                        "items": {
                                            "type": "string",
                                            "format": "email"
                                        },
                                        "maxItems": 25
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Batch accepted; poll status with data.id.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "success": {
                                            "type": "boolean"
                                        },
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": "integer"
                                                },
                                                "status": {
                                                    "type": "string"
                                                },
                                                "total_emails": {
                                                    "type": "integer"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Too many emails or invalid input.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "402": {
                        "description": "Not enough credits.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/api/v1/verify/batch/{id}": {
            "get": {
                "operationId": "getBatchStatus",
                "summary": "Batch progress.",
                "security": [
                    {
                        "bearer": []
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Status and counts."
                    }
                }
            }
        },
        "/api/v1/verify/batch/{id}/results": {
            "get": {
                "operationId": "getBatchResults",
                "summary": "Per-email results of a completed batch.",
                "security": [
                    {
                        "bearer": []
                    }
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "format",
                        "in": "query",
                        "schema": {
                            "type": "string",
                            "enum": [
                                "json",
                                "csv"
                            ]
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Results."
                    }
                }
            }
        },
        "/api/v1/credits": {
            "get": {
                "operationId": "getCredits",
                "summary": "Remaining credits.",
                "security": [
                    {
                        "bearer": []
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Balance."
                    }
                }
            }
        }
    }
}