Get User Templates
curl --request GET \
--url https://api.vizapi.ai/v1/templates \
--header 'x-api-key: <x-api-key>'import requests
url = "https://api.vizapi.ai/v1/templates"
headers = {"x-api-key": "<x-api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'x-api-key': '<x-api-key>'}};
fetch('https://api.vizapi.ai/v1/templates', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.vizapi.ai/v1/templates",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"x-api-key: <x-api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.vizapi.ai/v1/templates"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-api-key", "<x-api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.vizapi.ai/v1/templates")
.header("x-api-key", "<x-api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.vizapi.ai/v1/templates")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["x-api-key"] = '<x-api-key>'
response = http.request(request)
puts response.read_body{
"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>"
}Templates
Get User Templates
Retrieves all private templates belonging to the authenticated user
GET
/
v1
/
templates
Get User Templates
curl --request GET \
--url https://api.vizapi.ai/v1/templates \
--header 'x-api-key: <x-api-key>'import requests
url = "https://api.vizapi.ai/v1/templates"
headers = {"x-api-key": "<x-api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'x-api-key': '<x-api-key>'}};
fetch('https://api.vizapi.ai/v1/templates', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.vizapi.ai/v1/templates",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"x-api-key: <x-api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.vizapi.ai/v1/templates"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-api-key", "<x-api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.vizapi.ai/v1/templates")
.header("x-api-key", "<x-api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.vizapi.ai/v1/templates")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["x-api-key"] = '<x-api-key>'
response = http.request(request)
puts response.read_body{
"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
string
required
Your API key for authentication.
Response
Returns an array of template objects. Each template includes:string
The unique identifier for the template.
string
The name of the template.
string
The description of the template.
string
The category of the template.
array
The tags associated with the template.
integer
The number of times this template has been used.
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.
boolean
Whether the template is public or private.
string
The ID of the user who owns this template.
string
When the template was created (ISO 8601 format).
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"
const fetch = require('node-fetch');
async function getUserTemplates() {
const response = await fetch('https://api.vizapi.ai/v1/templates', {
method: 'GET',
headers: {
'x-api-key': 'YOUR_API_KEY'
}
});
const data = await response.json();
console.log(data);
}
getUserTemplates();
import requests
url = "https://api.vizapi.ai/v1/templates"
headers = {
"x-api-key": "YOUR_API_KEY"
}
response = requests.get(url, headers=headers)
data = response.json()
print(data)
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 Code | Description |
|---|---|
| 401 | Unauthorized - Invalid or missing API key |
| 500 | Internal Server Error - An unexpected error occurred on our servers |
⌘I