# CDA (Content Delivery API)

The CDA (Content Delivery API) is a **read-only** API that delivers published *Content*, *Media*, and more to visitors. Once the operator of a *Space* creates and publishes content in the content studio or via CMA, websites and apps read that published version through CDA and show it on screen. Creating, editing, and publishing are handled by CMA, not CDA.

The base URL is `https://cda.weegloo.com/v1`. Authentication typically uses a least-privilege *DeliveryAccessToken*, a token that holds only the scope it needs so it is safe for public browser delivery. A Weegloo User Bearer token can also read from CDA, but it is over-privileged for browser distribution, so a *DeliveryAccessToken* is recommended.

## Common behavior {#common-behavior}

The following applies across all CDA resources. Each resource page assumes this behavior and covers only its own specifics.

- **Read-only.** Every endpoint is a read (GET). Writing and publishing are the responsibility of CMA.
- **Only published items are visible.** *Content*, *Media*, and *Content Type* are delivered only as published snapshots. CMA's *Draft* or unpublished changes do not appear on CDA.
- **Published-snapshot `sys`.** The `sys` of those three resources has no management `version`, `status`, or `publish`; it has only `revision`, which points to the version at the time it was made public. (*Locale* is not a publication target but a configuration resource, so it keeps `version` as is.)
- **Selecting a language with `locale`.** *Content* and *Media* reads use the `locale` query parameter to choose which language to receive. It behaves in three ways.
  - Given a **code** such as `locale=ko-KR`, `fields` comes back as a single value for that locale (not a locale map). If there is no value and the *Fallback* does not reach one either, that field is empty or `null`.
  - **Omitted**, it returns the same way for the *Space*'s **default *Locale***.
  - Given **`locale=*`**, it does not pick a single language and returns the map holding all locale values (`{ apiName: { locale: value } }`) as is.

  In the first two cases, where a single language is returned, the response carries an `x-weegloo-locale` header that reports the locale actually used (it is absent when `locale=*`). (*Content Type* is the schema of the template, so it does not take `locale`; *Sync* does not pick a language and delivers the locale map as is.)
- **Author exposure.** The `createdBy` and `updatedBy` of a *Content* are delivered only when the `publishWithAuthor` of its *Content Type* is on. *Media* always omits author information.

## Resources {#resources}

- [Content Type](/api/reference/cda/content-type.md): Reads published *Content Type* (the template and field definitions of content).
- [Content](/api/reference/cda/content.md): Reads published *Content* as a full list, as a single item, and by *Content Type*.
- [Media](/api/reference/cda/media.md): Reads published *Media* (file assets) and their delivery URLs.
- [Locale](/api/reference/cda/locale.md): Reads the language settings a *Space* supports (`code`, whether it is the default, and `fallbackCode`). Because it is a configuration resource, its `sys` carries `version`.
- [Sync](/api/reference/cda/sync.md): Incremental sync that fetches only what changed and was deleted since the last sync. It delivers values as a locale map and does not resolve them by `locale`.

## Related documents {#related-documents}

- [CMA Content Type](/api/reference/cma/content-type.md): The management API for creating, editing, and publishing the template and the content.
- [ACDA](/api/reference/acda.md): The version that performs the same delivery under a member (*ServiceUser*) identity.
