Get a file with lineage
curl --request GET \
--url https://api.varg.ai/v2/resources/files/{id} \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.varg.ai/v2/resources/files/{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/resources/files/{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/resources/files/{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/resources/files/{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/resources/files/{id}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.varg.ai/v2/resources/files/{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": "<string>",
"source": "attachment",
"url": "<string>",
"filename": "<string>",
"title": "<string>",
"subtitle": "<string>",
"media_type": "<string>",
"size": 123,
"created_at": "2023-11-07T05:31:56Z",
"hash": "<string>",
"thumbnail_url": "<string>",
"origin": "upload",
"created_by": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"created_by_profile": {
"display_name": "<string>",
"avatar_url": "<string>"
},
"creator_type": "user",
"created_by_api_key": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"key_preview": "varg_a1b2...c3d4",
"name": "<string>"
},
"metadata": {},
"lineage": {
"job_id": "<string>",
"tool": "image",
"model": "<string>",
"prompt": "<string>",
"provider": "<string>",
"cost_cents": 123,
"parent_job_id": "<string>",
"root_job_id": "<string>",
"children_count": 123,
"total_cost_cents": 123,
"children_by_tool": [
{
"tool": "<string>",
"count": 123,
"cost_cents": 123
}
],
"breakdown": [
{
"job_id": "<string>",
"tool": "<string>",
"model": "<string>",
"status": "<string>",
"cost_cents": 123,
"is_root": true
}
],
"output_count": 123,
"output_index": 123,
"primary_file_id": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"input": {},
"file": {}
},
"is_favorite": true
}{
"error": {
"code": "unauthorized",
"message": "Invalid or missing API key or JWT"
}
}{
"error": {
"code": "model_not_found",
"message": "Unknown model: flux-shnell",
"details": "<unknown>"
}
}Files
Get a file with lineage
Returns one file with its full lineage, including the cost breakdown of the job tree when the job spawned sub-generations.
GET
/
resources
/
files
/
{id}
Get a file with lineage
curl --request GET \
--url https://api.varg.ai/v2/resources/files/{id} \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.varg.ai/v2/resources/files/{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/resources/files/{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/resources/files/{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/resources/files/{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/resources/files/{id}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.varg.ai/v2/resources/files/{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": "<string>",
"source": "attachment",
"url": "<string>",
"filename": "<string>",
"title": "<string>",
"subtitle": "<string>",
"media_type": "<string>",
"size": 123,
"created_at": "2023-11-07T05:31:56Z",
"hash": "<string>",
"thumbnail_url": "<string>",
"origin": "upload",
"created_by": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"created_by_profile": {
"display_name": "<string>",
"avatar_url": "<string>"
},
"creator_type": "user",
"created_by_api_key": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"key_preview": "varg_a1b2...c3d4",
"name": "<string>"
},
"metadata": {},
"lineage": {
"job_id": "<string>",
"tool": "image",
"model": "<string>",
"prompt": "<string>",
"provider": "<string>",
"cost_cents": 123,
"parent_job_id": "<string>",
"root_job_id": "<string>",
"children_count": 123,
"total_cost_cents": 123,
"children_by_tool": [
{
"tool": "<string>",
"count": 123,
"cost_cents": 123
}
],
"breakdown": [
{
"job_id": "<string>",
"tool": "<string>",
"model": "<string>",
"status": "<string>",
"cost_cents": 123,
"is_root": true
}
],
"output_count": 123,
"output_index": 123,
"primary_file_id": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"input": {},
"file": {}
},
"is_favorite": true
}{
"error": {
"code": "unauthorized",
"message": "Invalid or missing API key or JWT"
}
}{
"error": {
"code": "model_not_found",
"message": "Unknown model: flux-shnell",
"details": "<unknown>"
}
}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
Response
The file
gateway for generated files, attachment for uploads.
Available options:
attachment, gateway Available options:
upload, generated Show child attributes
Show child attributes
Available options:
user, api_key, system, null The API key the file was created through. Only set when creator_type is api_key.
Show child attributes
Show child attributes
The job that produced a file. Detail responses carry extra fields (provider, breakdown, created_at, file).
Show child attributes
Show child attributes
Was this page helpful?