> ## Documentation Index
> Fetch the complete documentation index at: https://docs.open-metadata.org/llms.txt
> Use this file to discover all available pages before exploring further.

# Create a Container

> Create a new container within a storage service

# Create a Container

Create a new container within a storage service.

## Body Parameters

<ParamField body="name" type="string" required>
  Name of the container. Must be unique within the parent storage service or parent container.
</ParamField>

<ParamField body="service" type="string" required>
  Fully qualified name of the parent StorageService (e.g., `s3_datalake`).
</ParamField>

<ParamField body="displayName" type="string">
  Human-readable display name for the container.
</ParamField>

<ParamField body="description" type="string">
  Description of the container in Markdown format.
</ParamField>

<ParamField body="parent" type="object">
  Reference to a parent container for nested containers.

  <Expandable title="properties">
    <ParamField body="id" type="string">
      UUID of the parent container.
    </ParamField>

    <ParamField body="type" type="string">
      Type of entity (always `container`).
    </ParamField>
  </Expandable>
</ParamField>

<ParamField body="prefix" type="string">
  Path prefix for objects in the container (e.g., `/raw/events/`).
</ParamField>

<ParamField body="numberOfObjects" type="number">
  Number of objects stored in the container.
</ParamField>

<ParamField body="size" type="number">
  Total size of the container in bytes.
</ParamField>

<ParamField body="fileFormats" type="array">
  List of file formats stored in the container (e.g., `csv`, `tsv`, `parquet`, `avro`, `json`, `jsonl`, `jsonGz`, `jsonZip`).
</ParamField>

<ParamField body="dataModel" type="object">
  Data model describing the schema of files in the container.

  <Expandable title="properties">
    <ParamField body="isPartitioned" type="boolean">
      Whether the data is partitioned.
    </ParamField>

    <ParamField body="columns" type="array">
      Array of column definitions for the data model.

      <Expandable title="properties">
        <ParamField body="name" type="string" required>
          Column name.
        </ParamField>

        <ParamField body="dataType" type="string" required>
          Data type (e.g., `STRING`, `INT`, `DOUBLE`, `TIMESTAMP`).
        </ParamField>

        <ParamField body="description" type="string">
          Description of the column.
        </ParamField>
      </Expandable>
    </ParamField>
  </Expandable>
</ParamField>

<ParamField body="fullPath" type="string">
  Full path of the container (e.g., `s3://analytics-bucket/raw/events`).
</ParamField>

<ParamField body="owners" type="array">
  Array of owner references (users or teams) to assign to the container.

  <Expandable title="properties">
    <ParamField body="id" type="string">
      UUID of the owner entity.
    </ParamField>

    <ParamField body="type" type="string">
      Type of owner entity (e.g., `user`, `team`).
    </ParamField>

    <ParamField body="name" type="string">
      Name of the owner entity.
    </ParamField>
  </Expandable>
</ParamField>

<ParamField body="domain" type="string">
  Fully qualified name of the domain to assign for governance purposes.
</ParamField>

<ParamField body="tags" type="array">
  Array of classification tags to apply to the container.

  <Expandable title="properties">
    <ParamField body="tagFQN" type="string" required>
      Fully qualified name of the tag.
    </ParamField>

    <ParamField body="labelType" type="string">
      Type of label (e.g., `Manual`, `Derived`, `Propagated`).
    </ParamField>

    <ParamField body="state" type="string">
      State of the tag (e.g., `Suggested`, `Confirmed`).
    </ParamField>
  </Expandable>
</ParamField>

<ParamField body="extension" type="object">
  Custom property values defined by your organization's metadata schema.
</ParamField>

<RequestExample dropdown>
  ```python POST /v1/containers theme={null}
  from metadata.sdk import configure
  from metadata.sdk.entities import Containers
  from metadata.generated.schema.api.data.createContainer import CreateContainerRequest

  configure(
      host="https://your-company.open-metadata.org/api",
      jwt_token="your-jwt-token"
  )

  request = CreateContainerRequest(
      name="analytics-bucket",
      displayName="Analytics Bucket",
      service="s3_datalake",
      description="Primary analytics data lake bucket",
      prefix="/analytics/",
      numberOfObjects=150000,
      size=5368709120,
      fileFormats=["parquet", "json"],
      dataModel={
          "isPartitioned": True,
          "columns": [
              {"name": "event_id", "dataType": "STRING", "description": "Unique event identifier"},
              {"name": "timestamp", "dataType": "TIMESTAMP", "description": "Event timestamp"},
              {"name": "user_id", "dataType": "STRING", "description": "User identifier"}
          ]
      },
      fullPath="s3://analytics-bucket"
  )

  container = Containers.create(request)
  print(f"Created: {container.fullyQualifiedName}")
  ```

  ```java POST /v1/containers theme={null}
  import static org.openmetadata.sdk.fluent.Containers.*;

  // Create using builder pattern
  var container = Containers.builder()
      .name("analytics-bucket")
      .displayName("Analytics Bucket")
      .service("s3_datalake")
      .description("Primary analytics data lake bucket")
      .prefix("/analytics/")
      .numberOfObjects(150000)
      .size(5368709120L)
      .fileFormats("parquet", "json")
      .create();
  ```

  ```bash POST /v1/containers theme={null}
  curl -X POST "{base_url}/api/v1/containers" \
    -H "Authorization: Bearer {access_token}" \
    -H "Content-Type: application/json" \
    -d '{
      "name": "analytics-bucket",
      "displayName": "Analytics Bucket",
      "service": "s3_datalake",
      "description": "Primary analytics data lake bucket",
      "prefix": "/analytics/",
      "numberOfObjects": 150000,
      "size": 5368709120,
      "fileFormats": ["parquet", "json"],
      "dataModel": {
        "isPartitioned": true,
        "columns": [
          {"name": "event_id", "dataType": "STRING", "description": "Unique event identifier"},
          {"name": "timestamp", "dataType": "TIMESTAMP", "description": "Event timestamp"},
          {"name": "user_id", "dataType": "STRING", "description": "User identifier"}
        ]
      },
      "fullPath": "s3://analytics-bucket"
    }'
  ```
</RequestExample>

<ResponseExample>
  ```json Response theme={null}
  {
    "id": "14744329-85c2-499e-b1fa-249fb8162341",
    "name": "analytics-bucket",
    "displayName": "Analytics Bucket",
    "fullyQualifiedName": "s3_datalake.analytics-bucket",
    "description": "Primary analytics data lake bucket",
    "version": 0.1,
    "updatedAt": 1769982673032,
    "updatedBy": "admin",
    "service": {
      "id": "d1589e1d-2ab0-431c-a383-15e4be20a106",
      "type": "storageService",
      "name": "s3_datalake",
      "fullyQualifiedName": "s3_datalake",
      "deleted": false
    },
    "serviceType": "S3",
    "prefix": "/analytics/",
    "numberOfObjects": 150000,
    "size": 5368709120,
    "fileFormats": ["parquet", "json"],
    "dataModel": {
      "isPartitioned": true,
      "columns": [
        {"name": "event_id", "dataType": "STRING", "description": "Unique event identifier"},
        {"name": "timestamp", "dataType": "TIMESTAMP", "description": "Event timestamp"},
        {"name": "user_id", "dataType": "STRING", "description": "User identifier"}
      ]
    },
    "fullPath": "s3://analytics-bucket",
    "href": "http://localhost:8585/api/v1/containers/14744329-85c2-499e-b1fa-249fb8162341",
    "deleted": false,
    "owners": [],
    "tags": [],
    "followers": [],
    "votes": {
      "upVotes": 0,
      "downVotes": 0
    },
    "domains": []
  }
  ```
</ResponseExample>

***

## Returns

Returns the created container object with all specified properties and system-generated fields.

## Response

<ResponseField name="id" type="string">
  Unique identifier for the container (UUID format).
</ResponseField>

<ResponseField name="name" type="string">
  Container name.
</ResponseField>

<ResponseField name="fullyQualifiedName" type="string">
  Fully qualified name in format `service.containerName`.
</ResponseField>

<ResponseField name="displayName" type="string">
  Human-readable display name.
</ResponseField>

<ResponseField name="description" type="string">
  Description of the container in Markdown format.
</ResponseField>

<ResponseField name="service" type="object">
  Reference to the parent storage service.

  <Expandable title="properties">
    <ResponseField name="id" type="string">
      UUID of the storage service.
    </ResponseField>

    <ResponseField name="type" type="string">
      Type of entity (always `storageService`).
    </ResponseField>

    <ResponseField name="name" type="string">
      Name of the storage service.
    </ResponseField>

    <ResponseField name="fullyQualifiedName" type="string">
      Fully qualified name of the storage service.
    </ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="serviceType" type="string">
  Type of storage service (e.g., S3, GCS, ADLS, CustomStorage).
</ResponseField>

<ResponseField name="prefix" type="string" optional>
  Path prefix for objects in the container.
</ResponseField>

<ResponseField name="numberOfObjects" type="number" optional>
  Number of objects stored in the container.
</ResponseField>

<ResponseField name="size" type="number" optional>
  Total size of the container in bytes.
</ResponseField>

<ResponseField name="fileFormats" type="array" optional>
  List of file formats stored in the container.
</ResponseField>

<ResponseField name="dataModel" type="object" optional>
  Data model describing the schema of files.

  <Expandable title="properties">
    <ResponseField name="isPartitioned" type="boolean">
      Whether the data is partitioned.
    </ResponseField>

    <ResponseField name="columns" type="array">
      Array of column definitions.
    </ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="fullPath" type="string" optional>
  Full path of the container.
</ResponseField>

<ResponseField name="owners" type="array" optional>
  List of owners assigned to the container.

  <Expandable title="properties">
    <ResponseField name="id" type="string">
      UUID of the owner entity.
    </ResponseField>

    <ResponseField name="type" type="string">
      Type of owner entity (e.g., `user`, `team`).
    </ResponseField>

    <ResponseField name="name" type="string">
      Name of the owner entity.
    </ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="domains" type="array" optional>
  Domain assignments for governance.
</ResponseField>

<ResponseField name="tags" type="array" optional>
  Classification tags applied to the container.

  <Expandable title="properties">
    <ResponseField name="tagFQN" type="string">
      Fully qualified name of the tag.
    </ResponseField>

    <ResponseField name="labelType" type="string">
      Type of label (e.g., `Manual`, `Derived`, `Propagated`).
    </ResponseField>

    <ResponseField name="state" type="string">
      State of the tag (e.g., `Suggested`, `Confirmed`).
    </ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="extension" type="object" optional>
  Custom property values defined by your organization's metadata schema.
</ResponseField>

<ResponseField name="version" type="number">
  Version number for the entity (starts at 0.1).
</ResponseField>

***

## Create or Update (PUT)

Use `PUT /v1/containers` instead of `POST` to perform an upsert. If a container with the same `fullyQualifiedName` already exists, it will be updated; otherwise, a new container is created. The request body is the same as `POST`.

```bash theme={null}
curl -X PUT "{base_url}/api/v1/containers" \
  -H "Authorization: Bearer {access_token}" \
  -H "Content-Type: application/json" \
  -d '{ ... same body as POST ... }'
```

<Note>
  `PUT` will not return a `409` conflict error if the entity already exists -- it will update the existing entity instead.
</Note>

***

## Bulk Create or Update (PUT)

Use `PUT /v1/containers/bulk` to create or update multiple containers in a single request. The request body is an array of create request objects.

```bash theme={null}
curl -X PUT "{base_url}/api/v1/containers/bulk" \
  -H "Authorization: Bearer {access_token}" \
  -H "Content-Type: application/json" \
  -d '[
    { "name": "analytics-bucket", "service": "s3_datalake" },
    { "name": "raw-data-bucket", "service": "s3_datalake" }
  ]'
```

***

## Error Handling

| Code  | Error Type              | Description                                                    |
| ----- | ----------------------- | -------------------------------------------------------------- |
| `400` | `BAD_REQUEST`           | Invalid request body or missing required fields                |
| `401` | `UNAUTHORIZED`          | Invalid or missing authentication token                        |
| `403` | `FORBIDDEN`             | User lacks permission to create containers                     |
| `409` | `ENTITY_ALREADY_EXISTS` | Container with same name already exists in service (POST only) |
