Classes
Class: TentoClient
TentoCMS TypeScript SDK Client
TentoCMS TypeScript SDK Client
Official client for interacting with the TentoCMS public API. Provides type-safe methods for accessing pages, collections, media, and blog content.
Read-only operations work with any API key (public or secret). Write operations require a secret key (tento_sk_*).
Example
import { TentoClient } from '@tentocms/client'
// Read-only client
const reader = new TentoClient({
apiKey: 'tento_pk_1234567890'
})
const pages = await reader.pages.list()
// Read + write client — write resources (e.g. `pagesWrite`) are non-null only with a
// secret key; `pages` etc. remain read-only.
const writer = new TentoClient({
apiKey: 'tento_sk_1234567890'
})
await writer.pagesWrite!.create({ ... })
Constructors
Constructor
new TentoClient(config): TentoClient;
Create a new TentoCMS client
Parameters
| Parameter | Type | Description |
|---|---|---|
config | TentoClientConfig | Client configuration |
Returns
TentoClient
Throws
If API key is not provided or has invalid format
Properties
| Property | Modifier | Type | Description |
|---|---|---|---|
blog | readonly | BlogResource | Blog API resource (posts, categories, tags) |
collections | readonly | CollectionsResource | Collections API resource (read) |
collectionsWrite | readonly | CollectionsWriteResource | null | Collections write resource (create, update, delete) Only available with secret API keys (tento_sk_*) |
media | readonly | MediaResource | Media API resource (read) |
mediaWrite | readonly | MediaWriteResource | null | Media write resource (upload) Only available with secret API keys (tento_sk_*) |
pages | readonly | PagesResource | Pages API resource (read) |
pagesWrite | readonly | PagesWriteResource | null | Pages write resource (create, update, publish, delete) Only available with secret API keys (tento_sk_*) |
Methods
getBaseUrl()
getBaseUrl(): string;
Get the base URL being used by this client
Returns
string
getTimeout()
getTimeout(): number;
Get the timeout being used by this client (in milliseconds)
Returns
number
hasWriteAccess()
hasWriteAccess(): boolean;
Check if this client has write capabilities
Returns
boolean

