Skip to main content
POST
/
api
/
artifacts
/
share
Create and Share
curl --request POST \
  --url https://genui.sh/api/artifacts/share \
  --header 'Content-Type: application/json' \
  --data '
{
  "template": "<string>",
  "title": "<string>",
  "content": {},
  "expiresIn": "<string>",
  "allowDownload": true,
  "metadata": {}
}
'
import requests

url = "https://genui.sh/api/artifacts/share"

payload = {
"template": "<string>",
"title": "<string>",
"content": {},
"expiresIn": "<string>",
"allowDownload": True,
"metadata": {}
}
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({
template: '<string>',
title: '<string>',
content: {},
expiresIn: '<string>',
allowDownload: true,
metadata: {}
})
};

fetch('https://genui.sh/api/artifacts/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/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([
'template' => '<string>',
'title' => '<string>',
'content' => [

],
'expiresIn' => '<string>',
'allowDownload' => true,
'metadata' => [

]
]),
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/share"

payload := strings.NewReader("{\n \"template\": \"<string>\",\n \"title\": \"<string>\",\n \"content\": {},\n \"expiresIn\": \"<string>\",\n \"allowDownload\": true,\n \"metadata\": {}\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/share")
.header("Content-Type", "application/json")
.body("{\n \"template\": \"<string>\",\n \"title\": \"<string>\",\n \"content\": {},\n \"expiresIn\": \"<string>\",\n \"allowDownload\": true,\n \"metadata\": {}\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://genui.sh/api/artifacts/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 \"template\": \"<string>\",\n \"title\": \"<string>\",\n \"content\": {},\n \"expiresIn\": \"<string>\",\n \"allowDownload\": true,\n \"metadata\": {}\n}"

response = http.request(request)
puts response.read_body
{
  "id": "art_abc123",
  "template": "markdown",
  "title": "Quick Note",
  "status": "active",
  "url": "https://genui.sh/a/art_abc123?token=eyJhbGc...",
  "expiresAt": "2024-01-22T12:00:00Z",
  "createdAt": "2024-01-15T12:00:00Z"
}
Create an artifact and immediately generate a share URL in a single request. This is the most efficient way to create shareable content.

Request

template
string
required
Template type: markdown, chart, table, pdf
title
string
Display title for the artifact
content
object
required
Template-specific content object
expiresIn
string
Expiration for both artifact and share link. Default: 7d
allowDownload
boolean
Allow viewers to download (PDF only). Default: false
metadata
object
Custom metadata key-value pairs

Response

id
string
The artifact ID
url
string
The shareable URL (ready to use immediately)
expiresAt
string
ISO 8601 expiration timestamp
{
  "id": "art_abc123",
  "template": "markdown",
  "title": "Quick Note",
  "status": "active",
  "url": "https://genui.sh/a/art_abc123?token=eyJhbGc...",
  "expiresAt": "2024-01-22T12:00:00Z",
  "createdAt": "2024-01-15T12:00:00Z"
}

Code Examples

curl -X POST https://genui.sh/api/artifacts/share \
  -H "Authorization: Bearer $GENUI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "template": "markdown",
    "title": "Quick Note",
    "content": {"text": "# Important Update\n\nHere is the information you requested."},
    "expiresIn": "24h"
  }'
import requests
import os

response = requests.post(
    "https://genui.sh/api/artifacts/share",
    headers={"Authorization": f"Bearer {os.environ['GENUI_API_KEY']}"},
    json={
        "template": "markdown",
        "title": "Quick Note",
        "content": {"text": "# Important Update\n\nHere is the information you requested."},
        "expiresIn": "24h"
    }
)
result = response.json()
print(f"Share this URL: {result['url']}")
const response = await fetch('https://genui.sh/api/artifacts/share', {
  method: 'POST',
  headers: {
    'Authorization': `Bearer ${process.env.GENUI_API_KEY}`,
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    template: 'markdown',
    title: 'Quick Note',
    content: { text: '# Important Update\n\nHere is the information you requested.' },
    expiresIn: '24h'
  })
});
const { url } = await response.json();
console.log(`Share this URL: ${url}`);
payload := map[string]interface{}{
    "template":  "markdown",
    "title":     "Quick Note",
    "content":   map[string]string{"text": "# Important Update\n\nHere is the information you requested."},
    "expiresIn": "24h",
}
body, _ := json.Marshal(payload)

req, _ := http.NewRequest("POST", "https://genui.sh/api/artifacts/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 result map[string]interface{}
json.NewDecoder(resp.Body).Decode(&result)
fmt.Printf("Share this URL: %s\n", result["url"])
uri = URI('https://genui.sh/api/artifacts/share')

request = Net::HTTP::Post.new(uri)
request['Authorization'] = "Bearer #{ENV['GENUI_API_KEY']}"
request['Content-Type'] = 'application/json'
request.body = {
  template: 'markdown',
  title: 'Quick Note',
  content: { text: '# Important Update\n\nHere is the information you requested.' },
  expiresIn: '24h'
}.to_json

response = http.request(request)
result = JSON.parse(response.body)
puts "Share this URL: #{result['url']}"
let response = client
    .post("https://genui.sh/api/artifacts/share")
    .header("Authorization", format!("Bearer {}", api_key))
    .json(&json!({
        "template": "markdown",
        "title": "Quick Note",
        "content": {"text": "# Important Update\n\nHere is the information you requested."},
        "expiresIn": "24h"
    }))
    .send()
    .await?;

let result: serde_json::Value = response.json().await?;
println!("Share this URL: {}", result["url"]);
var response = await client.PostAsJsonAsync("https://genui.sh/api/artifacts/share", new {
    template = "markdown",
    title = "Quick Note",
    content = new { text = "# Important Update\n\nHere is the information you requested." },
    expiresIn = "24h"
});
var result = await response.Content.ReadFromJsonAsync<JsonElement>();
Console.WriteLine($"Share this URL: {result.GetProperty("url")}");

Use Cases

This endpoint is ideal for:
  • AI agents that need to share results immediately
  • Automation workflows that generate and distribute content
  • One-off sharing without needing to manage artifact IDs
  • Ephemeral content that should auto-expire

Comparison with Separate Calls

ApproachAPI CallsUse Case
Create + Share2Need artifact ID for future updates
Create and Share1One-shot content sharing