Define Project-specific Custom Fields on resources and data types.
commercetools Composable Commerce APIs provide flexible data models that cover a wide range of use cases with the standard fields on the resources and their data objects. However, you might want to add additional fields to resources and data types to better support your usage scenario.
With Types, you can model your own Custom Fields on these data types.
A Type can contain multiple FieldDefinitions, each of which defines a Custom Field.
FieldDefinition is similar to AttributeDefinition of Product Types.
Multiple Types can be created for a single resource or data type, but a particular resource or data type can be customized with only one Type at the same time.
The values of Custom Fields are represented by CustomFieldValue on Custom Fields.
Find a step-by-step example on how to use Types and Custom Fields in our respective tutorial.
Representations
Type
id ​String​ | Unique identifier of the Type. |
version ​Int​ | Current version of the Type. |
key ​String​ | User-defined unique identifier of the Type. MinLength:2 ​MaxLength: 256 ​Pattern: ^[A-Za-z0-9_-]+$ ​ |
name ​ | Name of the Type. |
description ​ | Description of the Type. |
resourceTypeIds ​Array of ResourceTypeId​ | Resources and/or data types for which the Type is defined. |
fieldDefinitions ​Array of FieldDefinition​ | Defines Custom Fields. |
createdAt ​DateTime​ | Date and time (UTC) the Type was initially created. |
createdBy ​BETACreatedBy​ | IDs and references that created the Type. |
lastModifiedAt ​DateTime​ | Date and time (UTC) the Type was last updated. |
lastModifiedBy ​BETA | IDs and references that last modified the Type. |
TypeDraft
key ​String​ | User-defined unique identifier for the Type. MinLength:2 ​MaxLength: 256 ​Pattern: ^[A-Za-z0-9_-]+$ ​ |
name ​ | Name of the Type. |
description ​ | Description of the Type. |
resourceTypeIds ​Array of ResourceTypeId​ | Resources and/or data types for which the Type is defined. |
fieldDefinitions ​Array of FieldDefinition​ | Defines Custom Fields. |
{
"key": "line-item-string-field",
"name": {
"en": "String Custom Field on Line Items"
},
"description": {
"en": "This adds a Custom Field on Line Items, which can hold any string value."
},
"resourceTypeIds": [
"line-item"
],
"fieldDefinitions": [
{
"name": "exampleStringField",
"label": {
"en": "Example string field."
},
"required": false,
"type": {
"name": "String"
},
"inputHint": "SingleLine"
}
]
}
TypePagedQueryResponse
PagedQueryResult with results
containing an array of Types.
limit ​Int​ | Number of results requested. Default:20 ​Minimum: 0 ​Maximum: 500 ​ |
offset ​Int​ | Number of elements skipped. Default:0 ​Maximum: 10000 ​ |
count ​Int​ | Actual number of results returned. |
total ​Int​ | Total number of results matching the query.
This number is an estimation that is not strongly consistent.
This field is returned by default.
For improved performance, calculating this field can be deactivated by using the query parameter |
results ​Array of Type​ | Types matching the query. |
TypeReference
id ​String​ | Unique identifier of the referenced Type. |
typeId ​ | type Type of referenced resource. |
obj ​Type​ | Contains the representation of the expanded Type. Only present in responses to requests with Reference Expansion for Types. |
TypeResourceIdentifier
ResourceIdentifier of a Type. Either id
or key
is required. If both are set, an InvalidJsonInput error is returned.
id ​String​ | Unique identifier of the referenced Type. Required if |
key ​String​ | User-defined unique identifier of the referenced Type. Required if 2 ​MaxLength: 256 ​Pattern: ^[A-Za-z0-9_-]+$ ​ |
typeId ​ | type Type of referenced resource. If given, it must match the expected ReferenceTypeId of the referenced resource. |
ResourceTypeId
With Types, you can model your own Custom Fields on the following resources and data types.
address
Address on BusinessUnit, Cart, Order, OrderEdit, Customer, and Channel
asset
Asset on Category and ProductVariant
approval-flow
approval-rule
associate-role
business-unit
cart-discount
category
channel
customer
customer-group
custom-line-item
CustomLineItem on Cart and Order
discount-code
inventory-entry
line-item
LineItem on Cart and Order, and LineItem on ShoppingList
order
Cart and Order. When a Cart is ordered, the CustomFields need to be copied to the Order. For this reason, the Types for Carts are also valid for Orders, and hence both have the same identifier:
order
.order-edit
order-delivery
order-parcel
order-return-item
payment
payment-interface-interaction
product-price
product-selection
product-tailoring
quote
Quote, QuoteRequest and StagedQuote. When a StagedQuote is created, the CustomFields will be copied from the QuoteRequest and when a Quote is created, the CustomFields will be copied from the StagedQuote. For this reason, the Types for Quotes are also valid for QuoteRequests and StagedQuotes, and hence all have the same identifier:
quote
.review
shipping
shipping-method
shopping-list
shopping-list-text-line-item
standalone-price
store
transaction
FieldDefinition
Defines a Custom Field and its meta-information. This FieldDefinition is similar to an AttributeDefinition of Product Types.
type ​FieldType​ | Data type of the Custom Field to define. |
name ​String​ | Name of the Custom Field to define.
Must be unique for a given ResourceTypeId.
In case there is a FieldDefinition with the same 2 ​MaxLength: 36 ​Pattern: ^[A-Za-z0-9_-]+$ ​ |
label ​ | A human-readable label for the field. |
required ​Boolean​ | Defines whether the field is required to have a value. |
inputHint ​ | Defines the visual representation of the field in user interfaces like the Merchant Center. It is only relevant for string-based FieldTypes like CustomFieldStringType and CustomFieldLocalizedStringType. Default:SingleLine ​ |
{
"type": {
"name": "Set",
"elementType": {
"name": "Reference",
"referenceTypeId": "product"
}
},
"name": "exampleSetOfReferenceField",
"label": {
"en": "Example Set of Reference Field"
},
"required": false,
"inputHint": "SingleLine"
}
TextInputHint
Provides a visual representation type for this field. It is only relevant for string-based field types like CustomFieldStringType and CustomFieldLocalizedStringType. Following values are supported:
SingleLine
Hint for GUIs to display the field's content in a single line of text.
MultiLine
Hint for GUIs to display the field's content over multiple lines of text.
FieldType
Abstract parent type for the specific field types with the common name
field.
Some FieldTypes have additional fields for metadata. For example, allowed values
for enum types or elementType
for set type fields.
CustomFieldBooleanType
Field type for Boolean values.
name ​String​ | "Boolean" |
CustomFieldNumberType
Field type for number values.
name ​String​ | "Number" |
CustomFieldStringType
Field type for string values.
name ​String​ | "String" |
CustomFieldLocalizedStringType
Field type for LocalizedString values.
name ​String​ | "LocalizedString" |
CustomFieldEnumType
Field type for enum values.
name ​String​ | "Enum" |
values ​Array of CustomFieldEnumValue​ | Allowed values. |
{
"name": "Enum",
"values": [
{
"key": "first-value",
"label": "First"
},
{
"key": "second-value",
"label": "Second"
}
]
}
CustomFieldLocalizedEnumType
Field type for localized enum values.
name ​String​ | "LocalizedEnum" |
values ​Array of CustomFieldLocalizedEnumValue​ | Allowed values. |
{
"name": "LocalizedEnum",
"values": [
{
"key": "first-value",
"label": {
"en": "First",
"de": "Erste"
}
},
{
"key": "second-value",
"label": {
"en": "Second",
"de": "Zweite"
}
}
]
}
CustomFieldMoneyType
Field type for CentPrecisionMoney values.
name ​String​ | "Money" |
CustomFieldDateType
Field type for Date values.
name ​String​ | "Date" |
CustomFieldTimeType
Field type for Time values.
name ​String​ | "Time" |
CustomFieldDateTimeType
Field type for DateTime values.
name ​String​ | "DateTime" |
CustomFieldReferenceType
Field type for Reference values.
name ​String​ | "Reference" |
referenceTypeId ​ | Resource type the Custom Field can reference. |
{
"name": "Reference",
"referenceTypeId": "product"
}
CustomFieldSetType
Values of a SetType Custom Field are sets of values of the specified elementType
(without duplicate elements).
name ​String​ | "Set" |
elementType ​FieldType​ | Field type of the elements in the set. |
{
"name": "Set",
"elementType": {
"name": "Reference",
"referenceTypeId": "product"
}
}
CustomFieldEnumValue
Defines an allowed value of a CustomFieldEnumType field.
key ​String​ | Key of the value used as a programmatic identifier. |
label ​String​ | Descriptive label of the value. |
{
"key": "enum-value-key",
"label": "Enum value label"
}
CustomFieldLocalizedEnumValue
Defines an allowed value of a CustomFieldLocalizedEnumType field.
key ​String​ | Key of the value used as a programmatic identifier. |
label ​ | Descriptive localized label of the value. |
{
"key": "localized-enum-value-key",
"label": {
"en": "Localized enum value label"
}
}
CustomFieldReferenceValue
Defines which resource type a CustomFieldReferenceType can reference.
approval-flow
approval-rule
associate-role
business-unit
cart
cart-discount
category
channel
customer
customer-group
key-value-document
order
product
product-type
review
state
shipping-method
zone
Get Type
Get Type by ID
view_types:{projectKey}
region String ​ | Region in which the Project is hosted. |
projectKey String ​ |
|
id String ​ |
|
expand | The parameter can be passed multiple times. |
application/json
curl --get https://api.{region}.commercetools.com/{projectKey}/types/{id} -i \
--header "Authorization: Bearer ${BEARER_TOKEN}"
{
"id": "ff8b0f8c-78c8-4c4c-a4b7-2545d9279515",
"version": 1,
"key": "line-item-string-field",
"name": {
"en": "String Custom Field on Line Items"
},
"description": {
"en": "This adds a Custom Field on Line Items, which can hold any string value."
},
"resourceTypeIds": ["line-item"],
"fieldDefinitions": [
{
"name": "exampleStringField",
"label": {
"en": "Example string field."
},
"required": false,
"type": {
"name": "String"
},
"inputHint": "SingleLine"
}
],
"createdAt": "2023-10-07T06:56:19.217Z",
"lastModifiedAt": "2023-10-07T06:56:19.217Z"
}
Get Type by Key
view_types:{projectKey}
region String ​ | Region in which the Project is hosted. |
projectKey String ​ |
|
key String ​ |
|
expand | The parameter can be passed multiple times. |
application/json
curl --get https://api.{region}.commercetools.com/{projectKey}/types/key={key} -i \
--header "Authorization: Bearer ${BEARER_TOKEN}"
{
"id": "ff8b0f8c-78c8-4c4c-a4b7-2545d9279515",
"version": 1,
"key": "line-item-string-field",
"name": {
"en": "String Custom Field on Line Items"
},
"description": {
"en": "This adds a Custom Field on Line Items, which can hold any string value."
},
"resourceTypeIds": ["line-item"],
"fieldDefinitions": [
{
"name": "exampleStringField",
"label": {
"en": "Example string field."
},
"required": false,
"type": {
"name": "String"
},
"inputHint": "SingleLine"
}
],
"createdAt": "2023-10-07T06:56:19.217Z",
"lastModifiedAt": "2023-10-07T06:56:19.217Z"
}
Query Types
view_types:{projectKey}
region String ​ | Region in which the Project is hosted. |
projectKey String ​ |
|
where | The parameter can be passed multiple times. |
sort | The parameter can be passed multiple times. |
expand | The parameter can be passed multiple times. |
limit Int ​ | Number of results requested. Default: 20 ​ |
offset Int ​ | Number of elements skipped. Default: 0 ​ |
withTotal Boolean ​ | Controls the calculation of the total number of query results. Set to Default: true ​ |
var.<varName> String ​ | Predicate parameter values. The parameter can be passed multiple times. |
application/json
curl --get https://api.{region}.commercetools.com/{projectKey}/types -i \
--header "Authorization: Bearer ${BEARER_TOKEN}"
{
"limit": 20,
"offset": 0,
"count": 1,
"total": 1,
"results": [
{
"id": "ff8b0f8c-78c8-4c4c-a4b7-2545d9279515",
"version": 1,
"key": "line-item-string-field",
"name": {
"en": "String Custom Field on Line Items"
},
"description": {
"en": "This adds a Custom Field on Line Items, which can hold any string value."
},
"resourceTypeIds": ["line-item"],
"fieldDefinitions": [
{
"name": "exampleStringField",
"label": {
"en": "Example string field."
},
"required": false,
"type": {
"name": "String"
},
"inputHint": "SingleLine"
}
],
"createdAt": "2023-10-07T06:56:19.217Z",
"lastModifiedAt": "2023-10-07T06:56:19.217Z"
}
]
}
Check if Type exists
Check if Type exists by ID
Checks if a Type exists for a given id
. Returns a 200 OK
status if the Type exists or a 404 Not Found
otherwise.
view_types:{projectKey}
region String ​ | Region in which the Project is hosted. |
projectKey String ​ |
|
id String ​ |
|
curl --head https://api.{region}.commercetools.com/{projectKey}/types/{id} -i \
--header "Authorization: Bearer ${BEARER_TOKEN}"
Check if Type exists by Key
Checks if a Type exists for a given key
. Returns a 200 OK
status if the Type exists or a 404 Not Found
otherwise.
view_types:{projectKey}
region String ​ | Region in which the Project is hosted. |
projectKey String ​ |
|
key String ​ |
|
curl --head https://api.{region}.commercetools.com/{projectKey}/types/key={key} -i \
--header "Authorization: Bearer ${BEARER_TOKEN}"
Check if Type exists by Query Predicate
Checks if a Type exists for a given Query Predicate. Returns a 200 OK
status if any Types match the Query Predicate or a 404 Not Found
otherwise.
view_types:{projectKey}
region String ​ | Region in which the Project is hosted. |
projectKey String ​ |
|
where |
curl --head https://api.{region}.commercetools.com/{projectKey}/types -i \
--header "Authorization: Bearer ${BEARER_TOKEN}"
Create Type
manage_types:{projectKey}
region String ​ | Region in which the Project is hosted. |
projectKey String ​ |
|
expand | The parameter can be passed multiple times. |
application/json
application/json
curl https://api.{region}.commercetools.com/{projectKey}/types -i \
--header "Authorization: Bearer ${BEARER_TOKEN}" \
--header 'Content-Type: application/json' \
--data-binary @- << DATA
{
"key" : "line-item-string-field",
"name" : {
"en" : "String Custom Field on Line Items"
},
"description" : {
"en" : "This adds a Custom Field on Line Items, which can hold any string value."
},
"resourceTypeIds" : [ "line-item" ],
"fieldDefinitions" : [ {
"name" : "exampleStringField",
"label" : {
"en" : "Example string field."
},
"required" : false,
"type" : {
"name" : "String"
},
"inputHint" : "SingleLine"
} ]
}
DATA
{
"id": "ff8b0f8c-78c8-4c4c-a4b7-2545d9279515",
"version": 1,
"key": "line-item-string-field",
"name": {
"en": "String Custom Field on Line Items"
},
"description": {
"en": "This adds a Custom Field on Line Items, which can hold any string value."
},
"resourceTypeIds": ["line-item"],
"fieldDefinitions": [
{
"name": "exampleStringField",
"label": {
"en": "Example string field."
},
"required": false,
"type": {
"name": "String"
},
"inputHint": "SingleLine"
}
],
"createdAt": "2023-10-07T06:56:19.217Z",
"lastModifiedAt": "2023-10-07T06:56:19.217Z"
}
Update Type
Update Type by ID
manage_types:{projectKey}
region String ​ | Region in which the Project is hosted. |
projectKey String ​ |
|
id String ​ |
|
expand | The parameter can be passed multiple times. |
application/json
application/json
curl https://api.{region}.commercetools.com/{projectKey}/types/{id} -i \
--header "Authorization: Bearer ${BEARER_TOKEN}" \
--header 'Content-Type: application/json' \
--data-binary @- << DATA
{
"version" : 1,
"actions" : [ {
"action" : "changeName",
"name" : {
"en" : "New Name"
}
} ]
}
DATA
{
"id": "ff8b0f8c-78c8-4c4c-a4b7-2545d9279515",
"version": 2,
"key": "line-item-string-field",
"name": {
"en": "New Name"
},
"description": {
"en": "This adds a Custom Field on Line Items, which can hold any string value."
},
"resourceTypeIds": ["line-item"],
"fieldDefinitions": [
{
"name": "exampleStringField",
"label": {
"en": "Example string field."
},
"required": false,
"type": {
"name": "String"
},
"inputHint": "SingleLine"
}
],
"createdAt": "2023-10-07T06:56:19.217Z",
"lastModifiedAt": "2024-08-06T13:49:48.511Z"
}
Update Type by Key
manage_types:{projectKey}
region String ​ | Region in which the Project is hosted. |
projectKey String ​ |
|
key String ​ |
|
expand | The parameter can be passed multiple times. |
application/json
application/json
curl https://api.{region}.commercetools.com/{projectKey}/types/key={key} -i \
--header "Authorization: Bearer ${BEARER_TOKEN}" \
--header 'Content-Type: application/json' \
--data-binary @- << DATA
{
"version" : 1,
"actions" : [ {
"action" : "changeName",
"name" : {
"en" : "New Name"
}
} ]
}
DATA
{
"id": "ff8b0f8c-78c8-4c4c-a4b7-2545d9279515",
"version": 2,
"key": "line-item-string-field",
"name": {
"en": "New Name"
},
"description": {
"en": "This adds a Custom Field on Line Items, which can hold any string value."
},
"resourceTypeIds": ["line-item"],
"fieldDefinitions": [
{
"name": "exampleStringField",
"label": {
"en": "Example string field."
},
"required": false,
"type": {
"name": "String"
},
"inputHint": "SingleLine"
}
],
"createdAt": "2023-10-07T06:56:19.217Z",
"lastModifiedAt": "2024-08-06T13:49:48.511Z"
}
Update actions
Change Key
action ​String​ | "changeKey" |
key ​String​ | New value to set. Must not be empty. MinLength:2 ​MaxLength: 256 ​Pattern: ^[A-Za-z0-9_-]+$ ​ |
{
"action": "changeKey",
"key": "NewKey"
}
Change Name
action ​String​ | "changeName" |
name ​ | New value to set. Must not be empty. |
{
"action": "changeName",
"name": {
"en": "NameDE",
"de": "NameEN"
}
}
Set Description
action ​String​ | "setDescription" |
description ​ | Value to set. If empty, any existing value will be removed. |
{
"action": "setDescription",
"description": {
"de": "DescriptionDE",
"en": "DescriptionEN"
}
}
Add FieldDefinition
Defines a new field for a Type. Adding new required fields to a Type that is already referenced by existing entities can put those entities in a temporarily inconsistent state.
If a Type that is already in use requires new fields, we recommend making them optional (required
set to false
) whenever possible. Alternatively, any new required fields should be added one at a time followed by an update to all the resources using the Type. This prevents validation errors caused by an entity missing more than one required custom field.
action ​String​ | "addFieldDefinition" |
fieldDefinition ​ | Value to append to the array. |
{
"action": "addFieldDefinition",
"fieldDefinition": {
"type": {
"name": "LocalizedString"
},
"name": "fieldDefinitionName",
"label": {
"de": "labelDE",
"en": "labelEN"
},
"required": false,
"inputHint": "MultiLine"
}
}
Remove FieldDefinition
action ​String​ | "removeFieldDefinition" |
fieldName ​String​ |
|
{
"action": "removeFieldDefinition",
"fieldName": "fieldDefinitionName"
}
Change FieldDefinition Label
action ​String​ | "changeLabel" |
fieldName ​String​ | Name of the Field Definition to update. |
label ​ | New value to set. Must not be empty. |
{
"action": "changeLabel",
"fieldName": "exampleStringField",
"label": {
"de": "NewLabelDE",
"en": "NewLabelEN"
}
}
Add EnumValue to FieldDefinition
action ​String​ | "addEnumValue" |
fieldName ​String​ |
|
value ​ | Value to append to the array. |
{
"action": "addEnumValue",
"fieldName": "exampleEnumField",
"value": {
"key": "NewENumKey",
"label": "NewENumLabel"
}
}
Add LocalizedEnumValue to FieldDefinition
Adds a value to a LocalizedEnumType. This update action can be used to update a LocalizedEnumType FieldDefinition and a SetType FieldDefinition of CustomFieldLocalizedEnumType.
action ​String​ | "addLocalizedEnumValue" |
fieldName ​String​ |
|
value ​ | Value to append to the array. |
{
"action": "addLocalizedEnumValue",
"fieldName": "exampleLocalizedEnumField",
"value": {
"key": "NewLocalizedEnumKeyString",
"label": {
"en": "NewLocalizedEnumLabelEN",
"de": "NewLocalizedEnumLabelDE"
}
}
}
Change the order of FieldDefinitions
action ​String​ | "changeFieldDefinitionOrder" |
fieldNames ​Array of String​ | Must match the set of |
{
"action": "changeFieldDefinitionOrder",
"fieldNames": [
"exampleEnumField",
"exampleLocalizedEnumField",
"exampleStringField"
]
}
Change the order of EnumValues
Changes the order of EnumValues in an EnumType FieldDefinition. This update action can be used to update an EnumType FieldDefinition and a SetType FieldDefinition of EnumType.
action ​String​ | "changeEnumValueOrder" |
fieldName ​String​ |
|
keys ​Array of String​ | Must match the set of |
{
"action": "changeEnumValueOrder",
"fieldName": "exampleEnumField",
"keys": [
"enum3",
"enum4",
"enum2",
"enum1"
]
}
Change the order of LocalizedEnumValues
Changes the order of LocalizedEnumValues in a LocalizedEnumType FieldDefinition. This update action can be used to update a LocalizedEnumType FieldDefinition and a SetType of LocalizedEnumType FieldDefinitions.
action ​String​ | "changeLocalizedEnumValueOrder" |
fieldName ​String​ |
|
keys ​Array of String​ | Must match the set of |
{
"action": "changeLocalizedEnumValueOrder",
"fieldName": "exampleLocalizedEnumField",
"keys": [
"lenum3",
"lenum4",
"lenum2",
"lenum1"
]
}
Change InputHint
Changes the inputHint
of CustomFieldStringType FieldDefinition, a CustomFieldLocalizedStringType FieldDefinition, and CustomFieldSetType FieldDefinition of these string-based FieldTypes.
action ​String​ | "changeInputHint" |
fieldName ​String​ |
|
inputHint ​ | New value to set. Must not be empty. |
{
"action": "changeInputHint",
"fieldName": "exampleBooleanField",
"inputHint": "MultiLine"
}
Change EnumValue Label
action ​String​ | "changeEnumValueLabel" |
fieldName ​String​ |
|
value ​ | New value to set. Must not be empty. |
{
"action": "changeEnumValueLabel",
"fieldName": "exampleEnumField",
"value": {
"key": "NewENumKey",
"label": "New value"
}
}
Change LocalizedEnumValue Label
Changes the label
of a LocalizedEnumValue of a LocalizedEnumType FieldDefinition.
action ​String​ | "changeLocalizedEnumValueLabel" |
fieldName ​String​ |
|
value ​ | New value to set. Must not be empty. |
{
"action": "changeLocalizedEnumValueLabel",
"fieldName": "exampleLocalizedEnumField",
"value": {
"key": "NewLocalizedEnumKeyString",
"label": {
"en": "NewLocalizedEnumLabelEN",
"de": "NewLocalizedEnumLabelDE"
}
}
}
Delete Type
These requests delete Types only if they are not referenced by other entities.
Delete Type by ID
manage_types:{projectKey}
region String ​ | Region in which the Project is hosted. |
projectKey String ​ |
|
id String ​ |
|
version Int ​ | Last seen version of the resource. |
expand | The parameter can be passed multiple times. |
application/json
curl -X DELETE https://api.{region}.commercetools.com/{projectKey}/types/{id}?version={version} -i \
--header "Authorization: Bearer ${BEARER_TOKEN}"
{
"id": "ff8b0f8c-78c8-4c4c-a4b7-2545d9279515",
"version": 1,
"key": "line-item-string-field",
"name": {
"en": "String Custom Field on Line Items"
},
"description": {
"en": "This adds a Custom Field on Line Items, which can hold any string value."
},
"resourceTypeIds": ["line-item"],
"fieldDefinitions": [
{
"name": "exampleStringField",
"label": {
"en": "Example string field."
},
"required": false,
"type": {
"name": "String"
},
"inputHint": "SingleLine"
}
],
"createdAt": "2023-10-07T06:56:19.217Z",
"lastModifiedAt": "2023-10-07T06:56:19.217Z"
}
Delete Type by Key
manage_types:{projectKey}
region String ​ | Region in which the Project is hosted. |
projectKey String ​ |
|
key String ​ |
|
version Int ​ | Last seen version of the resource. |
expand | The parameter can be passed multiple times. |
application/json
curl -X DELETE https://api.{region}.commercetools.com/{projectKey}/types/key={key}?version={version} -i \
--header "Authorization: Bearer ${BEARER_TOKEN}"
{
"id": "ff8b0f8c-78c8-4c4c-a4b7-2545d9279515",
"version": 1,
"key": "line-item-string-field",
"name": {
"en": "String Custom Field on Line Items"
},
"description": {
"en": "This adds a Custom Field on Line Items, which can hold any string value."
},
"resourceTypeIds": ["line-item"],
"fieldDefinitions": [
{
"name": "exampleStringField",
"label": {
"en": "Example string field."
},
"required": false,
"type": {
"name": "String"
},
"inputHint": "SingleLine"
}
],
"createdAt": "2023-10-07T06:56:19.217Z",
"lastModifiedAt": "2023-10-07T06:56:19.217Z"
}