The /templates/{template_id} endpoint retrieves a template by its unique identifier.
Request
Your API key for authentication.
The unique identifier of the template to retrieve.
Optional specific version of the template to retrieve. If not specified, the latest version will be returned.
Response
The unique identifier for the template.
The name of the template.
The description of the template.
The category of the template.
The tags associated with the template.
The number of times this template has been used.
The field definitions for the template. Each field follows the same structure as described in the suggest-fields response.
Whether the template is public or private.
The ID of the user who owns this template (for private templates).
When the template was created (ISO 8601 format).
When the template was last updated (ISO 8601 format).
Examples
Example Request
curl -X GET https://api.vizapi.ai/v1/templates/template_12345 \
-H "x-api-key: YOUR_API_KEY"
Example Response
{
"id": "template_12345",
"name": "Plant Disease Detector",
"description": "Template for analyzing plant health and detecting diseases",
"category": "agriculture",
"tags": ["farming", "disease-detection"],
"usage_count": 25,
"fields": [
{
"name": "plant_species",
"type": "string",
"description": "The species of plant being analyzed",
"required": true,
"return_as_list": false,
"subfields": [],
"enum_values": []
},
{
"name": "disease_detected",
"type": "boolean",
"description": "Whether disease is present in the plant",
"required": true,
"return_as_list": false,
"subfields": [],
"enum_values": []
},
{
"name": "severity_level",
"type": "string",
"description": "The severity level of detected disease",
"required": false,
"return_as_list": false,
"subfields": [],
"enum_values": ["mild", "moderate", "severe"]
}
],
"is_public": false,
"user_id": "user_67890",
"created_at": "2024-01-15T10:30:00Z",
"updated_at": "2024-01-20T14:45:00Z"
}
Error Codes
| Status Code | Description |
|---|
| 401 | Unauthorized - Invalid or missing API key |
| 404 | Not Found - The requested template was not found |
| 500 | Internal Server Error - An unexpected error occurred on our servers |