松智云

松智云 API 接入文档

RESTful 接口 · 5 分钟快速接入 · 多语言 SDK

鉴权方式

所有 API 请求需要 Header: Authorization: Bearer <API_KEY>

在控制台 → API 密钥管理创建和管理你的密钥。

提交截图

POST /api/v1/screenshot

请求参数

参数类型默认说明
urlstring必填网页地址,含 http(s)://
widthint1280视口宽度(像素)
heightint720视口高度(像素)
fullPageboolfalse全页截图(长图)
mobileboolfalse移动端模拟(375宽)
waitMsint0页面加载后额外等待(毫秒)
formatstringpng输出格式:png / jpeg / webp / pdf
qualityint90图片质量 1-100(jpeg/webp)
adBlockbooltrue广告拦截
watermark.textstring-水印文字
watermark.positionstringbottom-right水印位置
watermark.opacityint50水印透明度 0-100

cURL 示例

curl -X POST https://api.songzhiyun.com/api/v1/screenshot \
  -H "Authorization: Bearer <API_KEY>" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://example.com",
    "width": 1280,
    "height": 720,
    "format": "png"
  }'

Node.js 示例

const resp = await fetch('https://api.songzhiyun.com/api/v1/screenshot', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer <API_KEY>',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({ url: 'https://example.com', width: 1280 })
});
const data = await resp.json();

Python 示例

import requests
resp = requests.post(
    'https://api.songzhiyun.com/api/v1/screenshot',
    headers={'Authorization': 'Bearer <API_KEY>'},
    json={'url': 'https://example.com', 'width': 1280}
)
data = resp.json()

Java 示例

var client = HttpClient.newHttpClient();
var req = HttpRequest.newBuilder()
    .uri(URI.create("https://api.songzhiyun.com/api/v1/screenshot"))
    .header("Authorization", "Bearer <API_KEY>")
    .header("Content-Type", "application/json")
    .POST(HttpRequest.BodyPublishers.ofString("{\"url\":\"https://example.com\"}"))
    .build();
var resp = client.send(req, HttpResponse.BodyHandlers.ofString());

响应

{
  "code": 0,
  "msg": "ok",
  "data": {
    "taskId": "d55c14cac3da46deba9edfdf2d0f670e",
    "status": "pending",
    "estimatedSeconds": 8
  }
}

查询结果

GET /api/v1/screenshot/{taskId}

cURL 示例

curl https://api.songzhiyun.com/api/v1/screenshot/{task_id} \
  -H "Authorization: Bearer <API_KEY>"

响应(完成时)

{
  "code": 0,
  "data": {
    "taskId": "d55c14cac3da46deba9edfdf2d0f670e",
    "status": "done",
    "imageUrl": "/screenshots/d55c14cac3da46deba9edfdf2d0f670e.png",
    "durationMs": 1317,
    "imageSize": 15542
  }
}

像素对比

POST /api/v1/screenshot/compare
curl -X POST https://api.songzhiyun.com/api/v1/screenshot/compare \
  -H "Authorization: Bearer <API_KEY>" \
  -H "Content-Type: application/json" \
  -d '{"imageUrl1":"/screenshots/aaa.png","imageUrl2":"/screenshots/bbb.png"}'

错误码

code说明
0成功
1001参数错误或资源不存在
1002缺少认证信息
1003配额超限
1004并发超限
1006速率限制
5000服务器内部错误