Smart Report HTML を取得する
SmartReport のレンダリング済み HTML を、リンクされた batchId、templateId、rowIndex、任意の verificationScore、および対応する row ペイロード(rowIndex、status、inputData、results、errors)とともに取得します。
重要: このエンドポイントは Content-Type: application/json で応答し、生の text/html ドキュメントではなく、data.html 内に HTML 文字列を返します。
エンドポイント
GET https://api.verifik.co/v2/smart-reports/{id}/html
このエンドポイントは、お客様自身のクライアント別 Authorization: Bearer <VERIFIK_JWT> を使用して Smart-Agent プロキシ経由の https://ai.verifik.co/v2/smart-reports/{id}/html からも利用できます。共有 x402 による実行は 403 Forbidden でブロックされます。
ヘッダー
| 名前 | 値 | 説明 |
|---|---|---|
Accept | application/json | JSON エンベロープ形式のレスポンス。 |
Authorization | Bearer <VERIFIK_JWT> | クライアント単位の JWT(authUser.clientId)。 |
パラメータ
| 名前 | 場所 | 型 | 必須 | 説明 |
|---|---|---|---|---|
id | path | string | はい | SmartReport ObjectId。 |
rowIndex | query | integer | いいえ | 0 始まりの行インデックス(>= 0)。 |
preview | query | boolean | いいえ | true の場合はプレビューモードでレンダリングします。 |
score | query | boolean | いいえ | verificationScore を計算して data に含めるかどうか。 |
scoreProfile | query | string | いいえ | score が有効な場合に使用するスコアリングプロファイル識別子(最大 64 文字)。 |
リクエスト
- Node.js
- PHP
- Python
- Go
- cURL
import axios from "axios";
const run = async () => {
const id = "6801a2b3c4d5e6f7a8b9c0d1";
const { data } = await axios.get(`https://api.verifik.co/v2/smart-reports/${id}/html`, {
params: {
rowIndex: 0,
preview: false,
score: true,
},
headers: {
Accept: "application/json",
Authorization: `Bearer ${process.env.VERIFIK_JWT}`,
},
});
console.log({
reportId: data.data.reportId,
htmlLength: data.data.html.length,
rowStatus: data.data.row?.status,
});
};
run();
<?php
$id = "6801a2b3c4d5e6f7a8b9c0d1";
$query = http_build_query([
"rowIndex" => 0,
"preview" => "false",
"score" => "true",
]);
$ch = curl_init("https://api.verifik.co/v2/smart-reports/" . $id . "/html?" . $query);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
"Accept: application/json",
"Authorization: Bearer " . getenv("VERIFIK_JWT"),
]);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
echo $response;
import os
import requests
report_id = "6801a2b3c4d5e6f7a8b9c0d1"
url = f"https://api.verifik.co/v2/smart-reports/{report_id}/html"
headers = {
"Accept": "application/json",
"Authorization": f"Bearer {os.getenv('VERIFIK_JWT')}",
}
params = {
"rowIndex": 0,
"preview": False,
"score": True,
}
response = requests.get(url, params=params, headers=headers)
print(response.json())
package main
import (
"encoding/json"
"fmt"
"net/http"
"net/url"
"os"
)
func main() {
id := "6801a2b3c4d5e6f7a8b9c0d1"
params := url.Values{}
params.Set("rowIndex", "0")
params.Set("preview", "false")
params.Set("score", "true")
req, _ := http.NewRequest("GET", "https://api.verifik.co/v2/smart-reports/"+id+"/html?"+params.Encode(), nil)
req.Header.Set("Accept", "application/json")
req.Header.Set("Authorization", "Bearer "+os.Getenv("VERIFIK_JWT"))
resp, _ := http.DefaultClient.Do(req)
defer resp.Body.Close()
var out map[string]interface{}
json.NewDecoder(resp.Body).Decode(&out)
fmt.Println(out)
}
curl -X GET "https://api.verifik.co/v2/smart-reports/6801a2b3c4d5e6f7a8b9c0d1/html?rowIndex=0&preview=false&score=true" \
-H "Accept: application/json" \
-H "Authorization: Bearer $VERIFIK_JWT"
レスポンス
- 200 OK
- 401
- 403
- 404
- 409
- 422
{
"data": {
"reportId": "6801a2b3c4d5e6f7a8b9c0d1",
"batchId": "6801a2b3c4d5e6f7a8b9c0d3",
"templateId": "6801a2b3c4d5e6f7a8b9c0d2",
"rowIndex": 0,
"html": "<!DOCTYPE html><html><head><meta charset=\"utf-8\" /></head><body><h1>Verification Report</h1></body></html>",
"verificationScore": {},
"row": {
"rowIndex": 0,
"status": "completed",
"inputData": {
"documentType": "CC",
"documentNumber": "1032386359"
},
"results": {},
"errors": []
}
}
}
{
"message": "Unauthorized",
"code": "Unauthorized"
}
{
"message": "Shared x402 execution is forbidden on this endpoint",
"code": "Forbidden"
}
{
"message": "template_not_found",
"code": "NotFound"
}
{
"message": "unknown_score_profile",
"code": "unknown_score_profile"
}
{
"message": "UnprocessableEntity",
"code": "UnprocessableEntity"
}
エラーコード
| ステータス | エラーコード / 種別 | 原因 |
|---|---|---|
401 | Unauthorized | JWT が欠落または無効です。 |
403 | Forbidden | 共有 x402 による実行が試行されました。クライアント別 JWT を使用してください。 |
404 | not_found | レポート ID が存在しないか、別のクライアントに属しています。 |
404 | template_not_found | リンクされたテンプレートが見つかりませんでした。 |
409 | MissingParameter | クエリまたはパスパラメータで Joi 検証に失敗しました。 |
409 | row_not_found | 要求された rowIndex がバッチ内に存在しません。 |
409 | unknown_score_profile | 指定された scoreProfile が認識されません。 |
422 | UnprocessableEntity | Mongoose 検証エラーです。 |
Webhook と MCP 統合
- MCP 相当ツール: AI エージェントは
smart_report_get_htmlMCP ツール経由でレンダリング済みのレポート HTML と行構造を取得できます。詳細は MCP と AI エージェント を参照してください。 - Webhook:
htmlUrlパス(/v2/smart-reports/{id}/html)は Smart Report を実行する、Smart Report を取得する、および Smart Report PDF を生成する のレスポンスに含まれています。詳細は SmartReports Webhook を参照してください。
注記
- HTTP レスポンスは
application/jsonを使用するため、WebView、iframe、または PDF レンダラーに埋め込む前に JSON ペイロードからdata.htmlを抽出してください。 score=trueが渡された場合、data.verificationScoreが返されます。- コンテキストにバッチ行オブジェクトが紐付いていない場合、
data.rowはnullになります。