{
  "openapi": "3.1.0",
  "info": {
    "title": "API Национального Банка Юности",
    "version": "1.0.0",
    "description": "Интеграция коммерческих банков с Национальным Банком Юности: курс, ставки, корсчета, межбанк, рефинансирование, отчётность, документы, программы."
  },
  "servers": [
    {
      "url": "https://nbapi.xata436.tech"
    },
    {
      "url": "http://10.0.10.13:8090"
    }
  ],
  "components": {
    "securitySchemes": {
      "bankBearer": {
        "type": "http",
        "scheme": "bearer",
        "description": "api_key банка"
      },
      "adminBearer": {
        "type": "http",
        "scheme": "bearer",
        "description": "ключ администратора ЦБ"
      }
    }
  },
  "paths": {
    "/v1/rates": {
      "get": {
        "summary": "Официальный курс фэня",
        "responses": {
          "200": {
            "description": "OK"
          },
          "4XX": {
            "description": "ошибка, тело {error:{code,message}}"
          }
        }
      }
    },
    "/v1/rates/history": {
      "get": {
        "summary": "История курса",
        "responses": {
          "200": {
            "description": "OK"
          },
          "4XX": {
            "description": "ошибка, тело {error:{code,message}}"
          }
        },
        "parameters": [
          {
            "name": "days",
            "in": "query",
            "schema": {
              "type": "integer"
            }
          }
        ]
      }
    },
    "/v1/key-rate": {
      "get": {
        "summary": "Ключевая ставка и ставки Хата Банка",
        "responses": {
          "200": {
            "description": "OK"
          },
          "4XX": {
            "description": "ошибка, тело {error:{code,message}}"
          }
        }
      }
    },
    "/v1/indices": {
      "get": {
        "summary": "Индексы: стоимость фэня, инфляция, активность",
        "responses": {
          "200": {
            "description": "OK"
          },
          "4XX": {
            "description": "ошибка, тело {error:{code,message}}"
          }
        }
      }
    },
    "/v1/decisions": {
      "get": {
        "summary": "Решения Совета ЦБ",
        "responses": {
          "200": {
            "description": "OK"
          },
          "4XX": {
            "description": "ошибка, тело {error:{code,message}}"
          }
        }
      }
    },
    "/v1/emission": {
      "get": {
        "summary": "Эмиссия, резерв, деньги в обороте",
        "responses": {
          "200": {
            "description": "OK"
          },
          "4XX": {
            "description": "ошибка, тело {error:{code,message}}"
          }
        }
      }
    },
    "/v1/reference/banks": {
      "get": {
        "summary": "Реестр банков",
        "responses": {
          "200": {
            "description": "OK"
          },
          "4XX": {
            "description": "ошибка, тело {error:{code,message}}"
          }
        }
      }
    },
    "/v1/reference/registry": {
      "get": {
        "summary": "Реестр участников финансового рынка",
        "responses": {
          "200": {
            "description": "OK"
          },
          "4XX": {
            "description": "ошибка, тело {error:{code,message}}"
          }
        }
      }
    },
    "/v1/about": {
      "get": {
        "summary": "Сведения о Национальном Банке Юности",
        "responses": {
          "200": {
            "description": "OK"
          },
          "4XX": {
            "description": "ошибка, тело {error:{code,message}}"
          }
        }
      }
    },
    "/v1/statistics": {
      "get": {
        "summary": "Макроэкономическая статистика",
        "responses": {
          "200": {
            "description": "OK"
          },
          "4XX": {
            "description": "ошибка, тело {error:{code,message}}"
          }
        }
      }
    },
    "/v1/appeals": {
      "post": {
        "summary": "Обращение в Национальный Банк Юности (интернет-приёмная)",
        "responses": {
          "200": {
            "description": "OK"
          },
          "4XX": {
            "description": "ошибка, тело {error:{code,message}}"
          }
        }
      }
    },
    "/v1/calendar": {
      "get": {
        "summary": "Календарь: Чёрные понедельники, дни зарплат",
        "responses": {
          "200": {
            "description": "OK"
          },
          "4XX": {
            "description": "ошибка, тело {error:{code,message}}"
          }
        }
      }
    },
    "/v1/me": {
      "get": {
        "summary": "Профиль банка и балансы",
        "responses": {
          "200": {
            "description": "OK"
          },
          "4XX": {
            "description": "ошибка, тело {error:{code,message}}"
          }
        },
        "security": [
          {
            "bankBearer": []
          }
        ]
      }
    },
    "/v1/accounts/correspondent": {
      "get": {
        "summary": "Баланс корсчёта",
        "responses": {
          "200": {
            "description": "OK"
          },
          "4XX": {
            "description": "ошибка, тело {error:{code,message}}"
          }
        },
        "security": [
          {
            "bankBearer": []
          }
        ]
      }
    },
    "/v1/accounts/correspondent/statement": {
      "get": {
        "summary": "Выписка по корсчёту",
        "responses": {
          "200": {
            "description": "OK"
          },
          "4XX": {
            "description": "ошибка, тело {error:{code,message}}"
          }
        },
        "security": [
          {
            "bankBearer": []
          }
        ],
        "parameters": [
          {
            "name": "from",
            "in": "query"
          },
          {
            "name": "to",
            "in": "query"
          }
        ]
      }
    },
    "/v1/transfers": {
      "post": {
        "summary": "Межбанковский перевод",
        "responses": {
          "200": {
            "description": "OK"
          },
          "4XX": {
            "description": "ошибка, тело {error:{code,message}}"
          }
        },
        "security": [
          {
            "bankBearer": []
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "to_bank": {
                    "type": "string"
                  },
                  "amount": {
                    "type": "number"
                  },
                  "purpose_code": {
                    "type": "string",
                    "enum": [
                      "INTERBANK",
                      "OTHER",
                      "SALARY",
                      "SERVICES",
                      "SETTLEMENT",
                      "TAX"
                    ]
                  },
                  "purpose": {
                    "type": "string"
                  },
                  "reference": {
                    "type": "string"
                  }
                }
              }
            }
          }
        }
      },
      "get": {
        "summary": "Список переводов",
        "responses": {
          "200": {
            "description": "OK"
          },
          "4XX": {
            "description": "ошибка, тело {error:{code,message}}"
          }
        },
        "security": [
          {
            "bankBearer": []
          }
        ]
      }
    },
    "/v1/transfers/{id}": {
      "get": {
        "summary": "Статус перевода",
        "responses": {
          "200": {
            "description": "OK"
          },
          "4XX": {
            "description": "ошибка, тело {error:{code,message}}"
          }
        },
        "security": [
          {
            "bankBearer": []
          }
        ]
      }
    },
    "/v1/refinancing/loans": {
      "post": {
        "summary": "Запрос кредита ЦБ (кредитор последней инстанции, § 12.1)",
        "responses": {
          "200": {
            "description": "OK"
          },
          "4XX": {
            "description": "ошибка, тело {error:{code,message}}"
          }
        },
        "security": [
          {
            "bankBearer": []
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "amount": {
                    "type": "number"
                  },
                  "term_days": {
                    "type": "integer"
                  },
                  "purpose": {
                    "type": "string"
                  }
                }
              }
            }
          }
        }
      },
      "get": {
        "summary": "Кредиты банка",
        "responses": {
          "200": {
            "description": "OK"
          },
          "4XX": {
            "description": "ошибка, тело {error:{code,message}}"
          }
        },
        "security": [
          {
            "bankBearer": []
          }
        ]
      }
    },
    "/v1/refinancing/loans/{id}/repay": {
      "post": {
        "summary": "Погашение кредита ЦБ",
        "responses": {
          "200": {
            "description": "OK"
          },
          "4XX": {
            "description": "ошибка, тело {error:{code,message}}"
          }
        },
        "security": [
          {
            "bankBearer": []
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "amount": {
                    "type": "number"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/deposits": {
      "post": {
        "summary": "Разместить депозит в ЦБ",
        "responses": {
          "200": {
            "description": "OK"
          },
          "4XX": {
            "description": "ошибка, тело {error:{code,message}}"
          }
        },
        "security": [
          {
            "bankBearer": []
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "amount": {
                    "type": "number"
                  },
                  "term_days": {
                    "type": "integer"
                  }
                }
              }
            }
          }
        }
      },
      "get": {
        "summary": "Депозиты банка",
        "responses": {
          "200": {
            "description": "OK"
          },
          "4XX": {
            "description": "ошибка, тело {error:{code,message}}"
          }
        },
        "security": [
          {
            "bankBearer": []
          }
        ]
      }
    },
    "/v1/deposits/{id}/withdraw": {
      "post": {
        "summary": "Забрать депозит из ЦБ",
        "responses": {
          "200": {
            "description": "OK"
          },
          "4XX": {
            "description": "ошибка, тело {error:{code,message}}"
          }
        },
        "security": [
          {
            "bankBearer": []
          }
        ]
      }
    },
    "/v1/reports": {
      "post": {
        "summary": "Сдать регуляторную отчётность",
        "responses": {
          "200": {
            "description": "OK"
          },
          "4XX": {
            "description": "ошибка, тело {error:{code,message}}"
          }
        },
        "security": [
          {
            "bankBearer": []
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "enum": [
                      "aml",
                      "balance_sheet",
                      "custom",
                      "liquidity",
                      "prudential_ratios"
                    ]
                  },
                  "period": {
                    "type": "string"
                  },
                  "data": {
                    "type": "object"
                  }
                }
              }
            }
          }
        }
      },
      "get": {
        "summary": "Свои отчёты",
        "responses": {
          "200": {
            "description": "OK"
          },
          "4XX": {
            "description": "ошибка, тело {error:{code,message}}"
          }
        },
        "security": [
          {
            "bankBearer": []
          }
        ]
      }
    },
    "/v1/reports/{id}": {
      "get": {
        "summary": "Отчёт",
        "responses": {
          "200": {
            "description": "OK"
          },
          "4XX": {
            "description": "ошибка, тело {error:{code,message}}"
          }
        },
        "security": [
          {
            "bankBearer": []
          }
        ]
      }
    },
    "/v1/documents": {
      "post": {
        "summary": "Отправить документ в ЦБ",
        "responses": {
          "200": {
            "description": "OK"
          },
          "4XX": {
            "description": "ошибка, тело {error:{code,message}}"
          }
        },
        "security": [
          {
            "bankBearer": []
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string"
                  },
                  "subject": {
                    "type": "string"
                  },
                  "body": {
                    "type": "string"
                  }
                }
              }
            }
          }
        }
      },
      "get": {
        "summary": "Входящие/исходящие документы",
        "responses": {
          "200": {
            "description": "OK"
          },
          "4XX": {
            "description": "ошибка, тело {error:{code,message}}"
          }
        },
        "security": [
          {
            "bankBearer": []
          }
        ],
        "parameters": [
          {
            "name": "box",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "inbox",
                "outbox",
                "all"
              ]
            }
          }
        ]
      }
    },
    "/v1/documents/{id}": {
      "get": {
        "summary": "Документ",
        "responses": {
          "200": {
            "description": "OK"
          },
          "4XX": {
            "description": "ошибка, тело {error:{code,message}}"
          }
        },
        "security": [
          {
            "bankBearer": []
          }
        ]
      }
    },
    "/v1/documents/{id}/ack": {
      "post": {
        "summary": "Подтвердить получение",
        "responses": {
          "200": {
            "description": "OK"
          },
          "4XX": {
            "description": "ошибка, тело {error:{code,message}}"
          }
        },
        "security": [
          {
            "bankBearer": []
          }
        ]
      }
    },
    "/v1/programs": {
      "get": {
        "summary": "Доступные программы ЦБ",
        "responses": {
          "200": {
            "description": "OK"
          },
          "4XX": {
            "description": "ошибка, тело {error:{code,message}}"
          }
        },
        "security": [
          {
            "bankBearer": []
          }
        ]
      }
    },
    "/v1/programs/user-grants": {
      "post": {
        "summary": "Стартовая выплата участнику (§ 7.2)",
        "responses": {
          "200": {
            "description": "OK"
          },
          "4XX": {
            "description": "ошибка, тело {error:{code,message}}"
          }
        },
        "security": [
          {
            "bankBearer": []
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "beneficiary_ref": {
                    "type": "string"
                  },
                  "count": {
                    "type": "integer"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/programs/{name}/claims": {
      "post": {
        "summary": "Заявка по программе ЦБ",
        "responses": {
          "200": {
            "description": "OK"
          },
          "4XX": {
            "description": "ошибка, тело {error:{code,message}}"
          }
        },
        "security": [
          {
            "bankBearer": []
          }
        ]
      }
    },
    "/v1/admin/banks": {
      "post": {
        "summary": "Зарегистрировать банк",
        "security": [
          {
            "adminBearer": []
          }
        ]
      }
    },
    "/v1/admin/emission": {
      "post": {
        "summary": "Эмиссия (решение Совета)",
        "security": [
          {
            "adminBearer": []
          }
        ]
      }
    },
    "/v1/admin/queue": {
      "get": {
        "summary": "Очередь на решение",
        "security": [
          {
            "adminBearer": []
          }
        ]
      }
    },
    "/v1/admin/documents": {
      "post": {
        "summary": "Письмо/директива банку",
        "security": [
          {
            "adminBearer": []
          }
        ]
      }
    },
    "/v1/openapi.json": {
      "get": {
        "summary": "Эта спецификация",
        "responses": {
          "200": {
            "description": "OK"
          },
          "4XX": {
            "description": "ошибка, тело {error:{code,message}}"
          }
        }
      }
    },
    "/v1/health": {
      "get": {
        "summary": "Проверка работоспособности",
        "responses": {
          "200": {
            "description": "OK"
          },
          "4XX": {
            "description": "ошибка, тело {error:{code,message}}"
          }
        }
      }
    }
  }
}