# Akarya CMS API contract

The website (`lib/cms.ts` → `lib/content.ts`) reads all editorial content from a
headless CMS at **`https://cms.akarya.id`** (overridable with `NEXT_PUBLIC_CMS_URL`).
This document is the contract that CMS must implement.

If any endpoint is unreachable, returns a non-2xx, or omits `data`, the site
silently falls back to the bundled content in `data/site.ts`. Seed the CMS from
that file — it is the current production content and the canonical example of
every shape below.

---

## Conventions

| | |
| --- | --- |
| **Base URL** | `https://cms.akarya.id` |
| **Methods** | `GET` only |
| **Auth** | none — endpoints are public, world-readable |
| **Content-Type** | `application/json; charset=utf-8` |
| **Caching** | site refetches every `NEXT_PUBLIC_CONTENT_REVALIDATE_SECONDS` (default 10s); `Cache-Control: public, max-age=60` on the CMS is fine |
| **Published only** | return only published items |

### Response envelope (every endpoint)

```json
{
  "data": { },
  "meta": { "count": 12, "generatedAt": "2026-08-28T00:00:00.000Z" }
}
```

The site reads **only `data`**. `meta` is informational and may hold anything.

### Field value shapes

| Shape | JSON | Used for |
| --- | --- | --- |
| Localised text (`L`) | `{ "en": "…", "id": "…" }` | every title / description / body — **never a bare string** |
| Localised list (`LL`) | `{ "en": ["…"], "id": ["…"] }` | bullet lists (benefits, features, …) |
| FAQ | `{ "question": L, "answer": L }` | `faqs[]` |
| Image | `{ "url": "https://cms.akarya.id/media/x.jpg", "alt": "…" }` | images — absolute URL on `cms.akarya.id`; `null` when unset |
| File | `{ "url": "https://cms.akarya.id/media/x.pdf", "originalFilename": "x.pdf" }` | video / PDF assets; `null` when unset |
| Slug | `"smart-classroom"` | plain string, unique per collection |
| Relation | `["smart-classroom-uad"]` | array of **target slug strings** |
| Date | `"2026-07-01T00:00:00.000Z"` | ISO-8601 |
| ArticleBlock | see below | one block in an article's modular `body[]` |

### ArticleBlock

`body` is an ordered array of blocks. Each block has a `type` and its own fields:

| `type` | fields |
| --- | --- |
| `"richText"` | `html`: `L` — an HTML string per locale (headings, `<p>`, `<ul>/<ol>`, `<a>`, `<strong>/<em>`, `<blockquote>`). The site injects it as-is. |
| `"image"` | `image`: Image or `null`; `caption`: `L` (opt) |
| `"video"` | `embedUrl`: string or `null` (YouTube/Vimeo/`.mp4`); `file`: File or `null` (uploaded video); `caption`: `L` (opt) |

```json
"body": [
  { "type": "richText", "html": { "en": "<h2>Background</h2><p>…</p>", "id": "<h2>Latar</h2><p>…</p>" } },
  { "type": "image", "image": { "url": "https://cms.akarya.id/img/x.jpg", "alt": "…" }, "caption": { "en": "…", "id": "…" } },
  { "type": "video", "embedUrl": "https://youtu.be/abc123", "file": null, "caption": { "en": "", "id": "" } }
]
```

Send `[]` (not `null`) for empty list fields where possible. Omit or `null` for
empty scalars/objects.

---

## Endpoints

| Site function | Endpoint | `data` | Order |
| --- | --- | --- | --- |
| `getSiteSettings()` | `GET /api/site-settings` | object | — |
| `getSolutions()` | `GET /api/solutions` | array | `title.en` asc |
| `getProductCategories()` | `GET /api/product-categories` | array | `position` asc |
| `getProducts()` | `GET /api/products` | array | `featuredProduct` desc, then `title.en` asc |
| `getIndustries()` | `GET /api/industries` | array | `title.en` asc |
| `getCaseStudies()` | `GET /api/success-stories` | array | `publishedAt` desc |
| `getPartnerBrands()` | `GET /api/partner-brands` | array | `name` asc |
| `getBlogPosts()` | `GET /api/insights` | array | `publishedAt` desc |
| _links directory page_ | `GET /api/links` | array | CMS row order (`position` asc) |

The site pulls whole collections and does its own filtering, slug lookup, and
detail rendering. **No per-slug detail endpoints are needed.**

`GET /api/links` is not consumed by `lib/cms.ts`. It backs the standalone
`public/links/index.html` channel directory, which fetches it client-side and
falls back to its own hardcoded list on any error.

---

## Resource fields

`L` = localised text, `LL` = localised list. "opt" = may be `null`/omitted.

### `/api/product-categories` — item

| field | type | |
| --- | --- | --- |
| `title` | L | required |
| `slug` | string | required, unique |
| `shortDescription` | L | opt — shown under the category heading on `/products` |
| `position` | number | 1-based display order |

### `/api/solutions` — item

| field | type | |
| --- | --- | --- |
| `title` | L | required |
| `slug` | string | required, unique |
| `eyebrow` | L | opt — card label |
| `shortDescription` | L | |
| `fullDescription` | L | |
| `icon` | string | icon key (e.g. `"Presentation"`) |
| `heroImage` | Image | opt |
| `showcaseImage` | Image | opt — homepage showcase |
| `detailHeroVideo` | File | opt — replaces the image carousel when set |
| `detailHeroImages` | Image[] | opt |
| `relatedCaseStudies` | string[] | success-story slugs |
| `commonProblems` | LL | |
| `systemComponents` | LL | |
| `suitableFor` | LL | |
| `benefits` | LL | |
| `faqs` | FAQ[] | |
| `seoTitle` | L | |
| `seoDescription` | L | |

### `/api/products` — item

| field | type | |
| --- | --- | --- |
| `title` | L | required |
| `slug` | string | required |
| `category` | `{ slug, title:L }` | opt/`null` — reference to a `/api/product-categories` item; groups the product on the `/products` page |
| `shortDescription` | L | required |
| `fullDescription` | L | |
| `heroImage` | Image | opt |
| `showcaseImage` | Image | opt — homepage product grid card; frontend falls back to `heroImage` |
| `detailHeroVideo` | File | opt |
| `detailHeroImages` | Image[] | opt |
| `keyFeatures` | LL | |
| `suitableFor` | LL | |
| `benefits` | LL | |
| `relatedSolutions` | string[] | solution slugs |
| `relatedCaseStudies` | string[] | success-story slugs |
| `faqs` | FAQ[] | |
| `featuredProduct` | boolean | |
| `seoTitle` | L | |
| `seoDescription` | L | |
| `ogImage` | Image | opt |

### `/api/industries` — item

| field | type | |
| --- | --- | --- |
| `title` | L | required |
| `slug` | string | required |
| `shortDescription` | L | |
| `fullDescription` | L | |
| `showcaseImage` | Image | opt |
| `detailHeroVideo` | File | opt |
| `detailHeroImages` | Image[] | opt |
| `relatedSolutions` | string[] | solution slugs |
| `relatedCaseStudies` | string[] | success-story slugs |
| `painPoints` | LL | |
| `keyBenefits` | LL | |
| `faqs` | FAQ[] | |
| `seoTitle` | L | |
| `seoDescription` | L | |

### `/api/success-stories` — item (case study)

| field | type | |
| --- | --- | --- |
| `title` | L | required |
| `slug` | string | required |
| `clientName` | string | |
| `industry` | string | free-text label |
| `location` | string | |
| `year` | string | |
| `projectCategory` | string | |
| `heroImage` | Image | opt |
| `galleryImages` | Image[] | opt |
| `shortSummary` | L | teaser / meta-description fallback |
| `body` | ArticleBlock[] | the story write-up as modular blocks (replaces the old `background`/`challenge`/`solution`/`process`/`result`/`benefits` fields) |
| `productsOrTechnologiesUsed` | string[] | |
| `partnerBrands` | string[] | brand **names** (free text, not slugs) |
| `portfolioFile` | File | opt — downloadable PDF/PPT |
| `featuredProject` | boolean | |
| `publishedAt` | date | ISO |
| `seoTitle` | L | |
| `seoDescription` | L | |
| `ogImage` | Image | opt |

### `/api/partner-brands` — item

| field | type | |
| --- | --- | --- |
| `name` | string | required |
| `logo` | Image | opt |
| `website` | string | URL |
| `category` | string | |
| `description` | L | |

### `/api/insights` — item (blog post)

| field | type | |
| --- | --- | --- |
| `title` | L | required |
| `slug` | string | required |
| `excerpt` | L | teaser / meta-description fallback |
| `body` | ArticleBlock[] | the post as modular blocks (rich text / image / video) |
| `content` | L | opt — **legacy** plain-text mirror of `body`, kept for older consumers; prefer `body` |
| `coverImage` | Image | opt |
| `author` | string | |
| `publishedAt` | date | ISO — drives sort and the year filter |
| `seoTitle` | L | |
| `seoDescription` | L | |

### `/api/links` — item (channel directory row)

Plain (non-localised) strings — the links page is single-language.

| field | type | |
| --- | --- | --- |
| `code` | string | opt — short tag beside the row, e.g. `"IN·01"`; page auto-numbers when `null` |
| `title` | string | required |
| `subtitle` | string | opt |
| `url` | string | required — absolute or site-relative |
| `icon` | string | opt — icon key: `globe`, `whatsapp`, `monitor`, `grid`, `blueprint`, `star`, `document`, `mail`, `phone`, `instagram`, `link` |
| `featured` | boolean | renders as the highlighted primary channel |
| `newTab` | boolean | open in a new tab |

```json
{
  "data": [
    { "code": "IN·01", "title": "akarya.id", "subtitle": "Main site", "url": "/", "icon": "globe", "featured": true, "newTab": false }
  ],
  "meta": { "count": 1, "generatedAt": "2026-08-31T09:00:00.000Z" }
}
```

### `/api/site-settings` — single object

Partial payloads are safe: the site deep-merges this over the `data/site.ts`
defaults, so you can send only the fields you want to override.

| field | type | |
| --- | --- | --- |
| `siteName` | string | |
| `siteDescription` | L | |
| `logo` | string (URL) | |
| `homepageHeroSlides` | HeroSlide[] | |
| `homepageOverview` | `{ eyebrow:L, title:L, body:L, metrics: { title:L, description:L }[] }` | |
| `homepageShowcase` | `{ eyebrow:L, items:string[] }` | `items` = curated Solution slugs in display order; the stage background is each Solution's own `showcaseImage` |
| `homepageProducts` | `{ eyebrow:L, title:L, intro:L, items: { title:L, description:L, image:Image, href:string }[] }` | |
| `partnerLogos` | `{ name:string, logo:Image, website:string, category:string, description:L }[]` | every published Partner Brand, in module order — same items as `GET /api/partner-brands` |
| `roomDesignerPage` | `{ eyebrow:L, title:L, description:L, ctaLabel:L, ctaHref:string, backgroundType:"image"\|"video", backgroundImage:Image, backgroundVideo:File }` | |
| `contactEmail` | string | |
| `phoneNumber` | string | e.g. `"+6282241427442"` |
| `whatsappNumber` | string | digits only, e.g. `"6282241427442"` |
| `headOfficeAddress` | string | |
| `studioAddress` | string | |
| `socialLinks` | `{ label:string, url:string }[]` | |
| `website` | string | |
| `socialHandle` | string | e.g. `"@akarya.official"` |
| `defaultSeoTitle` | L | |
| `defaultSeoDescription` | L | |
| `defaultOgImage` | Image | |

**HeroSlide** = `{ eyebrow:L, title:L (required), body:L, primaryLabel:L,
primaryHref:string, secondaryLabel:L, secondaryHref:string,
mediaType:"image"|"video", image:Image, video:File }`

---

## Examples

### `GET /api/solutions`

```json
{
  "data": [
    {
      "title": { "en": "Smart Classroom & Interactive Learning", "id": "Smart Classroom & Interactive Learning" },
      "slug": "smart-classroom",
      "eyebrow": { "en": "Learning Space", "id": "Ruang Belajar" },
      "shortDescription": { "en": "Interactive displays, projectors, audio systems…", "id": "Interactive display, proyektor, sistem audio…" },
      "fullDescription": { "en": "Akarya designs smart classroom environments…", "id": "Akarya merancang smart classroom…" },
      "icon": "Presentation",
      "heroImage": { "url": "https://cms.akarya.id/media/smart-classroom-hero.jpg", "alt": "Smart classroom" },
      "showcaseImage": null,
      "detailHeroVideo": null,
      "detailHeroImages": [],
      "relatedCaseStudies": ["ums-smart-classroom"],
      "commonProblems": { "en": ["Inconsistent AV setups"], "id": ["Setup AV tidak konsisten"] },
      "systemComponents": { "en": ["Interactive flat panel"], "id": ["Interactive flat panel"] },
      "suitableFor": { "en": ["Universities"], "id": ["Universitas"] },
      "benefits": { "en": ["Reliable daily teaching"], "id": ["Pengajaran harian yang andal"] },
      "faqs": [
        { "question": { "en": "Do you provide training?", "id": "Apakah ada training?" }, "answer": { "en": "Yes.", "id": "Ya." } }
      ],
      "seoTitle": { "en": "Smart Classroom System Integrator Indonesia | Akarya", "id": "System Integrator Smart Classroom Indonesia | Akarya" },
      "seoDescription": { "en": "Smart classroom system integration…", "id": "Integrasi smart classroom…" }
    }
  ],
  "meta": { "count": 1, "generatedAt": "2026-08-28T09:00:00.000Z" }
}
```

### `GET /api/insights`

```json
{
  "data": [
    {
      "title": { "en": "AV over IP basics", "id": "Dasar AV over IP" },
      "slug": "av-over-ip-basics",
      "excerpt": { "en": "A short intro…", "id": "Pengantar singkat…" },
      "body": [
        { "type": "richText", "html": { "en": "<p>Full article text as HTML…</p>", "id": "<p>Teks artikel lengkap…</p>" } }
      ],
      "content": { "en": "Full article text as a plain string…", "id": "Teks artikel lengkap…" },
      "coverImage": { "url": "https://cms.akarya.id/img/av-over-ip.jpg", "alt": "Network switch" },
      "author": "Akarya Team",
      "publishedAt": "2026-07-01T00:00:00.000Z",
      "seoTitle": { "en": "AV over IP basics | Akarya", "id": "Dasar AV over IP | Akarya" },
      "seoDescription": { "en": "What AV over IP means for your rooms.", "id": "Apa arti AV over IP untuk ruang Anda." }
    }
  ],
  "meta": { "count": 1, "generatedAt": "2026-08-28T09:00:00.000Z" }
}
```

### `GET /api/site-settings`

```json
{
  "data": {
    "siteName": "Akarya",
    "siteDescription": { "en": "Premium, reliable AV & IT system integration…", "id": "System integrator AV & IT yang premium…" },
    "logo": "https://cms.akarya.id/media/akarya-logo.svg",
    "homepageHeroSlides": [
      {
        "eyebrow": { "en": "AV & IT System Integrator", "id": "AV & IT System Integrator" },
        "title": { "en": "Building Reliable AV, IT & Experience Technology Spaces", "id": "Building Reliable AV, IT & Experience Technology Spaces" },
        "body": { "en": "Smart classrooms, meeting rooms, LED displays…", "id": "Smart classroom, meeting room, LED display…" },
        "primaryLabel": { "en": "Talk to Akarya", "id": "Talk to Akarya" },
        "primaryHref": "/talk-to-akarya",
        "mediaType": "image",
        "image": { "url": "https://cms.akarya.id/media/hero-1.jpg", "alt": "Integrated meeting room" }
      }
    ],
    "contactEmail": "info@akarya.id",
    "phoneNumber": "+6282241427442",
    "whatsappNumber": "6282241427442",
    "website": "test.akarya.id",
    "socialHandle": "@akarya.official",
    "headOfficeAddress": "Jl. Sisingamangaraja No.100, Yogyakarta 55153",
    "studioAddress": "Senggot, Singopadu, Sidoharjo, Kab. Sragen",
    "socialLinks": [{ "label": "Instagram", "url": "https://instagram.com/akarya.official" }],
    "defaultSeoTitle": { "en": "Akarya | AV & IT System Integrator…", "id": "Akarya | System Integrator AV & IT Indonesia" },
    "defaultSeoDescription": { "en": "Akarya designs, installs, and supports…", "id": "Akarya merancang, memasang…" },
    "defaultOgImage": { "url": "https://cms.akarya.id/media/og-default.jpg", "alt": "Akarya" }
  },
  "meta": { "generatedAt": "2026-08-28T09:00:00.000Z" }
}
```
