Skip to main content
POST
/
models
/
containers
Python SDK
from cognite.client.data_classes.data_modeling import ContainerApply, ContainerProperty, Text
container = [ContainerApply(space="mySpace", external_id="myContainer",
    properties={"name": ContainerProperty(type=Text, name="name")})]
res = client.data_modeling.containers.apply(container)

from cognite.client.data_classes.data_modeling import Float64
from cognite.client.data_classes.data_modeling.data_types import UnitReference
container = ContainerApply(
    space="mySpace",
    external_id="myContainer",
    properties={
        "maxPressure": ContainerProperty(
            nullable=True,
            description="Maximum Pump Pressure",
            name="maxPressure",
            type=Float64(
                unit=UnitReference(
                    external_id="pressure:bar",
                    source_unit="BAR"
                )
            )
        ),
        "rotationConfigurations": ContainerProperty(
            nullable=True,
            description="Rotation Configurations",
            name="rotationConfigurations",
            type=Float64(
                is_list=True,
                unit=UnitReference(
                    external_id="angular_velocity:rev-per-min"
                )
            )
        )
    }
)
res = client.data_modeling.containers.apply(container)

from cognite.client.data_classes.data_modeling.data_types import UnitReference, EnumValue
from cognite.client.data_classes.data_modeling.data_types import (
    Boolean, Date, DirectRelation, Enum, FileReference, Float32, Float64,
    Int32, Int64, Json, SequenceReference, Text, TimeSeriesReference, Timestamp
)
container_properties = {
    "prop01": ContainerProperty(Boolean),
    "prop02": ContainerProperty(Boolean(is_list=True)),
    "prop03": ContainerProperty(Date),
    "prop04": ContainerProperty(Date(is_list=True)),
    "prop05": ContainerProperty(Timestamp),
    "prop06": ContainerProperty(Timestamp(is_list=True)),
    "prop07": ContainerProperty(Text),
    "prop08": ContainerProperty(Text(is_list=True)),
    # Note: DirectRelation(list) support `container`: The (optional) required type for the node
    #       the direct relation points to.
    "prop09": ContainerProperty(DirectRelation),
    "prop10": ContainerProperty(DirectRelation(is_list=True)),
    # Note: Enum also support `unknown_value`: The value to use when the enum value is unknown.
    "prop11": ContainerProperty(
        Enum({"Closed": EnumValue("Valve is closed"),
              "Opened": EnumValue("Valve is opened")})),
    # Note: Floats support unit references, e.g. `unit=UnitReference("pressure:bar")`:
    "prop12": ContainerProperty(Float32),
    "prop13": ContainerProperty(Float32(is_list=True)),
    "prop14": ContainerProperty(Float64),
    "prop15": ContainerProperty(Float64(is_list=True)),
    "prop16": ContainerProperty(Int32),
    "prop17": ContainerProperty(Int32(is_list=True)),
    "prop18": ContainerProperty(Int64),
    "prop19": ContainerProperty(Int64(is_list=True)),
    "prop20": ContainerProperty(Json),
    "prop21": ContainerProperty(Json(is_list=True)),
    "prop22": ContainerProperty(SequenceReference),
    "prop23": ContainerProperty(SequenceReference(is_list=True)),
    # Note: It is adviced to represent files and time series directly as nodes
    #       instead of referencing existing:
    "prop24": ContainerProperty(FileReference),
    "prop25": ContainerProperty(FileReference(is_list=True)),
    "prop26": ContainerProperty(TimeSeriesReference),
    "prop27": ContainerProperty(TimeSeriesReference(is_list=True)),
}
container = ContainerApply(
    space="my-space",
    external_id="my-everything-container",
    properties=container_properties,
)
{
  "items": [
    {
      "space": "<string>",
      "externalId": "<string>",
      "usedFor": "node",
      "createdTime": 1730204346000,
      "lastUpdatedTime": 1730204346000,
      "isGlobal": true,
      "properties": {},
      "name": "<string>",
      "description": "<string>",
      "constraints": {},
      "indexes": {}
    }
  ]
}

Authorizations

Authorization
string
header
required

Access token issued by the CDF project's configured identity provider. Access token must be an OpenID Connect token, and the project must be configured to accept OpenID Connect tokens. Use a header key of 'Authorization' with a value of 'Bearer $accesstoken'. The token can be obtained through any flow supported by the identity provider.

Body

application/json

Containers to add or update.

items
(Instance Container · object | Record Container · object)[]
required

List of containers to create/update

Required array length: 1 - 100 elements

Container for properties you can access through views. Container specifications give details about storage related details, such as how to index the data and what constraints should be present.

Response

List of containers

items
object[]
required

List of containers

Last modified on April 23, 2026