Get Artifact
curl --request GET \
--url https://genui.sh/api/artifacts/{id}import requests
url = "https://genui.sh/api/artifacts/{id}"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://genui.sh/api/artifacts/{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://genui.sh/api/artifacts/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$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://genui.sh/api/artifacts/{id}"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://genui.sh/api/artifacts/{id}")
.asString();require 'uri'
require 'net/http'
url = URI("https://genui.sh/api/artifacts/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body{
"id": "art_abc123",
"template": "markdown",
"title": "My Document",
"description": "A sample document",
"content": {
"text": "# Hello World\n\nThis is my artifact."
},
"status": "active",
"metadata": {
"author": "john@example.com"
},
"createdAt": "2024-01-15T12:00:00Z",
"updatedAt": "2024-01-15T12:00:00Z",
"expiresAt": "2024-01-22T12:00:00Z"
}
{
"error": {
"code": "not_found",
"message": "Artifact not found"
}
}
Artifacts
Get Artifact
GET
/
api
/
artifacts
/
{id}
Get Artifact
curl --request GET \
--url https://genui.sh/api/artifacts/{id}import requests
url = "https://genui.sh/api/artifacts/{id}"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://genui.sh/api/artifacts/{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://genui.sh/api/artifacts/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$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://genui.sh/api/artifacts/{id}"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://genui.sh/api/artifacts/{id}")
.asString();require 'uri'
require 'net/http'
url = URI("https://genui.sh/api/artifacts/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body{
"id": "art_abc123",
"template": "markdown",
"title": "My Document",
"description": "A sample document",
"content": {
"text": "# Hello World\n\nThis is my artifact."
},
"status": "active",
"metadata": {
"author": "john@example.com"
},
"createdAt": "2024-01-15T12:00:00Z",
"updatedAt": "2024-01-15T12:00:00Z",
"expiresAt": "2024-01-22T12:00:00Z"
}
{
"error": {
"code": "not_found",
"message": "Artifact not found"
}
}
Retrieve a single artifact by ID.
Request
The artifact ID (format:
art_xxx)Response
Unique artifact ID
Template type used
Display title
Description text
The artifact’s content object
Current status:
active, expired, deletedCustom metadata key-value pairs
ISO 8601 creation timestamp
ISO 8601 last update timestamp
ISO 8601 expiration timestamp (if set)
{
"id": "art_abc123",
"template": "markdown",
"title": "My Document",
"description": "A sample document",
"content": {
"text": "# Hello World\n\nThis is my artifact."
},
"status": "active",
"metadata": {
"author": "john@example.com"
},
"createdAt": "2024-01-15T12:00:00Z",
"updatedAt": "2024-01-15T12:00:00Z",
"expiresAt": "2024-01-22T12:00:00Z"
}
{
"error": {
"code": "not_found",
"message": "Artifact not found"
}
}
Code Examples
curl -X GET https://genui.sh/api/artifacts/art_abc123 \
-H "Authorization: Bearer $GENUI_API_KEY"
import requests
import os
artifact_id = "art_abc123"
response = requests.get(
f"https://genui.sh/api/artifacts/{artifact_id}",
headers={"Authorization": f"Bearer {os.environ['GENUI_API_KEY']}"}
)
artifact = response.json()
print(f"Title: {artifact['title']}")
print(f"Status: {artifact['status']}")
const artifactId = 'art_abc123';
const response = await fetch(`https://genui.sh/api/artifacts/${artifactId}`, {
headers: {
'Authorization': `Bearer ${process.env.GENUI_API_KEY}`
}
});
const artifact = await response.json();
console.log(`Title: ${artifact.title}`);
console.log(`Status: ${artifact.status}`);
artifactID := "art_abc123"
req, _ := http.NewRequest("GET", "https://genui.sh/api/artifacts/"+artifactID, nil)
req.Header.Set("Authorization", "Bearer "+os.Getenv("GENUI_API_KEY"))
client := &http.Client{}
resp, _ := client.Do(req)
defer resp.Body.Close()
var artifact map[string]interface{}
json.NewDecoder(resp.Body).Decode(&artifact)
fmt.Printf("Title: %s\n", artifact["title"])
artifact_id = 'art_abc123'
uri = URI("https://genui.sh/api/artifacts/#{artifact_id}")
request = Net::HTTP::Get.new(uri)
request['Authorization'] = "Bearer #{ENV['GENUI_API_KEY']}"
response = http.request(request)
artifact = JSON.parse(response.body)
puts "Title: #{artifact['title']}"
let artifact_id = "art_abc123";
let response = client
.get(format!("https://genui.sh/api/artifacts/{}", artifact_id))
.header("Authorization", format!("Bearer {}", api_key))
.send()
.await?;
let artifact: serde_json::Value = response.json().await?;
println!("Title: {}", artifact["title"]);
var artifactId = "art_abc123";
var response = await client.GetAsync($"https://genui.sh/api/artifacts/{artifactId}");
var artifact = await response.Content.ReadFromJsonAsync<JsonElement>();
Console.WriteLine($"Title: {artifact.GetProperty("title")}");
⌘I