https://manage.kontent.ai/v2/projects/{environment_id}/files/{file_name}https://manage.kontent.ai/v2/projects/{environment_id}/assetshttps://manage.kontent.ai/v2/projects/{environment_id}/assets/{asset_identifier}https://manage.kontent.ai/v2/projects/{environment_id}/assetshttps://manage.kontent.ai/v2/projects/{environment_id}/assets/{asset_identifier}https://manage.kontent.ai/v2/projects/{environment_id}/assets/{asset_identifier}environment_idfile_nameContent-typeContent-lengthThe binary data of the file.
idtypeenvironment_idThe asset to create.
descriptions[]descriptions[]environment_idasset_identifierdescriptions[]environment_idx-continuationassets[]environment_idasset_identifierThe asset to update or create.
descriptions[]descriptions[]environment_idasset_identifierelements[]external_idfile_referencefoldercollectioncodenametitleelements[]external_idfile_namefile_referencefoldercollectionidcodenameimage_heightimage_widthlast_modifiedsizetitletypeurlelements[]external_idfile_namefile_referencefoldercollectionidcodenameimage_heightimage_widthlast_modifiedsizetitletypeurlpaginationelements[]foldercollectiontitlefile_referencecodenameelements[]external_idfile_namefile_referencefoldercollectionidcodenameimage_heightimage_widthlast_modifiedsizetitletypeurl/assets/external-id/<external_id>).Each binary file can be referenced only by a single asset.
my file#2.png would be URL-encoded to my%20file%232.png.
For image files, include a file extension such as .png to ensure the files can be optimized using the Image transformation API.Content-type value matches the file extension specified in file_name. fcbb12e6-66a3-4672-85d9-d502d16b8d9c), codename (e.g., codename/my_asset, or external ID (e.g., external-id/my-own-asset-identifier-42).x-continuation header parameter to the value of the continuation_token property.fcbb12e6-66a3-4672-85d9-d502d16b8d9c) or external ID (e.g., external-id/custom-identifier-of-your-asset).fcbb12e6-66a3-4672-85d9-d502d16b8d9c), codename (e.g., codename/my_asset, or external ID (e.g., external-id/my-own-asset-identifier-42).external_id property is not present."id" : "00000000-0000-0000-0000-000000000000".title. If title is empty, the file_name is used.title to better identify and filter your assets in the UI. If not specified, the title property is null.external_id property is not present."id" : "00000000-0000-0000-0000-000000000000".title. If title is empty, the file_name is used.null if the file is not an image.null if the file is not an image.title to better identify and filter your assets in the UI. If not specified, the title property is null.external_id property is not present."id" : "00000000-0000-0000-0000-000000000000".title. If title is empty, the file_name is used.null if the file is not an image.null if the file is not an image.title to better identify and filter your assets in the UI. If not specified, the title property is null.{"reference": null}.
title. If title is empty, the file_name is used.external_id property is not present."id" : "00000000-0000-0000-0000-000000000000".title. If title is empty, the file_name is used.null if the file is not an image.null if the file is not an image.title to better identify and filter your assets in the UI. If not specified, the title property is null.descriptions[]elements[]external_idfile_namefile_referencefoldercollectionidcodenameimage_heightimage_widthlast_modifiedsizetitletypeurlexternal_id property is not present."id" : "00000000-0000-0000-0000-000000000000".title. If title is empty, the file_name is used.null if the file is not an image.null if the file is not an image.title to better identify and filter your assets in the UI. If not specified, the title property is null.{
"request_id": "00000000-0000-0000-6f12-0080000000c7",
"error_code": 105,
"message": "The requested asset 'fcbb12e6-66a3-4672-85d9-d502d16b8d9c' was not found."
}file_reference property.file_reference property.file_reference property.file_reference property.file_reference property.file_reference property.file_reference property.file_reference property.file_reference property.file_reference property.file_reference property.file_reference property.file_reference property.file_reference property.file_reference property.{
"descriptions": [
{
"language": {
"id": "00000000-0000-0000-0000-000000000000"
},
"description": "The asset's alt text for the default language."
}
],
"elements": [
{
"element": {
"id": "c7c3b834-2222-5677-89c4-b46f04489109"
},
"value": [
{
"id": "53a5eecb-f295-59b4-a07d-19655b6ad860"
},
{
"id": "3f367e4f-75b7-4b48-be3b-1136bbaf1f53"
}
]
}
],
"external_id": "custom-asset-identifier",
"file_name": "file_name.png",
"file_reference": {
"id": "806ec84e-7c71-4856-9519-ee3dd3558583",
"type": "internal"
},
"folder": {
"id": "8fe4ff47-0ca8-449d-bc63-c280efee44ea"
},
"collection": {
"reference": {
"codename": "first_collection"
}
},
"id": "fcbb12e6-66a3-4672-85d9-d502d16b8d9c",
"codename": "my_asset",
"image_height": 548,
"image_width": 1280,
"last_modified": "2019-09-12T08:29:36.1645977Z",
"size": 148636,
"title": "Makes the asset easier to find when you need it",
"type": "image/png",
"url": "https://assets-us-01.kc-usercontent.com/8d20758c-d74c-4f59-ae04-ee928c0816b7/806ec84e-7c71-4856-9519-ee3dd3558583/file_name.png"
}/ \ : * ? " < > | % # & { } $ ! ' ` ~ ^ + = [ ] ; @ are replaced with underscores _. The only exceptions are comma , and brackets (), which are preserved. For example, the file name my file#2.png then displays as my file_2.png in the Kontent.ai UI.collection property can be modified but cannot be set to null.collection property can be modified but cannot be set to null.collection property can be modified but cannot be set to null.collection property can be modified but cannot be set to null.collection property can be modified but cannot be set to null.{
"id": "806ec84e-7c71-4856-9519-ee3dd3558583",
"type": "internal"
}{
"id": "fcbb12e6-66a3-4672-85d9-d502d16b8d9c",
"file_name": "file_name.jpeg",
"title": "Description of what the file contains",
"size": 148636,
"type": "image/jpeg",
"url": "https://assets-us-01.kc-usercontent.com/8d20758c-d74c-4f59-ae04-ee928c0816b7/adf26cd2-1acb-403f-9d1e-6d04e46c39f1/file_name.png",
"image_width": 1280,
"image_height": 548,
"file_reference": {
"id": "fcbb12e6-66a3-4672-85d9-d502d16b8d9c",
"type": "internal"
},
"folder": {
"id": "8fe4ff47-0ca8-449d-bc63-c280efee44ea"
},
"descriptions": [
{
"language": {
"id": "00000000-0000-0000-0000-000000000000"
},
"description": "The asset's alt text in the default language describing what the file or image shows."
}
],
"elements": [
{
"element": {
"id": "c7c3b834-2222-5677-89c4-b46f04489109"
},
"value": [
{
"id": "53a5eecb-f295-59b4-a07d-19655b6ad860"
},
{
"id": "3f367e4f-75b7-4b48-be3b-1136bbaf1f53"
}
]
}
],
"external_id": "custom-asset-identifier",
"last_modified": "2017-09-12T08:29:36.1645977Z"
}{
"descriptions": [
{
"language": {
"id": "00000000-0000-0000-0000-000000000000"
},
"description": "The asset's alt text for the default language."
}
],
"elements": [
{
"element": {
"id": "c7c3b834-2222-5677-89c4-b46f04489109"
},
"value": [
{
"id": "53a5eecb-f295-59b4-a07d-19655b6ad860"
},
{
"id": "3f367e4f-75b7-4b48-be3b-1136bbaf1f53"
}
]
}
],
"external_id": "custom-asset-identifier",
"file_name": "file_name.png",
"file_reference": {
"id": "806ec84e-7c71-4856-9519-ee3dd3558583",
"type": "internal"
},
"folder": {
"id": "8fe4ff47-0ca8-449d-bc63-c280efee44ea"
},
"collection": {
"reference": {
"codename": "first_collection"
}
},
"id": "fcbb12e6-66a3-4672-85d9-d502d16b8d9c",
"codename": "my_asset",
"image_height": 548,
"image_width": 1280,
"last_modified": "2019-09-12T08:29:36.1645977Z",
"size": 148636,
"title": "Makes the asset easier to find when you need it",
"type": "image/png",
"url": "https://assets-us-01.kc-usercontent.com/8d20758c-d74c-4f59-ae04-ee928c0816b7/806ec84e-7c71-4856-9519-ee3dd3558583/file_name.png"
}{
"assets": {
"descriptions": [
{
"language": {
"id": "00000000-0000-0000-0000-000000000000"
},
"description": "The asset's alt text for the default language."
}
],
"elements": [
{
"element": {
"id": "c7c3b834-2222-5677-89c4-b46f04489109"
},
"value": [
{
"id": "53a5eecb-f295-59b4-a07d-19655b6ad860"
},
{
"id": "3f367e4f-75b7-4b48-be3b-1136bbaf1f53"
}
]
}
],
"external_id": "custom-asset-identifier",
"file_name": "file_name.png",
"file_reference": {
"id": "806ec84e-7c71-4856-9519-ee3dd3558583",
"type": "internal"
},
"folder": {
"id": "8fe4ff47-0ca8-449d-bc63-c280efee44ea"
},
"collection": {
"reference": {
"codename": "first_collection"
}
},
"id": "fcbb12e6-66a3-4672-85d9-d502d16b8d9c",
"codename": "my_asset",
"image_height": 548,
"image_width": 1280,
"last_modified": "2019-09-12T08:29:36.1645977Z",
"size": 148636,
"title": "Makes the asset easier to find when you need it",
"type": "image/png",
"url": "https://assets-us-01.kc-usercontent.com/8d20758c-d74c-4f59-ae04-ee928c0816b7/806ec84e-7c71-4856-9519-ee3dd3558583/file_name.png"
},
"pagination": {
"continuation_token": "W3sidG9rZW4iOiIrUklEOn...",
"next_page": "https://manage.kontent.ai/v2/your/chosen/list/endpoint"
}
}file_reference property.file_reference property.file_reference property.file_reference property.file_reference property.// Tip: Find more about JS/TS SDKs at https://kontent.ai/learn/javascript
// Note that this approach works when using Node.js. See a worked example using the browser
import { ManagementClient } from '@kontent-ai/management-sdk';
import { readFileSync } from 'fs';
const client = new ManagementClient({
environmentId: 'KONTENT_AI_ENVIRONMENT_ID',
apiKey: 'KONTENT_AI_MANAGEMENT_API_KEY',
});
const data = readFileSync('which-brewing-fits-you-1080px.jpg');
const response = await client
.uploadBinaryFile()
.withData({
binaryData: data,
contentLength: data.byteLength,
contentType: 'image/jpeg',
filename: 'which-brewing-fits-you-1080px.jpg',
})
.toPromise();
// Tip: Find more about JS/TS SDKs at https://kontent.ai/learn/javascript
import { ManagementClient } from '@kontent-ai/management-sdk';
const client = new ManagementClient({
environmentId: 'KONTENT_AI_ENVIRONMENT_ID',
apiKey: 'KONTENT_AI_MANAGEMENT_API_KEY',
});
const response = await client
.viewAsset()
.byAssetId('0270ea18-4842-4d09-9570-17b41bb37e2d')
// .byAssetExternalId('which-brewing-fits-you')
.toPromise();
// Tip: Find more about JS/TS SDKs at https://kontent.ai/learn/javascript
import { ManagementClient } from '@kontent-ai/management-sdk';
const client = new ManagementClient({
environmentId: 'KONTENT_AI_ENVIRONMENT_ID',
apiKey: 'KONTENT_AI_MANAGEMENT_API_KEY',
});
// Gets the first page of results
const response = await client.listAssets().toPromise();
// Gets all pages of results
// const response = await client.listAssets()
// .toAllPromise();
// Tip: Find more about JS/TS SDKs at https://kontent.ai/learn/javascript
import { ManagementClient } from '@kontent-ai/management-sdk';
const client = new ManagementClient({
environmentId: 'KONTENT_AI_ENVIRONMENT_ID',
apiKey: 'KONTENT_AI_MANAGEMENT_API_KEY',
});
// Updates an existing asset
const response = await client
.updateAsset()
.byAssetExternalId('which-brewing-fits-you')
// .byAssetId('fcbb12e6-66a3-4672-85d9-d502d16b8d9c')
.withData((builder) => {
return {
title: 'Coffee Brewing Techniques',
assetId: 'fcbb12e6-66a3-4672-85d9-d502d16b8d9c',
descriptions: [
{
language: {
codename: 'en-US',
},
description: 'Coffee Brewing Techniques',
},
{
language: {
codename: 'es-ES',
},
description: 'Técnicas para hacer café',
},
],
elements: [
builder.taxonomyElement({
element: {
codename: 'taxonomy-categories',
},
value: [
{
codename: 'coffee',
},
{
codename: 'brewing',
},
],
}),
],
};
})
.toPromise();
// Creates a new asset or updates an existing one
const response = await client
.upsertAsset()
.byAssetExternalId('which-brewing-fits-you')
// .byAssetId('fcbb12e6-66a3-4672-85d9-d502d16b8d9c')
.withData((builder) => {
return {
// 'file_reference' is only required when creating a new asset
// To create a file reference, see the 'Upload a binary file' endpoint
file_reference: {
id: 'fcbb12e6-66a3-4672-85d9-d502d16b8d9c',
type: 'internal',
},
title: 'Coffee Brewing Techniques',
external_id: 'which-brewing-fits-you',
descriptions: [
{
language: {
codename: 'en-US',
},
description: 'Coffee Brewing Techniques',
},
{
language: {
codename: 'es-ES',
},
description: 'Técnicas para hacer café',
},
],
elements: [
builder.taxonomyElement({
element: {
codename: 'taxonomy-categories',
},
value: [
{
codename: 'coffee',
},
{
codename: 'brewing',
},
],
}),
],
};
})
.toPromise();
{
"id": "fcbb12e6-66a3-4672-85d9-d502d16b8d9c",
"folder": {
"id": "4033071a-5bc1-48da-8342-d129bb967d1d"
},
"file_name": "which-brewing-fits-you-1080px.jpg",
"title": "Coffee Brewing Techniques",
"size": 125770,
"type": "image/jpeg",
"url": "https://assets-us-01.kc-usercontent.com/975bf280-fd91-488c-994c-2f04416e5ee3/fcbb12e6-66a3-4672-85d9-d502d16b8d9c/which-brewing-fits-you-1080px.jpg",
"image_width": 1000,
"image_height": 666,
"file_reference": {
"id": "fcbb12e6-66a3-4672-85d9-d502d16b8d9c",
"type": "internal"
},
"descriptions": [
{
"language": {
"id": "00000000-0000-0000-0000-000000000000"
},
"description": "Coffee Brewing Techniques"
},
{
"language": {
"id": "d1f95fde-af02-b3b5-bd9e-f232311ccab8"
},
"description": "Técnicas para hacer café"
}
],
"elements": [
{
"element": {
"id": "c7c3b834-2222-5677-89c4-b46f04489109"
},
"value": [
{
"id": "53a5eecb-f295-59b4-a07d-19655b6ad860"
},
{
"id": "3f367e4f-75b7-4b48-be3b-1136bbaf1f53"
}
]
}
],
"last_modified": "2017-09-12T08:29:36.1645977Z"
}// Tip: Find more about JS/TS SDKs at https://kontent.ai/learn/javascript
import { ManagementClient } from '@kontent-ai/management-sdk';
const client = new ManagementClient({
environmentId: 'KONTENT_AI_ENVIRONMENT_ID',
apiKey: 'KONTENT_AI_MANAGEMENT_API_KEY',
});
const response = await client
.deleteAsset()
.byAssetId('1b458663-d23a-441c-8cc2-c2825fe53b48')
// .byAssetExternalId('which-brewing-fits-you')
.toPromise();
collection property can be modified but cannot be set to null.// Tip: Find more about JS/TS SDKs at https://kontent.ai/learn/javascript
import { ManagementClient } from '@kontent-ai/management-sdk';
const client = new ManagementClient({
environmentId: 'KONTENT_AI_ENVIRONMENT_ID',
apiKey: 'KONTENT_AI_MANAGEMENT_API_KEY',
});
const response = await client
.addAsset()
.withData((builder) => {
return {
// To create a file reference, check the 'Upload a binary file' endpoint
file_reference: {
id: 'fcbb12e6-66a3-4672-85d9-d502d16b8d9c',
type: 'internal',
},
title: 'Coffee Brewing Techniques',
external_id: 'which-brewing-fits-you',
descriptions: [
{
language: {
codename: 'en-US',
},
description: 'Coffee Brewing Techniques',
},
{
language: {
codename: 'es-ES',
},
description: 'Técnicas para hacer café',
},
],
elements: [
builder.taxonomyElement({
element: {
codename: 'taxonomy-categories',
},
value: [
{
codename: 'coffee',
},
{
codename: 'brewing',
},
],
}),
],
};
})
.toPromise();