Get your API key
Sign in to your dashboard and copy your API key from the settings page.Your API key starts with
genui_ and should be kept secure.Create and share an artifact
Make a single POST request to create your artifact and get a shareable URL:You’ll receive a response with your artifact and shareable URL:
curl -X POST https://genui.sh/api/artifacts/share \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"template": "markdown",
"title": "Hello World",
"content": {"text": "# Hello World\n\nThis is my first artifact!"}
}'
import requests
response = requests.post(
"https://genui.sh/api/artifacts/share",
headers={"Authorization": "Bearer YOUR_API_KEY"},
json={
"template": "markdown",
"title": "Hello World",
"content": {"text": "# Hello World\n\nThis is my first artifact!"}
}
)
print(response.json()["url"])
const response = await fetch('https://genui.sh/api/artifacts/share', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
template: 'markdown',
title: 'Hello World',
content: { text: '# Hello World\n\nThis is my first artifact!' }
})
});
const { url } = await response.json();
console.log(url);
package main
import (
"bytes"
"encoding/json"
"fmt"
"io"
"net/http"
)
func main() {
payload := map[string]interface{}{
"template": "markdown",
"title": "Hello World",
"content": map[string]string{"text": "# Hello World\n\nThis is my first artifact!"},
}
body, _ := json.Marshal(payload)
req, _ := http.NewRequest("POST", "https://genui.sh/api/artifacts/share", bytes.NewBuffer(body))
req.Header.Set("Authorization", "Bearer YOUR_API_KEY")
req.Header.Set("Content-Type", "application/json")
client := &http.Client{}
resp, _ := client.Do(req)
defer resp.Body.Close()
respBody, _ := io.ReadAll(resp.Body)
var result map[string]interface{}
json.Unmarshal(respBody, &result)
fmt.Println(result["url"])
}
require 'net/http'
require 'json'
require 'uri'
uri = URI('https://genui.sh/api/artifacts/share')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
request = Net::HTTP::Post.new(uri)
request['Authorization'] = 'Bearer YOUR_API_KEY'
request['Content-Type'] = 'application/json'
request.body = {
template: 'markdown',
title: 'Hello World',
content: { text: '# Hello World\n\nThis is my first artifact!' }
}.to_json
response = http.request(request)
result = JSON.parse(response.body)
puts result['url']
use reqwest::header::{AUTHORIZATION, CONTENT_TYPE};
use serde_json::json;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = reqwest::Client::new();
let response = client
.post("https://genui.sh/api/artifacts/share")
.header(AUTHORIZATION, "Bearer YOUR_API_KEY")
.header(CONTENT_TYPE, "application/json")
.json(&json!({
"template": "markdown",
"title": "Hello World",
"content": {"text": "# Hello World\n\nThis is my first artifact!"}
}))
.send()
.await?;
let result: serde_json::Value = response.json().await?;
println!("{}", result["url"]);
Ok(())
}
using System.Net.Http.Json;
using System.Text.Json;
var client = new HttpClient();
client.DefaultRequestHeaders.Add("Authorization", "Bearer YOUR_API_KEY");
var response = await client.PostAsJsonAsync("https://genui.sh/api/artifacts/share", new {
template = "markdown",
title = "Hello World",
content = new { text = "# Hello World\n\nThis is my first artifact!" }
});
var result = await response.Content.ReadFromJsonAsync<JsonElement>();
Console.WriteLine(result.GetProperty("url").GetString());
{
"id": "art_abc123",
"url": "https://genui.sh/a/art_abc123?token=xyz...",
"expiresAt": "2024-01-22T12:00:00Z"
}
Next Steps
Authentication
Learn about API key management
Templates
Explore all available templates
API Reference
Full API documentation
Playground
Try the API interactively