{
  "openapi": "3.1.0",
  "info": {
    "title": "Bitnovo Public API",
    "version": "1.0.0",
    "description": "Machine-readable contract for the public Bitnovo endpoints. The health, exchange-rate and subscription operations are public and do not require authentication. Approved private integrations use the scoped authorization vocabulary declared in components.securitySchemes.",
    "contact": {
      "name": "Bitnovo",
      "url": "https://www.bitnovo.com"
    }
  },
  "servers": [
    {
      "url": "https://www.bitnovo.com",
      "description": "Production"
    }
  ],
  "externalDocs": {
    "description": "Bitnovo resources for AI agents",
    "url": "https://www.bitnovo.com/llms.txt"
  },
  "paths": {
    "/api/health": {
      "get": {
        "operationId": "getHealth",
        "summary": "Check API availability",
        "description": "Returns the current health status of the public landing API.",
        "security": [],
        "responses": {
          "200": {
            "description": "The API is running.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HealthResponse"
                }
              }
            }
          },
          "405": {
            "$ref": "#/components/responses/MethodNotAllowed"
          }
        }
      }
    },
    "/api/v1/exchange-rates": {
      "post": {
        "operationId": "getHistoricalExchangeRates",
        "summary": "Get historical exchange rates",
        "description": "Returns historical exchange-rate data for the requested cryptocurrency symbols.",
        "security": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ExchangeRatesRequest"
              },
              "example": {
                "cryptos": ["BTC", "ETH"]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Historical exchange-rate data.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "The request contains no valid cryptocurrency symbols.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "405": {
            "$ref": "#/components/responses/MethodNotAllowed"
          },
          "500": {
            "$ref": "#/components/responses/InternalServerError"
          },
          "502": {
            "$ref": "#/components/responses/BadGateway"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/api/subscribe": {
      "post": {
        "operationId": "subscribeToUpdates",
        "summary": "Subscribe an email address",
        "description": "Submits an email address and locale to Bitnovo's newsletter service.",
        "security": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SubscribeRequest"
              },
              "example": {
                "email": "person@example.com",
                "locale": "es"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Subscription accepted.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SuccessResponse"
                }
              }
            }
          },
          "400": {
            "description": "A required field is missing.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "405": {
            "$ref": "#/components/responses/MethodNotAllowed"
          },
          "502": {
            "$ref": "#/components/responses/BadGateway"
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "BitnovoOAuth2": {
        "type": "oauth2",
        "description": "Scoped authorization vocabulary for approved private integrations. The public operations above explicitly require no token. Token issuance is subject to Bitnovo onboarding.",
        "flows": {
          "clientCredentials": {
            "tokenUrl": "https://www.bitnovo.com/oauth/token",
            "scopes": {
              "health:read": "Read service health",
              "rates:read": "Read exchange-rate data",
              "subscriptions:write": "Create newsletter subscriptions"
            }
          }
        }
      }
    },
    "responses": {
      "MethodNotAllowed": {
        "description": "The HTTP method is not supported for this operation.",
        "headers": {
          "Allow": {
            "schema": {
              "type": "string"
            }
          }
        },
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/ProblemDetails"
            }
          }
        }
      },
      "InternalServerError": {
        "description": "The server could not complete the request.",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/ProblemDetails"
            }
          }
        }
      },
      "BadGateway": {
        "description": "An upstream service failed.",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/ProblemDetails"
            }
          }
        }
      },
      "ServiceUnavailable": {
        "description": "A required service is temporarily unavailable.",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/ProblemDetails"
            }
          }
        }
      }
    },
    "schemas": {
      "HealthResponse": {
        "type": "object",
        "required": ["status", "timestamp", "uptime", "environment"],
        "properties": {
          "status": {
            "type": "string",
            "const": "healthy"
          },
          "timestamp": {
            "type": "string",
            "format": "date-time"
          },
          "uptime": {
            "type": "number",
            "minimum": 0
          },
          "environment": {
            "type": "string"
          }
        }
      },
      "ExchangeRatesRequest": {
        "type": "object",
        "required": ["cryptos"],
        "properties": {
          "cryptos": {
            "type": "array",
            "minItems": 1,
            "items": {
              "type": "string",
              "minLength": 1,
              "pattern": "^[A-Za-z0-9._-]+$"
            }
          }
        },
        "additionalProperties": true
      },
      "SubscribeRequest": {
        "type": "object",
        "required": ["email", "locale"],
        "properties": {
          "email": {
            "type": "string",
            "format": "email"
          },
          "locale": {
            "type": "string",
            "enum": ["es", "en", "fr", "it", "pt"]
          }
        },
        "additionalProperties": false
      },
      "SuccessResponse": {
        "type": "object",
        "required": ["success"],
        "properties": {
          "success": {
            "type": "boolean",
            "const": true
          }
        }
      },
      "ProblemDetails": {
        "type": "object",
        "required": ["type", "title", "status", "detail", "code", "resolution"],
        "properties": {
          "type": {
            "type": "string",
            "format": "uri-reference"
          },
          "title": {
            "type": "string"
          },
          "status": {
            "type": "integer",
            "minimum": 400,
            "maximum": 599
          },
          "detail": {
            "type": "string"
          },
          "instance": {
            "type": "string",
            "format": "uri-reference"
          },
          "code": {
            "type": "string",
            "pattern": "^[a-z0-9_]+$"
          },
          "resolution": {
            "type": "string"
          }
        },
        "additionalProperties": true
      }
    }
  }
}
