Share Artifact
curl --request POST \
--url https://genui.sh/api/artifacts/{id}/share \
--header 'Content-Type: application/json' \
--data '
{
"expiresIn": "<string>",
"allowDownload": true,
"password": "<string>"
}
'import requests
url = "https://genui.sh/api/artifacts/{id}/share"
payload = {
"expiresIn": "<string>",
"allowDownload": True,
"password": "<string>"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({expiresIn: '<string>', allowDownload: true, password: '<string>'})
};
fetch('https://genui.sh/api/artifacts/{id}/share', 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}/share",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'expiresIn' => '<string>',
'allowDownload' => true,
'password' => '<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}/share"
payload := strings.NewReader("{\n \"expiresIn\": \"<string>\",\n \"allowDownload\": true,\n \"password\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", 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.post("https://genui.sh/api/artifacts/{id}/share")
.header("Content-Type", "application/json")
.body("{\n \"expiresIn\": \"<string>\",\n \"allowDownload\": true,\n \"password\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://genui.sh/api/artifacts/{id}/share")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"expiresIn\": \"<string>\",\n \"allowDownload\": true,\n \"password\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"url": "https://genui.sh/a/art_abc123?token=eyJhbGc...",
"token": "eyJhbGc...",
"expiresAt": "2024-01-22T12:00:00Z"
}
{
"error": {
"code": "not_found",
"message": "Artifact not found"
}
}
Artifacts
Share Artifact
POST
/
api
/
artifacts
/
{id}
/
share
Share Artifact
curl --request POST \
--url https://genui.sh/api/artifacts/{id}/share \
--header 'Content-Type: application/json' \
--data '
{
"expiresIn": "<string>",
"allowDownload": true,
"password": "<string>"
}
'import requests
url = "https://genui.sh/api/artifacts/{id}/share"
payload = {
"expiresIn": "<string>",
"allowDownload": True,
"password": "<string>"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({expiresIn: '<string>', allowDownload: true, password: '<string>'})
};
fetch('https://genui.sh/api/artifacts/{id}/share', 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}/share",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'expiresIn' => '<string>',
'allowDownload' => true,
'password' => '<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}/share"
payload := strings.NewReader("{\n \"expiresIn\": \"<string>\",\n \"allowDownload\": true,\n \"password\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", 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.post("https://genui.sh/api/artifacts/{id}/share")
.header("Content-Type", "application/json")
.body("{\n \"expiresIn\": \"<string>\",\n \"allowDownload\": true,\n \"password\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://genui.sh/api/artifacts/{id}/share")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"expiresIn\": \"<string>\",\n \"allowDownload\": true,\n \"password\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"url": "https://genui.sh/a/art_abc123?token=eyJhbGc...",
"token": "eyJhbGc...",
"expiresAt": "2024-01-22T12:00:00Z"
}
{
"error": {
"code": "not_found",
"message": "Artifact not found"
}
}
Generate a signed share URL for an existing artifact. The URL allows anyone to view the artifact without authentication.
Viewers will be prompted to enter the password before accessing the artifact.
Request
string
required
The artifact ID to share
string
Share link expiration. Examples:
1h, 24h, 7d, 30d. Default: 7dboolean
Allow viewers to download the artifact (PDF only). Default:
falsestring
Optional password protection for the share link
Response
string
The shareable URL
string
The share token (for reference)
string
ISO 8601 expiration timestamp
{
"url": "https://genui.sh/a/art_abc123?token=eyJhbGc...",
"token": "eyJhbGc...",
"expiresAt": "2024-01-22T12:00:00Z"
}
{
"error": {
"code": "not_found",
"message": "Artifact not found"
}
}
Code Examples
curl -X POST https://genui.sh/api/artifacts/art_abc123/share \
-H "Authorization: Bearer $GENUI_API_KEY" \
-H "Content-Type: application/json" \
-d '{"expiresIn": "7d"}'
import requests
import os
artifact_id = "art_abc123"
response = requests.post(
f"https://genui.sh/api/artifacts/{artifact_id}/share",
headers={"Authorization": f"Bearer {os.environ['GENUI_API_KEY']}"},
json={"expiresIn": "7d"}
)
share = response.json()
print(f"Share URL: {share['url']}")
print(f"Expires: {share['expiresAt']}")
const artifactId = 'art_abc123';
const response = await fetch(`https://genui.sh/api/artifacts/${artifactId}/share`, {
method: 'POST',
headers: {
'Authorization': `Bearer ${process.env.GENUI_API_KEY}`,
'Content-Type': 'application/json'
},
body: JSON.stringify({ expiresIn: '7d' })
});
const { url, expiresAt } = await response.json();
console.log(`Share URL: ${url}`);
console.log(`Expires: ${expiresAt}`);
artifactID := "art_abc123"
payload := map[string]string{"expiresIn": "7d"}
body, _ := json.Marshal(payload)
req, _ := http.NewRequest("POST", "https://genui.sh/api/artifacts/"+artifactID+"/share", 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()
var share map[string]string
json.NewDecoder(resp.Body).Decode(&share)
fmt.Printf("Share URL: %s\n", share["url"])
artifact_id = 'art_abc123'
uri = URI("https://genui.sh/api/artifacts/#{artifact_id}/share")
request = Net::HTTP::Post.new(uri)
request['Authorization'] = "Bearer #{ENV['GENUI_API_KEY']}"
request['Content-Type'] = 'application/json'
request.body = { expiresIn: '7d' }.to_json
response = http.request(request)
share = JSON.parse(response.body)
puts "Share URL: #{share['url']}"
let artifact_id = "art_abc123";
let response = client
.post(format!("https://genui.sh/api/artifacts/{}/share", artifact_id))
.header("Authorization", format!("Bearer {}", api_key))
.json(&json!({"expiresIn": "7d"}))
.send()
.await?;
let share: serde_json::Value = response.json().await?;
println!("Share URL: {}", share["url"]);
var artifactId = "art_abc123";
var response = await client.PostAsJsonAsync($"https://genui.sh/api/artifacts/{artifactId}/share", new {
expiresIn = "7d"
});
var share = await response.Content.ReadFromJsonAsync<JsonElement>();
Console.WriteLine($"Share URL: {share.GetProperty("url")}");
Password-Protected Sharing
To create a password-protected share link:{
"expiresIn": "7d",
"password": "secret123"
}