{
    "openapi": "3.0.3",
    "info": {
        "title": "Email OTP API",
        "version": "1.0.0",
        "description": "Verify API: отправили код на email с бэкенда и проверили ответ\n\nСгенерировано из карты методов tools docs. Канон вызова — этот server, не Host документации."
    },
    "servers": [
        {
            "url": "https://mailganer.com",
            "description": "Production"
        }
    ],
    "tags": [
        {
            "name": "email-otp"
        }
    ],
    "paths": {
        "/tools/email-otp/v1/status": {
            "get": {
                "tags": [
                    "email-otp"
                ],
                "summary": "Квоты и ключ",
                "operationId": "email_otp_get_tools_email_otp_v1_status",
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "type": "boolean"
                                        },
                                        "service": {
                                            "type": "string"
                                        },
                                        "daily_limit": {
                                            "type": "integer"
                                        },
                                        "remaining": {
                                            "type": "integer"
                                        },
                                        "captcha": {
                                            "type": "object",
                                            "additionalProperties": true,
                                            "description": "required, site_key, mode"
                                        },
                                        "ttl_sec": {
                                            "type": "integer",
                                            "description": "жизнь кода"
                                        },
                                        "code_length": {
                                            "type": "integer"
                                        },
                                        "max_attempts": {
                                            "type": "integer"
                                        },
                                        "keyed_api": {
                                            "type": "boolean"
                                        },
                                        "keyed": {
                                            "type": "boolean",
                                            "description": "есть при валидном Bearer"
                                        },
                                        "tier": {
                                            "type": "string",
                                            "description": "free или paid; с Bearer"
                                        },
                                        "attribution_required": {
                                            "type": "boolean",
                                            "description": "true — нужна подпись Mailganer; с Bearer"
                                        }
                                    }
                                }
                            }
                        }
                    }
                },
                "description": "Доступ: опционально Bearer"
            }
        },
        "/tools/email-otp/v1/send": {
            "post": {
                "tags": [
                    "email-otp"
                ],
                "summary": "Отправить код (сессия проверки или доставка)",
                "operationId": "email_otp_post_tools_email_otp_v1_send",
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "type": "boolean"
                                        },
                                        "verification_id": {
                                            "type": "string",
                                            "description": "id сессии для /check"
                                        },
                                        "status": {
                                            "type": "string",
                                            "description": "pending"
                                        },
                                        "expires_in": {
                                            "type": "integer",
                                            "description": "секунды"
                                        },
                                        "remaining": {
                                            "type": "integer"
                                        },
                                        "daily_limit": {
                                            "type": "integer"
                                        },
                                        "tier": {
                                            "type": "string",
                                            "description": "с Bearer"
                                        },
                                        "attribution_required": {
                                            "type": "boolean",
                                            "description": "с Bearer"
                                        }
                                    }
                                }
                            }
                        }
                    }
                },
                "description": "Доступ: капча или Authorization: Bearer",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "email": {
                                        "type": "string",
                                        "description": "куда слать код"
                                    },
                                    "smart-token": {
                                        "type": "string",
                                        "description": "капча без ключа API; также captchaToken / smart_token / X-Captcha-Token"
                                    }
                                },
                                "required": [
                                    "email"
                                ]
                            }
                        }
                    }
                }
            }
        },
        "/tools/email-otp/v1/check": {
            "post": {
                "tags": [
                    "email-otp"
                ],
                "summary": "Проверить код",
                "operationId": "email_otp_post_tools_email_otp_v1_check",
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "type": "boolean"
                                        },
                                        "status": {
                                            "type": "string",
                                            "description": "approved или denied"
                                        },
                                        "reason": {
                                            "type": "string",
                                            "description": "invalid_code / expired / max_attempts / already_used"
                                        }
                                    }
                                }
                            }
                        }
                    }
                },
                "description": "Доступ: капча или Authorization: Bearer",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "verification_id": {
                                        "type": "string",
                                        "description": "из /send"
                                    },
                                    "code": {
                                        "type": "string",
                                        "description": "код из письма"
                                    },
                                    "smart-token": {
                                        "type": "string",
                                        "description": "капча без ключа API; также captchaToken / smart_token / X-Captcha-Token"
                                    }
                                },
                                "required": [
                                    "verification_id",
                                    "code"
                                ]
                            }
                        }
                    }
                }
            }
        },
        "/tools/email-otp/v1/deliver": {
            "post": {
                "tags": [
                    "email-otp"
                ],
                "summary": "Только доставить готовый код",
                "operationId": "email_otp_post_tools_email_otp_v1_deliver",
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "type": "boolean"
                                        },
                                        "status": {
                                            "type": "string",
                                            "description": "accepted"
                                        },
                                        "remaining": {
                                            "type": "integer"
                                        },
                                        "daily_limit": {
                                            "type": "integer"
                                        },
                                        "tier": {
                                            "type": "string"
                                        },
                                        "attribution_required": {
                                            "type": "boolean"
                                        }
                                    }
                                }
                            }
                        }
                    }
                },
                "description": "Доступ: только Bearer",
                "parameters": [
                    {
                        "name": "Authorization",
                        "in": "header",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "description": "Bearer ключ"
                        },
                        "description": "Bearer ключ"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "email": {
                                        "type": "string"
                                    },
                                    "code": {
                                        "type": "string",
                                        "description": "4–12 символов [0-9A-Za-z]"
                                    }
                                },
                                "required": [
                                    "email",
                                    "code"
                                ]
                            }
                        }
                    }
                }
            }
        }
    }
}