01. API_OVERVIEW
The Geometry Vault API is a RESTful service built with FastAPI, providing programmatic access to the procedural synthesis engine. It is designed for high-performance generation of SVG and PNG specimens, utilizing narrative hashing to ensure structural uniqueness.
BASE_URL
https://geometry-vault.glassgallery.my.id/api
02. ENDPOINTS
GET /health
System status and version check.
{
"status": "healthy",
"service": "geometry-vault-api",
"version": "1.0.0"
}
POST /generate
Generate archival specimens with JSON parameters.
curl -X POST "https://geometry-vault.glassgallery.my.id/api/generate" \
-H "Content-Type: application/json" \
-d '{
"seed": "Archival Sequence",
"colors": "#8B1A1A, #2A2520",
"format": "png",
"scale": 2400
}'
GET /preview
Retrieve metadata and base64 preview without direct download.
Parameters: seed, colors, ratio_w, ratio_h
03. EMBED_MODE
Embed mode provides a minimalist, iframe-optimized view of the specimen. It removes the UI controls and applies a bone-colored background suitable for archival presentation.
IFRAME_PROTOCOL
<iframe
src="https://geometry-vault.glassgallery.my.id/?mode=embed&seed=YourSeed"
width="500" height="500"
frameborder="0">
</iframe>
04. REAL_TIME_CONTROL
The embed interface can be controlled dynamically from a parent window via the postMessage API. This allows for seamless integration into interactive platforms or CMS environments.
// Example: Update embedded specimen
const vaultFrame = document.querySelector('iframe');
vaultFrame.contentWindow.postMessage({
type: 'UPDATE_SPECIMEN',
data: {
seed: 'New Narrative Sequence',
colors: '#8B1A1A, #EFE9DC',
w: 16,
h: 9
}
}, '*');
05. SMART_AUTOCACHE_PROTOCOL
To ensure near-instant response times for high-traffic integrations (e.g., WordPress titles), the vault employs a Dual-Layer Smart Autocache. Successful requests are cached at the edge (Nginx) and in-memory (FastAPI).
CACHE_TTL
24 Hours (86,400 seconds)
MONITORING_HEADER
X-Cache-Status: HIT | MISS
Note: The system serves stale content automatically if the backend is under heavy load, ensuring constant availability.
06. ID_RECONSTRUCTION_LOGIC
The sequence identifier (SEQ-ID) is a reversible Base32 representation of the 32-bit FNV-1a hash. This allows specimens to be perfectly reconstructed without the original narrative seed.
RECOVERY_PARAMETER
GET /?id=83-XHVBYJ&colors=#8B1A1A...
In the main vault interface, users can inject a known identifier into the ID_LOAD_INPUT field to recover a specific geometry specimen from the archival matrix.
07. WORDPRESS_INTEGRATION_GUIDE
Automate featured image generation by hooking into the WordPress save_post action. This implementation leverages the Smart Autocache to ensure that multiple edits to the same title do not strain the synthesis engine.
// Add to functions.php
add_action('save_post', function($post_id) {
if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) return;
$title = get_the_title($post_id);
$vault_url = "https://geometry-vault.glassgallery.my.id/api/generate";
$response = wp_remote_post($vault_url, [
'headers' => ['Content-Type' => 'application/json'],
'body' => json_encode([
'seed' => $title,
'format' => 'png',
'ratio_w' => 16,
'ratio_h' => 9,
'scale' => 1200
])
]);
if (!is_wp_error($response) && wp_remote_retrieve_response_code($response) === 200) {
$cache_status = wp_remote_retrieve_header($response, 'x-cache-status');
// Handle image upload and set as featured image...
}
}, 10, 1);