Update Artifact
curl --request PUT \
--url https://genui.sh/api/artifacts/{id} \
--header 'Content-Type: application/json' \
--data '
{
"title": "<string>",
"description": "<string>",
"content": {},
"metadata": {},
"expiresIn": "<string>"
}
'import requests
url = "https://genui.sh/api/artifacts/{id}"
payload = {
"title": "<string>",
"description": "<string>",
"content": {},
"metadata": {},
"expiresIn": "<string>"
}
headers = {"Content-Type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
title: '<string>',
description: '<string>',
content: {},
metadata: {},
expiresIn: '<string>'
})
};
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 => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'title' => '<string>',
'description' => '<string>',
'content' => [
],
'metadata' => [
],
'expiresIn' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://genui.sh/api/artifacts/{id}"
payload := strings.NewReader("{\n \"title\": \"<string>\",\n \"description\": \"<string>\",\n \"content\": {},\n \"metadata\": {},\n \"expiresIn\": \"<string>\"\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.put("https://genui.sh/api/artifacts/{id}")
.header("Content-Type", "application/json")
.body("{\n \"title\": \"<string>\",\n \"description\": \"<string>\",\n \"content\": {},\n \"metadata\": {},\n \"expiresIn\": \"<string>\"\n}")
.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::Put.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"title\": \"<string>\",\n \"description\": \"<string>\",\n \"content\": {},\n \"metadata\": {},\n \"expiresIn\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"id": "art_abc123",
"template": "markdown",
"title": "Updated Title",
"status": "active",
"createdAt": "2024-01-15T12:00:00Z",
"updatedAt": "2024-01-16T14:30:00Z"
}
{
"error": {
"code": "not_found",
"message": "Artifact not found"
}
}
Artifacts
Update Artifact
PUT
/
api
/
artifacts
/
{id}
Update Artifact
curl --request PUT \
--url https://genui.sh/api/artifacts/{id} \
--header 'Content-Type: application/json' \
--data '
{
"title": "<string>",
"description": "<string>",
"content": {},
"metadata": {},
"expiresIn": "<string>"
}
'import requests
url = "https://genui.sh/api/artifacts/{id}"
payload = {
"title": "<string>",
"description": "<string>",
"content": {},
"metadata": {},
"expiresIn": "<string>"
}
headers = {"Content-Type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
title: '<string>',
description: '<string>',
content: {},
metadata: {},
expiresIn: '<string>'
})
};
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 => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'title' => '<string>',
'description' => '<string>',
'content' => [
],
'metadata' => [
],
'expiresIn' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://genui.sh/api/artifacts/{id}"
payload := strings.NewReader("{\n \"title\": \"<string>\",\n \"description\": \"<string>\",\n \"content\": {},\n \"metadata\": {},\n \"expiresIn\": \"<string>\"\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.put("https://genui.sh/api/artifacts/{id}")
.header("Content-Type", "application/json")
.body("{\n \"title\": \"<string>\",\n \"description\": \"<string>\",\n \"content\": {},\n \"metadata\": {},\n \"expiresIn\": \"<string>\"\n}")
.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::Put.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"title\": \"<string>\",\n \"description\": \"<string>\",\n \"content\": {},\n \"metadata\": {},\n \"expiresIn\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"id": "art_abc123",
"template": "markdown",
"title": "Updated Title",
"status": "active",
"createdAt": "2024-01-15T12:00:00Z",
"updatedAt": "2024-01-16T14:30:00Z"
}
{
"error": {
"code": "not_found",
"message": "Artifact not found"
}
}
Update an existing artifact’s title, description, content, or metadata.
Request
string
required
The artifact ID to update
string
New display title
string
New description
object
Updated template-specific content object
object
Updated metadata (merged with existing)
string
New expiration duration from now
You cannot change the template type of an existing artifact.
Response
Returns the updated artifact object.{
"id": "art_abc123",
"template": "markdown",
"title": "Updated Title",
"status": "active",
"createdAt": "2024-01-15T12:00:00Z",
"updatedAt": "2024-01-16T14:30:00Z"
}
{
"error": {
"code": "not_found",
"message": "Artifact not found"
}
}
Code Examples
curl -X PUT https://genui.sh/api/artifacts/art_abc123 \
-H "Authorization: Bearer $GENUI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"title": "Updated Title",
"content": {"text": "# Updated Content\n\nThis has been modified."}
}'
import requests
import os
artifact_id = "art_abc123"
response = requests.put(
f"https://genui.sh/api/artifacts/{artifact_id}",
headers={"Authorization": f"Bearer {os.environ['GENUI_API_KEY']}"},
json={
"title": "Updated Title",
"content": {"text": "# Updated Content\n\nThis has been modified."}
}
)
artifact = response.json()
print(f"Updated at: {artifact['updatedAt']}")
const artifactId = 'art_abc123';
const response = await fetch(`https://genui.sh/api/artifacts/${artifactId}`, {
method: 'PUT',
headers: {
'Authorization': `Bearer ${process.env.GENUI_API_KEY}`,
'Content-Type': 'application/json'
},
body: JSON.stringify({
title: 'Updated Title',
content: { text: '# Updated Content\n\nThis has been modified.' }
})
});
const artifact = await response.json();
console.log(`Updated at: ${artifact.updatedAt}`);
artifactID := "art_abc123"
payload := map[string]interface{}{
"title": "Updated Title",
"content": map[string]string{"text": "# Updated Content\n\nThis has been modified."},
}
body, _ := json.Marshal(payload)
req, _ := http.NewRequest("PUT", "https://genui.sh/api/artifacts/"+artifactID, bytes.NewBuffer(body))
req.Header.Set("Authorization", "Bearer "+os.Getenv("GENUI_API_KEY"))
req.Header.Set("Content-Type", "application/json")
client := &http.Client{}
resp, _ := client.Do(req)
defer resp.Body.Close()
artifact_id = 'art_abc123'
uri = URI("https://genui.sh/api/artifacts/#{artifact_id}")
request = Net::HTTP::Put.new(uri)
request['Authorization'] = "Bearer #{ENV['GENUI_API_KEY']}"
request['Content-Type'] = 'application/json'
request.body = {
title: 'Updated Title',
content: { text: '# Updated Content\n\nThis has been modified.' }
}.to_json
response = http.request(request)
let artifact_id = "art_abc123";
let response = client
.put(format!("https://genui.sh/api/artifacts/{}", artifact_id))
.header("Authorization", format!("Bearer {}", api_key))
.json(&json!({
"title": "Updated Title",
"content": {"text": "# Updated Content\n\nThis has been modified."}
}))
.send()
.await?;
var artifactId = "art_abc123";
var response = await client.PutAsJsonAsync($"https://genui.sh/api/artifacts/{artifactId}", new {
title = "Updated Title",
content = new { text = "# Updated Content\n\nThis has been modified." }
});