image-advertisement-detection
圖片廣告檢測
自動檢測圖片中是否存在水印、二維碼、條形碼及小程式碼等廣告特徵,返回違規型別與置信度,輔助平臺內容稽覈。
呼叫價格
5 匠幣/次
快速接入
保持統一返回結構,直接透過服務端發起請求即可接入。
https://openapi.toolkk.com/v1/image-advertisement-detectioncURL 示例
curl --request POST \
--url 'https://openapi.toolkk.com/v1/image-advertisement-detection' \
--header 'Content-Type: application/json' \
--header 'X-API-Key: YOUR_API_KEY' \
--data '{\n "imageBase64": "iVBORw0KGgo...",\n "imgType": "0"\n}'Python 示例
import os
import requests
url = "https://openapi.toolkk.com/v1/image-advertisement-detection"
payload = {
"imageBase64": "iVBORw0KGgo...",
"imgType": "0"
}
headers = {
"Content-Type": "application/json",
"X-API-Key": os.getenv("TOOLKK_API_KEY", "YOUR_API_KEY"),
}
response = requests.request("POST", url, headers=headers, json=payload, timeout=30)
response.raise_for_status()
print(response.json())Go 示例
package main
import (
"bytes"
"fmt"
"io"
"net/http"
)
func main() {
endpoint := "https://openapi.toolkk.com/v1/image-advertisement-detection"
payload := []byte("{\n \"imageBase64\": \"iVBORw0KGgo...\",\n \"imgType\": \"0\"\n}")
req, err := http.NewRequest("POST", endpoint, bytes.NewBuffer(payload))
if err != nil {
panic(err)
}
req.Header.Set("Content-Type", "application/json")
req.Header.Set("X-API-Key", "YOUR_API_KEY")
resp, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
body, err := io.ReadAll(resp.Body)
if err != nil {
panic(err)
}
fmt.Println(string(body))
}Java 示例
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class ToolkkExample {
public static void main(String[] args) throws Exception {
String payload = "{\n \"imageBase64\": \"iVBORw0KGgo...\",\n \"imgType\": \"0\"\n}";
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://openapi.toolkk.com/v1/image-advertisement-detection"))
.method("POST", HttpRequest.BodyPublishers.ofString(payload))
.header("Content-Type", "application/json")
.header("X-API-Key", "YOUR_API_KEY")
.build();
HttpResponse<String> response = HttpClient.newHttpClient()
.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
}
}PHP 示例
<?php
$endpoint = 'https://openapi.toolkk.com/v1/image-advertisement-detection';
$payload = "{\n \"imageBase64\": \"iVBORw0KGgo...\",\n \"imgType\": \"0\"\n}";
$ch = curl_init($endpoint);
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_HTTPHEADER => [
'Content-Type: application/json',
'X-API-Key: YOUR_API_KEY',
],
CURLOPT_POSTFIELDS => $payload,
]);
$response = curl_exec($ch);
if ($response === false) {
throw new RuntimeException(curl_error($ch));
}
curl_close($ch);
echo $response;響應示例
{
"result": "2",
"resultMsg": "不合规",
"resultItems": [
{
"nonComplianceType": 0,
"msg": "存在水印",
"probability": 0.91
}
]
}範例用於理解回傳結構,實際結果以介面回傳為準。
- 鑑權方式
- 請求頭傳入 X-API-Key
- 預設限流
- 20 次/分鐘
- 超時時間
- 30000 ms
服務端呼叫時,將 API Key 放在 X-API-Key 請求頭中。
建議按 response code 與業務欄位雙重判斷呼叫結果。
高頻呼叫場景請結合速率限制與重試策略使用。
請求欄位
從伺服器發起請求,並在 X-API-Key 標頭中傳入金鑰。
請求欄位
以下欄位根據示例 JSON 自動提取,僅作接入參考。
| 欄位路徑 | 型別 | 必填 | 說明 | 示例值 |
|---|---|---|---|---|
| imageBase64 | string | 未標註 | 未標註 | iVBORw0KGgo... |
| imgType | string | 未標註 | 未標註 | 0 |
請求示例
{
"imageBase64": "iVBORw0KGgo...",
"imgType": "0"
}- 鑑權方式
- 請求頭傳入 X-API-Key
- 預設限流
- 20 次/分鐘
- 超時時間
- 30000 ms
響應欄位
範例用於理解回傳結構,實際結果以介面回傳為準。
響應欄位
以下欄位根據示例 JSON 自動提取,僅作接入參考。
| 欄位路徑 | 型別 | 必填 | 說明 | 示例值 |
|---|---|---|---|---|
| result | string | 未標註 | 未標註 | 2 |
| resultMsg | string | 未標註 | 未標註 | 不合规 |
| resultItems | array | 未標註 | 未標註 | [{"nonComplianceType":0,"msg":"存在水印","probability":0.91}] |
| resultItems[] | object | 未標註 | 未標註 | {...} |
| resultItems[].nonComplianceType | number | 未標註 | 未標註 | 0 |
| resultItems[].msg | string | 未標註 | 未標註 | 存在水印 |
| resultItems[].probability | number | 未標註 | 未標註 | 0.91 |
響應示例
{
"result": "2",
"resultMsg": "不合规",
"resultItems": [
{
"nonComplianceType": 0,
"msg": "存在水印",
"probability": 0.91
}
]
}$.code == 200介面簡介
介面功能、應用情境、使用限制與常見問題。
介面能力
本介面專注於圖片廣告特徵的自動化檢測。透過分析上傳圖片的 Base64 編碼,系統能夠高效識別圖片中可能隱藏的各類廣告元素,包括但不限於水印、二維碼、條形碼和小程式碼。介面會返回整體的合規判定結果、具體的違規型別說明以及相應的置信度機率,幫助開發者快速過濾違規營銷圖片。
請求與返回
- 請求引數:需傳入
imageBase64(待檢測圖片的 Base64 編碼)和imgType(圖片型別或場景標識,如 "0")。 - 返回結果:返回 JSON 格式的檢測報告,包含
result(整體判定狀態碼,如 2 表示不合規)、resultMsg(判定結果說明)以及resultItems(具體的違規項列表)。違規項中會詳細列出nonComplianceType(違規型別程式碼)、msg(如“存在水印”)和probability(置信度機率)。
使用場景
廣泛應用於社羣論壇、電商平臺、社交媒體、使用者頭像及評論配圖的內容安全稽覈,有效防範惡意引流、垃圾廣告和違規營銷內容的傳播。
使用說明與限制
- 輔助稽覈:本介面的檢測結果僅用於內容稽覈的輔助參考,不等同於平臺的最終合規結論,建議結合人工複審機制使用。
- 隱私保護:在提交檢測前,請提醒使用者或在系統層面最小化提交包含敏感個人資訊的圖片。ToolKK 不落盤儲存上傳的圖片;第三方服務商的資料處理受其服務條款約束。
- 錯誤排查:若介面返回異常,請優先檢查 Base64 字串是否完整、圖片體積是否過大,以及 引數是否符合規範要求。