{
  "openapi": "3.0.3",
  "info": {
    "title": "NEXOSOLT · API administrativa",
    "version": "2.3.0",
    "description": "Administración central con bases de datos independientes por empresa. Token exclusivo del propietario, permisos explícitos, IP/CIDR y vencimiento. POST requiere Idempotency-Key. Importes de salida en centavos enteros; precios de entrada decimales como cadenas. La creación de empresas es asíncrona y requiere confirmación del correo. Esta API utiliza identificadores globales de solicitudes/facturas; conserva local_id para correlacionar el registro en la empresa. No mezclar con los ID de la API de red."
  },
  "servers": [
    {
      "url": "https://admin.nexos.com.do/api/admin/v1"
    }
  ],
  "security": [
    {
      "AdminBearer": []
    },
    {
      "AdminHeader": []
    }
  ],
  "components": {
    "securitySchemes": {
      "AdminBearer": {
        "type": "http",
        "scheme": "bearer",
        "description": "nxa_ token generated by global administrator"
      },
      "AdminHeader": {
        "type": "apiKey",
        "in": "header",
        "name": "X-Admin-Token"
      }
    },
    "schemas": {
      "Company": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "maxLength": 120
          },
          "slug": {
            "type": "string",
            "description": "Required on create, immutable thereafter."
          },
          "account": {
            "type": "object",
            "properties": {
              "legal_name": {
                "type": "string"
              },
              "tax_id": {
                "type": "string"
              },
              "contact_name": {
                "type": "string"
              },
              "contact_email": {
                "type": "string"
              },
              "billing_email": {
                "type": "string"
              },
              "phone": {
                "type": "string"
              },
              "address": {
                "type": "string"
              },
              "city": {
                "type": "string"
              },
              "country": {
                "type": "string"
              },
              "website": {
                "type": "string"
              },
              "plan_name": {
                "type": "string"
              },
              "notes": {
                "type": "string"
              },
              "payment_contact": {
                "type": "string"
              },
              "olt_limit": {
                "type": "integer",
                "minimum": 0,
                "maximum": 10000,
                "nullable": true
              },
              "paid_until": {
                "type": "string",
                "format": "date",
                "nullable": true
              },
              "manual_suspended": {
                "type": "boolean"
              },
              "auto_suspend": {
                "type": "boolean"
              },
              "notify_email": {
                "type": "boolean"
              },
              "currency": {
                "type": "string",
                "enum": [
                  "USD",
                  "DOP",
                  "EUR"
                ]
              }
            }
          }
        }
      },
      "User": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "email": {
            "type": "string",
            "format": "email"
          },
          "role": {
            "type": "string",
            "enum": [
              "admin",
              "technician",
              "viewer"
            ]
          },
          "password": {
            "type": "string",
            "format": "password",
            "writeOnly": true,
            "minLength": 14,
            "maxLength": 200
          },
          "active": {
            "type": "integer",
            "enum": [
              0,
              1
            ]
          }
        }
      },
      "Pricing": {
        "type": "object",
        "properties": {
          "price_revision": {
            "type": "integer",
            "description": "GET pricing.revision first."
          },
          "price_mode": {
            "type": "string",
            "enum": [
              "custom",
              "inherit"
            ]
          },
          "monthly_price": {
            "type": "string",
            "example": "25.00"
          },
          "price_currency": {
            "type": "string",
            "enum": [
              "USD",
              "DOP",
              "EUR"
            ]
          },
          "discounts": {
            "type": "object",
            "description": "Keys 3,6,12; percent strings.",
            "example": {
              "3": "0",
              "6": "0",
              "12": "10"
            }
          }
        }
      },
      "Request": {
        "type": "object",
        "properties": {
          "tariff_fingerprint": {
            "type": "string",
            "description": "GET company pricing fingerprint."
          },
          "months": {
            "type": "object",
            "additionalProperties": {
              "type": "integer",
              "enum": [
                3,
                6,
                12
              ]
            },
            "example": {
              "19": 12
            }
          },
          "advance_payments": {
            "type": "object",
            "description": "OLT ID to string 1, explicit permission to renew before expiry.",
            "example": {
              "19": "1"
            }
          },
          "customer_note": {
            "type": "string",
            "maxLength": 1000
          },
          "plan_type": {
            "type": "string",
            "enum": [
              "paid",
              "demo"
            ],
            "default": "paid",
            "description": "Demo is owner-only and cannot replace paid accounts."
          },
          "demo_olts": {
            "type": "array",
            "items": {
              "type": "integer"
            }
          }
        }
      },
      "Quote": {
        "type": "object",
        "properties": {
          "revision": {
            "type": "integer"
          },
          "currency": {
            "type": "string",
            "enum": [
              "USD",
              "DOP",
              "EUR"
            ]
          },
          "prices": {
            "type": "object",
            "description": "Activation ITEM ID to monthly decimal string."
          },
          "line_discounts": {
            "type": "object",
            "description": "Activation ITEM ID to percent string."
          }
        }
      },
      "Approve": {
        "type": "object",
        "properties": {
          "revision": {
            "type": "integer"
          },
          "payment_confirmed": {
            "type": "string",
            "enum": [
              "1"
            ]
          },
          "received_date": {
            "type": "string",
            "format": "date"
          },
          "method": {
            "type": "string",
            "enum": [
              "transfer",
              "deposit",
              "cash",
              "free"
            ]
          },
          "reference": {
            "type": "string",
            "maxLength": 190
          }
        }
      },
      "Revision": {
        "type": "object",
        "properties": {
          "revision": {
            "type": "integer"
          },
          "admin_note": {
            "type": "string",
            "maxLength": 1000
          }
        }
      },
      "Issuer": {
        "type": "object",
        "properties": {
          "issuer_name": {
            "type": "string"
          },
          "issuer_tax_id": {
            "type": "string"
          },
          "issuer_registration": {
            "type": "string"
          },
          "issuer_address": {
            "type": "string"
          },
          "issuer_country": {
            "type": "string"
          },
          "issuer_email": {
            "type": "string"
          },
          "issuer_phone": {
            "type": "string"
          },
          "issuer_bank": {
            "type": "string"
          },
          "issuer_account": {
            "type": "string"
          },
          "issuer_instructions": {
            "type": "string"
          },
          "issuer_due_days": {
            "type": "integer",
            "minimum": 0,
            "maximum": 90
          }
        }
      },
      "ErrorEnvelope": {
        "type": "object",
        "required": [
          "success",
          "error"
        ],
        "properties": {
          "success": {
            "type": "boolean",
            "enum": [
              false
            ]
          },
          "error": {
            "type": "object",
            "properties": {
              "code": {
                "type": "string"
              },
              "message": {
                "type": "string"
              }
            }
          },
          "request_id": {
            "type": "string"
          }
        }
      },
      "SuccessEnvelope": {
        "type": "object",
        "required": [
          "success",
          "data"
        ],
        "properties": {
          "success": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "data": {},
          "request_id": {
            "type": "string"
          }
        }
      }
    }
  },
  "paths": {
    "/capabilities": {
      "get": {
        "summary": "Version and token capabilities",
        "description": "Required scope(s): authenticated",
        "operationId": "get__capabilities",
        "parameters": [],
        "responses": {
          "200": {
            "description": "JSON envelope success/data/request_id; PDF route returns application/pdf",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SuccessEnvelope"
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or missing idempotency key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired or revoked administrative key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Wrong host, source IP or scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Record or route not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Conflict, duplicate/processing request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "422": {
            "description": "Business rule validation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit: retry after 60 seconds",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Unexpected failure; reconcile before retrying",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/companies": {
      "get": {
        "summary": "List companies (after_id/limit)",
        "description": "Required scope(s): companies:read",
        "operationId": "get__companies",
        "parameters": [
          {
            "name": "include_retired",
            "in": "query",
            "schema": {
              "type": "boolean",
              "default": false
            },
            "description": "Incluir empresas eliminadas de forma recuperable; por defecto se omiten."
          },
          {
            "name": "after_id",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "maximum": 999999999
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          }
        ],
        "responses": {
          "200": {
            "description": "JSON envelope success/data/request_id; PDF route returns application/pdf",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SuccessEnvelope"
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or missing idempotency key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired or revoked administrative key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Wrong host, source IP or scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Record or route not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Conflict, duplicate/processing request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "422": {
            "description": "Business rule validation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit: retry after 60 seconds",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Unexpected failure; reconcile before retrying",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "post": {
        "summary": "Crear registro de empresa y enviar verificación",
        "description": "companies:write. Devuelve202. La empresa comienza pending_email y no dispone de base de datos ni prueba activa hasta confirmar el correo. Las etapas siguientes son queued/provisioning/ready o failed. La prueba inicial dura72h desde ready. Configura los datos de cuenta, precios y usuarios mediante /companies/{id} después de ready. El subdominio es inmutable. Un correo principal identifica un único registro.",
        "operationId": "post__companies",
        "parameters": [
          {
            "in": "header",
            "name": "Idempotency-Key",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 128
            }
          }
        ],
        "responses": {
          "400": {
            "description": "Invalid parameters or missing idempotency key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired or revoked administrative key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Wrong host, source IP or scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Record or route not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Conflict, duplicate/processing request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "422": {
            "description": "Business rule validation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit: retry after 60 seconds",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Unexpected failure; reconcile before retrying",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "202": {
            "description": "Registro aceptado; no implica cuenta preparada ni pago confirmado.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SuccessEnvelope"
                }
              }
            }
          },
          "413": {
            "description": "Cuerpo mayor de64KiB",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "415": {
            "description": "Usar application/json",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "423": {
            "description": "Mantenimiento o traslado en curso",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "name",
                  "slug",
                  "administrator_name",
                  "email",
                  "password"
                ],
                "properties": {
                  "name": {
                    "type": "string",
                    "maxLength": 120
                  },
                  "slug": {
                    "type": "string",
                    "pattern": "^[a-z][a-z0-9-]{1,40}[a-z0-9]$"
                  },
                  "administrator_name": {
                    "type": "string",
                    "maxLength": 120
                  },
                  "email": {
                    "type": "string",
                    "format": "email"
                  },
                  "password": {
                    "type": "string",
                    "format": "password",
                    "minLength": 14,
                    "maxLength": 200,
                    "writeOnly": true
                  },
                  "phone": {
                    "type": "string",
                    "maxLength": 40
                  }
                },
                "additionalProperties": false
              }
            }
          }
        }
      }
    },
    "/companies/{company_id}": {
      "get": {
        "summary": "Get or update company",
        "description": "Required scope(s): companies:read",
        "operationId": "get__companies_company_id",
        "parameters": [
          {
            "in": "path",
            "name": "company_id",
            "required": true,
            "schema": {
              "type": "integer",
              "minimum": 1
            }
          }
        ],
        "responses": {
          "200": {
            "description": "JSON envelope success/data/request_id; PDF route returns application/pdf",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SuccessEnvelope"
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or missing idempotency key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired or revoked administrative key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Wrong host, source IP or scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Record or route not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Conflict, duplicate/processing request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "422": {
            "description": "Business rule validation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit: retry after 60 seconds",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Unexpected failure; reconcile before retrying",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "post": {
        "summary": "Get or update company",
        "description": "Required scope(s): companies:write",
        "operationId": "post__companies_company_id",
        "parameters": [
          {
            "in": "path",
            "name": "company_id",
            "required": true,
            "schema": {
              "type": "integer",
              "minimum": 1
            }
          },
          {
            "in": "header",
            "name": "Idempotency-Key",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 128
            }
          }
        ],
        "responses": {
          "200": {
            "description": "JSON envelope success/data/request_id; PDF route returns application/pdf",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SuccessEnvelope"
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or missing idempotency key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired or revoked administrative key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Wrong host, source IP or scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Record or route not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Conflict, duplicate/processing request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "422": {
            "description": "Business rule validation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit: retry after 60 seconds",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Unexpected failure; reconcile before retrying",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "413": {
            "description": "Cuerpo mayor de64KiB",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "415": {
            "description": "Usar application/json",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "423": {
            "description": "Mantenimiento o traslado en curso",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "maxLength": 120
                  },
                  "slug": {
                    "type": "string",
                    "description": "Se define al crear la empresa y no se puede renombrar.",
                    "readOnly": true
                  },
                  "account": {
                    "type": "object",
                    "properties": {
                      "legal_name": {
                        "type": "string",
                        "maxLength": 160
                      },
                      "tax_id": {
                        "type": "string",
                        "maxLength": 40
                      },
                      "contact_name": {
                        "type": "string",
                        "maxLength": 120
                      },
                      "contact_email": {
                        "type": "string",
                        "maxLength": 190
                      },
                      "phone": {
                        "type": "string",
                        "maxLength": 40
                      },
                      "address": {
                        "type": "string",
                        "maxLength": 240
                      },
                      "city": {
                        "type": "string",
                        "maxLength": 100
                      },
                      "country": {
                        "type": "string",
                        "maxLength": 80
                      },
                      "website": {
                        "type": "string",
                        "maxLength": 240
                      },
                      "plan_name": {
                        "type": "string",
                        "maxLength": 80
                      },
                      "billing_email": {
                        "type": "string",
                        "maxLength": 190
                      },
                      "payment_contact": {
                        "type": "string",
                        "maxLength": 600
                      },
                      "notes": {
                        "type": "string",
                        "maxLength": 4000
                      },
                      "olt_limit": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 10000,
                        "nullable": true
                      },
                      "paid_until": {
                        "type": "string",
                        "format": "date",
                        "nullable": true
                      },
                      "auto_suspend": {
                        "type": "boolean"
                      },
                      "manual_suspended": {
                        "type": "boolean"
                      },
                      "notify_email": {
                        "type": "boolean",
                        "description": "Requiere billing_email válido si se habilita."
                      },
                      "currency": {
                        "type": "string",
                        "enum": [
                          "USD",
                          "DOP",
                          "EUR"
                        ]
                      }
                    },
                    "description": "Datos editables de la cuenta; las fechas de prueba se controlan mediante activación."
                  }
                }
              }
            }
          }
        }
      }
    },
    "/companies/{company_id}/suspend": {
      "post": {
        "summary": "suspend company; keeps login/payments accessible",
        "description": "Required scope(s): companies:write",
        "operationId": "post__companies_company_id_suspend",
        "parameters": [
          {
            "in": "path",
            "name": "company_id",
            "required": true,
            "schema": {
              "type": "integer",
              "minimum": 1
            }
          },
          {
            "in": "header",
            "name": "Idempotency-Key",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 128
            }
          }
        ],
        "responses": {
          "200": {
            "description": "JSON envelope success/data/request_id; PDF route returns application/pdf",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SuccessEnvelope"
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or missing idempotency key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired or revoked administrative key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Wrong host, source IP or scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Record or route not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Conflict, duplicate/processing request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "422": {
            "description": "Business rule validation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit: retry after 60 seconds",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Unexpected failure; reconcile before retrying",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "413": {
            "description": "Cuerpo mayor de64KiB",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "415": {
            "description": "Usar application/json",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "423": {
            "description": "Mantenimiento o traslado en curso",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              }
            }
          }
        }
      }
    },
    "/companies/{company_id}/resume": {
      "post": {
        "summary": "resume company; keeps login/payments accessible",
        "description": "Required scope(s): companies:write",
        "operationId": "post__companies_company_id_resume",
        "parameters": [
          {
            "in": "path",
            "name": "company_id",
            "required": true,
            "schema": {
              "type": "integer",
              "minimum": 1
            }
          },
          {
            "in": "header",
            "name": "Idempotency-Key",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 128
            }
          }
        ],
        "responses": {
          "200": {
            "description": "JSON envelope success/data/request_id; PDF route returns application/pdf",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SuccessEnvelope"
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or missing idempotency key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired or revoked administrative key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Wrong host, source IP or scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Record or route not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Conflict, duplicate/processing request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "422": {
            "description": "Business rule validation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit: retry after 60 seconds",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Unexpected failure; reconcile before retrying",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "413": {
            "description": "Cuerpo mayor de64KiB",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "415": {
            "description": "Usar application/json",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "423": {
            "description": "Mantenimiento o traslado en curso",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              }
            }
          }
        }
      }
    },
    "/companies/{company_id}/olts": {
      "get": {
        "summary": "OLT subscriptions and expiry",
        "description": "Required scope(s): companies:read",
        "operationId": "get__companies_company_id_olts",
        "parameters": [
          {
            "in": "path",
            "name": "company_id",
            "required": true,
            "schema": {
              "type": "integer",
              "minimum": 1
            }
          }
        ],
        "responses": {
          "200": {
            "description": "JSON envelope success/data/request_id; PDF route returns application/pdf",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SuccessEnvelope"
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or missing idempotency key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired or revoked administrative key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Wrong host, source IP or scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Record or route not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Conflict, duplicate/processing request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "422": {
            "description": "Business rule validation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit: retry after 60 seconds",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Unexpected failure; reconcile before retrying",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/companies/{company_id}/users": {
      "get": {
        "summary": "List/get/create/update tenant users",
        "description": "Required scope(s): users:read",
        "operationId": "get__companies_company_id_users",
        "parameters": [
          {
            "in": "path",
            "name": "company_id",
            "required": true,
            "schema": {
              "type": "integer",
              "minimum": 1
            }
          }
        ],
        "responses": {
          "200": {
            "description": "JSON envelope success/data/request_id; PDF route returns application/pdf",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SuccessEnvelope"
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or missing idempotency key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired or revoked administrative key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Wrong host, source IP or scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Record or route not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Conflict, duplicate/processing request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "422": {
            "description": "Business rule validation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit: retry after 60 seconds",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Unexpected failure; reconcile before retrying",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "post": {
        "summary": "List/get/create/update tenant users",
        "description": "Required scope(s): users:write",
        "operationId": "post__companies_company_id_users",
        "parameters": [
          {
            "in": "path",
            "name": "company_id",
            "required": true,
            "schema": {
              "type": "integer",
              "minimum": 1
            }
          },
          {
            "in": "header",
            "name": "Idempotency-Key",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 128
            }
          }
        ],
        "responses": {
          "200": {
            "description": "JSON envelope success/data/request_id; PDF route returns application/pdf",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SuccessEnvelope"
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or missing idempotency key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired or revoked administrative key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Wrong host, source IP or scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Record or route not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Conflict, duplicate/processing request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "422": {
            "description": "Business rule validation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit: retry after 60 seconds",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Unexpected failure; reconcile before retrying",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "413": {
            "description": "Cuerpo mayor de64KiB",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "415": {
            "description": "Usar application/json",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "423": {
            "description": "Mantenimiento o traslado en curso",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "name",
                  "email",
                  "password"
                ],
                "properties": {
                  "name": {
                    "type": "string"
                  },
                  "email": {
                    "type": "string",
                    "format": "email"
                  },
                  "role": {
                    "type": "string",
                    "enum": [
                      "admin",
                      "technician",
                      "viewer"
                    ]
                  },
                  "password": {
                    "type": "string",
                    "format": "password",
                    "writeOnly": true,
                    "minLength": 14,
                    "maxLength": 200
                  },
                  "active": {
                    "type": "integer",
                    "enum": [
                      0,
                      1
                    ]
                  }
                }
              }
            }
          }
        }
      }
    },
    "/companies/{company_id}/users/{user_id}": {
      "get": {
        "summary": "List/get/create/update tenant users",
        "description": "Required scope(s): users:read",
        "operationId": "get__companies_company_id_users_user_id",
        "parameters": [
          {
            "in": "path",
            "name": "company_id",
            "required": true,
            "schema": {
              "type": "integer",
              "minimum": 1
            }
          },
          {
            "in": "path",
            "name": "user_id",
            "required": true,
            "schema": {
              "type": "integer",
              "minimum": 1
            }
          }
        ],
        "responses": {
          "200": {
            "description": "JSON envelope success/data/request_id; PDF route returns application/pdf",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SuccessEnvelope"
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or missing idempotency key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired or revoked administrative key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Wrong host, source IP or scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Record or route not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Conflict, duplicate/processing request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "422": {
            "description": "Business rule validation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit: retry after 60 seconds",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Unexpected failure; reconcile before retrying",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "post": {
        "summary": "List/get/create/update tenant users",
        "description": "Required scope(s): users:write",
        "operationId": "post__companies_company_id_users_user_id",
        "parameters": [
          {
            "in": "path",
            "name": "company_id",
            "required": true,
            "schema": {
              "type": "integer",
              "minimum": 1
            }
          },
          {
            "in": "path",
            "name": "user_id",
            "required": true,
            "schema": {
              "type": "integer",
              "minimum": 1
            }
          },
          {
            "in": "header",
            "name": "Idempotency-Key",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 128
            }
          }
        ],
        "responses": {
          "200": {
            "description": "JSON envelope success/data/request_id; PDF route returns application/pdf",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SuccessEnvelope"
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or missing idempotency key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired or revoked administrative key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Wrong host, source IP or scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Record or route not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Conflict, duplicate/processing request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "422": {
            "description": "Business rule validation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit: retry after 60 seconds",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Unexpected failure; reconcile before retrying",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "413": {
            "description": "Cuerpo mayor de64KiB",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "415": {
            "description": "Usar application/json",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "423": {
            "description": "Mantenimiento o traslado en curso",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string"
                  },
                  "email": {
                    "type": "string",
                    "format": "email"
                  },
                  "role": {
                    "type": "string",
                    "enum": [
                      "admin",
                      "technician",
                      "viewer"
                    ]
                  },
                  "password": {
                    "type": "string",
                    "format": "password",
                    "writeOnly": true,
                    "minLength": 14,
                    "maxLength": 200
                  },
                  "active": {
                    "type": "integer",
                    "enum": [
                      0,
                      1
                    ]
                  }
                }
              }
            }
          }
        }
      }
    },
    "/pricing/global": {
      "get": {
        "summary": "Read/update monthly price and 3/6/12-month discounts",
        "description": "Required scope(s): pricing:read",
        "operationId": "get__pricing_global",
        "parameters": [],
        "responses": {
          "200": {
            "description": "JSON envelope success/data/request_id; PDF route returns application/pdf",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SuccessEnvelope"
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or missing idempotency key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired or revoked administrative key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Wrong host, source IP or scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Record or route not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Conflict, duplicate/processing request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "422": {
            "description": "Business rule validation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit: retry after 60 seconds",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Unexpected failure; reconcile before retrying",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "post": {
        "summary": "Read/update monthly price and 3/6/12-month discounts",
        "description": "Required scope(s): pricing:write",
        "operationId": "post__pricing_global",
        "parameters": [
          {
            "in": "header",
            "name": "Idempotency-Key",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 128
            }
          }
        ],
        "responses": {
          "200": {
            "description": "JSON envelope success/data/request_id; PDF route returns application/pdf",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SuccessEnvelope"
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or missing idempotency key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired or revoked administrative key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Wrong host, source IP or scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Record or route not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Conflict, duplicate/processing request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "422": {
            "description": "Business rule validation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit: retry after 60 seconds",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Unexpected failure; reconcile before retrying",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "413": {
            "description": "Cuerpo mayor de64KiB",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "415": {
            "description": "Usar application/json",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "423": {
            "description": "Mantenimiento o traslado en curso",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "price_revision": {
                    "type": "integer",
                    "description": "GET pricing.revision first."
                  },
                  "price_mode": {
                    "type": "string",
                    "enum": [
                      "custom",
                      "inherit"
                    ]
                  },
                  "monthly_price": {
                    "type": "string",
                    "example": "25.00"
                  },
                  "price_currency": {
                    "type": "string",
                    "enum": [
                      "USD",
                      "DOP",
                      "EUR"
                    ]
                  },
                  "discounts": {
                    "type": "object",
                    "description": "Keys 3,6,12; percent strings.",
                    "example": {
                      "3": "0",
                      "6": "0",
                      "12": "10"
                    }
                  }
                },
                "required": [
                  "price_revision",
                  "monthly_price"
                ]
              }
            }
          }
        }
      }
    },
    "/companies/{company_id}/pricing": {
      "get": {
        "summary": "Read/update monthly price and 3/6/12-month discounts",
        "description": "Required scope(s): pricing:read",
        "operationId": "get__companies_company_id_pricing",
        "parameters": [
          {
            "in": "path",
            "name": "company_id",
            "required": true,
            "schema": {
              "type": "integer",
              "minimum": 1
            }
          }
        ],
        "responses": {
          "200": {
            "description": "JSON envelope success/data/request_id; PDF route returns application/pdf",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SuccessEnvelope"
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or missing idempotency key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired or revoked administrative key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Wrong host, source IP or scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Record or route not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Conflict, duplicate/processing request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "422": {
            "description": "Business rule validation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit: retry after 60 seconds",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Unexpected failure; reconcile before retrying",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "post": {
        "summary": "Read/update monthly price and 3/6/12-month discounts",
        "description": "Required scope(s): pricing:write",
        "operationId": "post__companies_company_id_pricing",
        "parameters": [
          {
            "in": "path",
            "name": "company_id",
            "required": true,
            "schema": {
              "type": "integer",
              "minimum": 1
            }
          },
          {
            "in": "header",
            "name": "Idempotency-Key",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 128
            }
          }
        ],
        "responses": {
          "200": {
            "description": "JSON envelope success/data/request_id; PDF route returns application/pdf",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SuccessEnvelope"
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or missing idempotency key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired or revoked administrative key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Wrong host, source IP or scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Record or route not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Conflict, duplicate/processing request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "422": {
            "description": "Business rule validation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit: retry after 60 seconds",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Unexpected failure; reconcile before retrying",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "413": {
            "description": "Cuerpo mayor de64KiB",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "415": {
            "description": "Usar application/json",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "423": {
            "description": "Mantenimiento o traslado en curso",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "price_revision": {
                    "type": "integer",
                    "description": "GET pricing.revision first."
                  },
                  "price_mode": {
                    "type": "string",
                    "enum": [
                      "custom",
                      "inherit"
                    ]
                  },
                  "monthly_price": {
                    "type": "string",
                    "example": "25.00"
                  },
                  "price_currency": {
                    "type": "string",
                    "enum": [
                      "USD",
                      "DOP",
                      "EUR"
                    ]
                  },
                  "discounts": {
                    "type": "object",
                    "description": "Keys 3,6,12; percent strings.",
                    "example": {
                      "3": "0",
                      "6": "0",
                      "12": "10"
                    }
                  }
                },
                "required": [
                  "price_revision"
                ]
              }
            }
          }
        }
      }
    },
    "/companies/{company_id}/requests": {
      "get": {
        "summary": "List requests newest first (before_id/limit)",
        "description": "Required scope(s): billing:read",
        "operationId": "get__companies_company_id_requests",
        "parameters": [
          {
            "in": "path",
            "name": "company_id",
            "required": true,
            "schema": {
              "type": "integer",
              "minimum": 1
            }
          }
        ],
        "responses": {
          "200": {
            "description": "JSON envelope success/data/request_id; PDF route returns application/pdf",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SuccessEnvelope"
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or missing idempotency key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired or revoked administrative key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Wrong host, source IP or scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Record or route not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Conflict, duplicate/processing request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "422": {
            "description": "Business rule validation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit: retry after 60 seconds",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Unexpected failure; reconcile before retrying",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "post": {
        "summary": "Solicitar renovación o licencias OLT adicionales; crea proforma sin confirmar pago",
        "description": "Required scope(s): billing:write + activation:write Para comprar capacidad sin equipo: additional_olts + capacity_months + tariff_fingerprint. Solo la aprobación manual aumenta olt_limit y crea las licencias. Los items devueltos incluyen item_kind=capacity, quantity y olt_id=null. No se crean equipos ficticios. La solicitud de licencias adicionales no renueva OLT existentes. Los permisos y la idempotencia no cambian.",
        "operationId": "post__companies_company_id_requests",
        "parameters": [
          {
            "in": "path",
            "name": "company_id",
            "required": true,
            "schema": {
              "type": "integer",
              "minimum": 1
            }
          },
          {
            "in": "header",
            "name": "Idempotency-Key",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 128
            }
          }
        ],
        "responses": {
          "200": {
            "description": "JSON envelope success/data/request_id; PDF route returns application/pdf",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SuccessEnvelope"
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or missing idempotency key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired or revoked administrative key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Wrong host, source IP or scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Record or route not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Conflict, duplicate/processing request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "422": {
            "description": "Business rule validation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit: retry after 60 seconds",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Unexpected failure; reconcile before retrying",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "413": {
            "description": "Cuerpo mayor de64KiB",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "415": {
            "description": "Usar application/json",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "423": {
            "description": "Mantenimiento o traslado en curso",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "tariff_fingerprint"
                ],
                "properties": {
                  "tariff_fingerprint": {
                    "type": "string",
                    "description": "GET company pricing fingerprint."
                  },
                  "months": {
                    "type": "object",
                    "additionalProperties": {
                      "type": "integer",
                      "enum": [
                        3,
                        6,
                        12
                      ]
                    },
                    "description": "Mapa de ID local de OLT a meses para renovar equipos existentes. Omitir al solicitar additional_olts."
                  },
                  "advance_payments": {
                    "type": "object",
                    "additionalProperties": {
                      "type": "string",
                      "enum": [
                        "1",
                        "0"
                      ]
                    },
                    "description": "Mapa de ID local de OLT a la cadena1 para autorizar pago adelantado; usar cadena, no booleano."
                  },
                  "customer_note": {
                    "type": "string",
                    "maxLength": 1000
                  },
                  "plan_type": {
                    "type": "string",
                    "enum": [
                      "paid",
                      "demo"
                    ],
                    "default": "paid",
                    "description": "Demo is owner-only and cannot replace paid accounts."
                  },
                  "demo_olts": {
                    "type": "array",
                    "items": {
                      "type": "integer"
                    }
                  },
                  "additional_olts": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 50,
                    "description": "Licencias para OLT adicionales sin equipo registrado. No combinar con months ni demo_olts; plan_type debe ser paid."
                  },
                  "capacity_months": {
                    "type": "integer",
                    "enum": [
                      3,
                      6,
                      12
                    ],
                    "description": "Período de las licencias adicionales. La vigencia comienza al aprobar el pago."
                  }
                },
                "example": {
                  "tariff_fingerprint": "USE_COMPANY_PRICING_FINGERPRINT",
                  "additional_olts": 1,
                  "capacity_months": 12,
                  "customer_note": "Solicito licencia para mi segunda OLT."
                }
              }
            }
          }
        }
      }
    },
    "/companies/{company_id}/payments": {
      "get": {
        "summary": "List payments newest first (before_id/limit)",
        "description": "Required scope(s): billing:read",
        "operationId": "get__companies_company_id_payments",
        "parameters": [
          {
            "in": "path",
            "name": "company_id",
            "required": true,
            "schema": {
              "type": "integer",
              "minimum": 1
            }
          }
        ],
        "responses": {
          "200": {
            "description": "JSON envelope success/data/request_id; PDF route returns application/pdf",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SuccessEnvelope"
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or missing idempotency key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired or revoked administrative key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Wrong host, source IP or scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Record or route not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Conflict, duplicate/processing request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "422": {
            "description": "Business rule validation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit: retry after 60 seconds",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Unexpected failure; reconcile before retrying",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/companies/{company_id}/invoices": {
      "get": {
        "summary": "List invoices newest first (before_id/limit)",
        "description": "Required scope(s): billing:read",
        "operationId": "get__companies_company_id_invoices",
        "parameters": [
          {
            "in": "path",
            "name": "company_id",
            "required": true,
            "schema": {
              "type": "integer",
              "minimum": 1
            }
          }
        ],
        "responses": {
          "200": {
            "description": "JSON envelope success/data/request_id; PDF route returns application/pdf",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SuccessEnvelope"
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or missing idempotency key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired or revoked administrative key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Wrong host, source IP or scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Record or route not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Conflict, duplicate/processing request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "422": {
            "description": "Business rule validation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit: retry after 60 seconds",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Unexpected failure; reconcile before retrying",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/requests": {
      "get": {
        "summary": "All companies requests, newest first (before_id/limit)",
        "description": "Required scope(s): billing:read",
        "operationId": "get__requests",
        "parameters": [
          {
            "name": "before_id",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 999999999
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          }
        ],
        "responses": {
          "200": {
            "description": "JSON envelope success/data/request_id; PDF route returns application/pdf",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SuccessEnvelope"
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or missing idempotency key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired or revoked administrative key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Wrong host, source IP or scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Record or route not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Conflict, duplicate/processing request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "422": {
            "description": "Business rule validation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit: retry after 60 seconds",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Unexpected failure; reconcile before retrying",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/requests/{request_id}": {
      "get": {
        "summary": "Request, items, payments, documents and current revision",
        "description": "Required scope(s): billing:read",
        "operationId": "get__requests_request_id",
        "parameters": [
          {
            "in": "path",
            "name": "request_id",
            "required": true,
            "schema": {
              "type": "integer",
              "minimum": 1
            }
          }
        ],
        "responses": {
          "200": {
            "description": "JSON envelope success/data/request_id; PDF route returns application/pdf",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SuccessEnvelope"
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or missing idempotency key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired or revoked administrative key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Wrong host, source IP or scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Record or route not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Conflict, duplicate/processing request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "422": {
            "description": "Business rule validation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit: retry after 60 seconds",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Unexpected failure; reconcile before retrying",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/requests/{request_id}/quote": {
      "post": {
        "summary": "quote request",
        "description": "Required scope(s): billing:write + activation:write",
        "operationId": "post__requests_request_id_quote",
        "parameters": [
          {
            "in": "path",
            "name": "request_id",
            "required": true,
            "schema": {
              "type": "integer",
              "minimum": 1
            }
          },
          {
            "in": "header",
            "name": "Idempotency-Key",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 128
            }
          }
        ],
        "responses": {
          "200": {
            "description": "JSON envelope success/data/request_id; PDF route returns application/pdf",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SuccessEnvelope"
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or missing idempotency key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired or revoked administrative key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Wrong host, source IP or scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Record or route not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Conflict, duplicate/processing request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "422": {
            "description": "Business rule validation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit: retry after 60 seconds",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Unexpected failure; reconcile before retrying",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "413": {
            "description": "Cuerpo mayor de64KiB",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "415": {
            "description": "Usar application/json",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "423": {
            "description": "Mantenimiento o traslado en curso",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "revision",
                  "currency",
                  "prices"
                ],
                "properties": {
                  "revision": {
                    "type": "integer"
                  },
                  "currency": {
                    "type": "string",
                    "enum": [
                      "USD",
                      "DOP",
                      "EUR"
                    ]
                  },
                  "prices": {
                    "type": "object",
                    "description": "Activation ITEM ID to monthly decimal string."
                  },
                  "line_discounts": {
                    "type": "object",
                    "description": "Activation ITEM ID to percent string."
                  }
                }
              }
            }
          }
        }
      }
    },
    "/requests/{request_id}/report-payment": {
      "post": {
        "summary": "report-payment request",
        "description": "Required scope(s): billing:write + activation:write",
        "operationId": "post__requests_request_id_report-payment",
        "parameters": [
          {
            "in": "path",
            "name": "request_id",
            "required": true,
            "schema": {
              "type": "integer",
              "minimum": 1
            }
          },
          {
            "in": "header",
            "name": "Idempotency-Key",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 128
            }
          }
        ],
        "responses": {
          "200": {
            "description": "JSON envelope success/data/request_id; PDF route returns application/pdf",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SuccessEnvelope"
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or missing idempotency key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired or revoked administrative key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Wrong host, source IP or scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Record or route not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Conflict, duplicate/processing request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "422": {
            "description": "Business rule validation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit: retry after 60 seconds",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Unexpected failure; reconcile before retrying",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "413": {
            "description": "Cuerpo mayor de64KiB",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "415": {
            "description": "Usar application/json",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "423": {
            "description": "Mantenimiento o traslado en curso",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "revision"
                ],
                "properties": {
                  "revision": {
                    "type": "integer"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/requests/{request_id}/approve": {
      "post": {
        "summary": "approve request",
        "description": "Required scope(s): billing:write + activation:write",
        "operationId": "post__requests_request_id_approve",
        "parameters": [
          {
            "in": "path",
            "name": "request_id",
            "required": true,
            "schema": {
              "type": "integer",
              "minimum": 1
            }
          },
          {
            "in": "header",
            "name": "Idempotency-Key",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 128
            }
          }
        ],
        "responses": {
          "200": {
            "description": "JSON envelope success/data/request_id; PDF route returns application/pdf",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SuccessEnvelope"
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or missing idempotency key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired or revoked administrative key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Wrong host, source IP or scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Record or route not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Conflict, duplicate/processing request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "422": {
            "description": "Business rule validation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit: retry after 60 seconds",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Unexpected failure; reconcile before retrying",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "413": {
            "description": "Cuerpo mayor de64KiB",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "415": {
            "description": "Usar application/json",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "423": {
            "description": "Mantenimiento o traslado en curso",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "revision",
                  "payment_confirmed",
                  "received_date",
                  "method",
                  "reference"
                ],
                "properties": {
                  "revision": {
                    "type": "integer"
                  },
                  "payment_confirmed": {
                    "type": "string",
                    "enum": [
                      "1"
                    ]
                  },
                  "received_date": {
                    "type": "string",
                    "format": "date"
                  },
                  "method": {
                    "type": "string",
                    "enum": [
                      "transfer",
                      "deposit",
                      "cash",
                      "free"
                    ]
                  },
                  "reference": {
                    "type": "string",
                    "maxLength": 190
                  }
                }
              }
            }
          }
        }
      }
    },
    "/requests/{request_id}/reject": {
      "post": {
        "summary": "reject request",
        "description": "Required scope(s): billing:write + activation:write",
        "operationId": "post__requests_request_id_reject",
        "parameters": [
          {
            "in": "path",
            "name": "request_id",
            "required": true,
            "schema": {
              "type": "integer",
              "minimum": 1
            }
          },
          {
            "in": "header",
            "name": "Idempotency-Key",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 128
            }
          }
        ],
        "responses": {
          "200": {
            "description": "JSON envelope success/data/request_id; PDF route returns application/pdf",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SuccessEnvelope"
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or missing idempotency key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired or revoked administrative key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Wrong host, source IP or scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Record or route not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Conflict, duplicate/processing request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "422": {
            "description": "Business rule validation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit: retry after 60 seconds",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Unexpected failure; reconcile before retrying",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "413": {
            "description": "Cuerpo mayor de64KiB",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "415": {
            "description": "Usar application/json",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "423": {
            "description": "Mantenimiento o traslado en curso",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "revision",
                  "admin_note"
                ],
                "properties": {
                  "revision": {
                    "type": "integer"
                  },
                  "admin_note": {
                    "type": "string",
                    "maxLength": 1000
                  }
                }
              }
            }
          }
        }
      }
    },
    "/requests/{request_id}/cancel": {
      "post": {
        "summary": "cancel request",
        "description": "Required scope(s): billing:write + activation:write",
        "operationId": "post__requests_request_id_cancel",
        "parameters": [
          {
            "in": "path",
            "name": "request_id",
            "required": true,
            "schema": {
              "type": "integer",
              "minimum": 1
            }
          },
          {
            "in": "header",
            "name": "Idempotency-Key",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 128
            }
          }
        ],
        "responses": {
          "200": {
            "description": "JSON envelope success/data/request_id; PDF route returns application/pdf",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SuccessEnvelope"
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or missing idempotency key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired or revoked administrative key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Wrong host, source IP or scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Record or route not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Conflict, duplicate/processing request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "422": {
            "description": "Business rule validation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit: retry after 60 seconds",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Unexpected failure; reconcile before retrying",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "413": {
            "description": "Cuerpo mayor de64KiB",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "415": {
            "description": "Usar application/json",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "423": {
            "description": "Mantenimiento o traslado en curso",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "revision",
                  "admin_note"
                ],
                "properties": {
                  "revision": {
                    "type": "integer"
                  },
                  "admin_note": {
                    "type": "string",
                    "maxLength": 1000
                  }
                }
              }
            }
          }
        }
      }
    },
    "/billing/issuer": {
      "get": {
        "summary": "Invoice seller and payment instructions",
        "description": "Required scope(s): billing:read",
        "operationId": "get__billing_issuer",
        "parameters": [],
        "responses": {
          "200": {
            "description": "JSON envelope success/data/request_id; PDF route returns application/pdf",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SuccessEnvelope"
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or missing idempotency key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired or revoked administrative key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Wrong host, source IP or scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Record or route not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Conflict, duplicate/processing request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "422": {
            "description": "Business rule validation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit: retry after 60 seconds",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Unexpected failure; reconcile before retrying",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "post": {
        "summary": "Invoice seller and payment instructions",
        "description": "Required scope(s): billing:write",
        "operationId": "post__billing_issuer",
        "parameters": [
          {
            "in": "header",
            "name": "Idempotency-Key",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 128
            }
          }
        ],
        "responses": {
          "200": {
            "description": "JSON envelope success/data/request_id; PDF route returns application/pdf",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SuccessEnvelope"
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or missing idempotency key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired or revoked administrative key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Wrong host, source IP or scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Record or route not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Conflict, duplicate/processing request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "422": {
            "description": "Business rule validation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit: retry after 60 seconds",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Unexpected failure; reconcile before retrying",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "413": {
            "description": "Cuerpo mayor de64KiB",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "415": {
            "description": "Usar application/json",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "423": {
            "description": "Mantenimiento o traslado en curso",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "issuer_name": {
                    "type": "string"
                  },
                  "issuer_tax_id": {
                    "type": "string"
                  },
                  "issuer_registration": {
                    "type": "string"
                  },
                  "issuer_address": {
                    "type": "string"
                  },
                  "issuer_country": {
                    "type": "string"
                  },
                  "issuer_email": {
                    "type": "string"
                  },
                  "issuer_phone": {
                    "type": "string"
                  },
                  "issuer_bank": {
                    "type": "string"
                  },
                  "issuer_account": {
                    "type": "string"
                  },
                  "issuer_instructions": {
                    "type": "string"
                  },
                  "issuer_due_days": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 90
                  }
                },
                "required": [
                  "issuer_name"
                ]
              }
            }
          }
        }
      }
    },
    "/invoices/{invoice_id}": {
      "get": {
        "summary": "Invoice metadata and decrypted snapshot",
        "description": "Required scope(s): billing:read",
        "operationId": "get__invoices_invoice_id",
        "parameters": [
          {
            "in": "path",
            "name": "invoice_id",
            "required": true,
            "schema": {
              "type": "integer",
              "minimum": 1
            }
          }
        ],
        "responses": {
          "200": {
            "description": "JSON envelope success/data/request_id; PDF route returns application/pdf",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SuccessEnvelope"
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or missing idempotency key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired or revoked administrative key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Wrong host, source IP or scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Record or route not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Conflict, duplicate/processing request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "422": {
            "description": "Business rule validation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit: retry after 60 seconds",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Unexpected failure; reconcile before retrying",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/invoices/{invoice_id}/pdf": {
      "get": {
        "summary": "Download invoice/proforma PDF",
        "description": "Required scope(s): billing:read",
        "operationId": "get__invoices_invoice_id_pdf",
        "parameters": [
          {
            "in": "path",
            "name": "invoice_id",
            "required": true,
            "schema": {
              "type": "integer",
              "minimum": 1
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Documento PDF; leer como binario",
            "content": {
              "application/pdf": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or missing idempotency key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Invalid, expired or revoked administrative key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Wrong host, source IP or scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Record or route not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Conflict, duplicate/processing request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "422": {
            "description": "Business rule validation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit: retry after 60 seconds",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Unexpected failure; reconcile before retrying",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/companies/{id}/retry-provisioning": {
      "post": {
        "summary": "Reintentar preparación fallida verificada",
        "operationId": "retryCompanyProvisioning",
        "description": "companies:write. Solo empresas failed con correo confirmado. Reutiliza recursos ya creados; nunca descarta la base de datos ni vuelve a iniciar una prueba existente.",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer",
              "minimum": 1
            }
          },
          {
            "in": "header",
            "name": "Idempotency-Key",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 128
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Preparación puesta en cola",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SuccessEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Estado no recuperable por esta operación",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Clave administrativa inválida, vencida o revocada",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "413": {
            "description": "Cuerpo mayor de64KiB",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "415": {
            "description": "Usar application/json",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "423": {
            "description": "Mantenimiento o traslado en curso",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/olt-transfers/sources": {
      "get": {
        "summary": "Inventario de OLT transferibles",
        "description": "transfers:read. Solo propietario. Conserva el vencimiento individual; no crea pagos ni duplica facturas. La revisión vence en 15 minutos. Configuración física de la OLT intacta. Una VPN compartida no se copia: el destino necesita su propia ruta validada. Los usuarios del origen no adquieren acceso al destino.",
        "operationId": "get_olt_transfers_sources",
        "parameters": [],
        "responses": {
          "200": {
            "description": "success/data. Procesamiento asíncrono: consultar hasta completed, blocked, failed o cancelled.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SuccessEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Token sin permiso administrativo suficiente",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Conflicto o transferencia ya iniciada",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "422": {
            "description": "Selección o confirmación no válida",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/olt-transfers": {
      "get": {
        "summary": "Historial de transferencias",
        "description": "transfers:read. Solo propietario. Conserva el vencimiento individual; no crea pagos ni duplica facturas. La revisión vence en 15 minutos. Configuración física de la OLT intacta. Una VPN compartida no se copia: el destino necesita su propia ruta validada. Los usuarios del origen no adquieren acceso al destino.",
        "operationId": "get_olt_transfers",
        "parameters": [],
        "responses": {
          "200": {
            "description": "success/data. Procesamiento asíncrono: consultar hasta completed, blocked, failed o cancelled.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SuccessEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Token sin permiso administrativo suficiente",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Conflicto o transferencia ya iniciada",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "422": {
            "description": "Selección o confirmación no válida",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "post": {
        "summary": "Solicitar revisión previa; todavía no mueve datos",
        "description": "transfers:write. Solo propietario. Conserva el vencimiento individual; no crea pagos ni duplica facturas. La revisión vence en 15 minutos. Configuración física de la OLT intacta. Una VPN compartida no se copia: el destino necesita su propia ruta validada. Los usuarios del origen no adquieren acceso al destino.",
        "operationId": "post_olt_transfers",
        "parameters": [
          {
            "in": "header",
            "name": "Idempotency-Key",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 128
            }
          }
        ],
        "responses": {
          "202": {
            "description": "success/data. Procesamiento asíncrono: consultar hasta completed, blocked, failed o cancelled.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SuccessEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Token sin permiso administrativo suficiente",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Conflicto o transferencia ya iniciada",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "422": {
            "description": "Selección o confirmación no válida",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Clave administrativa inválida, vencida o revocada",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "413": {
            "description": "Cuerpo mayor de64KiB",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "415": {
            "description": "Usar application/json",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "423": {
            "description": "Mantenimiento o traslado en curso",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "source_system": {
                    "type": "string",
                    "enum": [
                      "legacy",
                      "globalolt"
                    ]
                  },
                  "source_company": {
                    "type": "integer",
                    "minimum": 1
                  },
                  "source_olt": {
                    "type": "integer",
                    "minimum": 1
                  },
                  "destination_company": {
                    "type": "integer",
                    "minimum": 1
                  }
                },
                "required": [
                  "source_system",
                  "source_company",
                  "source_olt",
                  "destination_company"
                ],
                "additionalProperties": false
              }
            }
          }
        }
      }
    },
    "/olt-transfers/{id}": {
      "get": {
        "summary": "Consultar revisión, estado y resultado",
        "description": "transfers:read. Solo propietario. Conserva el vencimiento individual; no crea pagos ni duplica facturas. La revisión vence en 15 minutos. Configuración física de la OLT intacta. Una VPN compartida no se copia: el destino necesita su propia ruta validada. Los usuarios del origen no adquieren acceso al destino.",
        "operationId": "get_olt_transfers_id",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer",
              "minimum": 1
            }
          }
        ],
        "responses": {
          "200": {
            "description": "success/data. Procesamiento asíncrono: consultar hasta completed, blocked, failed o cancelled.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SuccessEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Token sin permiso administrativo suficiente",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Conflicto o transferencia ya iniciada",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "422": {
            "description": "Selección o confirmación no válida",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/olt-transfers/{id}/execute": {
      "post": {
        "summary": "Confirmar traslado con revisión vigente",
        "description": "transfers:write. Solo propietario. Conserva el vencimiento individual; no crea pagos ni duplica facturas. La revisión vence en 15 minutos. Configuración física de la OLT intacta. Una VPN compartida no se copia: el destino necesita su propia ruta validada. Los usuarios del origen no adquieren acceso al destino.",
        "operationId": "post_olt_transfers_id_execute",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer",
              "minimum": 1
            }
          },
          {
            "in": "header",
            "name": "Idempotency-Key",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 128
            }
          }
        ],
        "responses": {
          "202": {
            "description": "success/data. Procesamiento asíncrono: consultar hasta completed, blocked, failed o cancelled.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SuccessEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Token sin permiso administrativo suficiente",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Conflicto o transferencia ya iniciada",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "422": {
            "description": "Selección o confirmación no válida",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Clave administrativa inválida, vencida o revocada",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "413": {
            "description": "Cuerpo mayor de64KiB",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "415": {
            "description": "Usar application/json",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "423": {
            "description": "Mantenimiento o traslado en curso",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "plan_hash": {
                    "type": "string",
                    "pattern": "^[a-f0-9]{64}$"
                  },
                  "confirmed": {
                    "type": "boolean",
                    "enum": [
                      true
                    ]
                  }
                },
                "required": [
                  "plan_hash",
                  "confirmed"
                ],
                "additionalProperties": false
              }
            }
          }
        }
      }
    },
    "/olt-transfers/{id}/recheck": {
      "post": {
        "summary": "Volver a comprobar una revisión pendiente",
        "description": "transfers:write. Solo propietario. Conserva el vencimiento individual; no crea pagos ni duplica facturas. La revisión vence en 15 minutos. Configuración física de la OLT intacta. Una VPN compartida no se copia: el destino necesita su propia ruta validada. Los usuarios del origen no adquieren acceso al destino.",
        "operationId": "post_olt_transfers_id_recheck",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer",
              "minimum": 1
            }
          },
          {
            "in": "header",
            "name": "Idempotency-Key",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 128
            }
          }
        ],
        "responses": {
          "202": {
            "description": "success/data. Procesamiento asíncrono: consultar hasta completed, blocked, failed o cancelled.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SuccessEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Token sin permiso administrativo suficiente",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Conflicto o transferencia ya iniciada",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "422": {
            "description": "Selección o confirmación no válida",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Clave administrativa inválida, vencida o revocada",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "413": {
            "description": "Cuerpo mayor de64KiB",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "415": {
            "description": "Usar application/json",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "423": {
            "description": "Mantenimiento o traslado en curso",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {},
                "required": [],
                "additionalProperties": false
              }
            }
          }
        }
      }
    },
    "/olt-transfers/{id}/cancel": {
      "post": {
        "summary": "Cancelar antes del inicio de ejecución",
        "description": "transfers:write. Solo propietario. Conserva el vencimiento individual; no crea pagos ni duplica facturas. La revisión vence en 15 minutos. Configuración física de la OLT intacta. Una VPN compartida no se copia: el destino necesita su propia ruta validada. Los usuarios del origen no adquieren acceso al destino.",
        "operationId": "post_olt_transfers_id_cancel",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer",
              "minimum": 1
            }
          },
          {
            "in": "header",
            "name": "Idempotency-Key",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 128
            }
          }
        ],
        "responses": {
          "200": {
            "description": "success/data. Procesamiento asíncrono: consultar hasta completed, blocked, failed o cancelled.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SuccessEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Token sin permiso administrativo suficiente",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Conflicto o transferencia ya iniciada",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "422": {
            "description": "Selección o confirmación no válida",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Clave administrativa inválida, vencida o revocada",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "413": {
            "description": "Cuerpo mayor de64KiB",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "415": {
            "description": "Usar application/json",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "423": {
            "description": "Mantenimiento o traslado en curso",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {},
                "required": [],
                "additionalProperties": false
              }
            }
          }
        }
      }
    },
    "/backups": {
      "post": {
        "summary": "Crear copia completa de una empresa o todas",
        "description": "backups:write. Solo API administrativa del propietario; tokens de empresa no son validos. Recuperar el contenido requiere primero el archivo privado01 y despues02, que permanecen fuera del servidor.",
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "202": {
            "description": "success/data",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SuccessEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Permiso insuficiente",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "422": {
            "description": "Estado o datos no válidos",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "405": {
            "description": "Metodo no permitido",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Limite de solicitudes",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Clave administrativa inválida, vencida o revocada",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "413": {
            "description": "Cuerpo mayor de64KiB",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "415": {
            "description": "Usar application/json",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "423": {
            "description": "Mantenimiento o traslado en curso",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "company_id": {
                    "type": "integer",
                    "nullable": true
                  }
                },
                "additionalProperties": false
              }
            }
          },
          "required": true
        },
        "operationId": "post_backups"
      },
      "get": {
        "summary": "Listar copias completas",
        "description": "backups:read. Solo API administrativa del propietario; tokens de empresa no son validos. Recuperar el contenido requiere primero el archivo privado01 y despues02, que permanecen fuera del servidor.",
        "parameters": [],
        "responses": {
          "200": {
            "description": "success/data",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SuccessEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Permiso insuficiente",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "422": {
            "description": "Estado o datos no válidos",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "405": {
            "description": "Metodo no permitido",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Limite de solicitudes",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "operationId": "get_backups"
      }
    },
    "/backups/{id}": {
      "get": {
        "summary": "Consultar avance y archivos de una copia",
        "description": "backups:read. Solo API administrativa del propietario; tokens de empresa no son validos. Recuperar el contenido requiere primero el archivo privado01 y despues02, que permanecen fuera del servidor.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "minimum": 1
            }
          }
        ],
        "responses": {
          "200": {
            "description": "success/data",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SuccessEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Permiso insuficiente",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "422": {
            "description": "Estado o datos no válidos",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "405": {
            "description": "Metodo no permitido",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Limite de solicitudes",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "operationId": "get_backups_id"
      }
    },
    "/backups/{id}/download": {
      "get": {
        "summary": "Descargar ZIP con integridad SHA256 verificada",
        "description": "backups:read. Solo API administrativa del propietario; tokens de empresa no son validos. Recuperar el contenido requiere primero el archivo privado01 y despues02, que permanecen fuera del servidor. company_id debe corresponder a un archivo incluido en esa copia.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "minimum": 1
            }
          },
          {
            "name": "company_id",
            "in": "query",
            "description": "0=ZIP de todas, -1=registro central, ID positivo=empresa incluida en esta copia",
            "schema": {
              "type": "integer",
              "minimum": -1
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Archivo ZIP cifrado",
            "headers": {
              "X-Content-SHA256": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/zip": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "403": {
            "description": "Permiso insuficiente",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "422": {
            "description": "Estado o datos no válidos",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "405": {
            "description": "Metodo no permitido",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Limite de solicitudes",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "Archivo no incluido o no disponible",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "Copia incompleta o integridad no verificada",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "operationId": "get_backups_id_download"
      }
    },
    "/backups/{id}/cancel": {
      "post": {
        "summary": "Cancelar una copia antes de comenzar",
        "description": "backups:write. Solo API administrativa del propietario; tokens de empresa no son validos. Recuperar el contenido requiere primero el archivo privado01 y despues02, que permanecen fuera del servidor.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "minimum": 1
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "success/data",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SuccessEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Permiso insuficiente",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "422": {
            "description": "Estado o datos no válidos",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "405": {
            "description": "Metodo no permitido",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Limite de solicitudes",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Clave administrativa inválida, vencida o revocada",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "413": {
            "description": "Cuerpo mayor de64KiB",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "415": {
            "description": "Usar application/json",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "423": {
            "description": "Mantenimiento o traslado en curso",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {},
                "additionalProperties": false
              }
            }
          },
          "required": true
        },
        "operationId": "post_backups_id_cancel"
      }
    },
    "/activity": {
      "get": {
        "summary": "Actividad con empresa, usuario, fechas, tipo y prioridad",
        "description": "activity:read. Solo API administrativa del propietario; tokens de empresa no son validos. No expone contenido cifrado ni enlaces privados. Fechas de filtro en America/Santo_Domingo; timestamps JSON en UTC.",
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "company_id",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 0
            }
          },
          {
            "name": "from",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "until",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "type",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "severity",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "p",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "enum": [
                25,
                50,
                100
              ],
              "default": 25
            }
          },
          {
            "name": "actor",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1
            }
          }
        ],
        "responses": {
          "200": {
            "description": "success/data",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SuccessEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Permiso insuficiente",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "422": {
            "description": "Estado o datos no válidos",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "405": {
            "description": "Metodo no permitido",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Limite de solicitudes",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "operationId": "get_activity"
      }
    },
    "/mail": {
      "get": {
        "summary": "Historial SMTP filtrado y estadísticas",
        "description": "mail:read. Solo API administrativa del propietario; tokens de empresa no son validos. No expone contenido cifrado ni enlaces privados. Fechas de filtro en America/Santo_Domingo; timestamps JSON en UTC.",
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "company_id",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 0
            }
          },
          {
            "name": "from",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "until",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "type",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "status",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "p",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "enum": [
                25,
                50,
                100
              ],
              "default": 25
            }
          }
        ],
        "responses": {
          "200": {
            "description": "success/data",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SuccessEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Permiso insuficiente",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "422": {
            "description": "Estado o datos no válidos",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "405": {
            "description": "Metodo no permitido",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Limite de solicitudes",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "operationId": "get_mail"
      }
    },
    "/mail/{id}/retry": {
      "post": {
        "summary": "Reintentar exclusivamente fallos anteriores a SMTP DATA",
        "description": "mail:retry. Solo API administrativa del propietario; tokens de empresa no son validos. No expone contenido cifrado ni enlaces privados. Fechas de filtro en America/Santo_Domingo; timestamps JSON en UTC.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "minimum": 1
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "success/data",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SuccessEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Permiso insuficiente",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "422": {
            "description": "Estado o datos no válidos",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "405": {
            "description": "Metodo no permitido",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "Limite de solicitudes",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Clave administrativa inválida, vencida o revocada",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "413": {
            "description": "Cuerpo mayor de64KiB",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "415": {
            "description": "Usar application/json",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "423": {
            "description": "Mantenimiento o traslado en curso",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {},
                "additionalProperties": false
              }
            }
          },
          "required": true
        },
        "operationId": "post_mail_id_retry"
      }
    },
    "/companies/{id}/deletion": {
      "get": {
        "summary": "Consultar eliminación y operaciones de una empresa",
        "operationId": "Consultar_eliminación_y_operaciones_de_una_empresa",
        "description": "companies:read. Exclusivo del propietario. No elimina físicamente las bases de datos, facturas ni archivos; los conserva para recuperación. Revoca sesiones y claves API, detiene servicios y desactiva VPN. El subdominio permanece reservado. Restaurar conserva las fechas del plan/demo y requiere nuevas claves API. No envía comandos de eliminación a OLT/ONT. La creación requiere confirmación del subdominio exacto. En cuentas en preparación o con tareas activas, espere y revise antes de repetir.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "minimum": 1
            }
          }
        ],
        "responses": {
          "200": {
            "description": "success/data; consultar status hasta complete o failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SuccessEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Permiso insuficiente",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "422": {
            "description": "Confirmación/estado inválidos; revisar mensaje",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "post": {
        "summary": "Eliminar empresa de forma recuperable con respaldo previo",
        "operationId": "Eliminar_empresa_de_forma_recuperable_con_respaldo_previo",
        "description": "companies:delete. Exclusivo del propietario. No elimina físicamente las bases de datos, facturas ni archivos; los conserva para recuperación. Revoca sesiones y claves API, detiene servicios y desactiva VPN. El subdominio permanece reservado. Restaurar conserva las fechas del plan/demo y requiere nuevas claves API. No envía comandos de eliminación a OLT/ONT. La creación requiere confirmación del subdominio exacto. En cuentas en preparación o con tareas activas, espere y revise antes de repetir.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "minimum": 1
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 128
            }
          }
        ],
        "responses": {
          "202": {
            "description": "success/data; consultar status hasta complete o failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SuccessEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Permiso insuficiente",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "422": {
            "description": "Confirmación/estado inválidos; revisar mensaje",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Clave administrativa inválida, vencida o revocada",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "413": {
            "description": "Cuerpo mayor de64KiB",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "415": {
            "description": "Usar application/json",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "423": {
            "description": "Mantenimiento o traslado en curso",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "confirm_slug",
                  "confirmed"
                ],
                "properties": {
                  "confirm_slug": {
                    "type": "string",
                    "example": "miempresa"
                  },
                  "confirmed": {
                    "type": "boolean",
                    "enum": [
                      true
                    ]
                  }
                },
                "additionalProperties": false
              }
            }
          }
        }
      }
    },
    "/companies/{id}/restore": {
      "post": {
        "summary": "Restaurar empresa con su vigencia original",
        "operationId": "Restaurar_empresa_con_su_vigencia_original",
        "description": "companies:delete. Exclusivo del propietario. No elimina físicamente las bases de datos, facturas ni archivos; los conserva para recuperación. Revoca sesiones y claves API, detiene servicios y desactiva VPN. El subdominio permanece reservado. Restaurar conserva las fechas del plan/demo y requiere nuevas claves API. No envía comandos de eliminación a OLT/ONT. La creación requiere confirmación del subdominio exacto. En cuentas en preparación o con tareas activas, espere y revise antes de repetir.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "minimum": 1
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 128
            }
          }
        ],
        "responses": {
          "202": {
            "description": "success/data; consultar status hasta complete o failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SuccessEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Permiso insuficiente",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "422": {
            "description": "Confirmación/estado inválidos; revisar mensaje",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Clave administrativa inválida, vencida o revocada",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "413": {
            "description": "Cuerpo mayor de64KiB",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "415": {
            "description": "Usar application/json",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "423": {
            "description": "Mantenimiento o traslado en curso",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "confirm_slug",
                  "confirmed"
                ],
                "properties": {
                  "confirm_slug": {
                    "type": "string",
                    "example": "miempresa"
                  },
                  "confirmed": {
                    "type": "boolean",
                    "enum": [
                      true
                    ]
                  }
                },
                "additionalProperties": false
              }
            }
          }
        }
      }
    },
    "/company-deletions/{id}": {
      "get": {
        "summary": "Consultar avance de eliminación o restauración",
        "operationId": "Consultar_avance_de_eliminación_o_restauración",
        "description": "companies:read. Exclusivo del propietario. No elimina físicamente las bases de datos, facturas ni archivos; los conserva para recuperación. Revoca sesiones y claves API, detiene servicios y desactiva VPN. El subdominio permanece reservado. Restaurar conserva las fechas del plan/demo y requiere nuevas claves API. No envía comandos de eliminación a OLT/ONT. La creación requiere confirmación del subdominio exacto. En cuentas en preparación o con tareas activas, espere y revise antes de repetir.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "minimum": 1
            }
          }
        ],
        "responses": {
          "200": {
            "description": "success/data; consultar status hasta complete o failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SuccessEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "Permiso insuficiente",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "422": {
            "description": "Confirmación/estado inválidos; revisar mensaje",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    }
  },
  "x-globalolt-changes-v2": [
    "Host administrativo exclusivo",
    "Creación asíncrona con correo verificado",
    "SQL y Mongo independientes por empresa",
    "ID globales de solicitudes/facturas/pagos; local_id permanece disponible",
    "72 horas exactas de prueba",
    "Datos de empresa y cobros se administran después de ready",
    "No se crean claves ni propietarios desde registro público"
  ],
  "x-globalolt-rate-limits": {
    "requests_per_minute": 60,
    "max_request_bytes": 65536,
    "post_idempotency_required": true
  }
}