{
  "openapi": "3.1.0",
  "info": {
    "title": "Banking.rest API",
    "version": "1.0.0",
    "description": "Verified reference data on banks, branches, BIC/SWIFT codes and regulators worldwide. Every endpoint is read-only, cursor-paginated and returns JSON.",
    "contact": {
      "name": "Banking.rest",
      "url": "https://banking.rest"
    },
    "license": {
      "name": "Commercial",
      "url": "https://banking.rest/pricing"
    }
  },
  "servers": [
    {
      "url": "https://api.banking.rest",
      "description": "Production"
    },
    {
      "url": "/api/public",
      "description": "Sandbox (sample dataset, no key required)"
    }
  ],
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "tags": [
    {
      "name": "Institutions",
      "description": "Banks and other licensed institutions."
    },
    {
      "name": "Branches",
      "description": "Branch records with addresses and clearing codes."
    },
    {
      "name": "Reference",
      "description": "Regulators and country coverage."
    }
  ],
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "description": "API key: `Bearer sk_live_…`"
      }
    },
    "schemas": {
      "Institution": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "example": "de_deutsche_bank"
          },
          "name": {
            "type": "string",
            "example": "Deutsche Bank AG"
          },
          "country": {
            "type": "string",
            "description": "ISO 3166-1 alpha-2",
            "example": "DE"
          },
          "country_name": {
            "type": "string",
            "example": "Germany"
          },
          "type": {
            "type": "string",
            "enum": [
              "universal_bank",
              "commercial_bank",
              "central_bank",
              "credit_union"
            ]
          },
          "regulator": {
            "type": "string",
            "example": "bafin"
          },
          "bic": {
            "type": "string",
            "example": "DEUTDEFF"
          },
          "lei": {
            "type": "string",
            "example": "7LTWFZYICNSX8D621K86"
          },
          "website": {
            "type": "string",
            "format": "uri"
          },
          "founded": {
            "type": "integer",
            "example": 1870
          },
          "verified_at": {
            "type": "string",
            "format": "date"
          }
        },
        "required": [
          "id",
          "name",
          "country",
          "type",
          "bic"
        ]
      },
      "Branch": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "institution_id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "country": {
            "type": "string"
          },
          "city": {
            "type": "string"
          },
          "address": {
            "type": "string"
          },
          "clearing_code": {
            "type": "string"
          },
          "bic": {
            "type": "string"
          }
        }
      },
      "Regulator": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "acronym": {
            "type": "string"
          },
          "country": {
            "type": "string"
          },
          "website": {
            "type": "string",
            "format": "uri"
          }
        }
      },
      "Country": {
        "type": "object",
        "properties": {
          "code": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "institutions": {
            "type": "integer"
          },
          "branches": {
            "type": "integer"
          },
          "code_scheme": {
            "type": "string"
          }
        }
      },
      "Error": {
        "type": "object",
        "properties": {
          "error": {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "example": "not_found"
              },
              "message": {
                "type": "string"
              }
            }
          }
        }
      }
    },
    "parameters": {
      "limit": {
        "name": "limit",
        "in": "query",
        "description": "Page size, 1–100.",
        "schema": {
          "type": "integer",
          "minimum": 1,
          "maximum": 100,
          "default": 25
        }
      },
      "country": {
        "name": "country",
        "in": "query",
        "description": "Filter by ISO 3166-1 alpha-2 country code.",
        "schema": {
          "type": "string",
          "example": "DE"
        }
      }
    },
    "responses": {
      "NotFound": {
        "description": "Resource not found",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      }
    }
  },
  "paths": {
    "/v1/banks": {
      "get": {
        "tags": [
          "Institutions"
        ],
        "operationId": "listBanks",
        "summary": "List institutions",
        "description": "List institutions, filterable by country, type and regulator.",
        "parameters": [
          {
            "$ref": "#/components/parameters/country"
          },
          {
            "name": "type",
            "in": "query",
            "description": "Institution type.",
            "schema": {
              "type": "string",
              "enum": [
                "universal_bank",
                "commercial_bank",
                "central_bank",
                "credit_union"
              ]
            }
          },
          {
            "name": "regulator",
            "in": "query",
            "description": "Regulator id, e.g. `bafin`.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "q",
            "in": "query",
            "description": "Free-text search on institution name.",
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/limit"
          }
        ],
        "responses": {
          "200": {
            "description": "A list of institutions",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "type": "string",
                      "enum": [
                        "list"
                      ]
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Institution"
                      }
                    },
                    "has_more": {
                      "type": "boolean"
                    },
                    "total": {
                      "type": "integer"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/banks/{id}": {
      "get": {
        "tags": [
          "Institutions"
        ],
        "operationId": "getBank",
        "summary": "Retrieve an institution",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "example": "de_deutsche_bank"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Institution profile",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Institution"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/v1/bic/{code}": {
      "get": {
        "tags": [
          "Institutions"
        ],
        "operationId": "resolveBic",
        "summary": "Resolve a BIC/SWIFT code",
        "parameters": [
          {
            "name": "code",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "example": "DEUTDEFF"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Resolved institution and branch",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "bic": {
                      "type": "string"
                    },
                    "institution": {
                      "$ref": "#/components/schemas/Institution"
                    },
                    "branch": {
                      "oneOf": [
                        {
                          "$ref": "#/components/schemas/Branch"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "verified_at": {
                      "type": "string",
                      "format": "date"
                    }
                  }
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/v1/branches": {
      "get": {
        "tags": [
          "Branches"
        ],
        "operationId": "listBranches",
        "summary": "List branches",
        "parameters": [
          {
            "$ref": "#/components/parameters/country"
          },
          {
            "name": "institution_id",
            "in": "query",
            "schema": {
              "type": "string",
              "example": "gb_barclays"
            }
          },
          {
            "$ref": "#/components/parameters/limit"
          }
        ],
        "responses": {
          "200": {
            "description": "A list of branches",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "type": "string",
                      "enum": [
                        "list"
                      ]
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Branch"
                      }
                    },
                    "has_more": {
                      "type": "boolean"
                    },
                    "total": {
                      "type": "integer"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/regulators": {
      "get": {
        "tags": [
          "Reference"
        ],
        "operationId": "listRegulators",
        "summary": "List regulators",
        "parameters": [
          {
            "$ref": "#/components/parameters/country"
          }
        ],
        "responses": {
          "200": {
            "description": "Supervisory authorities per jurisdiction",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "type": "string",
                      "enum": [
                        "list"
                      ]
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Regulator"
                      }
                    },
                    "has_more": {
                      "type": "boolean"
                    },
                    "total": {
                      "type": "integer"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/countries": {
      "get": {
        "tags": [
          "Reference"
        ],
        "operationId": "listCountries",
        "summary": "List coverage by country",
        "responses": {
          "200": {
            "description": "Coverage summary and local code schemes",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "type": "string",
                      "enum": [
                        "list"
                      ]
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Country"
                      }
                    },
                    "has_more": {
                      "type": "boolean"
                    },
                    "total": {
                      "type": "integer"
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}