API Reference

Complete API documentation for the Mybe CMS SDK

Content Models

getContentModels(projectId: string)

Get all content models for a project.

const contentModels = await sdk.getContentModels('project-id');

// Returns: Promise<ContentType[]>

getContentModel(contentTypeId: string)

Get a specific content model by ID.

const contentModel = await sdk.getContentModel('content-type-id');

// Returns: Promise<ContentType>

Content Entries

getContent(contentId: string)

Get a single content entry by ID.

const content = await sdk.getContent('content-id');

// Returns: Promise<ContentEntry>

getContentByType(contentTypeId: string, options?: ContentFilterOptions)

Get all content entries for a specific content type.

const result = await sdk.getContentByType('content-type-id', {
  status: 'published',
  limit: 20,
  lastKey: 'pagination-key'
});

// Returns: Promise<ContentListResponse>

Options:

  • status?: 'draft' | 'published' | 'archived'
  • locale?: string
  • limit?: number
  • lastKey?: string

getContentByField(contentTypeId: string, fieldName: string, fieldValue: string)

Get a single content entry by matching a specific field value. Useful for fetching content by slug, href, or any unique identifier.

// Get service by href field
const service = await sdk.getContentByField(
  "a231c87b-9a80-4170-bb5b-bf19fd69233b",
  "href",
  "/services/cloud-migration"
);

// Get blog post by slug
const post = await sdk.getContentByField(
  "blog-type-id",
  "slug",
  "my-first-post"
);

// Returns: Promise<ContentEntry | null>
// Returns null if no matching content is found

Use Cases:

  • • Dynamic routing (fetch page by URL path)
  • • SEO-friendly URLs (fetch by slug)
  • • Unique identifiers (fetch by custom ID field)
  • • Returns null instead of throwing error if not found