GET
/
v1
/
templates
/
{template_id}
Get Template By Id
curl --request GET \
  --url https://api.vizapi.ai/v1/templates/{template_id} \
  --header 'x-api-key: <x-api-key>'
{
  "id": "<string>",
  "name": "<string>",
  "description": "<string>",
  "category": "<string>",
  "tags": [
    {}
  ],
  "usage_count": 123,
  "fields": [
    {}
  ],
  "is_public": true,
  "user_id": "<string>",
  "created_at": "<string>",
  "updated_at": "<string>"
}
The /templates/{template_id} endpoint retrieves a template by its unique identifier.

Request

x-api-key
string
required
Your API key for authentication.
template_id
string
required
The unique identifier of the template to retrieve.
version
integer
Optional specific version of the template to retrieve. If not specified, the latest version will be returned.

Response

id
string
The unique identifier for the template.
name
string
The name of the template.
description
string
The description of the template.
category
string
The category of the template.
tags
array
The tags associated with the template.
usage_count
integer
The number of times this template has been used.
fields
array
The field definitions for the template. Each field follows the same structure as described in the suggest-fields response.
is_public
boolean
Whether the template is public or private.
user_id
string
The ID of the user who owns this template (for private templates).
created_at
string
When the template was created (ISO 8601 format).
updated_at
string
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 CodeDescription
401Unauthorized - Invalid or missing API key
404Not Found - The requested template was not found
500Internal Server Error - An unexpected error occurred on our servers