{
  "openapi": "3.1.0",
  "info": {
    "title": "Bilibili 图文与会话续期 · 上游调用学习参考",
    "version": "1.0.0",
    "description": "学习用上游接口参考，按项目实际调用整理；非官方稳定契约。本项目当前由青龙调用脚本，未开放独立 HTTP 网关。示例为脱敏演示，文档页不会执行请求。"
  },
  "servers": [
    {
      "url": "https://api.bilibili.com"
    }
  ],
  "security": [
    {
      "SESSDATA": [],
      "BiliJct": []
    }
  ],
  "externalDocs": {
    "url": "https://bismih-weekly-docs.pages.dev/bilibili/"
  },
  "paths": {
    "/x/passport-login/web/qrcode/generate": {
      "get": {
        "operationId": "generateLoginQr",
        "summary": "生成官方短时扫码授权请求",
        "description": "上游平台调用参考；没有浏览器在线调试功能。字段未覆盖整个平台协议。",
        "parameters": [],
        "responses": {
          "200": {
            "description": "上游响应，必须同时核对 HTTP 与业务状态",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "code": {
                      "type": "integer"
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "url": {
                          "type": "string",
                          "description": "短时授权 URL，不应公开"
                        },
                        "qrcode_key": {
                          "type": "string",
                          "description": "私有短时查询 key"
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "平台拒绝访问或要求验证；停止并检查会话"
          },
          "429": {
            "description": "平台限流；停止，不自动重发写请求"
          }
        },
        "security": [],
        "servers": [
          {
            "url": "https://passport.bilibili.com"
          }
        ]
      }
    },
    "/x/passport-login/web/qrcode/poll": {
      "get": {
        "operationId": "pollLoginQr",
        "summary": "查询已由本人手机确认的授权",
        "description": "上游平台调用参考；没有浏览器在线调试功能。字段未覆盖整个平台协议。",
        "parameters": [
          {
            "name": "qrcode_key",
            "in": "query",
            "required": true,
            "description": "生成接口返回的短时 key，不填真实值到文档站",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "上游响应，必须同时核对 HTTP 与业务状态",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "code": {
                      "type": "integer"
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "integer",
                          "description": "0 完成；86101 等待扫码；86090 等待确认；86038 过期"
                        },
                        "refresh_token": {
                          "type": "string",
                          "description": "成功后的配套私有续期令牌"
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "平台拒绝访问或要求验证；停止并检查会话"
          },
          "429": {
            "description": "平台限流；停止，不自动重发写请求"
          }
        },
        "security": [],
        "servers": [
          {
            "url": "https://passport.bilibili.com"
          }
        ]
      }
    },
    "/x/web-interface/nav": {
      "get": {
        "operationId": "verifyPublisherIdentity",
        "summary": "验证登录与指定发布 UID",
        "description": "上游平台调用参考；没有浏览器在线调试功能。字段未覆盖整个平台协议。",
        "parameters": [],
        "responses": {
          "200": {
            "description": "上游响应，必须同时核对 HTTP 与业务状态",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                },
                "example": {
                  "code": 0,
                  "data": {
                    "isLogin": true,
                    "mid": 42
                  }
                }
              }
            }
          },
          "403": {
            "description": "平台拒绝访问或要求验证；停止并检查会话"
          },
          "429": {
            "description": "平台限流；停止，不自动重发写请求"
          }
        }
      }
    },
    "/x/passport-login/web/cookie/info": {
      "get": {
        "operationId": "checkCookieRefresh",
        "summary": "只在平台要求时刷新 Cookie",
        "description": "上游平台调用参考；没有浏览器在线调试功能。字段未覆盖整个平台协议。",
        "parameters": [
          {
            "name": "csrf",
            "in": "query",
            "required": false,
            "description": "与会话对应的 bili_jct",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "上游响应，必须同时核对 HTTP 与业务状态",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                },
                "example": {
                  "code": 0,
                  "data": {
                    "refresh": false,
                    "timestamp": 1792970000000
                  }
                }
              }
            }
          },
          "403": {
            "description": "平台拒绝访问或要求验证；停止并检查会话"
          },
          "429": {
            "description": "平台限流；停止，不自动重发写请求"
          }
        },
        "servers": [
          {
            "url": "https://passport.bilibili.com"
          }
        ]
      }
    },
    "/correspond/1/{correspondPath}": {
      "get": {
        "operationId": "readRefreshCsrf",
        "summary": "取得 HTML 中的短时 refresh_csrf",
        "servers": [
          {
            "url": "https://www.bilibili.com"
          }
        ],
        "parameters": [
          {
            "name": "correspondPath",
            "in": "path",
            "required": true,
            "description": "RSA-OAEP / SHA-256 加密 refresh_{毫秒时间戳} 后的十六进制字符串",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "解析 div#1-name，不执行页面 JavaScript",
            "content": {
              "text/html": {
                "schema": {
                  "type": "string",
                  "description": ""
                }
              }
            }
          },
          "404": {
            "description": "路径无效或过期"
          }
        }
      }
    },
    "/x/passport-login/web/cookie/refresh": {
      "post": {
        "operationId": "rotateCookie",
        "summary": "轮换 Cookie 和配套刷新令牌",
        "description": "上游平台调用参考；没有浏览器在线调试功能。字段未覆盖整个平台协议。",
        "parameters": [],
        "responses": {
          "200": {
            "description": "上游响应，必须同时核对 HTTP 与业务状态",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                },
                "example": {
                  "code": 0,
                  "data": {
                    "refresh_token": "REDACTED_NEW_REFRESH_TOKEN"
                  }
                }
              }
            }
          },
          "403": {
            "description": "平台拒绝访问或要求验证；停止并检查会话"
          },
          "429": {
            "description": "平台限流；停止，不自动重发写请求"
          }
        },
        "servers": [
          {
            "url": "https://passport.bilibili.com"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/x-www-form-urlencoded": {
              "schema": {
                "type": "object",
                "required": [
                  "csrf",
                  "refresh_csrf",
                  "source",
                  "refresh_token"
                ],
                "properties": {
                  "csrf": {
                    "type": "string",
                    "description": "旧会话 bili_jct"
                  },
                  "refresh_csrf": {
                    "type": "string",
                    "description": "从短时 HTML 得到的口令"
                  },
                  "source": {
                    "type": "string",
                    "const": "main_web"
                  },
                  "refresh_token": {
                    "type": "string",
                    "description": "旧的配套续期令牌"
                  }
                },
                "additionalProperties": true
              }
            }
          }
        }
      }
    },
    "/x/passport-login/web/confirm/refresh": {
      "post": {
        "operationId": "confirmCookieRotation",
        "summary": "在新会话持久化并验证之后确认旧会话失效",
        "description": "上游平台调用参考；没有浏览器在线调试功能。字段未覆盖整个平台协议。",
        "parameters": [],
        "responses": {
          "200": {
            "description": "上游响应，必须同时核对 HTTP 与业务状态",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                },
                "example": {
                  "code": 0
                }
              }
            }
          },
          "403": {
            "description": "平台拒绝访问或要求验证；停止并检查会话"
          },
          "429": {
            "description": "平台限流；停止，不自动重发写请求"
          }
        },
        "servers": [
          {
            "url": "https://passport.bilibili.com"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/x-www-form-urlencoded": {
              "schema": {
                "type": "object",
                "required": [
                  "csrf",
                  "refresh_token"
                ],
                "properties": {
                  "csrf": {
                    "type": "string",
                    "description": "新会话 bili_jct"
                  },
                  "refresh_token": {
                    "type": "string",
                    "description": "旧的续期令牌"
                  }
                },
                "additionalProperties": true
              }
            }
          }
        }
      }
    },
    "/x/article/creative/article/upcover": {
      "post": {
        "operationId": "uploadArticleImage",
        "summary": "上传一张已校验图片",
        "description": "上游平台调用参考；没有浏览器在线调试功能。字段未覆盖整个平台协议。",
        "parameters": [],
        "responses": {
          "200": {
            "description": "上游响应，必须同时核对 HTTP 与业务状态",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                },
                "example": {
                  "code": 0,
                  "data": {
                    "url": "https://article.biliimg.com/example-image.jpg"
                  }
                }
              }
            }
          },
          "403": {
            "description": "平台拒绝访问或要求验证；停止并检查会话"
          },
          "429": {
            "description": "平台限流；停止，不自动重发写请求"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "required": [
                  "csrf",
                  "binary"
                ],
                "properties": {
                  "csrf": {
                    "type": "string",
                    "description": "当前 bili_jct"
                  },
                  "binary": {
                    "type": "string",
                    "format": "binary"
                  }
                },
                "additionalProperties": true
              }
            }
          }
        }
      }
    },
    "/x/dynamic/feed/create/opus": {
      "post": {
        "operationId": "submitWeeklyOpus",
        "summary": "实际投稿；必须先持久化防重复预留",
        "description": "上游平台调用参考；没有浏览器在线调试功能。字段未覆盖整个平台协议。",
        "parameters": [
          {
            "name": "csrf",
            "in": "query",
            "required": true,
            "description": "当前会话 bili_jct",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "gaia_source",
            "in": "query",
            "required": true,
            "description": "",
            "schema": {
              "type": "string"
            },
            "example": "main_web"
          }
        ],
        "responses": {
          "200": {
            "description": "上游响应，必须同时核对 HTTP 与业务状态",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                },
                "example": {
                  "code": 0,
                  "data": {
                    "dyn_id_str": "123456789",
                    "dyn_rid": 456789
                  }
                }
              }
            }
          },
          "403": {
            "description": "平台拒绝访问或要求验证；停止并检查会话"
          },
          "429": {
            "description": "平台限流；停止，不自动重发写请求"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "raw_content",
                  "opus_req"
                ],
                "properties": {
                  "raw_content": {
                    "type": "string",
                    "description": ""
                  },
                  "opus_req": {
                    "type": "object",
                    "required": [
                      "upload_id",
                      "opus",
                      "scene",
                      "meta",
                      "option"
                    ],
                    "properties": {
                      "upload_id": {
                        "type": "string",
                        "description": ""
                      },
                      "opus": {
                        "type": "object",
                        "additionalProperties": true
                      },
                      "scene": {
                        "type": "integer"
                      },
                      "meta": {
                        "type": "object",
                        "additionalProperties": true
                      },
                      "option": {
                        "type": "object",
                        "additionalProperties": true
                      }
                    },
                    "additionalProperties": true
                  }
                },
                "additionalProperties": true
              },
              "example": {
                "raw_content": "",
                "opus_req": {
                  "upload_id": "42_1792970000_0001",
                  "opus": {
                    "opus_source": 2,
                    "title": "Pixiv 每周插画榜 · 示例日期",
                    "content": {
                      "paragraphs": [
                        {
                          "para_type": 1,
                          "format": {},
                          "text": {
                            "nodes": [
                              {
                                "node_type": 1,
                                "word": {
                                  "words": "示例说明：内容版权归原作者，请查看原作链接。",
                                  "font_size": 17,
                                  "font_level": "regular",
                                  "color": "",
                                  "dark_color": "",
                                  "style": {}
                                }
                              }
                            ]
                          }
                        },
                        {
                          "para_type": 2,
                          "pic": {
                            "style": 0,
                            "pics": [
                              {
                                "url": "https://article.biliimg.com/example-image.jpg",
                                "width": 800,
                                "height": 600,
                                "size": 128.0
                              }
                            ]
                          }
                        },
                        {
                          "para_type": 1,
                          "format": {},
                          "text": {
                            "nodes": [
                              {
                                "node_type": 1,
                                "word": {
                                  "words": "原作：https://www.pixiv.net/artworks/123456789",
                                  "font_size": 17,
                                  "font_level": "regular",
                                  "color": "",
                                  "dark_color": "",
                                  "style": {}
                                }
                              }
                            ]
                          }
                        }
                      ]
                    },
                    "article": {
                      "category_id": 15,
                      "list_id": 0,
                      "originality": 0,
                      "reproduced": 1,
                      "biz_tags": [
                        "Pixiv",
                        "插画",
                        "周榜"
                      ],
                      "cover": [
                        {
                          "url": "https://article.biliimg.com/example-image.jpg",
                          "width": 800,
                          "height": 600,
                          "size": 128.0
                        }
                      ]
                    },
                    "pub_info": {
                      "editor_version": "eva3-4.0.0"
                    }
                  },
                  "scene": 12,
                  "meta": {
                    "app_meta": {
                      "mobi_app": "web",
                      "from": "create.creative.h5"
                    }
                  },
                  "option": {
                    "aigc": 2,
                    "close_comment": 0,
                    "up_choose_comment": 0,
                    "private_pub": 2
                  }
                }
              }
            }
          }
        }
      }
    },
    "/x/article/creative/article/view": {
      "get": {
        "operationId": "confirmSubmittedArticle",
        "summary": "按已有稿件编号确认平台状态，不再次投稿",
        "description": "上游平台调用参考；没有浏览器在线调试功能。字段未覆盖整个平台协议。",
        "parameters": [
          {
            "name": "aid",
            "in": "query",
            "required": true,
            "description": "保存的文章编号",
            "schema": {
              "type": "string"
            },
            "example": "456789"
          }
        ],
        "responses": {
          "200": {
            "description": "上游响应，必须同时核对 HTTP 与业务状态",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "code": {
                      "type": "integer"
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "state": {
                          "type": "integer",
                          "description": "本实现只对 0/9 确认发布；其他值待核对，不定义整个平台枚举"
                        }
                      }
                    }
                  }
                },
                "example": {
                  "code": 0,
                  "data": {
                    "state": 0
                  }
                }
              }
            }
          },
          "403": {
            "description": "平台拒绝访问或要求验证；停止并检查会话"
          },
          "429": {
            "description": "平台限流；停止，不自动重发写请求"
          }
        }
      }
    }
  },
  "x-implementation": "https://github.com/lizi-learn/bismih-weekly-publisher",
  "x-verified-baseline": "2026-10-26",
  "x-project-http-gateway": false,
  "components": {
    "securitySchemes": {
      "SESSDATA": {
        "type": "apiKey",
        "in": "cookie",
        "name": "SESSDATA",
        "description": "自己的有效网页登录会话"
      },
      "BiliJct": {
        "type": "apiKey",
        "in": "cookie",
        "name": "bili_jct",
        "description": "与会话配套的 CSRF Cookie"
      }
    }
  }
}
