Content types
Content type object
Content types specify the structure of your content using elements. This structure is then applied to your content items and components. For an improved authoring experience, we recommend you put the elements in content groups.
idstring · read-only · uuid
The content type's internal ID.
codenamestring · 1-60 chars
The content type's codename. Unless set while creating the content type, it is initially generated from the type's
name and can later be modified.external_idstring
The content type's external ID. Only present if defined when creating the content type via API.
last_modifiedstring · read-only · date-time
ISO-8601
formatted date and time of the last change to the content type.
namerequired · string · 1-50 chars
The content type's display name.
content_groups[]array
The content type's content groups. If the content type doesn't have any content groups, the
content_groups array is empty.Show child attributes
elements[]required · array · unique items
Elements within the content type. The order of the content type elements may differ compared to the UI. However, the content groups maintain the same order shown in the UI. Content type elements are ordered within the content group.
Any of:
Asset element
Content type snippet element
Custom element
Date & time element
Guidelines element
Linked items element
Multiple choice element
Number element
Rich text element
Subpages element
Taxonomy element
Text element
URL slug element
Asset element
namerequired · string · 1-50 chars
The element's display name.
typerequired · string
The element's type.
idstring · read-only
The element's internal ID.
codenamestring · 1-60 chars
The element's codename. Unless specified, initially generated from the element's
name.external_idstring
The element's external ID.
guidelinesstring · nullable
The element's guidelines, providing instructions on what to fill in.
asset_count_limitnestedSchema
Specifies the limitation for the number of assets allowed within the element.
valuerequired · number · int32
Specifies the image size, or how many objects can be used within the element.
conditionrequired · string
Specifies how to apply the
value.maximum_file_sizenumber · nullable · int32
Specifies the maximum file size in bytes.
allowed_file_typesstring
Specifies the allowed file types.
image_width_limitnestedSchema · nullable
Specifies the width limitation for the asset.
valuerequired · number · int32
Specifies the image size, or how many objects can be used within the element.
conditionrequired · string
Specifies how to apply the
value.image_height_limitnestedSchema · nullable
Specifies the height limitation for the asset.
valuerequired · number · int32
Specifies the image size, or how many objects can be used within the element.
conditionrequired · string
Specifies how to apply the
value.is_requiredboolean
Determines whether the element must be filled in.
is_non_localizableboolean
Determines whether the element uses the same value in all languages.
defaultobject · nullable
Specifies the element's initial value.
Renditions are currently not supported in the default value.
Show child attributes
content_groupnestedSchema
Reference to the content group the element is used in.The
content_group property is present only if one or more content groups are defined in the content type.idstring · uuid
The referenced object's internal ID.
codenamestring · write-only
The referenced object's codename. The value of the
codename property must meet the conditions defined in rules for codenames.external_idstring · write-only
The referenced object’s external ID. The value of the
external_id property must not contain the following characters: /, ., ;.JSON
{
"id": "dd1439d5-4ee2-4895-a4e4-5b0d9d8c754e",
"codename": "new_article",
"external_id": "custom-content-type-id",
"last_modified": "2021-06-17T06:28:11.6503569Z",
"name": "Article",
"content_groups": [
{
"id": "00000000-0000-0000-0000-000000000000",
"name": "Content",
"codename": "content"
},
{
"id": "0acae5f5-5479-46e9-aad0-9481abb4dcab",
"name": "Author",
"codename": "author"
},
{
"id": "b619a436-4e27-4cf3-8e42-c54ad9fccef7",
"name": "URL",
"codename": "url"
}
],
"elements": [
{
"snippet": {
"id": "b14f8a4a-229d-4429-9474-4d6b9789cb95"
},
"type": "snippet",
"id": "4e8b4583-f4f9-4db8-b9e5-683a9ed8cac6",
"codename": "snippet_with_title_element",
"is_non_localizable": false,
"content_group": {
"id": "00000000-0000-0000-0000-000000000000"
}
},
{
"maximum_text_length": null,
"maximum_image_size": null,
"allowed_content_types": [
{
"id": "f89956fd-92cc-473f-86bf-7616ffe72f5f"
}
],
"allowed_item_link_types": [],
"image_width_limit": null,
"image_height_limit": null,
"allowed_image_types": "any",
"allowed_blocks": [
"text",
"tables",
"components-and-items"
],
"allowed_formatting": [],
"allowed_text_blocks": [
"paragraph",
"heading-two",
"heading-three",
"heading-four",
"ordered-list",
"unordered-list"
],
"allowed_table_blocks": [
"text"
],
"allowed_table_formatting": [],
"allowed_table_text_blocks": [
"paragraph"
],
"name": "Content",
"guidelines": "Make it snappy.",
"is_required": true,
"is_non_localizable": false,
"type": "rich_text",
"id": "23375e4a-2ed8-42bf-aa3a-dfb32e6a42ec",
"codename": "content",
"content_group": {
"id": "00000000-0000-0000-0000-000000000000"
}
},
{
"item_count_limit": {
"value": 1,
"condition": "at_least"
},
"allowed_content_types": [
{
"id": "9fdd0ca7-e19d-4b83-9631-e9443f0e9d0e"
}
],
"name": "Author",
"guidelines": "Select the author or authors.",
"is_required": true,
"is_non_localizable": false,
"type": "modular_content",
"id": "02249cf0-e9db-4e96-a582-479a2650fbc1",
"codename": "author",
"content_group": {
"id": "0acae5f5-5479-46e9-aad0-9481abb4dcab"
}
},
{
"depends_on": {
"snippet": {
"id": "b14f8a4a-229d-4429-9474-4d6b9789cb95"
},
"element": {
"id": "e44db8df-3795-4455-95ee-d4fe10251371"
}
},
"name": "URL",
"guidelines": "If needed, provide a custom URL slug.",
"is_required": true,
"is_non_localizable": false,
"type": "url_slug",
"id": "4a90f541-2de4-4a69-b1ef-fe53c6abf0f4",
"codename": "url",
"content_group": {
"id": "b619a436-4e27-4cf3-8e42-c54ad9fccef7"
}
}
]
}Content group object
Every element in a content type can be assigned to a single content group. If you define one or more content groups for a content type, every element in the type must be assigned to a content group.
idstring · read-only · uuid
The content group's internal ID.
namerequired · string · 1-50 chars
The content group's display name.
codenamestring · 1-60 chars
The content group's codename. Unless specified, initially generated from the group's
When adding a content type, you must identify the content group by specifying its codename, external ID, or both. In the content elements, you specify a reference to the content group using either the group's codename or external ID.
name.external_idstring
The content group's external ID.
When adding a content type, you must identify the content group by specifying its codename, external ID, or both. In the content elements, you specify a reference to the content group using either the group's codename or external ID.
JSON
{
"id": "325107f6-5dfb-21a1-b24e-fa13be1fef1c",
"name": "My first group",
"codename": "my_first_group",
"external_id": "first-group"
}Add a content type
Create a new content type.
POST
https://manage.kontent.ai/v2/projects/{environment_id}/typesRequest
Path parameters
environment_idrequired · string
Identifies your environment.
Body schema
Application/json
The content type to be added.
codenamestring · 1-60 chars
The content type's codename. Unless set while creating the content type, it is initially generated from the type's
name and can later be modified.external_idstring
The content type's external ID. Only present if defined when creating the content type via API.
namerequired · string · 1-50 chars
The content type's display name.
content_groups[]array
The content type's content groups. If the content type doesn't have any content groups, the
content_groups array is empty.Show child attributes
elements[]required · array · unique items
Elements within the content type. The order of the content type elements may differ compared to the UI. However, the content groups maintain the same order shown in the UI. Content type elements are ordered within the content group.
Any of:
Asset element
Content type snippet element
Custom element
Date & time element
Guidelines element
Linked items element
Multiple choice element
Number element
Rich text element
Subpages element
Taxonomy element
Text element
URL slug element
Asset element
namerequired · string · 1-50 chars
The element's display name.
typerequired · string
The element's type.
codenamestring · 1-60 chars
The element's codename. Unless specified, initially generated from the element's
name.external_idstring
The element's external ID.
guidelinesstring · nullable
The element's guidelines, providing instructions on what to fill in.
asset_count_limitnestedSchema
Specifies the limitation for the number of assets allowed within the element.
valuerequired · number · int32
Specifies the image size, or how many objects can be used within the element.
conditionrequired · string
Specifies how to apply the
value.maximum_file_sizenumber · nullable · int32
Specifies the maximum file size in bytes.
allowed_file_typesstring
Specifies the allowed file types.
image_width_limitnestedSchema · nullable
Specifies the width limitation for the asset.
valuerequired · number · int32
Specifies the image size, or how many objects can be used within the element.
conditionrequired · string
Specifies how to apply the
value.image_height_limitnestedSchema · nullable
Specifies the height limitation for the asset.
valuerequired · number · int32
Specifies the image size, or how many objects can be used within the element.
conditionrequired · string
Specifies how to apply the
value.is_requiredboolean
Determines whether the element must be filled in.
is_non_localizableboolean
Determines whether the element uses the same value in all languages.
defaultobject · nullable
Specifies the element's initial value.
Renditions are currently not supported in the default value.
Show child attributes
content_groupnestedSchema
Reference to the content group the element is used in.The
content_group property is present only if one or more content groups are defined in the content type.idstring · uuid
The referenced object's internal ID.
codenamestring · write-only
The referenced object's codename. The value of the
codename property must meet the conditions defined in rules for codenames.external_idstring · write-only
The referenced object’s external ID. The value of the
external_id property must not contain the following characters: /, ., ;.Request samples
Payload
TypeScript
C#
cURL
// Tip: Find more about JS/TS SDKs at https://kontent.ai/learn/javascript
import { ManagementClient, ElementModels } from '@kontent-ai/management-sdk';
const client = new ManagementClient({
environmentId: 'KONTENT_AI_ENVIRONMENT_ID',
apiKey: 'KONTENT_AI_MANAGEMENT_API_KEY',
});
const response = await client
.addContentType()
.withData((builder) => {
return {
name: 'Article',
codename: 'my_article',
external_id: 'article',
content_groups: [
{
name: 'Article copy',
external_id: 'article-copy',
},
{
name: 'Author',
codename: 'author',
},
],
elements: [
builder.textElement({
name: 'Article title',
codename: 'title',
type: ElementModels.ElementType.text,
content_group: {
external_id: 'article-copy',
},
}),
builder.richTextElement({
name: 'Article body',
codename: 'body',
type: ElementModels.ElementType.richText,
content_group: {
external_id: 'article-copy',
},
}),
builder.richTextElement({
name: 'Author bio',
codename: 'bio',
type: ElementModels.ElementType.richText,
allowed_blocks: ['images', 'text'],
content_group: {
codename: 'author',
},
}),
],
};
})
.toPromise();
Response
Status (201)
The created content type.
idstring · read-only · uuid
The content type's internal ID.
codenamestring · 1-60 chars
The content type's codename. Unless set while creating the content type, it is initially generated from the type's
name and can later be modified.external_idstring
The content type's external ID. Only present if defined when creating the content type via API.
last_modifiedstring · read-only · date-time
ISO-8601
formatted date and time of the last change to the content type.
namerequired · string · 1-50 chars
The content type's display name.
content_groups[]array
The content type's content groups. If the content type doesn't have any content groups, the
content_groups array is empty.Show child attributes
elements[]required · array · unique items
Elements within the content type. The order of the content type elements may differ compared to the UI. However, the content groups maintain the same order shown in the UI. Content type elements are ordered within the content group.
Any of:
Asset element
Content type snippet element
Custom element
Date & time element
Guidelines element
Linked items element
Multiple choice element
Number element
Rich text element
Subpages element
Taxonomy element
Text element
URL slug element
Asset element
namerequired · string · 1-50 chars
The element's display name.
typerequired · string
The element's type.
idstring · read-only
The element's internal ID.
codenamestring · 1-60 chars
The element's codename. Unless specified, initially generated from the element's
name.external_idstring
The element's external ID.
guidelinesstring · nullable
The element's guidelines, providing instructions on what to fill in.
asset_count_limitnestedSchema
Specifies the limitation for the number of assets allowed within the element.
valuerequired · number · int32
Specifies the image size, or how many objects can be used within the element.
conditionrequired · string
Specifies how to apply the
value.maximum_file_sizenumber · nullable · int32
Specifies the maximum file size in bytes.
allowed_file_typesstring
Specifies the allowed file types.
image_width_limitnestedSchema · nullable
Specifies the width limitation for the asset.
valuerequired · number · int32
Specifies the image size, or how many objects can be used within the element.
conditionrequired · string
Specifies how to apply the
value.image_height_limitnestedSchema · nullable
Specifies the height limitation for the asset.
valuerequired · number · int32
Specifies the image size, or how many objects can be used within the element.
conditionrequired · string
Specifies how to apply the
value.is_requiredboolean
Determines whether the element must be filled in.
is_non_localizableboolean
Determines whether the element uses the same value in all languages.
defaultobject · nullable
Specifies the element's initial value.
Renditions are currently not supported in the default value.
Show child attributes
content_groupnestedSchema
Reference to the content group the element is used in.The
content_group property is present only if one or more content groups are defined in the content type.content_group
idstring · uuid
The referenced object's internal ID.
Example responses
201
400
{
"id": "d622fc28-5202-511a-9dbf-a3ee363b6c7c",
"codename": "my_article",
"last_modified": "2019-08-26T08:38:49.7302435Z",
"external_id": "article",
"name": "Article",
"content_groups": [
{
"id": "c2deb028-1bad-5191-952f-ace4b256ba61",
"name": "Article copy",
"codename": "article_copy",
"external_id": "article-copy"
},
{
"id": "46d8c4db-df5c-55ab-887a-458f7ad063a1",
"name": "Author",
"codename": "author"
}
],
"elements": [
{
"maximum_text_length": null,
"name": "Article title",
"guidelines": null,
"is_required": false,
"is_non_localizable": false,
"type": "text",
"id": "e32743cd-7616-4a4a-9948-c9fcb54bff3f",
"codename": "title",
"content_group": {
"id": "c2deb028-1bad-5191-952f-ace4b256ba61"
}
},
{
"maximum_text_length": null,
"maximum_image_size": null,
"allowed_content_types": [],
"allowed_item_link_types": [],
"image_width_limit": null,
"image_height_limit": null,
"allowed_image_types": "any",
"allowed_blocks": [],
"allowed_text_blocks": [],
"allowed_formatting": [],
"allowed_table_blocks": [],
"allowed_table_text_blocks": [],
"allowed_table_formatting": [],
"name": "Article body",
"guidelines": null,
"is_required": false,
"is_non_localizable": false,
"type": "rich_text",
"id": "bbddb422-774c-4226-984d-c15656df6108",
"codename": "body",
"content_group": {
"id": "c2deb028-1bad-5191-952f-ace4b256ba61"
}
},
{
"maximum_text_length": null,
"maximum_image_size": null,
"allowed_content_types": [],
"allowed_item_link_types": [],
"image_width_limit": null,
"image_height_limit": null,
"allowed_image_types": "any",
"allowed_blocks": [
"images",
"text"
],
"allowed_text_blocks": [],
"allowed_formatting": [],
"allowed_table_blocks": [],
"allowed_table_text_blocks": [],
"allowed_table_formatting": [],
"name": "Author bio",
"guidelines": null,
"is_required": false,
"is_non_localizable": false,
"type": "rich_text",
"id": "1c795ec7-368c-4c22-830e-e8b969f596be",
"codename": "bio",
"content_group": {
"id": "46d8c4db-df5c-55ab-887a-458f7ad063a1"
}
}
]
}Retrieve a content type
Retrieve information about a single content type.
GET
https://manage.kontent.ai/v2/projects/{environment_id}/types/{type_identifier}Request
Path parameters
environment_idrequired · string
Identifies your environment.
type_identifierrequired · string
Identifies the content type by internal ID (e.g.,
269202ad-1d9d-47fd-b3e8-bdb05b3e3cf0), external ID (e.g., external-id/Content-Type-123), or codename (e.g., codename/hosted_video).Request samples
TypeScript
C#
cURL
// 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
.viewContentType()
.byTypeId('269202ad-1d9d-47fd-b3e8-bdb05b3e3cf0')
// .byTypeCodename('hosted_video')
.toPromise();
Response
Status (200)
A content type object with metadata about the type and its elements.
idstring · read-only · uuid
The content type's internal ID.
codenamestring · 1-60 chars
The content type's codename. Unless set while creating the content type, it is initially generated from the type's
name and can later be modified.external_idstring
The content type's external ID. Only present if defined when creating the content type via API.
last_modifiedstring · read-only · date-time
ISO-8601
formatted date and time of the last change to the content type.
namerequired · string · 1-50 chars
The content type's display name.
content_groups[]array
The content type's content groups. If the content type doesn't have any content groups, the
content_groups array is empty.Show child attributes
elements[]required · array · unique items
Elements within the content type. The order of the content type elements may differ compared to the UI. However, the content groups maintain the same order shown in the UI. Content type elements are ordered within the content group.
Any of:
Asset element
Content type snippet element
Custom element
Date & time element
Guidelines element
Linked items element
Multiple choice element
Number element
Rich text element
Subpages element
Taxonomy element
Text element
URL slug element
Asset element
namerequired · string · 1-50 chars
The element's display name.
typerequired · string
The element's type.
idstring · read-only
The element's internal ID.
codenamestring · 1-60 chars
The element's codename. Unless specified, initially generated from the element's
name.external_idstring
The element's external ID.
guidelinesstring · nullable
The element's guidelines, providing instructions on what to fill in.
asset_count_limitnestedSchema
Specifies the limitation for the number of assets allowed within the element.
valuerequired · number · int32
Specifies the image size, or how many objects can be used within the element.
conditionrequired · string
Specifies how to apply the
value.maximum_file_sizenumber · nullable · int32
Specifies the maximum file size in bytes.
allowed_file_typesstring
Specifies the allowed file types.
image_width_limitnestedSchema · nullable
Specifies the width limitation for the asset.
valuerequired · number · int32
Specifies the image size, or how many objects can be used within the element.
conditionrequired · string
Specifies how to apply the
value.image_height_limitnestedSchema · nullable
Specifies the height limitation for the asset.
valuerequired · number · int32
Specifies the image size, or how many objects can be used within the element.
conditionrequired · string
Specifies how to apply the
value.is_requiredboolean
Determines whether the element must be filled in.
is_non_localizableboolean
Determines whether the element uses the same value in all languages.
defaultobject · nullable
Specifies the element's initial value.
Renditions are currently not supported in the default value.
Show child attributes
content_groupnestedSchema
Reference to the content group the element is used in.The
content_group property is present only if one or more content groups are defined in the content type.content_group
idstring · uuid
The referenced object's internal ID.
Example responses
200
404
{
"id": "dd1439d5-4ee2-4895-a4e4-5b0d9d8c754e",
"codename": "new_article",
"external_id": "custom-content-type-id",
"last_modified": "2021-06-17T06:28:11.6503569Z",
"name": "Article",
"content_groups": [
{
"id": "00000000-0000-0000-0000-000000000000",
"name": "Content",
"codename": "content"
},
{
"id": "0acae5f5-5479-46e9-aad0-9481abb4dcab",
"name": "Author",
"codename": "author"
},
{
"id": "b619a436-4e27-4cf3-8e42-c54ad9fccef7",
"name": "URL",
"codename": "url"
}
],
"elements": [
{
"snippet": {
"id": "b14f8a4a-229d-4429-9474-4d6b9789cb95"
},
"type": "snippet",
"id": "4e8b4583-f4f9-4db8-b9e5-683a9ed8cac6",
"codename": "snippet_with_title_element",
"is_non_localizable": false,
"content_group": {
"id": "00000000-0000-0000-0000-000000000000"
}
},
{
"maximum_text_length": null,
"maximum_image_size": null,
"allowed_content_types": [
{
"id": "f89956fd-92cc-473f-86bf-7616ffe72f5f"
}
],
"allowed_item_link_types": [],
"image_width_limit": null,
"image_height_limit": null,
"allowed_image_types": "any",
"allowed_blocks": [
"text",
"tables",
"components-and-items"
],
"allowed_formatting": [],
"allowed_text_blocks": [
"paragraph",
"heading-two",
"heading-three",
"heading-four",
"ordered-list",
"unordered-list"
],
"allowed_table_blocks": [
"text"
],
"allowed_table_formatting": [],
"allowed_table_text_blocks": [
"paragraph"
],
"name": "Content",
"guidelines": "Make it snappy.",
"is_required": true,
"is_non_localizable": false,
"type": "rich_text",
"id": "23375e4a-2ed8-42bf-aa3a-dfb32e6a42ec",
"codename": "content",
"content_group": {
"id": "00000000-0000-0000-0000-000000000000"
}
},
{
"item_count_limit": {
"value": 1,
"condition": "at_least"
},
"allowed_content_types": [
{
"id": "9fdd0ca7-e19d-4b83-9631-e9443f0e9d0e"
}
],
"name": "Author",
"guidelines": "Select the author or authors.",
"is_required": true,
"is_non_localizable": false,
"type": "modular_content",
"id": "02249cf0-e9db-4e96-a582-479a2650fbc1",
"codename": "author",
"content_group": {
"id": "0acae5f5-5479-46e9-aad0-9481abb4dcab"
}
},
{
"depends_on": {
"snippet": {
"id": "b14f8a4a-229d-4429-9474-4d6b9789cb95"
},
"element": {
"id": "e44db8df-3795-4455-95ee-d4fe10251371"
}
},
"name": "URL",
"guidelines": "If needed, provide a custom URL slug.",
"is_required": true,
"is_non_localizable": false,
"type": "url_slug",
"id": "4a90f541-2de4-4a69-b1ef-fe53c6abf0f4",
"codename": "url",
"content_group": {
"id": "b619a436-4e27-4cf3-8e42-c54ad9fccef7"
}
}
]
}List content types
Retrieve a dynamically paginated list of content types.
GET
https://manage.kontent.ai/v2/projects/{environment_id}/typesRequest
Path parameters
environment_idrequired · string
Identifies your environment.
Header parameters
x-continuationstring
Determines the page of results to retrieve.To get the next page of results, check the pagination object in the API response and set the
x-continuation header parameter to the value of the continuation_token property.Request samples
TypeScript
C#
cURL
// 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.listContentTypes().toPromise();
// Gets all pages of results
// const response = await client.listContentTypes()
// .toAllPromise();
Response
Status (200)
A dynamically paginated list of content types.
types[]required · array
Show child attributes
paginationrequired · object
Information about the next page of results.
Show child attributes
Example responses
200
400
{
"types": {
"id": "dd1439d5-4ee2-4895-a4e4-5b0d9d8c754e",
"codename": "new_article",
"external_id": "custom-content-type-id",
"last_modified": "2021-06-17T06:28:11.6503569Z",
"name": "Article",
"content_groups": [
{
"id": "00000000-0000-0000-0000-000000000000",
"name": "Content",
"codename": "content"
},
{
"id": "0acae5f5-5479-46e9-aad0-9481abb4dcab",
"name": "Author",
"codename": "author"
},
{
"id": "b619a436-4e27-4cf3-8e42-c54ad9fccef7",
"name": "URL",
"codename": "url"
}
],
"elements": [
{
"snippet": {
"id": "b14f8a4a-229d-4429-9474-4d6b9789cb95"
},
"type": "snippet",
"id": "4e8b4583-f4f9-4db8-b9e5-683a9ed8cac6",
"codename": "snippet_with_title_element",
"is_non_localizable": false,
"content_group": {
"id": "00000000-0000-0000-0000-000000000000"
}
},
{
"maximum_text_length": null,
"maximum_image_size": null,
"allowed_content_types": [
{
"id": "f89956fd-92cc-473f-86bf-7616ffe72f5f"
}
],
"allowed_item_link_types": [],
"image_width_limit": null,
"image_height_limit": null,
"allowed_image_types": "any",
"allowed_blocks": [
"text",
"tables",
"components-and-items"
],
"allowed_formatting": [],
"allowed_text_blocks": [
"paragraph",
"heading-two",
"heading-three",
"heading-four",
"ordered-list",
"unordered-list"
],
"allowed_table_blocks": [
"text"
],
"allowed_table_formatting": [],
"allowed_table_text_blocks": [
"paragraph"
],
"name": "Content",
"guidelines": "Make it snappy.",
"is_required": true,
"is_non_localizable": false,
"type": "rich_text",
"id": "23375e4a-2ed8-42bf-aa3a-dfb32e6a42ec",
"codename": "content",
"content_group": {
"id": "00000000-0000-0000-0000-000000000000"
}
},
{
"item_count_limit": {
"value": 1,
"condition": "at_least"
},
"allowed_content_types": [
{
"id": "9fdd0ca7-e19d-4b83-9631-e9443f0e9d0e"
}
],
"name": "Author",
"guidelines": "Select the author or authors.",
"is_required": true,
"is_non_localizable": false,
"type": "modular_content",
"id": "02249cf0-e9db-4e96-a582-479a2650fbc1",
"codename": "author",
"content_group": {
"id": "0acae5f5-5479-46e9-aad0-9481abb4dcab"
}
},
{
"depends_on": {
"snippet": {
"id": "b14f8a4a-229d-4429-9474-4d6b9789cb95"
},
"element": {
"id": "e44db8df-3795-4455-95ee-d4fe10251371"
}
},
"name": "URL",
"guidelines": "If needed, provide a custom URL slug.",
"is_required": true,
"is_non_localizable": false,
"type": "url_slug",
"id": "4a90f541-2de4-4a69-b1ef-fe53c6abf0f4",
"codename": "url",
"content_group": {
"id": "b619a436-4e27-4cf3-8e42-c54ad9fccef7"
}
}
]
},
"pagination": {
"continuation_token": "W3sidG9rZW4iOiIrUklEOn...",
"next_page": "https://manage.kontent.ai/v2/your/chosen/list/endpoint"
}
}Modify a content type
Modify how existing content types and their elements are set up.You can modify content types and their element configuration using the following operations:
addIntooperation to add new objects. For example, add an element or content group to the content type, or add an option to a multiple choice element.moveoperation to reorder objects. For example, change the position of an element or content group within the content type, or the position of a multiple choice element option.removeoperation to delete objects. For example, delete an element or content group from the content type, or delete a specific multiple choice element option.replaceoperation to update values. For example, replace the value of a specific object property such as a codename.
path to the element or content group using a {path_reference}. Path references can use internal IDs, codenames, or external IDs.
id:5eb3d03e-c69d-4e93-b4cc-76f453271386codename:my_text_elementexternal_id:id_from_external_source– Special characters such as slashes (/) need to be escaped. For example, to reference an object using its external ID ofmy/value, you use a path reference ofexternal_id:my\\/value.
PATCH
https://manage.kontent.ai/v2/projects/{environment_id}/types/{type_identifier}Request
Path parameters
environment_idrequired · string
Identifies your environment.
type_identifierrequired · string
Identifies the content type by internal ID (e.g.,
269202ad-1d9d-47fd-b3e8-bdb05b3e3cf0), external ID (e.g., external-id/Content-Type-123), or codename (e.g., codename/hosted_video).Body schema
Application/json
The operations to perform on the specified content type and its elements.
array · unique items
Any of:
TypeOperationAddInto
TypeOperationMove
TypeOperationRemove
TypeOperationReplace
TypeOperationAddInto
oprequired · string
Specifies the operation to perform.
addIntoto add new objectsmoveto reorder objectsremoveto delete objectsreplaceto modify object properties
pathstring · write-only
Specifies where to add the new object or property. The exact path depends on what you are trying to add and where. For example, if you want to add a property to an element, you need to provide a
{path_reference} for the element.- To add a new element, set
pathto/elements. - To add a new content group, set
pathto/content_groups. - To add an allowed content type to a rich text or linked items element, set
pathto/elements/{path_reference}/allowed_content_types. - To add an allowed element to a custom element, set
pathto/elements/{path_reference}/allowed_elements. - To add a new multiple choice option, set
pathto/elements/{path_reference}/options. - To add a block so it can be used in a rich text element, set
pathto/elements/{path_reference}/allowed_blocks.
valuerequired · nestedSchema
The object to add. The value depends on the selected
path:- To add a new element, use a content element object.
- To add a new content group, use a content group object.
- To add an allowed content type to a rich text or linked items element, use a reference object that points to a specific content type.
- To add an allowed element to a custom element, use a reference object that points to the specific element.
- To add an option to a multiple choice element, use an option object.
- To add an allowed block, text block, or text formatting to a rich text element, use an array of strings to specify its value.
Any of:
StringArray
Asset element
Content group object
Content type snippet element
Custom element
Date & time element
Guidelines element
Linked items element
MultipleChoiceOption
Multiple choice element
Number element
Reference object
Rich text element
Taxonomy element
Text element
URL slug element
Subpages element
StringArray
stringArray[]array
beforeobject
Reference to a specific object in the environment.
The API uses internal IDs for referencing objects. This means that the reference objects in the API responses will always use internal IDs.
Show child attributes
afterobject
Reference to a specific object in the environment.
The API uses internal IDs for referencing objects. This means that the reference objects in the API responses will always use internal IDs.
Show child attributes
Request samples
Payload
TypeScript
C#
cURL
// 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
.modifyContentType()
.byTypeId('0be13600-e57c-577d-8108-c8d860330985')
// .byTypeCodename('my_article')
// .byTypeExternalId('my-article-id')
.withData([
{
op: 'replace',
path: '/name',
value: 'A new type name',
},
{
op: 'replace',
path: '/elements/codename:my_text_element/guidelines',
value: 'Here you can tell users how to fill in the element.',
},
{
op: 'addInto',
path: '/elements',
value: {
name: 'My title',
type: 'text',
guidelines: 'Title of the article in plain text.',
external_id: 'my-title-id',
},
},
{
op: 'remove',
path: '/elements/id:0b2015d0-16ae-414a-85f9-7e1a4b3a3eae',
},
{
op: 'remove',
path: '/elements/external_id:my-multiple-choice-id/options/codename:my_option',
},
{
op: 'remove',
path: '/elements/id:e94fab1f-c2c1-4f4a-b36c-3f7a0808d2b8/allowed_blocks/text',
},
])
.toPromise();
Response
Status (200)
The modified content type.
idstring · read-only · uuid
The content type's internal ID.
codenamestring · 1-60 chars
The content type's codename. Unless set while creating the content type, it is initially generated from the type's
name and can later be modified.external_idstring
The content type's external ID. Only present if defined when creating the content type via API.
last_modifiedstring · read-only · date-time
ISO-8601
formatted date and time of the last change to the content type.
namerequired · string · 1-50 chars
The content type's display name.
content_groups[]array
The content type's content groups. If the content type doesn't have any content groups, the
content_groups array is empty.Show child attributes
elements[]required · array · unique items
Elements within the content type. The order of the content type elements may differ compared to the UI. However, the content groups maintain the same order shown in the UI. Content type elements are ordered within the content group.
Any of:
Asset element
Content type snippet element
Custom element
Date & time element
Guidelines element
Linked items element
Multiple choice element
Number element
Rich text element
Subpages element
Taxonomy element
Text element
URL slug element
Asset element
namerequired · string · 1-50 chars
The element's display name.
typerequired · string
The element's type.
idstring · read-only
The element's internal ID.
codenamestring · 1-60 chars
The element's codename. Unless specified, initially generated from the element's
name.external_idstring
The element's external ID.
guidelinesstring · nullable
The element's guidelines, providing instructions on what to fill in.
asset_count_limitnestedSchema
Specifies the limitation for the number of assets allowed within the element.
valuerequired · number · int32
Specifies the image size, or how many objects can be used within the element.
conditionrequired · string
Specifies how to apply the
value.maximum_file_sizenumber · nullable · int32
Specifies the maximum file size in bytes.
allowed_file_typesstring
Specifies the allowed file types.
image_width_limitnestedSchema · nullable
Specifies the width limitation for the asset.
valuerequired · number · int32
Specifies the image size, or how many objects can be used within the element.
conditionrequired · string
Specifies how to apply the
value.image_height_limitnestedSchema · nullable
Specifies the height limitation for the asset.
valuerequired · number · int32
Specifies the image size, or how many objects can be used within the element.
conditionrequired · string
Specifies how to apply the
value.is_requiredboolean
Determines whether the element must be filled in.
is_non_localizableboolean
Determines whether the element uses the same value in all languages.
defaultobject · nullable
Specifies the element's initial value.
Renditions are currently not supported in the default value.
Show child attributes
content_groupnestedSchema
Reference to the content group the element is used in.The
content_group property is present only if one or more content groups are defined in the content type.content_group
idstring · uuid
The referenced object's internal ID.
Example responses
200
400
404
{
"id": "2b4aa3ad-f008-45a2-9561-7483557facce",
"codename": "my_article",
"last_modified": "2019-12-11T15:51:52.7389684Z",
"name": "A new type name",
"content_groups": [],
"elements": [
{
"mode": "multiple",
"options": [
{
"id": "d66ffa49-86ff-eeaa-c33b-e5d9eefe8b81",
"codename": "my_other_multiple_choice_option",
"name": "My other multiple choice option"
},
{
"id": "523e6231-8d80-a158-3601-dffde4e64a78",
"codename": "another_multiple_choice_option",
"name": "Another multiple choice option"
}
],
"name": "My multiple choice element",
"guidelines": "",
"type": "multiple_choice",
"id": "87924912-4861-aa84-176a-1eae7b22529b",
"codename": "my_multiple_choice_element",
"external_id": "my-multiple-choice-id",
"is_non_localizable": false
},
{
"name": "My title",
"guidelines": "Title of the article in plain text.",
"type": "text",
"external_id": "my-title-id",
"id": "eacf283d-7e60-57b9-a68e-91180bfebb6d",
"codename": "my_title",
"is_non_localizable": false
},
{
"name": "My text element",
"guidelines": "Here you can tell users how to fill in the element.",
"type": "text",
"id": "116a2441-6441-7124-c85b-46a4fef5dcb9",
"codename": "my_text_element",
"is_non_localizable": false
},
{
"maximum_text_length": null,
"maximum_image_size": null,
"allowed_content_types": [],
"allowed_item_link_types": [],
"image_width_limit": null,
"image_height_limit": null,
"allowed_image_types": "any",
"allowed_blocks": [
"tables"
],
"name": "Rich text",
"guidelines": null,
"is_required": false,
"is_non_localizable": false,
"type": "rich_text",
"id": "e94fab1f-c2c1-4f4a-b36c-3f7a0808d2b8",
"codename": "rich_text"
}
]
}Delete a content type
Delete an unused content type.
DELETE
https://manage.kontent.ai/v2/projects/{environment_id}/types/{type_identifier}Request
Path parameters
environment_idrequired · string
Identifies your environment.
type_identifierrequired · string
Identifies the content type by internal ID (e.g.,
269202ad-1d9d-47fd-b3e8-bdb05b3e3cf0), external ID (e.g., external-id/Content-Type-123), or codename (e.g., codename/hosted_video).Request samples
TypeScript
C#
cURL
// 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
.deleteContentType()
.byTypeId('269202ad-1d9d-47fd-b3e8-bdb05b3e3cf0')
// .byTypeCodename('hosted_video')
.toPromise();
Response
Status (204)
The specified content type was deleted.
Empty response
Example responses
400
404
{
"request_id": "|6374648c6c8f18449b027b68dad7808a.f72d851f_",
"error_code": 0,
"message": "Type 'Article (d622fc28-5202-511a-9dbf-a3ee363b6c7c)' is still used and cannot be archived."
}