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
| Name | Value |
|---|---|
| Content-Type | application/json |
| Authorization | Bearer <token> |
Path Parameters
| Name | Type | Required | Description |
|---|---|---|---|
id | string | Yes | The unique identifier of the template to update |
Request Body
| Name | Type | Required | Description |
|---|---|---|---|
name | string | No | Template name |
description | string | No | Template description |
prompt | string | No | The prompt text (minimum 50 characters) |
documentTypes | array | No | Array of document types this template applies to |
fields | array | No | Array of fields to extract |
format | string | No | Output format (e.g., "json") |
requiresBackSide | boolean | No | Whether the template requires a back side image |
active | boolean | No | Whether the template is active |
Request
- JavaScript
- Python
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);
}
import requests
url = "https://api.verifik.co/v2/ocr/scan-prompt/template/template_id_123"
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer <your_token>'
}
payload = {
'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
}
response = requests.put(url, json=payload, headers=headers)
print(response.json())
Response
- 200
- 403
- 404
{
"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"
}
}
{
"code": "FORBIDDEN",
"message": "Clients cannot update system templates"
}
{
"code": "NOT_FOUND",
"message": "Template not found"
}
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