{
  "openapi": "3.1.0",
  "info": {
    "title": "RecargaDoble B2B API",
    "version": "1",
    "description": "API de integracion para revendedores: lo que consume el sistema de un cliente.\n\nEnvelope: `{ ok: true, data }` o `{ ok: false, error: { code, details? } }`.\n\nToda respuesta lleva `x-request-id`.\n\nToda ruta exige `Authorization: Bearer <token>`, con el token de las credenciales de integracion de tu cuenta. Sin token, o con uno caducado, la respuesta es 401.\n\nModo de pruebas: con una credencial de pruebas (`rdc_test_...`) todo ocurre en pruebas. Los pedidos llevan `livemode: false`, no se cobran ni llegan al operador, y su resultado se simula por las cuatro ultimas cifras del numero: `0001` falla, `0002` queda en entrega unos minutos y se entrega, `0003` queda en entrega y falla, y cualquier otro se entrega. Los avisos se firman igual y llevan `livemode: false`. Una credencial de pruebas solo ve pedidos y avisos de prueba, y una real solo los reales."
  },
  "servers": [
    {
      "url": "https://b2b.recargadoble.com"
    }
  ],
  "components": {
    "securitySchemes": {
      "bearer": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "JWT"
      }
    },
    "schemas": {
      "CatalogCarrier": {
        "$id": "#/components/schemas/CatalogCarrier",
        "type": "object",
        "properties": {
          "name": {
            "examples": [
              "Digicel"
            ],
            "type": "string"
          },
          "countryCode": {
            "examples": [
              "JM"
            ],
            "description": "ISO 3166-1 alfa-2",
            "type": "string",
            "pattern": "^[A-Z]{2}$"
          },
          "logoUrl": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "productTypes": {
            "type": "array",
            "items": {
              "description": "TOPUP: saldo. BUNDLE: paquete de minutos, mensajes o datos. DATA: solo datos",
              "type": "string",
              "enum": [
                "TOPUP",
                "BUNDLE",
                "DATA"
              ]
            }
          }
        },
        "required": [
          "id",
          "name",
          "countryCode",
          "logoUrl",
          "productTypes"
        ],
        "additionalProperties": false
      },
      "CatalogCountry": {
        "$id": "#/components/schemas/CatalogCountry",
        "type": "object",
        "properties": {
          "code": {
            "examples": [
              "JM"
            ],
            "description": "ISO 3166-1 alfa-2",
            "type": "string",
            "pattern": "^[A-Z]{2}$"
          },
          "name": {
            "examples": [
              "Jamaica"
            ],
            "description": "En el idioma pedido",
            "type": "string"
          },
          "callingCode": {
            "examples": [
              "+1876"
            ],
            "type": "string"
          },
          "carrierCount": {
            "examples": [
              2
            ],
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "productTypes": {
            "type": "array",
            "items": {
              "description": "TOPUP: saldo. BUNDLE: paquete de minutos, mensajes o datos. DATA: solo datos",
              "type": "string",
              "enum": [
                "TOPUP",
                "BUNDLE",
                "DATA"
              ]
            }
          }
        },
        "required": [
          "code",
          "name",
          "callingCode",
          "carrierCount",
          "productTypes"
        ],
        "additionalProperties": false
      },
      "CatalogProduct": {
        "$id": "#/components/schemas/CatalogProduct",
        "type": "object",
        "properties": {
          "sku": {
            "examples": [
              "JM-DIGICEL-TOPUP-500-K7Q2M9XA"
            ],
            "description": "Lo que se manda al comprar. Identifica el producto; la denominacion no",
            "type": "string"
          },
          "carrierId": {
            "examples": [
              "jm-digicel"
            ],
            "type": "string"
          },
          "countryCode": {
            "examples": [
              "JM"
            ],
            "description": "ISO 3166-1 alfa-2",
            "type": "string",
            "pattern": "^[A-Z]{2}$"
          },
          "type": {
            "description": "TOPUP: saldo. BUNDLE: paquete de minutos, mensajes o datos. DATA: solo datos",
            "type": "string",
            "enum": [
              "TOPUP",
              "BUNDLE",
              "DATA"
            ]
          },
          "name": {
            "examples": [
              "Recarga 500 JMD"
            ],
            "description": "Nombre para mostrar al cliente final",
            "type": "string"
          },
          "description": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "delivers": {
            "description": "Lo que recibe el numero, en la moneda local del operador",
            "$ref": "#/components/schemas/Money"
          },
          "price": {
            "description": "Lo que se le cobra a la cuenta por este producto, hoy",
            "$ref": "#/components/schemas/Money"
          },
          "promotion": {
            "description": "La promocion vigente que aplica el operador, si hay una",
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "name": {
                    "examples": [
                      "Doble saldo"
                    ],
                    "type": "string"
                  },
                  "endsAt": {
                    "anyOf": [
                      {
                        "description": "ISO 8601 en UTC",
                        "type": "string",
                        "format": "date-time",
                        "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "name",
                  "endsAt"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "sku",
          "carrierId",
          "countryCode",
          "type",
          "name",
          "description",
          "delivers",
          "price",
          "promotion"
        ],
        "additionalProperties": false
      },
      "ErrorEnvelope": {
        "$id": "#/components/schemas/ErrorEnvelope",
        "type": "object",
        "properties": {
          "ok": {
            "type": "boolean",
            "const": false
          },
          "error": {
            "type": "object",
            "properties": {
              "code": {
                "description": "Catalogo cerrado en `errors.ts`",
                "type": "string"
              },
              "details": {
                "type": "object",
                "propertyNames": {
                  "type": "string"
                },
                "additionalProperties": {}
              }
            },
            "required": [
              "code"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "ok",
          "error"
        ],
        "additionalProperties": false
      },
      "InvoiceSummary": {
        "$id": "#/components/schemas/InvoiceSummary",
        "type": "object",
        "properties": {
          "number": {
            "examples": [
              "INV-ACME-12"
            ],
            "description": "Numero de la factura (pospago) o del extracto (prepago)",
            "type": "string"
          },
          "kind": {
            "description": "INVOICE en pospago; STATEMENT, un extracto informativo, en prepago",
            "type": "string",
            "enum": [
              "INVOICE",
              "STATEMENT"
            ]
          },
          "status": {
            "description": "ISSUED: emitida y pendiente. OVERDUE: vencida sin pagar. PAID: pagada. VOID: anulada",
            "type": "string",
            "enum": [
              "ISSUED",
              "PAID",
              "OVERDUE",
              "VOID"
            ]
          },
          "periodStart": {
            "description": "Inicio del periodo, incluido",
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
          },
          "periodEnd": {
            "description": "Fin del periodo, excluido",
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
          },
          "issuedAt": {
            "description": "ISO 8601 en UTC",
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
          },
          "dueAt": {
            "description": "Vencimiento; un extracto no vence",
            "anyOf": [
              {
                "description": "ISO 8601 en UTC",
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
              },
              {
                "type": "null"
              }
            ]
          },
          "total": {
            "description": "Lo facturado en el periodo",
            "$ref": "#/components/schemas/Money"
          },
          "paidAt": {
            "anyOf": [
              {
                "description": "ISO 8601 en UTC",
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "number",
          "kind",
          "status",
          "periodStart",
          "periodEnd",
          "issuedAt",
          "dueAt",
          "total",
          "paidAt"
        ],
        "additionalProperties": false
      },
      "LedgerEntry": {
        "$id": "#/components/schemas/LedgerEntry",
        "type": "object",
        "properties": {
          "kind": {
            "description": "ORDER_DEBIT: cobro de una recarga. ORDER_REVERSAL: devolucion de una que no se entrego",
            "type": "string",
            "enum": [
              "DEPOSIT",
              "ORDER_DEBIT",
              "ORDER_REVERSAL",
              "INVOICE_PAYMENT",
              "ADJUSTMENT"
            ]
          },
          "amount": {
            "description": "Positivo si suma al saldo, negativo si resta",
            "$ref": "#/components/schemas/Money"
          },
          "balanceAfter": {
            "$ref": "#/components/schemas/Money"
          },
          "orderReference": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "invoiceNumber": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "description": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "createdAt": {
            "description": "ISO 8601 en UTC",
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
          }
        },
        "required": [
          "id",
          "kind",
          "amount",
          "balanceAfter",
          "orderReference",
          "invoiceNumber",
          "description",
          "createdAt"
        ],
        "additionalProperties": false
      },
      "Money": {
        "$id": "#/components/schemas/Money",
        "type": "object",
        "properties": {
          "amount": {
            "examples": [
              1050
            ],
            "description": "Unidad minima de la moneda: 1050 son 10,50 USD",
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "currency": {
            "examples": [
              "USD"
            ],
            "description": "ISO 4217",
            "type": "string",
            "pattern": "^[A-Z]{3}$"
          }
        },
        "required": [
          "amount",
          "currency"
        ],
        "additionalProperties": false
      },
      "OrderEvent": {
        "$id": "#/components/schemas/OrderEvent",
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "order.created",
              "order.item.sending",
              "order.item.completed",
              "order.item.failed",
              "order.item.voided",
              "order.completed"
            ]
          },
          "itemIndex": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              {
                "type": "null"
              }
            ]
          },
          "status": {
            "type": "string"
          },
          "at": {
            "description": "ISO 8601 en UTC",
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
          }
        },
        "required": [
          "type",
          "itemIndex",
          "status",
          "at"
        ],
        "additionalProperties": false
      },
      "OrderItem": {
        "$id": "#/components/schemas/OrderItem",
        "type": "object",
        "properties": {
          "index": {
            "examples": [
              0
            ],
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "sku": {
            "examples": [
              "JM-DIGICEL-TOPUP-500-K7Q2M9XA"
            ],
            "type": "string"
          },
          "name": {
            "examples": [
              "Recarga 500 JMD"
            ],
            "type": "string"
          },
          "type": {
            "description": "TOPUP: saldo. BUNDLE: paquete de minutos, mensajes o datos. DATA: solo datos",
            "type": "string",
            "enum": [
              "TOPUP",
              "BUNDLE",
              "DATA"
            ]
          },
          "phoneNumber": {
            "examples": [
              "+18765550123"
            ],
            "description": "E.164, con el prefijo del pais",
            "type": "string",
            "pattern": "^\\+[1-9]\\d{6,14}$"
          },
          "countryCode": {
            "examples": [
              "JM"
            ],
            "description": "ISO 3166-1 alfa-2",
            "type": "string",
            "pattern": "^[A-Z]{2}$"
          },
          "carrierName": {
            "examples": [
              "Digicel"
            ],
            "type": "string"
          },
          "delivers": {
            "$ref": "#/components/schemas/Money"
          },
          "price": {
            "$ref": "#/components/schemas/Money"
          },
          "status": {
            "description": "Finales: COMPLETED, FAILED y VOIDED. FAILED y VOIDED devuelven su precio al saldo",
            "type": "string",
            "enum": [
              "PENDING",
              "SENDING",
              "COMPLETED",
              "FAILED",
              "VOIDED"
            ]
          },
          "failureCode": {
            "description": "Por que no se entrego; null mientras no falle",
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "INVALID_NUMBER",
                  "CARRIER_REJECTED",
                  "NUMBER_NOT_ELIGIBLE",
                  "CARRIER_UNAVAILABLE",
                  "VOIDED"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "carrierReference": {
            "description": "La referencia de la recarga en el operador, cuando la da",
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "completedAt": {
            "anyOf": [
              {
                "description": "ISO 8601 en UTC",
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "index",
          "sku",
          "name",
          "type",
          "phoneNumber",
          "countryCode",
          "carrierName",
          "delivers",
          "price",
          "status",
          "failureCode",
          "carrierReference",
          "completedAt"
        ],
        "additionalProperties": false
      },
      "OrderItemInput": {
        "$id": "#/components/schemas/OrderItemInput",
        "type": "object",
        "properties": {
          "sku": {
            "examples": [
              "JM-DIGICEL-TOPUP-500-K7Q2M9XA"
            ],
            "type": "string"
          },
          "phoneNumber": {
            "examples": [
              "+18765550123"
            ],
            "description": "E.164, con el prefijo del pais",
            "type": "string",
            "pattern": "^\\+[1-9]\\d{6,14}$"
          },
          "expectedPrice": {
            "description": "Si se indica y el precio de hoy es otro, el pedido se rechaza con PRICE_CHANGED en vez de cobrar otra cifra",
            "$ref": "#/components/schemas/Money"
          }
        },
        "required": [
          "sku",
          "phoneNumber"
        ],
        "additionalProperties": false
      },
      "OrderSummary": {
        "$id": "#/components/schemas/OrderSummary",
        "type": "object",
        "properties": {
          "reference": {
            "examples": [
              "B2B-7KQ2M9XH4P"
            ],
            "description": "Identifica el pedido en la API, los avisos y soporte",
            "type": "string"
          },
          "externalReference": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "livemode": {
            "examples": [
              true
            ],
            "description": "false: pedido de prueba, hecho con una credencial de pruebas. No cobra ni llega al operador; su resultado se simula",
            "type": "boolean"
          },
          "status": {
            "description": "PARTIAL: unas recargas se entregaron y otras no; lo no entregado se devuelve al saldo",
            "type": "string",
            "enum": [
              "PENDING",
              "DELIVERING",
              "DELIVERED",
              "PARTIAL",
              "FAILED"
            ]
          },
          "total": {
            "$ref": "#/components/schemas/Money"
          },
          "refunded": {
            "description": "Lo devuelto al saldo por recargas no entregadas",
            "$ref": "#/components/schemas/Money"
          },
          "createdAt": {
            "description": "ISO 8601 en UTC",
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
          },
          "completedAt": {
            "anyOf": [
              {
                "description": "ISO 8601 en UTC",
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
              },
              {
                "type": "null"
              }
            ]
          },
          "itemCount": {
            "examples": [
              1
            ],
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          }
        },
        "required": [
          "reference",
          "externalReference",
          "livemode",
          "status",
          "total",
          "refunded",
          "createdAt",
          "completedAt",
          "itemCount"
        ],
        "additionalProperties": false
      },
      "WebhookDelivery": {
        "$id": "#/components/schemas/WebhookDelivery",
        "type": "object",
        "properties": {
          "eventType": {
            "type": "string",
            "enum": [
              "order.item.completed",
              "order.item.failed",
              "order.completed",
              "balance.low",
              "invoice.issued",
              "invoice.overdue",
              "invoice.paid",
              "invoice.voided"
            ]
          },
          "eventId": {
            "examples": [
              "evt_01J9ZK7QXN"
            ],
            "description": "Igual en cada reintento: sirve para no procesar dos veces el mismo aviso",
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "PENDING",
              "DELIVERED",
              "FAILED",
              "GIVEN_UP"
            ]
          },
          "attempts": {
            "examples": [
              1
            ],
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "lastStatusCode": {
            "anyOf": [
              {
                "examples": [
                  200
                ],
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              {
                "type": "null"
              }
            ]
          },
          "nextAttemptAt": {
            "anyOf": [
              {
                "description": "ISO 8601 en UTC",
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
              },
              {
                "type": "null"
              }
            ]
          },
          "createdAt": {
            "description": "ISO 8601 en UTC",
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
          },
          "deliveredAt": {
            "anyOf": [
              {
                "description": "ISO 8601 en UTC",
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "id",
          "eventType",
          "eventId",
          "status",
          "attempts",
          "lastStatusCode",
          "nextAttemptAt",
          "createdAt",
          "deliveredAt"
        ],
        "additionalProperties": false
      }
    }
  },
  "paths": {
    "/v1/merchant": {
      "get": {
        "summary": "Tu cuenta: datos, estado, modo de facturacion y limites",
        "tags": [
          "account"
        ],
        "operationId": "GET_v1_merchant",
        "security": [
          {
            "bearer": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "const": true
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "examples": [
                            "ACME"
                          ],
                          "description": "Identificador de la cuenta; aparece en referencias y facturas",
                          "type": "string"
                        },
                        "tradeName": {
                          "examples": [
                            "Acme Recargas"
                          ],
                          "type": "string"
                        },
                        "legalName": {
                          "examples": [
                            "Acme Recargas LLC"
                          ],
                          "type": "string"
                        },
                        "countryCode": {
                          "examples": [
                            "JM"
                          ],
                          "description": "ISO 3166-1 alfa-2",
                          "type": "string",
                          "pattern": "^[A-Z]{2}$"
                        },
                        "currency": {
                          "examples": [
                            "USD"
                          ],
                          "description": "ISO 4217",
                          "type": "string",
                          "pattern": "^[A-Z]{3}$"
                        },
                        "status": {
                          "description": "Una cuenta bloqueada consulta, pero no compra",
                          "type": "string",
                          "enum": [
                            "ACTIVE",
                            "BLOCKED"
                          ]
                        },
                        "billingMode": {
                          "description": "PREPAID: se compra con saldo depositado. POSTPAID: se compra con credito y se factura por periodo",
                          "type": "string",
                          "enum": [
                            "PREPAID",
                            "POSTPAID"
                          ]
                        },
                        "billingEmail": {
                          "examples": [
                            "facturas@acme.example"
                          ],
                          "type": "string"
                        },
                        "limits": {
                          "type": "object",
                          "properties": {
                            "dailyAmount": {
                              "description": "null: sin limite diario de importe",
                              "anyOf": [
                                {
                                  "$ref": "#/components/schemas/Money"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "dailyOrders": {
                              "description": "null: sin limite diario de pedidos",
                              "anyOf": [
                                {
                                  "examples": [
                                    500
                                  ],
                                  "type": "integer",
                                  "minimum": -9007199254740991,
                                  "maximum": 9007199254740991
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            }
                          },
                          "required": [
                            "dailyAmount",
                            "dailyOrders"
                          ],
                          "additionalProperties": false
                        },
                        "createdAt": {
                          "description": "ISO 8601 en UTC",
                          "type": "string",
                          "format": "date-time",
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                        }
                      },
                      "required": [
                        "code",
                        "tradeName",
                        "legalName",
                        "countryCode",
                        "currency",
                        "status",
                        "billingMode",
                        "billingEmail",
                        "limits",
                        "createdAt"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "ok",
                    "data"
                  ]
                }
              }
            }
          },
          "default": {
            "description": "Error. Codigos: VALIDATION_FAILED, RATE_LIMITED, UNAUTHORIZED, FORBIDDEN, INTERNAL_ERROR",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/v1/merchant/balance": {
      "get": {
        "summary": "Saldo, credito y lo disponible para comprar",
        "tags": [
          "account"
        ],
        "operationId": "GET_v1_merchant_balance",
        "security": [
          {
            "bearer": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "const": true
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "currency": {
                          "examples": [
                            "USD"
                          ],
                          "description": "ISO 4217",
                          "type": "string",
                          "pattern": "^[A-Z]{3}$"
                        },
                        "balance": {
                          "examples": [
                            250000
                          ],
                          "description": "Saldo en unidad minima; negativo si se usa credito",
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "creditLimit": {
                          "examples": [
                            0
                          ],
                          "description": "Credito concedido en unidad minima; 0 en prepago",
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "available": {
                          "examples": [
                            250000
                          ],
                          "description": "balance + creditLimit: el maximo que admite el siguiente pedido",
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "lowBalanceThreshold": {
                          "description": "Bajo esta cifra se emite el aviso balance.low",
                          "anyOf": [
                            {
                              "examples": [
                                20000
                              ],
                              "type": "integer",
                              "minimum": -9007199254740991,
                              "maximum": 9007199254740991
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "updatedAt": {
                          "description": "ISO 8601 en UTC",
                          "type": "string",
                          "format": "date-time",
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                        }
                      },
                      "required": [
                        "currency",
                        "balance",
                        "creditLimit",
                        "available",
                        "lowBalanceThreshold",
                        "updatedAt"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "ok",
                    "data"
                  ]
                }
              }
            }
          },
          "default": {
            "description": "Error. Codigos: VALIDATION_FAILED, RATE_LIMITED, UNAUTHORIZED, FORBIDDEN, INTERNAL_ERROR",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/v1/catalog/countries": {
      "get": {
        "summary": "Paises habilitados para tu cuenta",
        "tags": [
          "catalog"
        ],
        "operationId": "GET_v1_catalog_countries",
        "security": [
          {
            "bearer": []
          }
        ],
        "parameters": [
          {
            "name": "locale",
            "in": "query",
            "required": false,
            "description": "Idioma de nombres y descripciones; es si no se indica",
            "schema": {
              "type": "string",
              "enum": [
                "es",
                "en",
                "fr"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "const": true
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "items": {
                          "type": "array",
                          "items": {
                            "$ref": "#/components/schemas/CatalogCountry"
                          }
                        }
                      },
                      "required": [
                        "items"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "ok",
                    "data"
                  ]
                }
              }
            }
          },
          "default": {
            "description": "Error. Codigos: VALIDATION_FAILED, RATE_LIMITED, UNAUTHORIZED, FORBIDDEN, INTERNAL_ERROR",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/v1/catalog/countries/{country}/carriers": {
      "get": {
        "summary": "Operadores habilitados de un pais",
        "tags": [
          "catalog"
        ],
        "operationId": "GET_v1_catalog_countries_country_carriers",
        "security": [
          {
            "bearer": []
          }
        ],
        "parameters": [
          {
            "name": "country",
            "in": "path",
            "required": true,
            "description": "ISO 3166-1 alfa-2",
            "schema": {
              "examples": [
                "JM"
              ],
              "type": "string",
              "pattern": "^[A-Z]{2}$"
            }
          },
          {
            "name": "locale",
            "in": "query",
            "required": false,
            "description": "Idioma de nombres y descripciones; es si no se indica",
            "schema": {
              "type": "string",
              "enum": [
                "es",
                "en",
                "fr"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "const": true
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "items": {
                          "type": "array",
                          "items": {
                            "$ref": "#/components/schemas/CatalogCarrier"
                          }
                        }
                      },
                      "required": [
                        "items"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "ok",
                    "data"
                  ]
                }
              }
            }
          },
          "default": {
            "description": "Error. Codigos: NOT_FOUND, VALIDATION_FAILED, RATE_LIMITED, UNAUTHORIZED, FORBIDDEN, INTERNAL_ERROR",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/v1/catalog/carriers/{carrier}/products": {
      "get": {
        "summary": "Productos de un operador, con tu precio",
        "tags": [
          "catalog"
        ],
        "operationId": "GET_v1_catalog_carriers_carrier_products",
        "security": [
          {
            "bearer": []
          }
        ],
        "parameters": [
          {
            "name": "carrier",
            "in": "path",
            "required": true,
            "schema": {
              "examples": [
                "jm-digicel"
              ],
              "type": "string"
            }
          },
          {
            "name": "locale",
            "in": "query",
            "required": false,
            "description": "Idioma de nombres y descripciones; es si no se indica",
            "schema": {
              "type": "string",
              "enum": [
                "es",
                "en",
                "fr"
              ]
            }
          },
          {
            "name": "type",
            "in": "query",
            "required": false,
            "description": "Solo productos de este tipo",
            "schema": {
              "type": "string",
              "enum": [
                "TOPUP",
                "BUNDLE",
                "DATA"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "const": true
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "items": {
                          "type": "array",
                          "items": {
                            "$ref": "#/components/schemas/CatalogProduct"
                          }
                        }
                      },
                      "required": [
                        "items"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "ok",
                    "data"
                  ]
                }
              }
            }
          },
          "default": {
            "description": "Error. Codigos: NOT_FOUND, VALIDATION_FAILED, RATE_LIMITED, UNAUTHORIZED, FORBIDDEN, INTERNAL_ERROR",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/v1/catalog/products/{sku}": {
      "get": {
        "summary": "Un producto por su sku, con tu precio de hoy",
        "tags": [
          "catalog"
        ],
        "operationId": "GET_v1_catalog_products_sku",
        "security": [
          {
            "bearer": []
          }
        ],
        "parameters": [
          {
            "name": "sku",
            "in": "path",
            "required": true,
            "schema": {
              "examples": [
                "JM-DIGICEL-TOPUP-500-K7Q2M9XA"
              ],
              "type": "string"
            }
          },
          {
            "name": "locale",
            "in": "query",
            "required": false,
            "description": "Idioma de nombres y descripciones; es si no se indica",
            "schema": {
              "type": "string",
              "enum": [
                "es",
                "en",
                "fr"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "const": true
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "sku": {
                          "examples": [
                            "JM-DIGICEL-TOPUP-500-K7Q2M9XA"
                          ],
                          "description": "Lo que se manda al comprar. Identifica el producto; la denominacion no",
                          "type": "string"
                        },
                        "carrierId": {
                          "examples": [
                            "jm-digicel"
                          ],
                          "type": "string"
                        },
                        "countryCode": {
                          "examples": [
                            "JM"
                          ],
                          "description": "ISO 3166-1 alfa-2",
                          "type": "string",
                          "pattern": "^[A-Z]{2}$"
                        },
                        "type": {
                          "description": "TOPUP: saldo. BUNDLE: paquete de minutos, mensajes o datos. DATA: solo datos",
                          "type": "string",
                          "enum": [
                            "TOPUP",
                            "BUNDLE",
                            "DATA"
                          ]
                        },
                        "name": {
                          "examples": [
                            "Recarga 500 JMD"
                          ],
                          "description": "Nombre para mostrar al cliente final",
                          "type": "string"
                        },
                        "description": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "delivers": {
                          "description": "Lo que recibe el numero, en la moneda local del operador",
                          "$ref": "#/components/schemas/Money"
                        },
                        "price": {
                          "description": "Lo que se le cobra a la cuenta por este producto, hoy",
                          "$ref": "#/components/schemas/Money"
                        },
                        "promotion": {
                          "description": "La promocion vigente que aplica el operador, si hay una",
                          "anyOf": [
                            {
                              "type": "object",
                              "properties": {
                                "name": {
                                  "examples": [
                                    "Doble saldo"
                                  ],
                                  "type": "string"
                                },
                                "endsAt": {
                                  "anyOf": [
                                    {
                                      "description": "ISO 8601 en UTC",
                                      "type": "string",
                                      "format": "date-time",
                                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                }
                              },
                              "required": [
                                "name",
                                "endsAt"
                              ],
                              "additionalProperties": false
                            },
                            {
                              "type": "null"
                            }
                          ]
                        }
                      },
                      "required": [
                        "sku",
                        "carrierId",
                        "countryCode",
                        "type",
                        "name",
                        "description",
                        "delivers",
                        "price",
                        "promotion"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "ok",
                    "data"
                  ]
                }
              }
            }
          },
          "default": {
            "description": "Error. Codigos: NOT_FOUND, VALIDATION_FAILED, RATE_LIMITED, UNAUTHORIZED, FORBIDDEN, INTERNAL_ERROR",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/v1/destination/detect": {
      "post": {
        "summary": "Pais y operador de un numero",
        "tags": [
          "catalog"
        ],
        "operationId": "POST_v1_destination_detect",
        "security": [
          {
            "bearer": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "phoneNumber": {
                    "examples": [
                      "+18765550123"
                    ],
                    "description": "E.164, con el prefijo del pais",
                    "type": "string",
                    "pattern": "^\\+[1-9]\\d{6,14}$"
                  }
                },
                "required": [
                  "phoneNumber"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "const": true
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "phoneNumber": {
                          "examples": [
                            "+18765550123"
                          ],
                          "description": "El numero normalizado",
                          "type": "string",
                          "pattern": "^\\+[1-9]\\d{6,14}$"
                        },
                        "countryCode": {
                          "examples": [
                            "JM"
                          ],
                          "description": "ISO 3166-1 alfa-2",
                          "type": "string",
                          "pattern": "^[A-Z]{2}$"
                        },
                        "carrier": {
                          "description": "null si no se pudo detectar o no esta habilitado para la cuenta",
                          "anyOf": [
                            {
                              "$ref": "#/components/schemas/CatalogCarrier"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        }
                      },
                      "required": [
                        "phoneNumber",
                        "countryCode",
                        "carrier"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "ok",
                    "data"
                  ]
                }
              }
            }
          },
          "default": {
            "description": "Error. Codigos: DESTINATION_INVALID, VALIDATION_FAILED, RATE_LIMITED, UNAUTHORIZED, FORBIDDEN, INTERNAL_ERROR",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/v1/orders": {
      "post": {
        "summary": "Compra una o varias recargas",
        "tags": [
          "orders"
        ],
        "operationId": "POST_v1_orders",
        "security": [
          {
            "bearer": []
          }
        ],
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "Unica por compra en tu cuenta. Repetir la peticion con la misma clave devuelve el mismo pedido sin cobrar otro; con otro cuerpo, IDEMPOTENCY_CONFLICT. Una compra rechazada no consume la clave",
            "schema": {
              "type": "string",
              "maxLength": 100
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "items": {
                    "minItems": 1,
                    "maxItems": 50,
                    "type": "array",
                    "items": {
                      "$ref": "#/components/schemas/OrderItemInput"
                    }
                  },
                  "externalReference": {
                    "description": "Tu referencia; se devuelve en el pedido y en los avisos",
                    "examples": [
                      "venta-000123"
                    ],
                    "type": "string",
                    "maxLength": 100
                  }
                },
                "required": [
                  "items"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "const": true
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "reference": {
                          "examples": [
                            "B2B-7KQ2M9XH4P"
                          ],
                          "description": "Identifica el pedido en la API, los avisos y soporte",
                          "type": "string"
                        },
                        "externalReference": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "livemode": {
                          "examples": [
                            true
                          ],
                          "description": "false: pedido de prueba, hecho con una credencial de pruebas. No cobra ni llega al operador; su resultado se simula",
                          "type": "boolean"
                        },
                        "status": {
                          "description": "PARTIAL: unas recargas se entregaron y otras no; lo no entregado se devuelve al saldo",
                          "type": "string",
                          "enum": [
                            "PENDING",
                            "DELIVERING",
                            "DELIVERED",
                            "PARTIAL",
                            "FAILED"
                          ]
                        },
                        "total": {
                          "$ref": "#/components/schemas/Money"
                        },
                        "refunded": {
                          "description": "Lo devuelto al saldo por recargas no entregadas",
                          "$ref": "#/components/schemas/Money"
                        },
                        "items": {
                          "type": "array",
                          "items": {
                            "$ref": "#/components/schemas/OrderItem"
                          }
                        },
                        "createdAt": {
                          "description": "ISO 8601 en UTC",
                          "type": "string",
                          "format": "date-time",
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                        },
                        "completedAt": {
                          "anyOf": [
                            {
                              "description": "ISO 8601 en UTC",
                              "type": "string",
                              "format": "date-time",
                              "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        }
                      },
                      "required": [
                        "reference",
                        "externalReference",
                        "livemode",
                        "status",
                        "total",
                        "refunded",
                        "items",
                        "createdAt",
                        "completedAt"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "ok",
                    "data"
                  ]
                }
              }
            }
          },
          "default": {
            "description": "Error. Codigos: MERCHANT_BLOCKED, IDEMPOTENCY_KEY_REQUIRED, IDEMPOTENCY_CONFLICT, PRODUCT_UNAVAILABLE, PRICE_CHANGED, CURRENCY_MISMATCH, DESTINATION_INVALID, INSUFFICIENT_BALANCE, DAILY_LIMIT_EXCEEDED, VALIDATION_FAILED, RATE_LIMITED, UNAUTHORIZED, FORBIDDEN, INTERNAL_ERROR",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "get": {
        "summary": "Tus pedidos, del mas reciente al mas antiguo",
        "tags": [
          "orders"
        ],
        "operationId": "GET_v1_orders",
        "security": [
          {
            "bearer": []
          }
        ],
        "parameters": [
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "description": "El `nextCursor` de la pagina anterior",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Entre 1 y 100; 50 si no se indica",
            "schema": {
              "examples": [
                50
              ],
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          },
          {
            "name": "from",
            "in": "query",
            "required": false,
            "description": "Desde (incluido)",
            "schema": {
              "type": "string",
              "format": "date-time",
              "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
            }
          },
          {
            "name": "to",
            "in": "query",
            "required": false,
            "description": "Hasta (excluido)",
            "schema": {
              "type": "string",
              "format": "date-time",
              "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "description": "PARTIAL: unas recargas se entregaron y otras no; lo no entregado se devuelve al saldo",
            "schema": {
              "type": "string",
              "enum": [
                "PENDING",
                "DELIVERING",
                "DELIVERED",
                "PARTIAL",
                "FAILED"
              ]
            }
          },
          {
            "name": "phoneNumber",
            "in": "query",
            "required": false,
            "description": "Pedidos con alguna recarga a este numero",
            "schema": {
              "examples": [
                "+18765550123"
              ],
              "type": "string",
              "pattern": "^\\+[1-9]\\d{6,14}$"
            }
          },
          {
            "name": "externalReference",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "const": true
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "items": {
                          "type": "array",
                          "items": {
                            "$ref": "#/components/schemas/OrderSummary"
                          }
                        },
                        "nextCursor": {
                          "description": "null en la ultima pagina",
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        }
                      },
                      "required": [
                        "items",
                        "nextCursor"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "ok",
                    "data"
                  ]
                }
              }
            }
          },
          "default": {
            "description": "Error. Codigos: VALIDATION_FAILED, RATE_LIMITED, UNAUTHORIZED, FORBIDDEN, INTERNAL_ERROR",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/v1/orders/{reference}": {
      "get": {
        "summary": "Un pedido con el estado de cada recarga",
        "tags": [
          "orders"
        ],
        "operationId": "GET_v1_orders_reference",
        "security": [
          {
            "bearer": []
          }
        ],
        "parameters": [
          {
            "name": "reference",
            "in": "path",
            "required": true,
            "schema": {
              "examples": [
                "B2B-7KQ2M9XH4P"
              ],
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "const": true
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "reference": {
                          "examples": [
                            "B2B-7KQ2M9XH4P"
                          ],
                          "description": "Identifica el pedido en la API, los avisos y soporte",
                          "type": "string"
                        },
                        "externalReference": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "livemode": {
                          "examples": [
                            true
                          ],
                          "description": "false: pedido de prueba, hecho con una credencial de pruebas. No cobra ni llega al operador; su resultado se simula",
                          "type": "boolean"
                        },
                        "status": {
                          "description": "PARTIAL: unas recargas se entregaron y otras no; lo no entregado se devuelve al saldo",
                          "type": "string",
                          "enum": [
                            "PENDING",
                            "DELIVERING",
                            "DELIVERED",
                            "PARTIAL",
                            "FAILED"
                          ]
                        },
                        "total": {
                          "$ref": "#/components/schemas/Money"
                        },
                        "refunded": {
                          "description": "Lo devuelto al saldo por recargas no entregadas",
                          "$ref": "#/components/schemas/Money"
                        },
                        "items": {
                          "type": "array",
                          "items": {
                            "$ref": "#/components/schemas/OrderItem"
                          }
                        },
                        "createdAt": {
                          "description": "ISO 8601 en UTC",
                          "type": "string",
                          "format": "date-time",
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                        },
                        "completedAt": {
                          "anyOf": [
                            {
                              "description": "ISO 8601 en UTC",
                              "type": "string",
                              "format": "date-time",
                              "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        }
                      },
                      "required": [
                        "reference",
                        "externalReference",
                        "livemode",
                        "status",
                        "total",
                        "refunded",
                        "items",
                        "createdAt",
                        "completedAt"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "ok",
                    "data"
                  ]
                }
              }
            }
          },
          "default": {
            "description": "Error. Codigos: NOT_FOUND, VALIDATION_FAILED, RATE_LIMITED, UNAUTHORIZED, FORBIDDEN, INTERNAL_ERROR",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/v1/orders/{reference}/events": {
      "get": {
        "summary": "La historia de un pedido, paso a paso",
        "tags": [
          "orders"
        ],
        "operationId": "GET_v1_orders_reference_events",
        "security": [
          {
            "bearer": []
          }
        ],
        "parameters": [
          {
            "name": "reference",
            "in": "path",
            "required": true,
            "schema": {
              "examples": [
                "B2B-7KQ2M9XH4P"
              ],
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "const": true
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "items": {
                          "type": "array",
                          "items": {
                            "$ref": "#/components/schemas/OrderEvent"
                          }
                        }
                      },
                      "required": [
                        "items"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "ok",
                    "data"
                  ]
                }
              }
            }
          },
          "default": {
            "description": "Error. Codigos: NOT_FOUND, VALIDATION_FAILED, RATE_LIMITED, UNAUTHORIZED, FORBIDDEN, INTERNAL_ERROR",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/v1/ledger": {
      "get": {
        "summary": "Movimientos del saldo: depositos, cobros, devoluciones y pagos",
        "tags": [
          "ledger"
        ],
        "operationId": "GET_v1_ledger",
        "security": [
          {
            "bearer": []
          }
        ],
        "parameters": [
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "description": "El `nextCursor` de la pagina anterior",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Entre 1 y 100; 50 si no se indica",
            "schema": {
              "examples": [
                50
              ],
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          },
          {
            "name": "from",
            "in": "query",
            "required": false,
            "description": "Desde (incluido)",
            "schema": {
              "type": "string",
              "format": "date-time",
              "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
            }
          },
          {
            "name": "to",
            "in": "query",
            "required": false,
            "description": "Hasta (excluido)",
            "schema": {
              "type": "string",
              "format": "date-time",
              "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
            }
          },
          {
            "name": "kind",
            "in": "query",
            "required": false,
            "description": "ORDER_DEBIT: cobro de una recarga. ORDER_REVERSAL: devolucion de una que no se entrego",
            "schema": {
              "type": "string",
              "enum": [
                "DEPOSIT",
                "ORDER_DEBIT",
                "ORDER_REVERSAL",
                "INVOICE_PAYMENT",
                "ADJUSTMENT"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "const": true
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "items": {
                          "type": "array",
                          "items": {
                            "$ref": "#/components/schemas/LedgerEntry"
                          }
                        },
                        "nextCursor": {
                          "description": "null en la ultima pagina",
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        }
                      },
                      "required": [
                        "items",
                        "nextCursor"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "ok",
                    "data"
                  ]
                }
              }
            }
          },
          "default": {
            "description": "Error. Codigos: VALIDATION_FAILED, RATE_LIMITED, UNAUTHORIZED, FORBIDDEN, INTERNAL_ERROR",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/v1/reports/sales": {
      "get": {
        "summary": "Ventas de un periodo, por dia, pais u operador",
        "tags": [
          "reports"
        ],
        "operationId": "GET_v1_reports_sales",
        "security": [
          {
            "bearer": []
          }
        ],
        "parameters": [
          {
            "name": "from",
            "in": "query",
            "required": false,
            "description": "Desde (incluido)",
            "schema": {
              "type": "string",
              "format": "date-time",
              "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
            }
          },
          {
            "name": "to",
            "in": "query",
            "required": false,
            "description": "Hasta (excluido)",
            "schema": {
              "type": "string",
              "format": "date-time",
              "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
            }
          },
          {
            "name": "groupBy",
            "in": "query",
            "required": false,
            "description": "Como se agrupan las filas; day si no se indica",
            "schema": {
              "type": "string",
              "enum": [
                "day",
                "country",
                "carrier"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "const": true
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "from": {
                          "description": "ISO 8601 en UTC",
                          "type": "string",
                          "format": "date-time",
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                        },
                        "to": {
                          "description": "ISO 8601 en UTC",
                          "type": "string",
                          "format": "date-time",
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                        },
                        "groupBy": {
                          "type": "string",
                          "enum": [
                            "day",
                            "country",
                            "carrier"
                          ]
                        },
                        "totals": {
                          "type": "object",
                          "properties": {
                            "orders": {
                              "examples": [
                                120
                              ],
                              "type": "integer",
                              "minimum": -9007199254740991,
                              "maximum": 9007199254740991
                            },
                            "itemsDelivered": {
                              "examples": [
                                118
                              ],
                              "type": "integer",
                              "minimum": -9007199254740991,
                              "maximum": 9007199254740991
                            },
                            "itemsFailed": {
                              "examples": [
                                2
                              ],
                              "type": "integer",
                              "minimum": -9007199254740991,
                              "maximum": 9007199254740991
                            },
                            "spent": {
                              "description": "Lo cobrado por recargas entregadas",
                              "$ref": "#/components/schemas/Money"
                            },
                            "refunded": {
                              "$ref": "#/components/schemas/Money"
                            }
                          },
                          "required": [
                            "orders",
                            "itemsDelivered",
                            "itemsFailed",
                            "spent",
                            "refunded"
                          ],
                          "additionalProperties": false
                        },
                        "rows": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "orders": {
                                "examples": [
                                  120
                                ],
                                "type": "integer",
                                "minimum": -9007199254740991,
                                "maximum": 9007199254740991
                              },
                              "itemsDelivered": {
                                "examples": [
                                  118
                                ],
                                "type": "integer",
                                "minimum": -9007199254740991,
                                "maximum": 9007199254740991
                              },
                              "itemsFailed": {
                                "examples": [
                                  2
                                ],
                                "type": "integer",
                                "minimum": -9007199254740991,
                                "maximum": 9007199254740991
                              },
                              "spent": {
                                "description": "Lo cobrado por recargas entregadas",
                                "$ref": "#/components/schemas/Money"
                              },
                              "refunded": {
                                "$ref": "#/components/schemas/Money"
                              },
                              "key": {
                                "examples": [
                                  "2026-10-14"
                                ],
                                "description": "El dia (AAAA-MM-DD), el pais o el operador de la fila",
                                "type": "string"
                              },
                              "countryCode": {
                                "anyOf": [
                                  {
                                    "examples": [
                                      "JM"
                                    ],
                                    "description": "ISO 3166-1 alfa-2",
                                    "type": "string",
                                    "pattern": "^[A-Z]{2}$"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              }
                            },
                            "required": [
                              "orders",
                              "itemsDelivered",
                              "itemsFailed",
                              "spent",
                              "refunded",
                              "key",
                              "countryCode"
                            ],
                            "additionalProperties": false
                          }
                        }
                      },
                      "required": [
                        "from",
                        "to",
                        "groupBy",
                        "totals",
                        "rows"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "ok",
                    "data"
                  ]
                }
              }
            }
          },
          "default": {
            "description": "Error. Codigos: VALIDATION_FAILED, RATE_LIMITED, UNAUTHORIZED, FORBIDDEN, INTERNAL_ERROR",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/v1/webhooks": {
      "get": {
        "summary": "A donde se envian tus avisos y cuales",
        "tags": [
          "webhooks"
        ],
        "operationId": "GET_v1_webhooks",
        "security": [
          {
            "bearer": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "const": true
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "url": {
                          "anyOf": [
                            {
                              "examples": [
                                "https://api.acme.example/rd/webhooks"
                              ],
                              "type": "string"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "events": {
                          "description": "Los avisos suscritos",
                          "type": "array",
                          "items": {
                            "type": "string",
                            "enum": [
                              "order.item.completed",
                              "order.item.failed",
                              "order.completed",
                              "balance.low",
                              "invoice.issued",
                              "invoice.overdue",
                              "invoice.paid",
                              "invoice.voided"
                            ]
                          }
                        },
                        "isActive": {
                          "type": "boolean"
                        },
                        "secretHint": {
                          "description": "Los ultimos caracteres del secreto con el que se firma",
                          "anyOf": [
                            {
                              "examples": [
                                "whsec_...9f2a"
                              ],
                              "type": "string"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "disabledReason": {
                          "description": "Por que se desactivo, si fallo de forma continuada",
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        }
                      },
                      "required": [
                        "url",
                        "events",
                        "isActive",
                        "secretHint",
                        "disabledReason"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "ok",
                    "data"
                  ]
                }
              }
            }
          },
          "default": {
            "description": "Error. Codigos: VALIDATION_FAILED, RATE_LIMITED, UNAUTHORIZED, FORBIDDEN, INTERNAL_ERROR",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "put": {
        "summary": "Configura la URL de avisos, los eventos y el secreto",
        "tags": [
          "webhooks"
        ],
        "operationId": "PUT_v1_webhooks",
        "security": [
          {
            "bearer": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "url": {
                    "examples": [
                      "https://api.acme.example/rd/webhooks"
                    ],
                    "type": "string",
                    "format": "uri",
                    "pattern": "^https:\\/\\/.*"
                  },
                  "events": {
                    "minItems": 1,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "enum": [
                        "order.item.completed",
                        "order.item.failed",
                        "order.completed",
                        "balance.low",
                        "invoice.issued",
                        "invoice.overdue",
                        "invoice.paid",
                        "invoice.voided"
                      ]
                    }
                  },
                  "rotateSecret": {
                    "description": "Emite un secreto nuevo; el anterior sigue valido 24 h",
                    "type": "boolean"
                  }
                },
                "required": [
                  "url",
                  "events"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "const": true
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "url": {
                          "anyOf": [
                            {
                              "examples": [
                                "https://api.acme.example/rd/webhooks"
                              ],
                              "type": "string"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "events": {
                          "description": "Los avisos suscritos",
                          "type": "array",
                          "items": {
                            "type": "string",
                            "enum": [
                              "order.item.completed",
                              "order.item.failed",
                              "order.completed",
                              "balance.low",
                              "invoice.issued",
                              "invoice.overdue",
                              "invoice.paid",
                              "invoice.voided"
                            ]
                          }
                        },
                        "isActive": {
                          "type": "boolean"
                        },
                        "secretHint": {
                          "description": "Los ultimos caracteres del secreto con el que se firma",
                          "anyOf": [
                            {
                              "examples": [
                                "whsec_...9f2a"
                              ],
                              "type": "string"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "disabledReason": {
                          "description": "Por que se desactivo, si fallo de forma continuada",
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "secret": {
                          "description": "Solo al crear o rotar: no se vuelve a mostrar",
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        }
                      },
                      "required": [
                        "url",
                        "events",
                        "isActive",
                        "secretHint",
                        "disabledReason",
                        "secret"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "ok",
                    "data"
                  ]
                }
              }
            }
          },
          "default": {
            "description": "Error. Codigos: WEBHOOK_URL_INVALID, VALIDATION_FAILED, RATE_LIMITED, UNAUTHORIZED, FORBIDDEN, INTERNAL_ERROR",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/v1/webhooks/deliveries": {
      "get": {
        "summary": "Avisos enviados y su resultado",
        "tags": [
          "webhooks"
        ],
        "operationId": "GET_v1_webhooks_deliveries",
        "security": [
          {
            "bearer": []
          }
        ],
        "parameters": [
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "description": "El `nextCursor` de la pagina anterior",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Entre 1 y 100; 50 si no se indica",
            "schema": {
              "examples": [
                50
              ],
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          },
          {
            "name": "from",
            "in": "query",
            "required": false,
            "description": "Desde (incluido)",
            "schema": {
              "type": "string",
              "format": "date-time",
              "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
            }
          },
          {
            "name": "to",
            "in": "query",
            "required": false,
            "description": "Hasta (excluido)",
            "schema": {
              "type": "string",
              "format": "date-time",
              "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "PENDING",
                "DELIVERED",
                "FAILED",
                "GIVEN_UP"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "const": true
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "items": {
                          "type": "array",
                          "items": {
                            "$ref": "#/components/schemas/WebhookDelivery"
                          }
                        },
                        "nextCursor": {
                          "description": "null en la ultima pagina",
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        }
                      },
                      "required": [
                        "items",
                        "nextCursor"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "ok",
                    "data"
                  ]
                }
              }
            }
          },
          "default": {
            "description": "Error. Codigos: VALIDATION_FAILED, RATE_LIMITED, UNAUTHORIZED, FORBIDDEN, INTERNAL_ERROR",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/v1/webhooks/deliveries/{id}/resend": {
      "post": {
        "summary": "Reenvia un aviso",
        "tags": [
          "webhooks"
        ],
        "operationId": "POST_v1_webhooks_deliveries_id_resend",
        "security": [
          {
            "bearer": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "const": true
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "eventType": {
                          "type": "string",
                          "enum": [
                            "order.item.completed",
                            "order.item.failed",
                            "order.completed",
                            "balance.low",
                            "invoice.issued",
                            "invoice.overdue",
                            "invoice.paid",
                            "invoice.voided"
                          ]
                        },
                        "eventId": {
                          "examples": [
                            "evt_01J9ZK7QXN"
                          ],
                          "description": "Igual en cada reintento: sirve para no procesar dos veces el mismo aviso",
                          "type": "string"
                        },
                        "status": {
                          "type": "string",
                          "enum": [
                            "PENDING",
                            "DELIVERED",
                            "FAILED",
                            "GIVEN_UP"
                          ]
                        },
                        "attempts": {
                          "examples": [
                            1
                          ],
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "lastStatusCode": {
                          "anyOf": [
                            {
                              "examples": [
                                200
                              ],
                              "type": "integer",
                              "minimum": -9007199254740991,
                              "maximum": 9007199254740991
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "nextAttemptAt": {
                          "anyOf": [
                            {
                              "description": "ISO 8601 en UTC",
                              "type": "string",
                              "format": "date-time",
                              "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "createdAt": {
                          "description": "ISO 8601 en UTC",
                          "type": "string",
                          "format": "date-time",
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                        },
                        "deliveredAt": {
                          "anyOf": [
                            {
                              "description": "ISO 8601 en UTC",
                              "type": "string",
                              "format": "date-time",
                              "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        }
                      },
                      "required": [
                        "id",
                        "eventType",
                        "eventId",
                        "status",
                        "attempts",
                        "lastStatusCode",
                        "nextAttemptAt",
                        "createdAt",
                        "deliveredAt"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "ok",
                    "data"
                  ]
                }
              }
            }
          },
          "default": {
            "description": "Error. Codigos: NOT_FOUND, VALIDATION_FAILED, RATE_LIMITED, UNAUTHORIZED, FORBIDDEN, INTERNAL_ERROR",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/v1/invoices": {
      "get": {
        "summary": "Facturas y extractos",
        "tags": [
          "invoices"
        ],
        "operationId": "GET_v1_invoices",
        "security": [
          {
            "bearer": []
          }
        ],
        "parameters": [
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "description": "El `nextCursor` de la pagina anterior",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Entre 1 y 100; 50 si no se indica",
            "schema": {
              "examples": [
                50
              ],
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "description": "ISSUED: emitida y pendiente. OVERDUE: vencida sin pagar. PAID: pagada. VOID: anulada",
            "schema": {
              "type": "string",
              "enum": [
                "ISSUED",
                "PAID",
                "OVERDUE",
                "VOID"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "const": true
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "items": {
                          "type": "array",
                          "items": {
                            "$ref": "#/components/schemas/InvoiceSummary"
                          }
                        },
                        "nextCursor": {
                          "description": "null en la ultima pagina",
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        }
                      },
                      "required": [
                        "items",
                        "nextCursor"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "ok",
                    "data"
                  ]
                }
              }
            }
          },
          "default": {
            "description": "Error. Codigos: VALIDATION_FAILED, RATE_LIMITED, UNAUTHORIZED, FORBIDDEN, INTERNAL_ERROR",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/v1/invoices/{number}": {
      "get": {
        "summary": "Una factura con sus lineas y el resumen del saldo",
        "tags": [
          "invoices"
        ],
        "operationId": "GET_v1_invoices_number",
        "security": [
          {
            "bearer": []
          }
        ],
        "parameters": [
          {
            "name": "number",
            "in": "path",
            "required": true,
            "schema": {
              "examples": [
                "INV-ACME-12"
              ],
              "type": "string",
              "pattern": "^INV-[A-Z0-9-]+-\\d+$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "const": true
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "number": {
                          "examples": [
                            "INV-ACME-12"
                          ],
                          "description": "Numero de la factura (pospago) o del extracto (prepago)",
                          "type": "string"
                        },
                        "kind": {
                          "description": "INVOICE en pospago; STATEMENT, un extracto informativo, en prepago",
                          "type": "string",
                          "enum": [
                            "INVOICE",
                            "STATEMENT"
                          ]
                        },
                        "status": {
                          "description": "ISSUED: emitida y pendiente. OVERDUE: vencida sin pagar. PAID: pagada. VOID: anulada",
                          "type": "string",
                          "enum": [
                            "ISSUED",
                            "PAID",
                            "OVERDUE",
                            "VOID"
                          ]
                        },
                        "periodStart": {
                          "description": "Inicio del periodo, incluido",
                          "type": "string",
                          "format": "date-time",
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                        },
                        "periodEnd": {
                          "description": "Fin del periodo, excluido",
                          "type": "string",
                          "format": "date-time",
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                        },
                        "issuedAt": {
                          "description": "ISO 8601 en UTC",
                          "type": "string",
                          "format": "date-time",
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                        },
                        "dueAt": {
                          "description": "Vencimiento; un extracto no vence",
                          "anyOf": [
                            {
                              "description": "ISO 8601 en UTC",
                              "type": "string",
                              "format": "date-time",
                              "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "total": {
                          "description": "Lo facturado en el periodo",
                          "$ref": "#/components/schemas/Money"
                        },
                        "paidAt": {
                          "anyOf": [
                            {
                              "description": "ISO 8601 en UTC",
                              "type": "string",
                              "format": "date-time",
                              "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "lines": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "type": {
                                "description": "RECHARGES: recargas cobradas. REVERSALS: devoluciones de las no entregadas. ADJUSTMENT: ajuste",
                                "type": "string",
                                "enum": [
                                  "RECHARGES",
                                  "REVERSALS",
                                  "ADJUSTMENT"
                                ]
                              },
                              "description": {
                                "examples": [
                                  "Recargas: Digicel (JM)"
                                ],
                                "type": "string"
                              },
                              "countryCode": {
                                "anyOf": [
                                  {
                                    "examples": [
                                      "JM"
                                    ],
                                    "type": "string"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              },
                              "carrierName": {
                                "anyOf": [
                                  {
                                    "examples": [
                                      "Digicel"
                                    ],
                                    "type": "string"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              },
                              "quantity": {
                                "examples": [
                                  118
                                ],
                                "type": "integer",
                                "minimum": -9007199254740991,
                                "maximum": 9007199254740991
                              },
                              "amount": {
                                "description": "Positivo es un cargo; negativo, un abono",
                                "$ref": "#/components/schemas/Money"
                              }
                            },
                            "required": [
                              "type",
                              "description",
                              "countryCode",
                              "carrierName",
                              "quantity",
                              "amount"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "summary": {
                          "type": "object",
                          "properties": {
                            "openingBalance": {
                              "$ref": "#/components/schemas/Money"
                            },
                            "credits": {
                              "description": "Depositos y pagos anotados en el periodo",
                              "$ref": "#/components/schemas/Money"
                            },
                            "closingBalance": {
                              "$ref": "#/components/schemas/Money"
                            }
                          },
                          "required": [
                            "openingBalance",
                            "credits",
                            "closingBalance"
                          ],
                          "additionalProperties": false
                        }
                      },
                      "required": [
                        "number",
                        "kind",
                        "status",
                        "periodStart",
                        "periodEnd",
                        "issuedAt",
                        "dueAt",
                        "total",
                        "paidAt",
                        "lines",
                        "summary"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "ok",
                    "data"
                  ]
                }
              }
            }
          },
          "default": {
            "description": "Error. Codigos: NOT_FOUND, VALIDATION_FAILED, RATE_LIMITED, UNAUTHORIZED, FORBIDDEN, INTERNAL_ERROR",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/v1/invoices/{number}/pdf": {
      "get": {
        "summary": "El PDF de una factura, en base64",
        "tags": [
          "invoices"
        ],
        "operationId": "GET_v1_invoices_number_pdf",
        "security": [
          {
            "bearer": []
          }
        ],
        "parameters": [
          {
            "name": "number",
            "in": "path",
            "required": true,
            "schema": {
              "examples": [
                "INV-ACME-12"
              ],
              "type": "string",
              "pattern": "^INV-[A-Z0-9-]+-\\d+$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "const": true
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "filename": {
                          "examples": [
                            "INV-ACME-12.pdf"
                          ],
                          "type": "string"
                        },
                        "contentType": {
                          "type": "string",
                          "const": "application/pdf"
                        },
                        "contentBase64": {
                          "description": "El PDF en base64",
                          "type": "string"
                        }
                      },
                      "required": [
                        "filename",
                        "contentType",
                        "contentBase64"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "ok",
                    "data"
                  ]
                }
              }
            }
          },
          "default": {
            "description": "Error. Codigos: NOT_FOUND, VALIDATION_FAILED, RATE_LIMITED, UNAUTHORIZED, FORBIDDEN, INTERNAL_ERROR",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    }
  }
}
