Skip to content

Delivery API

The Delivery API is the read-only, public-facing API that your storefront uses to fetch published content. It is optimized for low latency through Cloudflare KV caching.

Base path

/api/v1/

Endpoints

Get page by path

GET /api/v1/pages/by-path/{path}

Fetch the published content for a URL path. This is the primary endpoint used by the storefront router.

Path parameter:

  • path — URL path of the page, e.g. about or category/shoes

Query parameters:

ParamDefaultDescription
localedefault localeIETF locale code, e.g. en-US
environmentmainEnvironment ID
previewPreview token (fetches draft instead of published)

Example:

Terminal window
curl "https://your-worker.workers.dev/api/v1/pages/by-path/about?locale=en-US"

Response:

{
"id": "pg_01jnk...",
"path": "/about",
"content_type": "page",
"status": "published",
"layout_id": "pg_01jnk...",
"data": {
"componentsAboveFold": [
{
"id": "comp_01...",
"component": "Hero",
"title": "Welcome",
"subtitle": "...",
"uniqueClass": "alokon-abc123",
"styles": ".alokon-abc123 { ... }"
}
],
"componentsBelowFold": []
},
"locale": "en-US",
"version": 3
}

Get page by ID

GET /api/v1/pages/{id}

Same as above but fetches by page ID instead of path.

Query parameters: Same as by-path.

Caching

Published pages are cached in Cloudflare KV on publish. The delivery API reads from KV first:

  • Cache hit → immediate response, no D1 query
  • Cache miss → query D1, write to KV, return response

Cache is invalidated when a page is published, re-published, or unpublished.

Cache keys:

  • delivery:path:{spaceId}:{envId}:{path}:{locale}
  • delivery:id:{spaceId}:{envId}:{pageId}:{locale}

Integrating with the Alokai storefront

In your storefront’s middleware, use the @vsf-enterprise/alokon-api package. The SDK calls /alokon/unified/getPage which internally calls the delivery API.

const page = await sdk.alokon.getPage({ path: '/about', locale: 'en-US' });