Skip to main content

Update a Scan Prompt Template

Update an existing scan prompt template. Clients can only update their own templates, while super admins can update any template.

Endpoint

PUT https://api.verifik.co/v2/ocr/scan-prompt/template/:id

Headers

NameValue
Content-Typeapplication/json
AuthorizationBearer <token>

Path Parameters

NameTypeRequiredDescription
idstringYesThe unique identifier of the template to update

Request Body

NameTypeRequiredDescription
namestringNoTemplate name
descriptionstringNoTemplate description
promptstringNoThe prompt text (minimum 50 characters)
documentTypesarrayNoArray of document types this template applies to
fieldsarrayNoArray of fields to extract
formatstringNoOutput format (e.g., "json")
requiresBackSidebooleanNoWhether the template requires a back side image
activebooleanNoWhether the template is active

Request

import axios from 'axios';

const options = {
method: 'PUT',
url: 'https://api.verifik.co/v2/ocr/scan-prompt/template/template_id_123',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer <your_token>'
},
data: {
name: 'Updated CC Template',
description: 'Updated description',
prompt: 'From the provided image, extract the following fields: {{fields}} in {{format}} format.',
documentTypes: ['CC'],
fields: ['firstName', 'lastName', 'documentNumber'],
format: 'json',
requiresBackSide: false,
active: true
}
};

try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}

Response

{
"data": {
"_id": "template_id_123",
"name": "Updated CC Template",
"description": "Updated description",
"documentTypes": ["CC"],
"fields": ["firstName", "lastName", "documentNumber"],
"prompt": "From the provided image, extract the following fields: {{fields}} in {{format}} format.",
"format": "json",
"requiresBackSide": false,
"system": false,
"client": "client_id_789",
"active": true,
"version": 1,
"updatedAt": "2024-01-15T10:30:00Z"
}
}

Features

  • Template Updates: Update existing template properties
  • Access Control: Clients can only update their own templates
  • System Template Protection: Clients cannot update system templates
  • Flexible Updates: Update any template property as needed