便签 APIdeveloper docs

接入文档

三种方式,覆盖 99% 场景。全部 CORS 开放,可直接跨域引用。

方式一
IMG 标签
最简单,一行 html,适合 Markdown/博客
方式二
JS Widget
可点赞,Shadow DOM 隔离,样式不受宿主影响
方式三
REST API
拿 JSON 自己渲染,最灵活

方式一:IMG 标签

直接返回图片,每日自动更换。

<!-- 今日语录卡片 4:3 -->
<img src="https://api.bianqian.app/v1/quote/daily?spec=card&theme=ink-wash&format=image" 
     alt="今日语录" loading="lazy" />

<!-- 方形 1:1 朋友圈 -->
<img src="https://api.bianqian.app/v1/quote/daily?spec=square&format=image" />

<!-- 横图 16:9 博客头图 -->
<img src="https://api.bianqian.app/v1/quote/daily?spec=landscape&format=image" />

方式二:JS Widget(可点赞)

<div id="xf-quote"></div>
<script src="https://static.bianqian.app/embed.js"
  data-api="https://api.bianqian.app/v1"
  data-spec="card"          <!-- square/card/landscape/portrait/pinterest/fluid -->
  data-theme="ink-wash"     <!-- 见下方主题表 -->
  data-id="daily"           <!-- daily/random/具体id -->
  data-show-like="true"     <!-- 显示点赞按钮 -->
  data-target="xf-quote"></script>

方式三:REST API

GET/v1/quote/daily
返回今日精选语录 + 图片 URL。参数:
参数类型说明
specstringsquare/card/landscape/portrait/pinterest/fluid
themestringink-wash/minimal-black/paper-texture/dark-mist/bauhaus/minimal-white
formatstringjson(默认)/image(302到图片)/html(返回html卡片)
GET/v1/quote/random?tag=治愈
随机返回一条,可按 tag 或情绪过滤。
GET/v1/quote/:id
按 id 查询语录详情 + 所有图片规格。
POST/v1/like
点赞,数据回流。防刷:同 IP+指纹 24h 一次。
{ "quoteId": "xxx", "fpHash": "可选指纹" }

尺寸规格

square1080×1080 1:1朋友圈/小组件
card1200×900 4:3文章内联
landscape1920×1080 16:9博客头图/OG
portrait1080×1920 9:16Story/壁纸
pinterest1000×1500 2:3高点击
fluid800×auto 自适应JS嵌入

主题 Theme

ink-wash水墨
Chinese ink wash, rice paper, Zen empty space
minimal-black极简白
minimal white, soft light, clean texture
minimal-white极简黑
dark minimal, moody, empty space
paper-texture纸纹
handmade paper, warm light
dark-mist暗雾
dark foggy forest, cinematic
bauhaus包豪斯
bauhaus geometric, muted colors

数据回流

每次点赞通过 POST /v1/like 回流到便签总后台, 记录 quoteId、来源域名(Referer)、IP 指纹。你可以在管理后台看到:热门语录、点赞率排行、引用域名排行。