Skip to main content

Smart Report 생성

기존 template 및 smartBatch에 연결된 초안 SmartReport 레코드(status: "draft")를 생성합니다. 이미 완료되었거나 진행 중인 SmartBatch가 있고 리포트 생성, PDF 생성, HTML 조회 및 이메일 전송을 개별 단계로 관리하려는 경우 이 엔드포인트를 사용하세요.

초안 레코드가 생성되면 { data }에 새 SmartReport를 담아 HTTP **200 OK**를 반환합니다. 이 호출 자체만으로는 검증 단계를 실행하거나 PDF를 렌더링하지 않으므로, 후속으로 Smart Report PDF 생성 또는 이메일로 Smart Report 전송을 호출해야 합니다. 단일 요청으로 검증 단계 실행과 리포트 생성을 모두 처리하려면 Smart Report 실행을 사용하세요.

엔드포인트​

POST https://api.verifik.co/v2/smart-reports

이 엔드포인트는 본인의 클라이언트별 Authorization: Bearer <VERIFIK_JWT>를 사용하여 Smart-Agent 프록시(https://ai.verifik.co/v2/smart-reports)를 통해서도 호출할 수 있습니다. 공유 x402 실행은 403 Forbidden으로 차단됩니다.

헤더​

이름값설명
Content-Typeapplication/json요청 페이로드 형식.
AuthorizationBearer <VERIFIK_JWT>클라이언트 범위 JWT (authUser.clientId).

요청 본문​

이름타입필수설명
templatestring예이 리포트를 렌더링할 기준 템플릿 ObjectId.
smartBatchstring예검증 행 결과를 제공하는 SmartBatch ObjectId.
namestring아니요리포트의 표시 이름. 최대 150자.
externalRefIdstring아니요호출자 상관관계 식별자. 최대 200자.
webhookUrlstring아니요리포트별 http 또는 https 웹훅 재정의 URL. 최대 2048자.
rowIndexinteger아니요연결된 SmartBatch에서 0부터 시작하는 행 인덱스(>= 0).
createdByChannelstring아니요발생 채널: "portal", "api", "mcp", "x402" 또는 "webhook". 기본값 "portal".

단계별 워크플로 vs 헤드리스 실행​

  • 워크플로에서 이미 SmartBatch(예: SmartBatch UI 또는 큐 API를 통해)를 실행했고 먼저 초안 SmartReport(status: "draft")를 만든 뒤 Smart Report HTML 조회로 HTML을 미리 보고, Smart Report PDF 생성으로 PDF를 렌더링하며, 이메일로 Smart Report 전송으로 전달하려는 경우 POST /v2/smart-reports를 사용하세요.
  • 이 라우트에서 createdByChannel의 기본값은 "portal"이므로, 채널 기여도 추적이 필요한 API 연동에서는 createdByChannel: "api"를 설정하세요.

요청​

import axios from "axios";

const run = async () => {
const { data } = await axios.post(
"https://api.verifik.co/v2/smart-reports",
{
template: "6801a2b3c4d5e6f7a8b9c0d2",
smartBatch: "6801a2b3c4d5e6f7a8b9c0d3",
name: "Applicant 42 Draft Report",
externalRefId: "applicant-42",
webhookUrl: "https://webhooks.example.com/verifik",
rowIndex: 0,
createdByChannel: "api",
},
{
headers: {
"Content-Type": "application/json",
Authorization: `Bearer ${process.env.VERIFIK_JWT}`,
},
}
);

console.log(data);
};

run();

응답​

{
"data": {
"_id": "6801a2b3c4d5e6f7a8b9c0d1",
"template": "6801a2b3c4d5e6f7a8b9c0d2",
"smartBatch": "6801a2b3c4d5e6f7a8b9c0d3",
"name": "Applicant 42 Draft Report",
"status": "draft",
"externalRefId": "applicant-42",
"webhookUrl": "https://webhooks.example.com/verifik",
"rowIndex": 0,
"createdByChannel": "api",
"createdAt": "2026-11-24T20:00:00.000Z",
"updatedAt": "2026-11-24T20:00:00.000Z"
}
}

웹훅 및 MCP 연동​

  • 웹훅: 초안 SmartReport에 webhookUrl과 externalRefId를 저장하면, 이후 PDF 생성(smart_batch_report_generated, smart_batch_report_generation_failed) 및 이메일 전송(smart_batch_report_sent, smart_batch_report_delivery_failed) 호출 시 리포트별 콜백 대상과 상관관계 식별자를 상속합니다. SmartReports 웹훅을 참조하세요.
  • MCP 연동: AI 에이전트에서 단일 호출 헤드리스 리포트 실행이 필요한 경우 smart_report_run을 사용하세요. MCP 및 AI 에이전트를 참조하세요.

참고 사항​

관련 문서​