curl --request GET \
--url https://api.varg.ai/v2/templates/{id} \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.varg.ai/v2/templates/{id}"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.varg.ai/v2/templates/{id}', 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.varg.ai/v2/templates/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$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.varg.ai/v2/templates/{id}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
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.varg.ai/v2/templates/{id}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.varg.ai/v2/templates/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"documentId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"sourceDocumentId": "<string>",
"userId": "<string>",
"description": "<string>",
"tags": [
"<string>"
],
"status": "approved",
"useCount": 123,
"favoriteCount": 123,
"isFavorited": true,
"thumbnailObjectPosition": "center center",
"videoObjectPosition": "center center",
"isServiceTemplate": true,
"previewUrl": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"document": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"title": "<string>",
"content": "<string>",
"metadata": {},
"kind": "media",
"visibility": "private",
"createdBy": "<string>",
"projectId": "<string>",
"createdAt": "2023-11-07T05:31:56Z"
},
"thumbnailUrl": "<string>",
"outputMediaUrl": "<string>",
"outputMediaType": "<string>",
"durationMs": 123,
"author": {
"id": "<string>",
"displayName": "<string>",
"avatarUrl": "<string>"
}
}{
"error": {
"code": "invalid_request",
"message": "Request failed validation"
}
}{
"error": {
"code": "unauthorized",
"message": "Invalid or missing API key or JWT"
}
}{
"error": {
"code": "not_found",
"message": "Template not found"
}
}Get a template
Returns one template including its TSX source in document.content.
Approved templates are visible to everyone; others only to their author
(everyone else gets 404).
curl --request GET \
--url https://api.varg.ai/v2/templates/{id} \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.varg.ai/v2/templates/{id}"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.varg.ai/v2/templates/{id}', 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.varg.ai/v2/templates/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$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.varg.ai/v2/templates/{id}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
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.varg.ai/v2/templates/{id}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.varg.ai/v2/templates/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"documentId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"sourceDocumentId": "<string>",
"userId": "<string>",
"description": "<string>",
"tags": [
"<string>"
],
"status": "approved",
"useCount": 123,
"favoriteCount": 123,
"isFavorited": true,
"thumbnailObjectPosition": "center center",
"videoObjectPosition": "center center",
"isServiceTemplate": true,
"previewUrl": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"document": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"title": "<string>",
"content": "<string>",
"metadata": {},
"kind": "media",
"visibility": "private",
"createdBy": "<string>",
"projectId": "<string>",
"createdAt": "2023-11-07T05:31:56Z"
},
"thumbnailUrl": "<string>",
"outputMediaUrl": "<string>",
"outputMediaType": "<string>",
"durationMs": 123,
"author": {
"id": "<string>",
"displayName": "<string>",
"avatarUrl": "<string>"
}
}{
"error": {
"code": "invalid_request",
"message": "Request failed validation"
}
}{
"error": {
"code": "unauthorized",
"message": "Invalid or missing API key or JWT"
}
}{
"error": {
"code": "not_found",
"message": "Template not found"
}
}Authorizations
varg API key (varg_...). Get one at app.varg.ai
or run bunx vargai login. App sessions may alternatively send a
Supabase JWT.
Path Parameters
Template id
Response
The template
A community-published render template
The template's own (frozen) copy of the source document
The document the author published it from
Author user id
Moderation status. Only approved templates are public.
"approved"
Whether the calling user has favorited it
"center center"
"center center"
Short autoplay clip; null until the preview is ready
The document that holds the template's TSX source
Show child attributes
Show child attributes
Output video duration in milliseconds
Show child attributes
Show child attributes
Was this page helpful?