Noma

Content

Content

Content methods read and write entries under /{collectionSlug} and bulk routes. They use your API key (CMS routes), not end-user tokens.

const noma = createClient({ projectId, apiKey })

Entry bodies use a data object keyed by each field’s name from the schema (usually kebab-case, e.g. meta-title). System fields such as state, locale, and published_at sit next to data on create and update.

content.list

Query entries in a collection.

const result = await noma.content.list("blog-posts", {
  state: "published",
  locale: "en",
  sort: "created_at:DESC",
  paginate: 20,
  page: 1,
})
ParamTypeDescription
state'draft' | 'published'Filter by draft or published entries.
localestringLocale code.
excludestring | string[]Field names to omit from each entry.
whereRecord<string, unknown>Structured filters; serialized to where[field][...] query params.
sortstringComma-separated sort keys. Each key is column:ASC or column:DESC (for example created_at:DESC, title:ASC). Core columns include id, created_at, updated_at, published_at; custom field names sort when paginate is set.
limitnumberMax rows (non-paginated list).
offsetnumberSkip rows (only applied when limit is set).
paginatenumberPage size when using page.
pagenumberPage number.
timestampsbooleanInclude created_at / updated_at on each entry when supported.
countflagIf the count query parameter is present, the response is { count: number } for the current filters instead of a list of entries.
firstflagIf the first query parameter is present on a list collection, the response is a single entry object (first row). Singleton collections use a different code path and ignore this.

Singleton collections

If the collection has is_singleton: true, list returns one entry resource directly (not an array), before pagination. That is separate from the first query parameter, which applies to non-singleton collections when you want only the first matching row.

where filters

Pass a nested object; the SDK flattens it for query strings. Detailed operators (equals, in, relations, and so on) are documented in the Content API filtering reference.

content.get

Fetch a single entry by UUID.

const entry = await noma.content.get("blog-posts", entryUuid, {
  locale: "en",
  translation_locale: "tr",
  state: "published",
})
ParamTypeDescription
localestringPreferred locale for the entry.
translation_localestringLoad a linked translation in this locale when available.
state'draft' | 'published'Which revision to read.
excludestring | string[]Fields to strip from the response.
timestampsbooleanInclude timestamps when supported.

content.create

Create an entry.

await noma.content.create("blog-posts", {
  locale: "en",
  state: "draft",
  data: {
    title: "Hello",
    slug: "hello",
    content: "<p>...</p>",
  },
})
FieldDescription
localeOptional locale for the new entry.
statedraft or published. Use the built-in state instead of a custom "published" boolean field.
published_atOptional ISO timestamp when publishing.
dataRequired. Field values keyed by field name.

content.update

Full replacement of an entry (PUT semantics on the API).

await noma.content.update("blog-posts", entryUuid, {
  state: "published",
  data: {
    title: "Hello (updated)",
    slug: "hello",
    content: "<p>Updated</p>",
  },
})

content.patch

Partial update (PATCH). Send only the fields you want to change inside data, plus optional state / locale / published_at.

await noma.content.patch("blog-posts", entryUuid, {
  data: {
    title: "New title only",
  },
})

content.delete

Delete an entry.

await noma.content.delete("blog-posts", entryUuid)
await noma.content.delete("blog-posts", entryUuid, true) // force when API allows

The third argument sets force on the query string when you need hard deletes per API rules.

Bulk operations

content.bulkCreate

await noma.content.bulkCreate("blog-posts", {
  items: [
    { locale: "en", state: "draft", data: { title: "A", slug: "a" } },
    { locale: "en", state: "draft", data: { title: "B", slug: "b" } },
  ],
})

content.bulkUpdate

await noma.content.bulkUpdate("blog-posts", {
  items: [
    { uuid: uuid1, data: { title: "A2" } },
    { uuid: uuid2, state: "published", data: { title: "B2" } },
  ],
})

content.bulkDelete

await noma.content.bulkDelete("blog-posts", {
  uuids: [uuid1, uuid2],
  force: false,
})

content.linkTranslation

Link two entries in the same collection as translations (different locales).

import type { LinkTranslationPayload } from "@nomacms/js-sdk"
 
const payload: LinkTranslationPayload = {
  translation_entry_uuid: otherEntryUuid,
}
 
await noma.content.linkTranslation("blog-posts", entryUuid, payload)
  • Assets - Upload files referenced from media fields.
  • Error Handling - Validation and not-found errors from these calls.

Search documentation

Find guides and reference pages