import type { Metadata } from 'next'; import { TipBox } from '@/components/docs/shared/TipBox'; import { Table } from '@/components/docs/shared/Table'; import { CodeBlock } from '@/components/docs/shared/CodeBlock'; import { DocPage } from '@/components/docs/layout/DocPage'; import { JsonLd } from '@/components/seo/JsonLd'; import { createDocsMetadata, DOCS_PAGES } from '@/config/docs-seo'; import { createBreadcrumbSchema, createTechArticleSchema } from '@/config/docs-schema'; import { Hero, SectionHeader, InlineCode, EndpointCard, ResponseBlock, } from '@/components/docs/blocks'; const PAGE = DOCS_PAGES['api-live-scopes']; export const metadata: Metadata = createDocsMetadata(PAGE); const breadcrumbSchema = createBreadcrumbSchema([ { name: 'Home', path: '/' }, { name: 'Documentation', path: '/docs/' }, { name: 'API Reference', path: '/docs/api/' }, { name: 'Live Scopes', path: '/docs/api/live-scopes/' }, ]); const articleSchema = createTechArticleSchema(PAGE); const tocItems = [ { id: 'overview', text: 'Overview', level: 2 }, { id: 'create-scope', text: 'Create Scope', level: 2 }, { id: 'list-scopes', text: 'List Scopes', level: 2 }, { id: 'get-scope', text: 'Get Scope', level: 2 }, { id: 'update-scope', text: 'Update Scope', level: 2 }, { id: 'regenerate-scope', text: 'Regenerate Scope', level: 2 }, { id: 'delete-scope', text: 'Delete Scope', level: 2 }, { id: 'cdn-live-endpoint', text: 'CDN Live Endpoint', level: 2 }, { id: 'next-steps', text: 'Next Steps', level: 2 }, ]; export default function LiveScopesAPIPage() { return ( <>
Overview

Live scopes organize live URL generations. Each scope has its own generation limit and can be configured independently.

Scopes are auto-created on first use, but you can pre-configure them via this API to set custom limits.

Create Scope

Create a new live scope with custom settings.

Request Body

slug, string, Yes, 'Unique scope identifier (alphanumeric + hyphens + underscores)', ], [ allowNewGenerations, boolean, No, 'Allow new generations (default: true)', ], [ newGenerationsLimit, number, No, 'Maximum generations allowed (default: 30)', ], [ meta, object, No, 'Custom metadata', ], ]} />

Example Request

Response

List Scopes

Retrieve all live scopes for your project.

Query Parameters

slug, 'string', 'Filter by exact slug match'], [limit, 'number', 'Results per page (default: 20, max: 100)'], [offset, 'number', 'Number of results to skip'], ]} />

Example Request

Get Scope

Retrieve a single scope with statistics.

Example Request

Update Scope

Update scope settings. Changes take effect immediately.

Request Body

allowNewGenerations, 'boolean', 'Allow/disallow new generations'], [newGenerationsLimit, 'number', 'Update generation limit'], [meta, 'object', 'Update custom metadata'], ]} />

Example Request

Regenerate Scope

Regenerate images in a scope. Can regenerate a specific image or all images.

Request Body

imageId, 'string', 'Specific image to regenerate (omit for all)'], ]} />

Example Requests

Response

Delete Scope

Delete a scope and all its cached images.

Example Request

Deleting a scope permanently removes all cached images in it. This cannot be undone.
CDN Live Endpoint

Public endpoint for live URL generation (no authentication required):

Query Parameters

prompt, Yes, 'Text description of the image to generate', ], [ aspectRatio, No, 'Image ratio (default: 16:9)', ], [ autoEnhance, No, 'Enable prompt enhancement', ], [ template, No, 'Enhancement template to use', ], ]} />

Example

Response Headers

X-Cache-Status, 'HIT (cached) or MISS (generated)'], [X-Scope, 'Scope identifier'], [X-Image-Id, 'Image UUID'], [X-RateLimit-Remaining, 'Remaining IP rate limit (on MISS)'], ]} /> ); }