API 參考

整合 API v1

每個端點的方法、範圍、參數、回傳和錯誤,從 openapi.json 產生。位址是 https://cms.drmn.app/api/integrations/v1,每個請求都帶 Authorization: Bearer dcmi_…。欄位說明取自 OpenAPI,是英文。

列出可以播放的媒體,新的在前

GET/media範圍 media:read

Needs the media:read scope. With media:files too, each media item carries fileUrl.

參數

名稱位置型別說明
cursor查詢stringThe nextCursor of the previous page.
limit查詢integer1–200, 預設 50
tag查詢string (uuid)[]A tag id from GET /tags. Repeat it to require every tag listed.
q查詢stringMatches the media's name or description, ignoring case. (最多 200 字)

範例

curl -s https://cms.drmn.app/api/integrations/v1/media \
  -H "Authorization: Bearer $DIGICMS_INTEGRATION_TOKEN"

回傳 200 MediaPage

欄位型別說明
itemsMedia[]必填
nextCursorstring | null必填Pass as cursor for the next page; null on the last page.
{
  "items": [
    {
      "id": "0192f0c4-7a3c-7b1d-9e2f-3a4b5c6d7e8f",
      "name": "Autumn menu",
      "type": "image",
      "width": 1920,
      "height": 1080,
      "durationSeconds": 15,
      "tags": [
        {
          "id": "0192f0c4-7a3c-7b1d-9e2f-3a4b5c6d7e8f",
          "name": "Autumn menu"
        }
      ],
      "thumbnailUrl": "https://…",
      "createdAt": "2026-10-17T08:00:00.000Z",
      "fileUrl": "https://…"
    }
  ],
  "nextCursor": null
}

錯誤

狀態什麼時候
400 Bad RequestA query parameter is not valid.
401 UnauthorizedThe token is missing, unknown, expired or revoked, or its merchant is suspended or its plan has ended.
403 ForbiddenThe token lacks the scope this endpoint needs; the message names it.
429 Too Many RequestsMore than 120 requests in a minute with this token.

單一媒體

GET/media/{id}範圍 media:read

Needs the media:read scope. With media:files too, each media item carries fileUrl.

參數

名稱位置型別說明
id路徑(必填)string (uuid)A media id.

範例

curl -s https://cms.drmn.app/api/integrations/v1/media/0192f0c4-7a3c-7b1d-9e2f-3a4b5c6d7e8f \
  -H "Authorization: Bearer $DIGICMS_INTEGRATION_TOKEN"

回傳 200 Media

欄位型別說明
idstring (uuid)必填
namestring必填
type"image" | "video" | "web"必填
widthinteger | null必填Pixels; null when unknown (and for web pages).
heightinteger | null必填Pixels; null when unknown (and for web pages).
durationSecondsnumber | null必填A video's length; null for images and web pages.
tagsTag[]必填
thumbnailUrlstring (uri) | null必填A signed URL that stops working 15 minutes after the response; null when there is no thumbnail.
createdAtstring (date-time)必填
fileUrlstring (uri) | null選填Only with the media:files scope. The file itself: a signed URL that stops working 15 minutes after the response, or a web page's own address. Absent without that scope.
{
  "id": "0192f0c4-7a3c-7b1d-9e2f-3a4b5c6d7e8f",
  "name": "Autumn menu",
  "type": "image",
  "width": 1920,
  "height": 1080,
  "durationSeconds": 15,
  "tags": [
    {
      "id": "0192f0c4-7a3c-7b1d-9e2f-3a4b5c6d7e8f",
      "name": "Autumn menu"
    }
  ],
  "thumbnailUrl": "https://…",
  "createdAt": "2026-10-17T08:00:00.000Z",
  "fileUrl": "https://…"
}

錯誤

狀態什麼時候
401 UnauthorizedThe token is missing, unknown, expired or revoked, or its merchant is suspended or its plan has ended.
403 ForbiddenThe token lacks the scope this endpoint needs; the message names it.
404 Not FoundNo such item in the token's merchant.
429 Too Many RequestsMore than 120 requests in a minute with this token.

列出活動(不含已封存),最近修改的在前

GET/campaigns範圍 campaigns:read

Needs the campaigns:read scope.

參數

名稱位置型別說明
cursor查詢stringThe nextCursor of the previous page.
limit查詢integer1–200, 預設 50
tag查詢string (uuid)[]A tag id from GET /tags. Repeat it to require every tag listed.
q查詢stringMatches the campaign's name, ignoring case. (最多 200 字)

範例

curl -s https://cms.drmn.app/api/integrations/v1/campaigns \
  -H "Authorization: Bearer $DIGICMS_INTEGRATION_TOKEN"

回傳 200 CampaignPage

欄位型別說明
itemsCampaign[]必填
nextCursorstring | null必填Pass as cursor for the next page; null on the last page.
{
  "items": [
    {
      "lineageId": "0192f0c4-1b2c-7d3e-8f4a-5b6c7d8e9f0a",
      "name": "Autumn menu",
      "status": "running",
      "flight": {
        "start": "Autumn",
        "end": "Autumn"
      },
      "tags": [
        {
          "id": "0192f0c4-7a3c-7b1d-9e2f-3a4b5c6d7e8f",
          "name": "Autumn menu"
        }
      ]
    }
  ],
  "nextCursor": null
}

錯誤

狀態什麼時候
400 Bad RequestA query parameter is not valid.
401 UnauthorizedThe token is missing, unknown, expired or revoked, or its merchant is suspended or its plan has ended.
403 ForbiddenThe token lacks the scope this endpoint needs; the message names it.
429 Too Many RequestsMore than 120 requests in a minute with this token.

單一活動,以及它播放的媒體

GET/campaigns/{lineageId}範圍 campaigns:read

Needs the campaigns:read scope.

參數

名稱位置型別說明
lineageId路徑(必填)string (uuid)A campaign's lineage id.

範例

curl -s https://cms.drmn.app/api/integrations/v1/campaigns/0192f0c4-1b2c-7d3e-8f4a-5b6c7d8e9f0a \
  -H "Authorization: Bearer $DIGICMS_INTEGRATION_TOKEN"

回傳 200 CampaignDetail

欄位型別說明
lineageIdstring (uuid)必填The campaign's stable id: it stays the same across versions.
namestring必填
status"running" | "upcoming" | "draft" | "ended" | "withdrawn"必填running, upcoming or ended while live; else draft (never published) or withdrawn.
flightobject必填The live version's flight, else the newest version's.
tagsTag[]必填
mediaIdsstring (uuid)[]必填The media the live version plays (landscape and portrait), in play order, each once; empty when nothing is live.
contentobject | null必填The live version's content in play order; null when nothing is live.
{
  "lineageId": "0192f0c4-1b2c-7d3e-8f4a-5b6c7d8e9f0a",
  "name": "Autumn menu",
  "status": "running",
  "flight": {
    "start": "Autumn",
    "end": "Autumn"
  },
  "tags": [
    {
      "id": "0192f0c4-7a3c-7b1d-9e2f-3a4b5c6d7e8f",
      "name": "Autumn menu"
    }
  ],
  "mediaIds": [
    "0192f0c4-7a3c-7b1d-9e2f-3a4b5c6d7e8f"
  ],
  "content": {
    "landscape": {
      "playlistId": "0192f0c4-2c3d-7e4f-9a5b-6c7d8e9f0a1b",
      "items": [
        {
          "mediaId": "0192f0c4-7a3c-7b1d-9e2f-3a4b5c6d7e8f",
          "type": "image",
          "durationSeconds": 15
        }
      ]
    },
    "portrait": null
  }
}

錯誤

狀態什麼時候
401 UnauthorizedThe token is missing, unknown, expired or revoked, or its merchant is suspended or its plan has ended.
403 ForbiddenThe token lacks the scope this endpoint needs; the message names it.
404 Not FoundNo such item in the token's merchant.
429 Too Many RequestsMore than 120 requests in a minute with this token.

列出共用的播放清單,最近修改的在前

GET/playlists範圍 playlists:read

Needs the playlists:read scope.

參數

名稱位置型別說明
cursor查詢stringThe nextCursor of the previous page.
limit查詢integer1–200, 預設 50
q查詢stringMatches the playlist's name, ignoring case. (最多 200 字)

範例

curl -s https://cms.drmn.app/api/integrations/v1/playlists \
  -H "Authorization: Bearer $DIGICMS_INTEGRATION_TOKEN"

回傳 200 PlaylistPage

欄位型別說明
itemsPlaylist[]必填
nextCursorstring | null必填Pass as cursor for the next page; null on the last page.
{
  "items": [
    {
      "id": "0192f0c4-7a3c-7b1d-9e2f-3a4b5c6d7e8f",
      "name": "Autumn menu",
      "createdAt": "2026-10-17T08:00:00.000Z",
      "updatedAt": "2026-10-17T08:00:00.000Z"
    }
  ],
  "nextCursor": null
}

錯誤

狀態什麼時候
400 Bad RequestA query parameter is not valid.
401 UnauthorizedThe token is missing, unknown, expired or revoked, or its merchant is suspended or its plan has ended.
403 ForbiddenThe token lacks the scope this endpoint needs; the message names it.
429 Too Many RequestsMore than 120 requests in a minute with this token.

單一播放清單,依播放順序列出項目

GET/playlists/{id}範圍 playlists:read

Needs the playlists:read scope.

參數

名稱位置型別說明
id路徑(必填)string (uuid)A playlist id, e.g. a campaign's content.landscape.playlistId.

範例

curl -s https://cms.drmn.app/api/integrations/v1/playlists/0192f0c4-7a3c-7b1d-9e2f-3a4b5c6d7e8f \
  -H "Authorization: Bearer $DIGICMS_INTEGRATION_TOKEN"

回傳 200 PlaylistDetail

欄位型別說明
idstring (uuid)必填
namestring必填
createdAtstring (date-time)必填
updatedAtstring (date-time)必填
totalDurationSecondsnumber必填
itemsPlayItem[]必填In play order.
{
  "id": "0192f0c4-7a3c-7b1d-9e2f-3a4b5c6d7e8f",
  "name": "Autumn menu",
  "createdAt": "2026-10-17T08:00:00.000Z",
  "updatedAt": "2026-10-17T08:00:00.000Z",
  "totalDurationSeconds": 45,
  "items": [
    {
      "mediaId": "0192f0c4-7a3c-7b1d-9e2f-3a4b5c6d7e8f",
      "type": "image",
      "durationSeconds": 15
    }
  ]
}

錯誤

狀態什麼時候
401 UnauthorizedThe token is missing, unknown, expired or revoked, or its merchant is suspended or its plan has ended.
403 ForbiddenThe token lacks the scope this endpoint needs; the message names it.
404 Not FoundNo such item in the token's merchant.
429 Too Many RequestsMore than 120 requests in a minute with this token.

開始上傳一個檔案到媒體庫

POST/media/uploads範圍 media:write

Needs the media:write scope. Then PUT the file (and thumbnail) to the returned URLs and call finalize. Uploading an exact file the merchant already has returns duplicateOf and nothing to upload.

請求內容 UploadRequest

欄位型別說明
idstring (uuid)必填Your id for this file, a UUID (v7 is best). Sending the same id again is a safe retry: it never adds a second item.
namestring必填The name shown in the media library. (最多 200 字)
fileNamestring必填最多 500 字
mimeTypestring必填image/jpeg, image/png, image/webp, video/mp4 or video/webm.
fileSizeinteger必填Bytes. Images up to 50 MB, videos up to 2 GB.
checksumstring必填The file's SHA-256, lower-case hex.
durationnumber | null選填A video's length in seconds.
widthinteger | null選填
heightinteger | null選填
hasThumbnailboolean選填True when you will PUT a JPEG thumbnail (480 px wide is best) too.
thumbnailSizeinteger | null選填The thumbnail's bytes, at most 1 MB; required with hasThumbnail.
codecstring | null選填A video's codec (h264, hevc, …); only used for warnings. (最多 50 字)

範例

curl -s -X POST https://cms.drmn.app/api/integrations/v1/media/uploads \
  -H "Authorization: Bearer $DIGICMS_INTEGRATION_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"id":"0192f0c4-7a3c-7b1d-9e2f-3a4b5c6d7e8f","name":"Autumn menu","fileName":"autumn-menu.jpg","mimeType":"image/jpeg","fileSize":245760,"checksum":"9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08","duration":15,"width":1920,"height":1080,"hasThumbnail":true,"thumbnailSize":18432,"codec":"h264"}'

回傳 200 UploadTicket

欄位型別說明
mediaIdstring (uuid)必填The item's id: yours, or the existing item's when duplicateOf is set.
duplicateOfobject | null必填Set when the merchant already has this exact file: nothing to upload or finalize, use mediaId.
uploadobject | null必填Where to PUT the file; null for a duplicate.
thumbnailUploadobject | null必填Where to PUT the thumbnail; null without one.
warningsobject[]必填Video compatibility warnings for the merchant's screens. Never blocking.
{
  "mediaId": "0192f0c4-7a3c-7b1d-9e2f-3a4b5c6d7e8f",
  "duplicateOf": {
    "id": "0192f0c4-7a3c-7b1d-9e2f-3a4b5c6d7e8f",
    "name": "Autumn menu",
    "type": "image"
  },
  "upload": null,
  "thumbnailUpload": null,
  "warnings": [
    {
      "code": "Autumn",
      "message": "This token does not have the media:write scope this endpoint needs."
    }
  ]
}

錯誤

狀態什麼時候
400 Bad RequestThe body is not valid JSON or not what this endpoint takes; the message names the fields.
401 UnauthorizedThe token is missing, unknown, expired or revoked, or its merchant is suspended or its plan has ended.
403 ForbiddenThe token lacks the scope this endpoint needs, or the merchant's plan does not allow it (code: plan).
409 Conflictcode: storage_quota_exceeded: the merchant's storage is full. code: id_conflict: the id is another item's.
413 Payload Too LargeThe body is larger than 16 KB.
422 UnprocessableThe file is not accepted: type, size, checksum or name; the message says which.
429 Too Many RequestsMore than 30 writes in a minute with this token (counted apart from reads).

完成上傳:素材變成可以播放

POST/media/uploads/{id}/finalize範圍 media:write

Needs the media:write scope. Checks that the file was stored with the declared size. Returns the item as GET /media/{id} does. Finalizing a ready item again returns it.

參數

名稱位置型別說明
id路徑(必填)string (uuid)The mediaId from POST /media/uploads.

範例

curl -s -X POST https://cms.drmn.app/api/integrations/v1/media/uploads/0192f0c4-7a3c-7b1d-9e2f-3a4b5c6d7e8f/finalize \
  -H "Authorization: Bearer $DIGICMS_INTEGRATION_TOKEN"

回傳 200 Media

欄位型別說明
idstring (uuid)必填
namestring必填
type"image" | "video" | "web"必填
widthinteger | null必填Pixels; null when unknown (and for web pages).
heightinteger | null必填Pixels; null when unknown (and for web pages).
durationSecondsnumber | null必填A video's length; null for images and web pages.
tagsTag[]必填
thumbnailUrlstring (uri) | null必填A signed URL that stops working 15 minutes after the response; null when there is no thumbnail.
createdAtstring (date-time)必填
fileUrlstring (uri) | null選填Only with the media:files scope. The file itself: a signed URL that stops working 15 minutes after the response, or a web page's own address. Absent without that scope.
{
  "id": "0192f0c4-7a3c-7b1d-9e2f-3a4b5c6d7e8f",
  "name": "Autumn menu",
  "type": "image",
  "width": 1920,
  "height": 1080,
  "durationSeconds": 15,
  "tags": [
    {
      "id": "0192f0c4-7a3c-7b1d-9e2f-3a4b5c6d7e8f",
      "name": "Autumn menu"
    }
  ],
  "thumbnailUrl": "https://…",
  "createdAt": "2026-10-17T08:00:00.000Z",
  "fileUrl": "https://…"
}

錯誤

狀態什麼時候
400 Bad RequestThe body is not valid JSON or not what this endpoint takes; the message names the fields.
401 UnauthorizedThe token is missing, unknown, expired or revoked, or its merchant is suspended or its plan has ended.
403 ForbiddenThe token lacks the scope this endpoint needs, or the merchant's plan does not allow it (code: plan).
404 Not FoundNo such upload in the token's merchant.
413 Payload Too LargeThe body is larger than 16 KB.
422 UnprocessableThe file was not stored, or not with the declared size; PUT it again.
429 Too Many RequestsMore than 30 writes in a minute with this token (counted apart from reads).

替媒體加標籤

POST/media/{id}/tags範圍 tags:write

Needs the tags:write scope. Up to 10 names a call. Only adds: taking tags off is not offered.

參數

名稱位置型別說明
id路徑(必填)string (uuid)A media id.

請求內容 AddTagsRequest

欄位型別說明
addstring[]必填Tag names. A name the merchant already has (ignoring case and spacing) reuses that tag; others are created. (1–10 個)

範例

curl -s -X POST https://cms.drmn.app/api/integrations/v1/media/0192f0c4-7a3c-7b1d-9e2f-3a4b5c6d7e8f/tags \
  -H "Authorization: Bearer $DIGICMS_INTEGRATION_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"add":["Autumn","Group buy"]}'

回傳 200 AddTagsResult

欄位型別說明
mediaIdstring (uuid)必填
tagsTag[]必填The tags the names resolved to.
addedinteger必填How many of them the item did not have yet.
{
  "mediaId": "0192f0c4-7a3c-7b1d-9e2f-3a4b5c6d7e8f",
  "tags": [
    {
      "id": "0192f0c4-7a3c-7b1d-9e2f-3a4b5c6d7e8f",
      "name": "Autumn menu"
    }
  ],
  "added": 1
}

錯誤

狀態什麼時候
400 Bad RequestThe body is not valid JSON or not what this endpoint takes; the message names the fields.
401 UnauthorizedThe token is missing, unknown, expired or revoked, or its merchant is suspended or its plan has ended.
403 ForbiddenThe token lacks the scope this endpoint needs, or the merchant's plan does not allow it (code: plan).
404 Not FoundNo such media item in the token's merchant.
413 Payload Too LargeThe body is larger than 16 KB.
422 UnprocessableThe body asks to remove tags, or the item would have too many tags.
429 Too Many RequestsMore than 30 writes in a minute with this token (counted apart from reads).

依名稱列出標籤

GET/tags範圍 tags:read

Needs the tags:read scope.

參數

名稱位置型別說明
cursor查詢stringThe nextCursor of the previous page.
limit查詢integer1–200, 預設 50
q查詢stringMatches the tag's name, ignoring case. (最多 200 字)

範例

curl -s https://cms.drmn.app/api/integrations/v1/tags \
  -H "Authorization: Bearer $DIGICMS_INTEGRATION_TOKEN"

回傳 200 TagPage

欄位型別說明
itemsTag[]必填
nextCursorstring | null必填Pass as cursor for the next page; null on the last page.
{
  "items": [
    {
      "id": "0192f0c4-7a3c-7b1d-9e2f-3a4b5c6d7e8f",
      "name": "Autumn menu"
    }
  ],
  "nextCursor": null
}

錯誤

狀態什麼時候
400 Bad RequestA query parameter is not valid.
401 UnauthorizedThe token is missing, unknown, expired or revoked, or its merchant is suspended or its plan has ended.
403 ForbiddenThe token lacks the scope this endpoint needs; the message names it.
429 Too Many RequestsMore than 120 requests in a minute with this token.

共用的資料結構

Media

欄位型別說明
idstring (uuid)必填
namestring必填
type"image" | "video" | "web"必填
widthinteger | null必填Pixels; null when unknown (and for web pages).
heightinteger | null必填Pixels; null when unknown (and for web pages).
durationSecondsnumber | null必填A video's length; null for images and web pages.
tagsTag[]必填
thumbnailUrlstring (uri) | null必填A signed URL that stops working 15 minutes after the response; null when there is no thumbnail.
createdAtstring (date-time)必填
fileUrlstring (uri) | null選填Only with the media:files scope. The file itself: a signed URL that stops working 15 minutes after the response, or a web page's own address. Absent without that scope.

Tag

欄位型別說明
idstring (uuid)必填
namestring必填

Campaign

欄位型別說明
lineageIdstring (uuid)必填The campaign's stable id: it stays the same across versions.
namestring必填
status"running" | "upcoming" | "draft" | "ended" | "withdrawn"必填running, upcoming or ended while live; else draft (never published) or withdrawn.
flightobject必填The live version's flight, else the newest version's.
tagsTag[]必填

CampaignDetail

欄位型別說明
lineageIdstring (uuid)必填The campaign's stable id: it stays the same across versions.
namestring必填
status"running" | "upcoming" | "draft" | "ended" | "withdrawn"必填running, upcoming or ended while live; else draft (never published) or withdrawn.
flightobject必填The live version's flight, else the newest version's.
tagsTag[]必填
mediaIdsstring (uuid)[]必填The media the live version plays (landscape and portrait), in play order, each once; empty when nothing is live.
contentobject | null必填The live version's content in play order; null when nothing is live.

CampaignContent

欄位型別說明
playlistIdstring (uuid) | null必填The playlist it was published from (GET /playlists/{id}); null when that playlist was deleted since.
itemsPlayItem[]必填In play order, as frozen at publish: what screens play now.

Playlist

欄位型別說明
idstring (uuid)必填
namestring必填
createdAtstring (date-time)必填
updatedAtstring (date-time)必填

PlaylistDetail

欄位型別說明
idstring (uuid)必填
namestring必填
createdAtstring (date-time)必填
updatedAtstring (date-time)必填
totalDurationSecondsnumber必填
itemsPlayItem[]必填In play order.

PlayItem

欄位型別說明
mediaIdstring (uuid)必填
type"image" | "video" | "web"必填
durationSecondsnumber必填How long it plays, in seconds: the item's own setting, else the media's length or the default.

PresignedUpload

欄位型別說明
urlstring (uri)必填PUT the bytes here within 15 minutes.
headersobject必填Send every one of these headers unchanged: they are part of the signature.

Error

欄位型別說明
error"invalid_request" | "unauthorized" | "forbidden" | "not_found" | "method_not_allowed" | "conflict" | "payload_too_large" | "unprocessable" | "rate_limited" | "internal"必填
messagestring必填
codestring選填Which reason behind the status: for a 409 storage_quota_exceeded or id_conflict; for a 403 plan; for a 422 invalid.