Docs

Site API reference

Version 4.1.0 · Markdown version at /api/v1/docs

casadigital.pt is the single owner of all customer data. Client websites — and any other app built on this platform — never touch the database directly: they read and write through this HTTP API.

Every tenant (a Site) has its own API key, issued when the site is provisioned. The key both authenticates the request and identifies the tenant, so no site identifier needs to be sent.

Building a site on the platform?

This page documents the endpoints. The full integration contract — environment, caching, the invalidation endpoint a client site must expose, limits and error handling — is at /api/v1/integration.md, described as OpenAPI 3.1 at /api/v1/openapi.json and indexed for agents at /llms.txt.

Authentication

All authenticated endpoints expect the key in the Authorization header: "Authorization: Bearer sk_<48 hex chars>".

Requests with a missing or unknown key receive 401. Keys are managed by Casa Digital; if a key leaks it can be regenerated, which immediately invalidates the old one.

Authorization: Bearer sk_0123abcd…

Content resources

Content is served one resource at a time so each consumer fetches only what it renders and caches it on its own schedule. There is no combined content document.

Every resource response is wrapped in the same envelope: { version, siteKey, <resource> }. Compare version against the contract version you built against and log loudly on a major mismatch.

An empty site is a valid site. Singleton resources come back fully defaulted (absent strings are empty strings) and collections come back as empty arrays, so a website whose content has not been authored yet still renders. Content problems are never signalled by a 404.

The platform serves design-agnostic business data only. Layout and section copy belong to each website's own design and are not part of these resources.

Endpoints

GET

/api/v1/settings

API key

Business name, tagline, description, contact details, opening schedule and social links for the authenticated site.

Response

200 with { version, siteKey, settings } — empty content included. 401 on bad key.

{
  "version": "4.1.0",
  "siteKey": "my-business",
  "settings": {
    "name": "…",
    "tagline": "…",
    "phone": "+351 912 345 678",
    "schedule": [{ "days": "Seg – Sáb", "hours": "09h – 19h" }],
    "social": { "instagram": "…", "facebook": "" }
  }
}
FieldTypeRequiredDescription
namestringnoBusiness name as displayed across the site.
taglinestringnoOne-line slogan shown near the logo/footer. Portuguese.
descriptionstringnoShort description of the business, 1-2 sentences. Portuguese.
phonestringnoDisplay phone number, formatted for reading (e.g. "+351 912 345 678"). Empty string if none. Derive a tel: URI from it by stripping everything but + and digits.
emailstringnoPublic contact email. Empty string if none.
whatsappstringnoWhatsApp chat URL (e.g. "https://wa.me/351912345678"). Empty string if none.
appUrlstringnoMobile app store URL if the business has an app. Empty string if none.
schedulearray of objectnoOpening schedule rows, in display order.
schedule[].daysstringnoDay range label (e.g. "Seg – Sáb"). Portuguese.
schedule[].hoursstringnoOpening hours label (e.g. "09h – 19h" or "Fechado").
socialobjectnoSocial media profile links.
social.facebookstringnoFacebook page URL. Empty string if none.
social.instagramstringnoInstagram profile URL. Empty string if none.
social.linkedinstringnoLinkedIn page URL. Empty string if none.
social.xstringnoX/Twitter profile URL. Empty string if none.
social.youtubestringnoYouTube channel URL. Empty string if none.
GET

/api/v1/services

API key

Services for the authenticated site in display order, each with a slug, title, icon key, display tier, copy and an optional image.

Image pathnames refer to GET /api/v1/assets/{pathname}; client sites usually proxy that under their own route.

Response

200 with { version, siteKey, services } — empty content included. 401 on bad key.

{
  "version": "4.1.0",
  "siteKey": "my-business",
  "services": [
    {
      "slug": "mudancas",
      "title": "Mudanças",
      "icon": "truck",
      "tier": "primary",
      "short": "…",
      "description": "…",
      "bullets": ["…"]
    }
  ]
}
FieldTypeRequiredDescription
[].slugstringyesURL-safe unique identifier, lowercase, hyphen-separated.
[].titlestringnoService name. Portuguese.
[].icon"truck" | "wrench" | "packageCheck" | "hammer" | "boxes" | "warehouse" | "arrowDownToLine" | "zap" | "clock" | "shieldCheck"yesIcon key from the fixed icon set (Lucide-style names).
[].imageobjectnoIllustrative image stored in Vercel Blob.
[].image.assetIdstringnoAsset document id, set by the backoffice after upload.
[].image.pathnamestringnoBlob storage pathname; client sites serve it through their own /api/blob/ proxy.
[].image.altstringnoImage alt text. Portuguese.
[].image.widthintegernoImage width in pixels.
[].image.heightintegernoImage height in pixels.
[].tier"primary" | "featured" | "secondary"yesDisplay tier: "primary" for the main highlighted services, "featured" for the secondary highlights, "secondary" for the rest.
[].shortstringnoOne-sentence summary shown on service cards. Portuguese.
[].descriptionstringnoFull description. Portuguese.
[].bulletsarray of stringnoBullet-point highlights. Portuguese.
GET

/api/v1/products

API key

Products for the authenticated site in display order, each with a slug, title, icon key, copy, an optional image and a price.

The price is an amount plus its currency and billing period, so each website formats it in its own style. A price of 0 means it is not published, and `available: false` marks a product kept on record but not currently sold.

Response

200 with { version, siteKey, products } — empty content included. 401 on bad key.

{
  "version": "4.1.0",
  "siteKey": "my-business",
  "products": [
    {
      "slug": "caixa-cartao-60x40",
      "title": "Caixa de cartão 60x40",
      "icon": "boxes",
      "sku": "CX-6040",
      "price": 2.5,
      "currency": "EUR",
      "pricePeriod": "once",
      "priceNote": "IVA incluído",
      "featured": false,
      "available": true
    }
  ]
}
FieldTypeRequiredDescription
[].slugstringyesURL-safe unique identifier, lowercase, hyphen-separated.
[].titlestringnoProduct name. Portuguese.
[].icon"truck" | "wrench" | "packageCheck" | "hammer" | "boxes" | "warehouse" | "arrowDownToLine" | "zap" | "clock" | "shieldCheck"yesIcon key from the fixed icon set (Lucide-style names).
[].imageobjectnoIllustrative image stored in Vercel Blob.
[].image.assetIdstringnoAsset document id, set by the backoffice after upload.
[].image.pathnamestringnoBlob storage pathname; client sites serve it through their own /api/blob/ proxy.
[].image.altstringnoImage alt text. Portuguese.
[].image.widthintegernoImage width in pixels.
[].image.heightintegernoImage height in pixels.
[].skustringnoInternal reference or article number. Empty string if none.
[].pricenumbernoPrice amount in the currency below. 0 means the price is not published.
[].currency"EUR" | "USD" | "GBP"noCurrency of the price amount.
[].pricePeriod"once" | "month" | "year"noBilling period the price refers to: "once" for a one-off price, "month" or "year" for a subscription.
[].priceNotestringnoShort qualifier shown next to the price (e.g. "IVA incluído"). Portuguese.
[].shortstringnoOne-sentence summary shown on product cards. Portuguese.
[].descriptionstringnoFull description. Portuguese.
[].bulletsarray of stringnoBullet-point highlights. Portuguese.
[].featuredbooleannoTrue for a product the website should highlight.
[].availablebooleannoFalse for a product kept on record but not currently sold.
GET

/api/v1/caseStudies

API key

Work the business has already delivered, in display order: the client it was for, then the problem, the solution and the results, plus related links.

Every attached file arrives in one `assets` array with its `kind` (`image`, `video` or `document`), MIME type, original filename, byte size and, for media, its pixel dimensions. Group by `kind` if your design shows media separately from documents; fetch each file from `GET /api/v1/assets/{pathname}`.

Response

200 with { version, siteKey, caseStudies } — empty content included. 401 on bad key.

{
  "version": "4.1.0",
  "siteKey": "my-business",
  "caseStudies": [
    {
      "slug": "caso-mudanca-armazem",
      "client": "Padaria Central",
      "problem": "…",
      "solution": "…",
      "results": "…",
      "links": [{ "title": "Website do cliente", "url": "https://exemplo.pt" }],
      "assets": [
        {
          "kind": "image",
          "pathname": "sites/my-business/antes-abc123.webp",
          "contentType": "image/webp",
          "name": "antes.webp",
          "alt": "",
          "size": 184320,
          "width": 1600,
          "height": 1067
        },
        {
          "kind": "document",
          "pathname": "sites/my-business/relatorio-def456.pdf",
          "contentType": "application/pdf",
          "name": "relatorio.pdf",
          "alt": "",
          "size": 240128
        }
      ]
    }
  ]
}
FieldTypeRequiredDescription
[].slugstringyesURL-safe unique identifier, lowercase, hyphen-separated.
[].clientstringnoName of the client the work was delivered for. Doubles as the case study's title.
[].problemstringnoThe situation the client was in. Portuguese.
[].solutionstringnoWhat the business did about it. Portuguese.
[].resultsstringnoWhat the client got out of it. Portuguese.
[].linksarray of objectnoRelated links, in display order.
[].links[].titlestringnoLink label. Portuguese. May be empty — fall back to showing the URL.
[].links[].urlstringnoAbsolute URL, including the scheme.
[].assetsarray of objectnoEvery attached file in one list, in display order. Group them by `kind` if your design shows media separately from documents.
[].assets[].kind"image" | "video" | "document"yesWhat the file is, derived from its MIME type: "image" and "video" are media, everything else is a "document". Split a list on this rather than on the file extension.
[].assets[].pathnamestringyesBlob storage pathname; fetch the file from GET /api/v1/assets/{pathname}, or proxy it through your own route.
[].assets[].contentTypestringnoMIME type the file was stored with (e.g. "image/webp", "application/pdf").
[].assets[].namestringnoOriginal filename at upload time. Use it as the download label for a document.
[].assets[].altstringnoAlt text, when one was written. Often empty — fall back to the surrounding context.
[].assets[].sizeintegernoFile size in bytes, when known.
[].assets[].widthintegernoIntrinsic width in pixels. Present for media, absent for documents.
[].assets[].heightintegernoIntrinsic height in pixels. Present for media, absent for documents.
GET

/api/v1/locations

API key

Locations for the authenticated site in display order, with address lines and optional Google Maps URLs. At most one is flagged primary.

Response

200 with { version, siteKey, locations } — empty content included. 401 on bad key.

{
  "version": "4.1.0",
  "siteKey": "my-business",
  "locations": [
    {
      "slug": "lisboa",
      "city": "Lisboa",
      "lines": ["Rua Exemplo 12", "1000-001 Lisboa"],
      "primary": true
    }
  ]
}
FieldTypeRequiredDescription
[].slugstringyesURL-safe unique identifier, lowercase, hyphen-separated.
[].citystringnoCity or locality name.
[].linesarray of stringnoAddress lines, in display order.
[].mapsSearchUrlstringnoGoogle Maps search/share URL for this address. Empty string if none.
[].mapEmbedUrlstringnoGoogle Maps embed URL (iframe src). Empty string if none.
[].primarybooleannoTrue for the main location (at most one per site).
GET

/api/v1/values

API key

Company values for the authenticated site in display order.

Response

200 with { version, siteKey, values } — empty content included. 401 on bad key.

{
  "version": "4.1.0",
  "siteKey": "my-business",
  "values": [{ "slug": "qualidade", "title": "Qualidade", "description": "…" }]
}
FieldTypeRequiredDescription
[].slugstringyesURL-safe unique identifier, lowercase, hyphen-separated.
[].titlestringnoValue name (e.g. Qualidade). Portuguese.
[].descriptionstringnoShort explanation of the value. Portuguese.
GET

/api/v1/legal

API key

Terms and privacy text the client maintains in the backoffice, keyed by document, each an ordered list of title and body sections.

This is the only page-shaped content the platform holds. Which pages a website has, what they say and how they are titled belongs to the website itself.

Response

200 with { version, siteKey, legal } — empty content included. 401 on bad key.

{
  "version": "4.1.0",
  "siteKey": "my-business",
  "legal": {
    "terms": { "sections": [{ "title": "1. Objeto", "body": "…" }] },
    "privacy": { "sections": [{ "title": "1. Dados recolhidos", "body": "…" }] }
  }
}
FieldTypeRequiredDescription
<key>objectnoOne legal document.
<key>.sectionsarray of objectnoOrdered sections, as the document should read.
<key>.sections[].titlestringnoSection heading. Portuguese.
<key>.sections[].bodystringnoSection body prose; plain text, may contain multiple sentences. Portuguese.
POST

/api/v1/leads

API key

Creates a lead for the authenticated site — typically a quote or contact form submission. The lead enters the backoffice CRM pipeline with status "new".

If the tenant enabled SMS notifications in the backoffice, an SMS is sent to them. Notification failures never fail the request.

Request body

FieldTypeRequiredDescription
namestringyesContact name. Required.
emailstring (email)yesContact email. Required.
phonestringnoContact phone, free format.
formType"quote" | "contact"noWhich website form produced the lead. Defaults to "quote" for older client sites that do not send it.
serviceSlugstringnoSlug of the service the visitor is interested in.
originDestinationstringnoPickup / delivery description, for transport-style quote forms.
messagestringyesThe visitor's message. Required.

Response

201 with { success: true, id }. 422 with field issues when the payload is invalid. 401 on bad key.

{
  "success": true,
  "id": "665f1c2ab8d3e0a1f0c4d5e6"
}
GET

/api/v1/assets/{pathname}

public

Streams a file from the tenant asset store (anything uploaded through the backoffice). Pathnames come from the content itself: services[].image.pathname, products[].image.pathname and caseStudies[].assets[].pathname.

Public and heavily cached; client sites usually proxy it under their own /api/blob/ route to keep same-origin URLs. Serve a document from a download link rather than inline.

Response

200 with the file body and its Content-Type. 404 when the pathname does not exist.

(binary file body)

Content formats

The shape of each resource is documented separately: JSON Schema at /api/content-schema, human-readable reference at /docs/content-api, Markdown for AI agents at /api/content-schema/docs. Open the content format reference.