请求与设备信息
查看访问者与 Cloudflare 连接信息
GET
/visitor公开访问curl
返回当前请求的 Cloudflare 连接、地理和 TLS ClientHello 摘要。字段始终齐全,边缘未提供时为 null。tlsClient 始终为对象。不返回 tlsClientRandom。 访问类别:匿名 API,可携带 Token 使用独立额度
请求参数
_formatquery- 响应格式为 json 或 text;_format=svg 返回 JSON。plain 是 text 的别名。未识别的值继续按 Accept 协商。
- string · 可选:json、text
_colorquery- 控制 text 响应的 ANSI 颜色。0、false、off、no 关闭;省略或其他值保留。
- string · 可选:0、false、off、no
响应
200 请求处理结果
application/json
{
"ip": null,
"source": "cloudflare",
"country": null,
"city": null,
"continent": null,
"region": null,
"regionCode": null,
"postalCode": null,
"timezone": null,
"latitude": null,
"longitude": null,
"asOrganization": null,
"asn": null,
"colo": null,
"cfRay": null,
"httpProtocol": null,
"tlsVersion": null,
"tlsCipher": null,
"clientTcpRtt": null,
"clientQuicRtt": null,
"edgeL4": {
"deliveryRate": null
},
"clientAcceptEncoding": null,
"metroCode": null,
"isEUCountry": null,
"requestPriority": null,
"tlsClient": {
"helloLength": null,
"ciphersSha1": null,
"extensionsSha1": null,
"extensionsSha1Le": null
}
}400 参数或请求格式无效
application/json
{
"type": "object",
"properties": {
"error": {
"type": "object",
"properties": {
"code": {
"type": "string"
},
"message": {
"type": "string"
},
"issues": {
"type": "array",
"items": {
"type": "object",
"properties": {
"location": {
"type": "string",
"enum": [
"body",
"query",
"path",
"header"
]
},
"field": {
"type": "string"
},
"code": {
"type": "string"
},
"message": {
"type": "string"
}
},
"required": [
"location",
"field",
"code",
"message"
]
}
}
},
"required": [
"code",
"message"
]
}
},
"required": [
"error"
]
}401 凭据无效、停用、过期或缺少所需 Token
application/json
{
"type": "object",
"properties": {
"error": {
"type": "object",
"properties": {
"code": {
"type": "string"
},
"message": {
"type": "string"
},
"issues": {
"type": "array",
"items": {
"type": "object",
"properties": {
"location": {
"type": "string",
"enum": [
"body",
"query",
"path",
"header"
]
},
"field": {
"type": "string"
},
"code": {
"type": "string"
},
"message": {
"type": "string"
}
},
"required": [
"location",
"field",
"code",
"message"
]
}
}
},
"required": [
"code",
"message"
]
}
},
"required": [
"error"
]
}403 需要管理员 Token
application/json
{
"type": "object",
"properties": {
"error": {
"type": "object",
"properties": {
"code": {
"type": "string"
},
"message": {
"type": "string"
},
"issues": {
"type": "array",
"items": {
"type": "object",
"properties": {
"location": {
"type": "string",
"enum": [
"body",
"query",
"path",
"header"
]
},
"field": {
"type": "string"
},
"code": {
"type": "string"
},
"message": {
"type": "string"
}
},
"required": [
"location",
"field",
"code",
"message"
]
}
}
},
"required": [
"code",
"message"
]
}
},
"required": [
"error"
]
}413 请求体过大
application/json
{
"type": "object",
"properties": {
"error": {
"type": "object",
"properties": {
"code": {
"type": "string"
},
"message": {
"type": "string"
},
"issues": {
"type": "array",
"items": {
"type": "object",
"properties": {
"location": {
"type": "string",
"enum": [
"body",
"query",
"path",
"header"
]
},
"field": {
"type": "string"
},
"code": {
"type": "string"
},
"message": {
"type": "string"
}
},
"required": [
"location",
"field",
"code",
"message"
]
}
}
},
"required": [
"code",
"message"
]
}
},
"required": [
"error"
]
}415 请求内容类型无效
application/json
{
"type": "object",
"properties": {
"error": {
"type": "object",
"properties": {
"code": {
"type": "string"
},
"message": {
"type": "string"
},
"issues": {
"type": "array",
"items": {
"type": "object",
"properties": {
"location": {
"type": "string",
"enum": [
"body",
"query",
"path",
"header"
]
},
"field": {
"type": "string"
},
"code": {
"type": "string"
},
"message": {
"type": "string"
}
},
"required": [
"location",
"field",
"code",
"message"
]
}
}
},
"required": [
"code",
"message"
]
}
},
"required": [
"error"
]
}429 请求过于频繁,Retry-After 为建议等待秒数;匿名额度及认证保护在各 Cloudflare 地点近似计数,Token 业务额度使用 D1 原子计数
application/json
{
"type": "object",
"properties": {
"error": {
"type": "object",
"properties": {
"code": {
"type": "string"
},
"message": {
"type": "string"
},
"issues": {
"type": "array",
"items": {
"type": "object",
"properties": {
"location": {
"type": "string",
"enum": [
"body",
"query",
"path",
"header"
]
},
"field": {
"type": "string"
},
"code": {
"type": "string"
},
"message": {
"type": "string"
}
},
"required": [
"location",
"field",
"code",
"message"
]
}
}
},
"required": [
"code",
"message"
]
}
},
"required": [
"error"
]
}500 内部执行失败
application/json
{
"type": "object",
"properties": {
"error": {
"type": "object",
"properties": {
"code": {
"type": "string"
},
"message": {
"type": "string"
},
"issues": {
"type": "array",
"items": {
"type": "object",
"properties": {
"location": {
"type": "string",
"enum": [
"body",
"query",
"path",
"header"
]
},
"field": {
"type": "string"
},
"code": {
"type": "string"
},
"message": {
"type": "string"
}
},
"required": [
"location",
"field",
"code",
"message"
]
}
}
},
"required": [
"code",
"message"
]
}
},
"required": [
"error"
]
}响应示例
运行命令前,将环境变量 BASE_URL 设置为站点地址。
成功响应
curl --silent --show-error -H 'User-Agent: simpleWebUtils-example/2.0.1' -H 'Accept: application/json' "$BASE_URL"'/visitor'
HTTP 200
content-type: application/json
content-encoding: gzip
cache-control: no-store
{
"ip": "127.0.0.1",
"source": "cloudflare",
"country": "JP",
"city": "Tokyo",
"continent": "AS",
"region": "Tokyo",
"regionCode": "13",
"postalCode": "101-8656",
"timezone": "Asia/Tokyo",
"latitude": "35.6895",
"longitude": "139.69171",
"asOrganization": "Astrix Co., Ltd.",
"asn": 36530,
"colo": "NRT",
"cfRay": null,
"httpProtocol": "HTTP/1.1",
"tlsVersion": "TLSv1.3",
"tlsCipher": "AEAD-AES256-GCM-SHA384",
"clientTcpRtt": 0,
"clientQuicRtt": null,
"edgeL4": {
"deliveryRate": 3489214
},
"clientAcceptEncoding": "gzip, deflate",
"metroCode": null,
"isEUCountry": false,
"requestPriority": null,
"tlsClient": {
"helloLength": 1605,
"ciphersSha1": "kXrN3VEKDdzz2cPKTQaKzpxVTxQ=",
"extensionsSha1": "1eY97BUYYO8vDaTfHQywB1pcNdM=",
"extensionsSha1Le": "u4wtEMFQBY18l3BzHAvORm+KGRw="
}
}错误示例
curl --silent --show-error -X PATCH -H 'User-Agent: simpleWebUtils-example/2.0.1' -H 'Accept: application/json' "$BASE_URL"'/visitor'
HTTP 405
content-type: application/json
content-encoding: gzip
cache-control: no-store
{
"error": {
"code": "METHOD_NOT_ALLOWED",
"message": "接口不支持该请求方法"
}
}curl 访问示例
curl、wget、HTTPie 默认得到 text/plain。示例展示纯文本输出。
命令与输出
curl --silent --show-error -H 'User-Agent: curl/8.7.1' "$BASE_URL"'/visitor?_color=0'
HTTP 200 content-type: text/plain; charset=utf-8 content-encoding: gzip cache-control: no-store ip: 127.0.0.1 source: cloudflare country: JP city: Tokyo continent: AS region: Tokyo regionCode: 13 postalCode: 101-8656 timezone: Asia/Tokyo latitude: 35.6895 longitude: 139.69171 asOrganization: Astrix Co., Ltd. asn: 36530 colo: NRT cfRay: null httpProtocol: HTTP/1.1 tlsVersion: TLSv1.3 tlsCipher: AEAD-AES256-GCM-SHA384 clientTcpRtt: 0 clientQuicRtt: null edgeL4: deliveryRate: 3489214 clientAcceptEncoding: gzip, deflate metroCode: null isEUCountry: false requestPriority: null tlsClient: helloLength: 1605 ciphersSha1: kXrN3VEKDdzz2cPKTQaKzpxVTxQ= extensionsSha1: 1eY97BUYYO8vDaTfHQywB1pcNdM= extensionsSha1Le: u4wtEMFQBY18l3BzHAvORm+KGRw=
在线调试
调用示例
curl -X GET 'https://oit.sh/visitor'
响应
等待发送请求
配置上方请求参数后点击「发送请求」查看实时响应
快捷键:Ctrl / ⌘ + Enter