Show examples in:
JavascriptHTTP
Endpoint info
Available examples
Content Management API > Site

Update CDN settings default assets

Warning: Experimental API

Please note that this API method is marked as unstable and should be avoided in production environments. Changes may occur at any time without warning, potentially impacting your scripts. We recommend contacting our Support Team to explore alternative approaches that are safer and more reliable!

Allows to modify default settings for assets serving optimization from the CDN

Body parameters

assets_cdn_default_settingsobjectRequired

Allows setting default parameters for assets served through the CDN

imageobjectRequired

Allows setting default parameters for optimizing images served by the CDN

qintegerOptional

Controls the output quality of lossy file formats (jpg, pjpg, webp, avif, or jxr). Valid values are in the range 0 – 100 and the default is 75.

Example:50
autoOptional

The auto parameter helps automating a baseline level of optimization. Specify one or more settings

Type:Array<string>
Example:["compress", "format"]
csenumOptional

Specifies the color space of the output image

Example:"srgb"
srgbOptional

Uses the sRGB colorspace which is an internet standard. This is the default

adobergb1998Optional

Refers to the Adobe RGB (1998) color space, which provides accurate color reproduction from screen to print

tinysrgbOptional

Reduces the color space metadata but may cause a slight shift in color values

stripOptional

Removes the colorspace for maximum size reduction. Note that colors will still be rendered, but a colorspace will not be specified

originOptional

Keeps the color space of the origin image. This is the default value unless auto=compress

videoobjectRequired

Allows setting default parameters for optimizing videos served by the CDN

disable_serving_raw_videosbooleanOptional

When true, attempting to retrieve raw video files directly instead of their optimized counterparts will result in a HTTP 422 status code

Returns

Returns a resource object of type site

Examples

import { buildClient } from "@datocms/cma-client-node";
async function run() {
const client = buildClient({ apiToken: process.env.DATOCMS_API_TOKEN });
const site = await client.site.updateAssetsCdnDefaultSettings({
assets_cdn_default_settings: { image: {}, video: {} },
});
// Check the 'Returned output' tab for the result ☝️
console.log(site);
}
run();
{
id: "155",
domain: "admin.my-awesome-website.com",
favicon: "123",
global_seo: {},
google_maps_api_token: "xxxxxxxxxxxxx",
imgix_host: "www.datocms-assets.com",
internal_domain: "my-website.admin.datocms.com",
last_data_change_at: "2017-03-30T09:29:14.872Z",
locales: ["en"],
name: "My Awesome Website",
no_index: true,
require_2fa: false,
theme: { type: "monochromatic", hue: 16, logo: "123" },
timezone: "Europe/London",
ip_tracking_enabled: true,
force_use_of_sandbox_environments: true,
assets_cdn_default_settings: { image: {}, video: {} },
meta: {
created_at: "2020-04-21T07:57:11.124Z",
improved_timezone_management: true,
improved_hex_management: true,
improved_gql_multilocale_fields: true,
improved_gql_visibility_control: true,
improved_boolean_fields: true,
draft_mode_default: true,
improved_validation_at_publishing: true,
improved_exposure_of_inline_blocks_in_cda: true,
improved_items_listing: true,
milliseconds_in_datetime: true,
non_localized_focal_points: true,
allow_custom_theme: true,
},
item_types: [{ type: "item_type", id: "DxMaW10UQiCmZcuuA-IkkA" }],
owner: { type: "account", id: "312" },
}