Data collections
Structured content the owner edits in Behio (team, references, price list, FAQ, listings), read by the site without its own database
A data collection is a small table the owner keeps in Behio: team members, references, a price list, FAQ, job offers, property listings, events. The owner defines the fields once and adds items in the admin or the mobile app; the site reads them through the API. No site needs its own database, and an edit is live without a new deploy.
Collection endpoints work with both e-shop keys and website keys, so a company website without a shop can use them too.
Read a collection
const { data: team, error } = await client.collections.get('team');
if (error || !team) {
// 404 be.collections.collectionNotFound: unknown slug, or the collection is private
}
// team.name, team.description
// team.fields: StorefrontCollectionField[] (key, type, label, required, options?)
// team.items: [{ id, slug, data: { name: 'Jana', role: 'CEO', photo: 'https://...' } }]
// team.total: number of published itemsclient.collections.get(slug: string, query?: { limit?: number; offset?: number }): Promise<SdkResult<StorefrontCollection>>
- Items come in the order the owner set in the admin.
- Only published items of public collections are returned. Drafts and admin-only collections never leave Behio.
limitis 1 to 200 (default 100); page withoffsetandtotal.- The response is cached by Behio and invalidated on every change in the admin, so fetch it server-side (a Server Component or a loader) on every request without your own cache.
One item (detail page)
const { data: member } = await client.collections.item('team', params.slug);
// slug or id; 404 be.collections.itemNotFound for a draft or unknown itemclient.collections.item(slug: string, itemSlugOrId: string): Promise<SdkResult<StorefrontCollectionItem>>
Field types
type | Value in data |
|---|---|
text, longtext | string (longtext may contain line breaks; render as text, not HTML) |
number | number |
boolean | boolean |
date | YYYY-MM-DD string |
url, image | absolute http(s) address string |
email | string |
select | one of field.options |
tags | string[] |
A field the owner left empty is missing from data, so always guard optional values.
React hooks
import { useCollection, useCollectionItem } from '@behio/storefront-sdk/react';
const { data: faq } = useCollection('faq');
const { data: item } = useCollectionItem('references', 'acme');Prefer the server-side client.collections.get for the first render; the hooks are for parts that load later.
Creating collections
Collections are created in the Behio admin (Web or E-shop, Data collections) or by an AI agent through the Behio MCP tools collection-create-update and collection-item-upsert. See Build with AI.