Technical Reference
Share API
Create and manage shareable content from your installation.
Overview
The Share API enables creating temporary or permanent shareable links to installation content. Shares can include text, images, or interactive components with optional expiration.
Base endpoint
POST /api/v1/share Content types
Different content types support different body formats and rendering.
Text content
{
"content": {
"type": "text",
"body": "Plain text or markdown content"
}
} Image content
{
"content": {
"type": "image",
"body": "https://your-domain.com/images/example.jpg"
}
} Interactive content
{
"content": {
"type": "interactive",
"body": {
"component": "HandDrawnEmphasis",
"props": {
"text": "Shared interactive element",
"variant": "underline"
}
}
}
} Rate limits
Share API has specific rate limits to prevent abuse.
| Endpoint | Limit | Window |
|---|---|---|
| Create share | 30 requests | per minute |
| Retrieve share | 300 requests | per minute |
| Update/Delete share | 60 requests | per minute |
| List shares | 60 requests | per minute |
Code examples
Complete examples for common Share API use cases.
Create and share text
createShare.js
async function createShare(content, options = {}) {
const response = await fetch('/api/v1/share', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': `Bearer ${API_TOKEN}`
},
body: JSON.stringify({
content: {
type: 'text',
body: content
},
options
})
});
const result = await response.json();
if (result.success) {
console.log('Share created:', result.data.url);
return result.data;
} else {
console.error('Error:', result.error);
}
}
// Usage
const share = await createShare(
'Check out this amazing installation!',
{ expires: '2024-12-31T23:59:59Z', maxViews: 100 }
); Retrieve and display share
displayShare.js
async function displayShare(shareId) {
const response = await fetch(`/api/v1/share/${shareId}`);
const result = await response.json();
if (result.success) {
const { content, viewCount, remainingViews } = result.data;
console.log('Content:', content.body);
console.log(`Views: ${viewCount} (remaining: ${remainingViews})`);
return result.data;
} else {
console.error('Share not found or expired');
}
}
// Usage
const share = await displayShare('abc123xyz');