{
  "openapi": "3.1.0",
  "info": {
    "title": "Fintoc FX",
    "version": "1.0.0",
    "description": "API pública y gratuita para USD, CLP y MXN. Tasas referenciales de terceros. Sin garantía de exactitud, disponibilidad o aptitud para operaciones financieras. Caché de 300 segundos. Sin autenticación. 100 solicitudes por IP en una ventana móvil de 60 minutos, compartidas globalmente entre REST y MCP. Los parámetros desconocidos o duplicados se rechazan. No admite históricos.",
    "termsOfService": "https://fx.fintoc.com/terms",
    "contact": {
      "name": "Fintoc",
      "url": "https://fintoc.com"
    }
  },
  "servers": [
    {
      "url": "https://fx.fintoc.com"
    }
  ],
  "security": [],
  "paths": {
    "/v1/rates": {
      "get": {
        "operationId": "getExchangeRates",
        "summary": "Unidades de destino por 1 unidad de base.",
        "parameters": [
          {
            "name": "base",
            "in": "query",
            "required": false,
            "description": "",
            "schema": {
              "type": "string",
              "enum": [
                "USD",
                "CLP",
                "MXN"
              ],
              "default": "USD"
            }
          },
          {
            "name": "symbols",
            "in": "query",
            "required": false,
            "description": "Hasta tres monedas separadas por comas. Por defecto, todas salvo base.",
            "schema": {
              "type": "string",
              "example": "CLP,MXN"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Consulta exitosa.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "base": {
                      "type": "string",
                      "enum": [
                        "USD",
                        "CLP",
                        "MXN"
                      ]
                    },
                    "rates": {
                      "type": "object",
                      "additionalProperties": {
                        "type": "number",
                        "exclusiveMinimum": 0
                      }
                    },
                    "retrieved_at": {
                      "type": "string",
                      "format": "date-time",
                      "description": "Cuándo consultamos al proveedor. No es la fecha garantizada del precio de mercado."
                    },
                    "provider_datetime": {
                      "type": "object",
                      "properties": {
                        "CLP": {
                          "type": "string",
                          "format": "date-time"
                        },
                        "MXN": {
                          "type": "string",
                          "format": "date-time"
                        }
                      }
                    },
                    "source": {
                      "type": "object",
                      "properties": {
                        "name": {
                          "type": "string",
                          "const": "robin-pgbot"
                        },
                        "url": {
                          "type": "string",
                          "format": "uri"
                        }
                      }
                    },
                    "cache_seconds": {
                      "type": "integer",
                      "const": 300
                    },
                    "disclaimer": {
                      "type": "string"
                    },
                    "terms_url": {
                      "type": "string",
                      "format": "uri"
                    }
                  },
                  "required": [
                    "base",
                    "rates",
                    "retrieved_at",
                    "source",
                    "disclaimer"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Error con código estable y mensaje legible.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "code",
                        "message"
                      ]
                    },
                    "docs_url": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "429": {
            "description": "Límite global de 100 solicitudes por IP en los últimos 60 minutos.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "code",
                        "message"
                      ]
                    },
                    "docs_url": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer",
                  "minimum": 1,
                  "maximum": 3600
                }
              }
            }
          },
          "503": {
            "description": "Error con código estable y mensaje legible.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "code",
                        "message"
                      ]
                    },
                    "docs_url": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/v1/convert": {
      "get": {
        "operationId": "convertCurrency",
        "summary": "Conversión referencial, redondeada a 6 decimales.",
        "parameters": [
          {
            "name": "from",
            "in": "query",
            "required": true,
            "description": "",
            "schema": {
              "type": "string",
              "enum": [
                "USD",
                "CLP",
                "MXN"
              ]
            }
          },
          {
            "name": "to",
            "in": "query",
            "required": true,
            "description": "",
            "schema": {
              "type": "string",
              "enum": [
                "USD",
                "CLP",
                "MXN"
              ]
            }
          },
          {
            "name": "amount",
            "in": "query",
            "required": true,
            "description": "Notación decimal con hasta 6 decimales; sin separadores de miles ni notación exponencial.",
            "schema": {
              "type": "number",
              "minimum": 0,
              "maximum": 1000000000000,
              "multipleOf": 0.000001
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Consulta exitosa.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "from": {
                      "type": "string",
                      "enum": [
                        "USD",
                        "CLP",
                        "MXN"
                      ]
                    },
                    "to": {
                      "type": "string",
                      "enum": [
                        "USD",
                        "CLP",
                        "MXN"
                      ]
                    },
                    "amount": {
                      "type": "number"
                    },
                    "rate": {
                      "type": "number"
                    },
                    "result": {
                      "type": "number"
                    },
                    "retrieved_at": {
                      "type": "string",
                      "format": "date-time",
                      "description": "Cuándo consultamos al proveedor. No es la fecha garantizada del precio de mercado."
                    },
                    "provider_datetime": {
                      "type": "object",
                      "properties": {
                        "CLP": {
                          "type": "string",
                          "format": "date-time"
                        },
                        "MXN": {
                          "type": "string",
                          "format": "date-time"
                        }
                      }
                    },
                    "source": {
                      "type": "object",
                      "properties": {
                        "name": {
                          "type": "string",
                          "const": "robin-pgbot"
                        },
                        "url": {
                          "type": "string",
                          "format": "uri"
                        }
                      }
                    },
                    "cache_seconds": {
                      "type": "integer",
                      "const": 300
                    },
                    "disclaimer": {
                      "type": "string"
                    },
                    "terms_url": {
                      "type": "string",
                      "format": "uri"
                    }
                  },
                  "required": [
                    "from",
                    "to",
                    "amount",
                    "rate",
                    "result",
                    "retrieved_at",
                    "source",
                    "disclaimer"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Error con código estable y mensaje legible.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "code",
                        "message"
                      ]
                    },
                    "docs_url": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "429": {
            "description": "Límite global de 100 solicitudes por IP en los últimos 60 minutos.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "code",
                        "message"
                      ]
                    },
                    "docs_url": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer",
                  "minimum": 1,
                  "maximum": 3600
                }
              }
            }
          },
          "503": {
            "description": "Error con código estable y mensaje legible.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "code",
                        "message"
                      ]
                    },
                    "docs_url": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/v1/currencies": {
      "get": {
        "operationId": "listCurrencies",
        "summary": "Monedas disponibles.",
        "parameters": [],
        "responses": {
          "200": {
            "description": "Consulta exitosa.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "currencies": {
                      "type": "object",
                      "properties": {
                        "USD": {
                          "type": "string"
                        },
                        "CLP": {
                          "type": "string"
                        },
                        "MXN": {
                          "type": "string"
                        }
                      }
                    },
                    "disclaimer": {
                      "type": "string"
                    },
                    "terms_url": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "currencies"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Error con código estable y mensaje legible.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "code",
                        "message"
                      ]
                    },
                    "docs_url": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "429": {
            "description": "Límite global de 100 solicitudes por IP en los últimos 60 minutos.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "code",
                        "message"
                      ]
                    },
                    "docs_url": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer",
                  "minimum": 1,
                  "maximum": 3600
                }
              }
            }
          },
          "503": {
            "description": "Error con código estable y mensaje legible.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "code",
                        "message"
                      ]
                    },
                    "docs_url": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      }
    }
  }
}
