GET
/
v1
/
templates
Get User Templates
curl --request GET \
  --url https://api.vizapi.ai/v1/templates \
  --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 endpoint retrieves all private templates belonging to the authenticated user.

Request

x-api-key
string
required
Your API key for authentication.

Response

Returns an array of template objects. Each template includes:
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, from the latest version of 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.
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 \
  -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"
  },
  {
    "id": "template_67890",
    "name": "Object Detection Template",
    "description": "Template for detecting and counting objects in images",
    "category": "detection",
    "tags": ["object-detection", "counting"],
    "usage_count": 12,
    "fields": [
      {
        "name": "object_type",
        "type": "string",
        "description": "The type of object detected",
        "required": true,
        "return_as_list": false,
        "subfields": [],
        "enum_values": []
      },
      {
        "name": "object_count",
        "type": "number",
        "description": "The number of objects detected",
        "required": true,
        "return_as_list": false,
        "subfields": [],
        "enum_values": []
      },
      {
        "name": "confidence_score",
        "type": "number",
        "description": "The confidence score of the detection",
        "required": true,
        "return_as_list": false,
        "subfields": [],
        "enum_values": []
      }
    ],
    "is_public": false,
    "user_id": "user_67890",
    "created_at": "2024-01-10T09:15:00Z",
    "updated_at": "2024-01-18T16:20:00Z"
  }
]

Error Codes

Status CodeDescription
401Unauthorized - Invalid or missing API key
500Internal Server Error - An unexpected error occurred on our servers