{
  "openapi": "3.1.0",
  "info": {
    "title": "VozAlta API",
    "description": "API REST para convertir texto, PDFs y URLs en audio español natural. Voces de México y España. Gratis: 5 generaciones/hora por IP. Pro $7/mes sin límite. Lifetime $49 pago único.",
    "contact": {
      "name": "VozAlta",
      "url": "https://voz.4l3.org/",
      "email": "hola@4l3.org"
    },
    "license": {
      "name": "Proprietary"
    },
    "version": "1.0.0"
  },
  "servers": [
    {
      "url": "https://voz.4l3.org"
    }
  ],
  "paths": {
    "/pay/checkout/{plan}": {
      "get": {
        "tags": [
          "payments"
        ],
        "summary": "Create Checkout",
        "description": "Crea sesión Checkout y redirige al user a Stripe.\nplan = 'pro' o 'lifetime'",
        "operationId": "create_checkout_pay_checkout__plan__get",
        "parameters": [
          {
            "name": "plan",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Plan"
            }
          },
          {
            "name": "email",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Email"
            }
          },
          {
            "name": "ref",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Ref"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/pay/success": {
      "get": {
        "tags": [
          "payments"
        ],
        "summary": "Success",
        "operationId": "success_pay_success_get",
        "parameters": [
          {
            "name": "session_id",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Session Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/pay/status": {
      "get": {
        "tags": [
          "payments"
        ],
        "summary": "Status",
        "operationId": "status_pay_status_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          }
        }
      }
    },
    "/pay/portal": {
      "post": {
        "tags": [
          "payments"
        ],
        "summary": "Customer Portal",
        "description": "Crea sesión de Stripe Customer Portal para que el cliente gestione su suscripción.\nEl cliente cancela, actualiza tarjeta, ve historial sin contactar soporte.",
        "operationId": "customer_portal_pay_portal_post",
        "parameters": [
          {
            "name": "email",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Email"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/pay/webhook": {
      "post": {
        "tags": [
          "payments"
        ],
        "summary": "Webhook",
        "description": "Stripe webhook handler. Procesa checkout.session.completed,\ncustomer.subscription.updated, customer.subscription.deleted.\nVerifica signature con STRIPE_WEBHOOK_SECRET.",
        "operationId": "webhook_pay_webhook_post",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          }
        }
      }
    },
    "/ab/results/{experiment}": {
      "get": {
        "tags": [
          "ab"
        ],
        "summary": "Results",
        "description": "Return A/B test results. Protected by dashboard token.",
        "operationId": "results_ab_results__experiment__get",
        "parameters": [
          {
            "name": "experiment",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Experiment"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/voices": {
      "get": {
        "summary": "Voices",
        "operationId": "voices_voices_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          }
        }
      }
    },
    "/convert/text": {
      "post": {
        "summary": "Convert Text",
        "operationId": "convert_text_convert_text_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ConvertTextReq"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/convert/pdf": {
      "post": {
        "summary": "Convert Pdf",
        "operationId": "convert_pdf_convert_pdf_post",
        "requestBody": {
          "content": {
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/Body_convert_pdf_convert_pdf_post"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/convert/url": {
      "post": {
        "summary": "Convert Url",
        "operationId": "convert_url_convert_url_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ConvertURLReq"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/audio/{audio_id}": {
      "get": {
        "summary": "Get Audio",
        "operationId": "get_audio_audio__audio_id__get",
        "parameters": [
          {
            "name": "audio_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Audio Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/waitlist": {
      "post": {
        "summary": "Join Waitlist",
        "operationId": "join_waitlist_waitlist_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WaitlistReq"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/waitlist/count": {
      "get": {
        "summary": "Waitlist Count",
        "operationId": "waitlist_count_waitlist_count_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Body_convert_pdf_convert_pdf_post": {
        "properties": {
          "file": {
            "type": "string",
            "format": "binary",
            "title": "File"
          },
          "voice": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Voice"
          }
        },
        "type": "object",
        "required": [
          "file"
        ],
        "title": "Body_convert_pdf_convert_pdf_post"
      },
      "ConvertTextReq": {
        "properties": {
          "text": {
            "type": "string",
            "maxLength": 100000,
            "minLength": 1,
            "title": "Text"
          },
          "voice": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Voice"
          },
          "fmt": {
            "type": "string",
            "title": "Fmt",
            "default": "mp3"
          }
        },
        "type": "object",
        "required": [
          "text"
        ],
        "title": "ConvertTextReq"
      },
      "ConvertURLReq": {
        "properties": {
          "url": {
            "type": "string",
            "title": "Url"
          },
          "voice": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Voice"
          },
          "fmt": {
            "type": "string",
            "title": "Fmt",
            "default": "mp3"
          }
        },
        "type": "object",
        "required": [
          "url"
        ],
        "title": "ConvertURLReq"
      },
      "HTTPValidationError": {
        "properties": {
          "detail": {
            "items": {
              "$ref": "#/components/schemas/ValidationError"
            },
            "type": "array",
            "title": "Detail"
          }
        },
        "type": "object",
        "title": "HTTPValidationError"
      },
      "ValidationError": {
        "properties": {
          "loc": {
            "items": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "integer"
                }
              ]
            },
            "type": "array",
            "title": "Location"
          },
          "msg": {
            "type": "string",
            "title": "Message"
          },
          "type": {
            "type": "string",
            "title": "Error Type"
          }
        },
        "type": "object",
        "required": [
          "loc",
          "msg",
          "type"
        ],
        "title": "ValidationError"
      },
      "WaitlistReq": {
        "properties": {
          "email": {
            "type": "string",
            "maxLength": 200,
            "title": "Email"
          },
          "source": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 120
              },
              {
                "type": "null"
              }
            ],
            "title": "Source"
          },
          "interest": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^(pro|lifetime)$"
              },
              {
                "type": "null"
              }
            ],
            "title": "Interest"
          }
        },
        "type": "object",
        "required": [
          "email"
        ],
        "title": "WaitlistReq"
      }
    }
  }
}