Créer un Smart Report
Créez un enregistrement brouillon SmartReport (status: "draft") lié à un template et à un smartBatch existants. Utilisez ce point de terminaison lorsque vous disposez déjà d'un SmartBatch terminé ou en cours et que vous souhaitez gérer la création du rapport, la génération PDF, la récupération HTML et l'envoi par e-mail en étapes distinctes.
La création d'un enregistrement brouillon renvoie HTTP 200 OK avec le nouveau SmartReport dans { data }. Elle n'exécute pas d'étapes de vérification et ne génère pas de PDF par elle-même — enchaînez avec Générer le PDF d'un Smart Report ou Envoyer un Smart Report par e-mail. Si vous souhaitez exécuter les étapes de vérification et produire un rapport en une seule requête, utilisez Exécuter un Smart Report.
Point de terminaison
POST https://api.verifik.co/v2/smart-reports
Ce point de terminaison est également accessible via le proxy Smart-Agent à l'adresse https://ai.verifik.co/v2/smart-reports en utilisant votre propre en-tête par client Authorization: Bearer <VERIFIK_JWT>. L'exécution partagée x402 est bloquée avec 403 Forbidden.
En-têtes
| Nom | Valeur | Description |
|---|---|---|
Content-Type | application/json | Format du payload de la requête. |
Authorization | Bearer <VERIFIK_JWT> | JWT limité au client (authUser.clientId). |
Corps de la requête
| Nom | Type | Requis | Description |
|---|---|---|---|
template | string | Oui | ObjectId du modèle selon lequel effectuer le rendu de ce rapport. |
smartBatch | string | Oui | ObjectId du SmartBatch fournissant les résultats des lignes de vérification. |
name | string | Non | Nom d'affichage du rapport. Max 150 caractères. |
externalRefId | string | Non | Identifiant de corrélation de l'appelant. Max 200 caractères. |
webhookUrl | string | Non | URL de surcharge webhook http ou https spécifique au rapport. Max 2048 caractères. |
rowIndex | integer | Non | Index de ligne basé sur zéro (>= 0) provenant du SmartBatch lié. |
createdByChannel | string | Non | Canal d'origine : "portal", "api", "mcp", "x402" ou "webhook". Défaut "portal". |
Workflow étape par étape vs exécution headless
- Utilisez
POST /v2/smart-reportslorsque votre workflow a déjà exécuté unSmartBatch(par exemple via l'interface SmartBatch ou l'API file) et que vous souhaitez d'abord créer un brouillonSmartReport(status: "draft"), prévisualiser le HTML avec Récupérer le HTML d'un Smart Report, générer le PDF avec Générer le PDF d'un Smart Report et l'envoyer avec Envoyer un Smart Report par e-mail. - Notez que
createdByChannelvaut"portal"par défaut sur cette route ; les intégrations API doivent donc définircreatedByChannel: "api"pour suivre l'attribution du canal.
Requête
- Node.js
- PHP
- Python
- Go
- cURL
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();
<?php
$ch = curl_init("https://api.verifik.co/v2/smart-reports");
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
"Content-Type: application/json",
"Authorization: Bearer " . getenv("VERIFIK_JWT"),
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([
"template" => "6801a2b3c4d5e6f7a8b9c0d2",
"smartBatch" => "6801a2b3c4d5e6f7a8b9c0d3",
"name" => "Applicant 42 Draft Report",
"externalRefId" => "applicant-42",
"webhookUrl" => "https://webhooks.example.com/verifik",
"rowIndex" => 0,
"createdByChannel" => "api",
]));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
echo $response;
import os
import requests
url = "https://api.verifik.co/v2/smart-reports"
headers = {
"Content-Type": "application/json",
"Authorization": f"Bearer {os.getenv('VERIFIK_JWT')}",
}
payload = {
"template": "6801a2b3c4d5e6f7a8b9c0d2",
"smartBatch": "6801a2b3c4d5e6f7a8b9c0d3",
"name": "Applicant 42 Draft Report",
"externalRefId": "applicant-42",
"webhookUrl": "https://webhooks.example.com/verifik",
"rowIndex": 0,
"createdByChannel": "api",
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
package main
import (
"bytes"
"encoding/json"
"fmt"
"net/http"
"os"
)
func main() {
body, _ := json.Marshal(map[string]interface{}{
"template": "6801a2b3c4d5e6f7a8b9c0d2",
"smartBatch": "6801a2b3c4d5e6f7a8b9c0d3",
"name": "Applicant 42 Draft Report",
"externalRefId": "applicant-42",
"webhookUrl": "https://webhooks.example.com/verifik",
"rowIndex": 0,
"createdByChannel": "api",
})
req, _ := http.NewRequest("POST", "https://api.verifik.co/v2/smart-reports", bytes.NewReader(body))
req.Header.Set("Content-Type", "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 POST "https://api.verifik.co/v2/smart-reports" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $VERIFIK_JWT" \
-d '{
"template": "6801a2b3c4d5e6f7a8b9c0d2",
"smartBatch": "6801a2b3c4d5e6f7a8b9c0d3",
"name": "Applicant 42 Draft Report",
"externalRefId": "applicant-42",
"webhookUrl": "https://webhooks.example.com/verifik",
"rowIndex": 0,
"createdByChannel": "api"
}'
Réponse
- 200 OK
- 401
- 403
- 409
- 422
{
"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"
}
}
{
"message": "Unauthorized",
"code": "Unauthorized"
}
{
"message": "Shared x402 execution is forbidden on this endpoint",
"code": "Forbidden"
}
{
"message": "\"template\" is required",
"code": "MissingParameter"
}
{
"message": "UnprocessableEntity",
"code": "UnprocessableEntity"
}
Intégration Webhooks et MCP
- Webhooks : Enregistrer
webhookUrletexternalRefIdsur le brouillonSmartReportgarantit que les appels ultérieurs de génération (smart_batch_report_generated,smart_batch_report_generation_failed) et d'envoi par e-mail (smart_batch_report_sent,smart_batch_report_delivery_failed) héritent de votre destination de callback et de votre identifiant de corrélation propres au rapport. Consultez Webhooks SmartReports. - Intégration MCP : Pour une exécution headless de rapport en un seul appel dans des agents IA, utilisez
smart_report_run. Consultez MCP et Agents IA.
Notes
- Une création réussie renvoie HTTP
200(et non201) avecstatus: "draft". - Conservez
data._idpour les appels ultérieurs vers Récupérer un Smart Report, Générer le PDF d'un Smart Report, Télécharger le PDF d'un Smart Report, Récupérer le HTML d'un Smart Report et Envoyer un Smart Report par e-mail.