Quickstart
From zero to your first working API call in 5 minutes.
Quickstart
Get a working OptimoCMS integration in 5 steps.
Step 1 — Create an API key
- Log in to optimocms.com
- Navigate to Settings → API Keys
- Click Create API Key
- Give the key a name (e.g. "My App") and select the required scopes
- Copy the key — it is only shown once
Tip: Start with
sites:readandpages:readscopes. You can add more scopes later.
Step 2 — Install the SDK
npm install @optimocms/sdkThe SDK works with Node.js 18+ and modern browsers (ESM).
Don't need the SDK? You can also call the REST API directly:
curl https://api.optimocms.com/v1/health \
-H "X-Api-Key: your_api_key"{
"status": "ok",
"version": "1.0.0",
"timestamp": "2026-05-26T12:00:00Z"
}Step 3 — Initialize the client
Create a file cms.ts:
import { OptimoCMS } from '@optimocms/sdk';
const cms = new OptimoCMS({
apiKey: process.env.OPTIMOCMS_API_KEY!,
});
export default cms;Security: Always store your API key in an environment variable, never hardcoded in your code.
Step 4 — List your sites
import cms from './cms';
const response = await cms.sites.list();
for (const site of response.data) {
console.log(`${site.name} — ${site.domain} (${site.status})`);
}Response:
{
"data": [
{
"id": "site_abc123",
"name": "Baker's Corner",
"domain": "bakerscorner.com",
"status": "published",
"createdAt": "2026-01-15T10:30:00Z",
"updatedAt": "2026-05-20T14:22:00Z"
},
{
"id": "site_def456",
"name": "Corner Café",
"domain": "cornercafe.com",
"status": "draft",
"createdAt": "2026-03-01T09:00:00Z",
"updatedAt": "2026-05-25T16:45:00Z"
}
],
"pagination": { "total": 2, "limit": 20, "nextCursor": null },
"meta": { "requestId": "req_abc123", "timestamp": "2026-05-26T12:00:00Z" }
}Try it — curl:
curl https://api.optimocms.com/v1/sites \
-H "X-Api-Key: your_api_key"Try it — MCP (Cursor/Claude):
Use the list_sites tool to retrieve all my sites.Step 5 — Update a page and publish
import cms from './cms';
const siteId = 'site_abc123';
const pageId = 'page_xyz789';
// Update page title and SEO
const updated = await cms.pages.update(siteId, pageId, {
title: 'Our Bread Selection',
seo: {
title: 'Bread | Baker\'s Corner',
description: 'Discover our daily fresh bread selection.',
},
});
console.log(`Page updated: ${updated.data.title}`);
// Publish the site
const deploy = await cms.sites.publish(siteId);
console.log(`Deploy started: ${deploy.data.deployId}`);Response (update):
{
"data": {
"id": "page_xyz789",
"title": "Our Bread Selection",
"slug": "bread",
"status": "draft",
"seo": {
"title": "Bread | Baker's Corner",
"description": "Discover our daily fresh bread selection."
},
"updatedAt": "2026-05-26T12:05:00Z"
},
"meta": { "requestId": "req_def456", "timestamp": "2026-05-26T12:05:00Z" }
}Response (publish):
{
"data": {
"deployId": "deploy_ghi789",
"status": "queued",
"cached": false
},
"meta": { "requestId": "req_ghi789", "timestamp": "2026-05-26T12:05:01Z" }
}Try it — curl:
curl -X PUT https://api.optimocms.com/v1/sites/site_abc123/pages/page_xyz789 \
-H "X-Api-Key: your_api_key" \
-H "Content-Type: application/json" \
-d '{"title": "Our Bread Selection", "seo": {"title": "Bread | Baker'\''s Corner"}}'Try it — MCP:
Update the page "bread" on site site_abc123 with title "Our Bread Selection"
and then publish the site.Next steps
- Authentication — Learn about scopes, sandbox keys and rate limits
- SDK installation — Advanced SDK configuration
- SDK error handling — Typed errors and retry strategy
- SDK pagination — Fetch large datasets with cursors
- API Reference — All 30+ endpoints