Kanorio

API 参考

Items

Content Delivery API: GET /collections/{key}/items, GET /collections/{key}/items/{slug}

本页只有英文版。API 参考、Webhook 事件和更新日志保持英文,与代码中的字段名称、错误码一致。
Base URL https://{site}/api/v1ErrorsPagination

Published items of a collection

GET/collections/{key}/items
betaNo auth

Parameters

  • keystring · pathrequired
  • filterobject · query

    Bracket-notation filter conditions (up to 10 conditions combined with AND, plus 2-level OR groups via filter[any][0][field][op]=value). Shorthand filter[field]=value equals filter[field][eq]=value. 15 operators by field type: eq, ne, in, nin (up to 100 comma-separated values), gt, gte, lt, lte, contains, ncontains, match (multi-word substring match on text/rich_text, max 1 per query and 8 words), exists (true|false), has (multi_select/multi_reference), eq_slug (reference), has_slug (multi_reference). Item-level attributes slug, publishedAt, createdAt, updatedAt are also filterable. Date/datetime fields accept relative expressions: now or now[+-]<N><s|m|h|d|w|M|y> (e.g. filter[publishedAt][gte]=now-30d).

  • sortstring · query

    Comma-separated sort fields (up to 3 fields), prefix with `-` for descending (e.g. `sort=-publishedAt,title`), or bracket form `sort[field]=asc|desc`. Sortable: scalar fields and item attributes (`slug`, `publishedAt`, `createdAt`, `updatedAt`); `rich_text`, `json`, `image`, `gallery`, `file`, and `multi_*` are not sortable.

  • limitinteger · query

    Maximum number of items to return, 1-100. Defaults to 20.

  • cursorstring · query

    Opaque cursor from the previous page's nextCursor. Omit for the first page.

  • totalboolean · query

    true adds total (the number of matching items) to the response; it costs an extra count query.

  • fieldsstring · query

    Comma-separated `fieldData` field IDs to project (top-level item metadata `id`, `slug`, `publishedAt`, `updatedAt` are always returned).

  • expandstring · query

    Comma-separated `reference` or `multi_reference` field IDs (plus `primary_author`, `primary_category` on `blog`) to expand 1 layer into `item.expanded[fieldId]`. Referenced media assets are automatically included in the top-level `assets` map (trashed, missing, or private-bucket assets are filtered out).

  • includeDepth1 · query

    Reference include depth. Only 1 is accepted in v1.

  • formatsstring · query

    Comma-separated blog content formats: markdown, html, plaintext

  • localestring · query

    Locale for item fields marked localized; for the blog, blog_categories, blog_tags and authors collections, the post, category, tag and author translations (titles, excerpts, bodies, SEO fields). Expanded references are translated too. One of the site's locales from /site (a code such as `en-US` or the URL prefix such as `en`); omit it for the primary locale. Other values, including locales that are still translating, return 400 UNSUPPORTED_LOCALE. Untranslated fields fall back to the primary locale. On multilingual sites each item carries resolvedLocale and availableLocales.

  • preview"1" · query

    Pass `preview=1` with `X-Kanorio-Preview: knr_pv_<token>` (or a server-held PAT with `collections:view`) to read unpublished draft `fieldData` (`Cache-Control: no-store`).

Response 200

  • dataobject[]required
  • hasMorebooleanrequired

    True when another page exists; pass nextCursor to fetch it.

  • nextCursorstring | nullrequired

    Cursor for the next page, or null on the last page.

  • totalinteger

    Number of matching items; only present when the request sets total=true.

  • assetsobjectrequired
  • accessobject

    Field-level access summary. At the top level it describes the collection policy for the current viewer (anonymous or the bearer of a Customer Access Token); per-item access may differ when the collection sets itemOverrideField, so render per item from items[].access.

  • access.grantedbooleanrequired
  • access.gatedstring[]required
  • access.requiresobject | nullrequired
  • access.requires.kind"customer" | "entitlement"
  • access.requires.featureKeystring

Errors

  • COLLECTION_NOT_FOUND 404
  • INVALID_QUERY 400
  • INVALID_CURSOR 400
  • UNSUPPORTED_LOCALE 400
  • QUERY_TIMEOUT 503
curl -X GET "https://{site}/api/v1/collections/{key}/items"

One published item by slug

GET/collections/{key}/items/{slug}
betaNo auth

Parameters

  • keystring · pathrequired
  • slugstring · pathrequired
  • fieldsstring · query
  • expandstring · query
  • formatsstring · query

    Comma-separated blog content formats: markdown, html, plaintext

  • preview"1" · query
  • includeDepth1 · query

    Reference include depth. Only 1 is accepted in v1.

  • localestring · query

    Locale for the item, the same as the list endpoint (system collections use the post, category, tag and author translations; expanded references are translated too). One of the site's locales from /site (a code such as `en-US` or the URL prefix such as `en`); omit it for the primary locale. Other values, including locales that are still translating, return 400 UNSUPPORTED_LOCALE. Untranslated fields fall back to the primary locale. On multilingual sites the item carries resolvedLocale and availableLocales.

Response 200

  • itemobjectrequired
  • assetsobjectrequired
  • accessobject

    Field-level access summary. At the top level it describes the collection policy for the current viewer (anonymous or the bearer of a Customer Access Token); per-item access may differ when the collection sets itemOverrideField, so render per item from items[].access.

  • access.grantedbooleanrequired
  • access.gatedstring[]required
  • access.requiresobject | nullrequired
  • access.requires.kind"customer" | "entitlement"
  • access.requires.featureKeystring

Errors

  • COLLECTION_NOT_FOUND 404
  • ITEM_NOT_FOUND 404
  • UNSUPPORTED_LOCALE 400
curl -X GET "https://{site}/api/v1/collections/{key}/items/{slug}"