> ## 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 Table

> Create a new table within a database schema

# Create a Table

Create a new table within a database schema.

## Body Parameters

**name** `string` *required*

Name of the table. Must be unique within the parent schema.

**databaseSchema** `string` *required*

Fully qualified name of the parent DatabaseSchema, for example `snowflake_prod.analytics.public`.

**columns** `array` *required*

Array of column definitions for the table.

**properties**

**name** `string` *required*

Name of the column.

**dataType** `string` *required*

Data type of the column, for example `INT`, `VARCHAR`, `TIMESTAMP`, `BOOLEAN`, `ARRAY`, `MAP`.

**description** `string`

Description of the column in Markdown format.

**dataLength** `integer`

Length of the data type, for example `256` for `VARCHAR(256`).

**constraint** `string`

Column constraint: `PRIMARY_KEY`, `UNIQUE`, `NOT_NULL`, `NULL`.

**tags** `array`

Classification tags to apply to this column.

**displayName** `string`

Human-readable display name for the table.

**description** `string`

Description of the table in Markdown format.

**tableType** `string`

Type of table: `Regular`, `External`, `Dynamic`, `View`, `SecureView`, `MaterializedView`, `Iceberg`, `DeltaLake`, `Local`, `Partitioned`, `Foreign`, `Transient`, `Stream`, `Stage`, `SemanticView`.

**retentionPeriod** `string`

Data retention period in ISO 8601 duration format, for example `P365D`.

**certification** `object`

Certification to set when the table is created. Ingestion connectors can send it in the same request instead of a follow-up patch to `/certification`.
When a bot sends a `PUT` with an explicit `certification`, the value is applied. A bot `PUT` that omits it keeps the stored certification.

**properties**

**tagLabel** `object` *required*

Certification tag, for example `{"tagFQN": "Certification.Gold"}`.

**owners** `array`

Array of owner references (users or teams) to assign to the table.

**properties**

**id** `string`

UUID of the owner entity.

**type** `string`

Type of owner entity, for example `user`, `team`.

**name** `string`

Name of the owner entity.

**domains** `array`

Fully qualified names of the domains to assign for governance purposes.

**tags** `array`

Array of classification tags to apply to the table.

**properties**

**tagFQN** `string` *required*

Fully qualified name of the tag.

**labelType** `string`

Type of label, for example `Manual`, `Derived`, `Propagated`.

**state** `string`

State of the tag, for example `Suggested`, `Confirmed`.

```python POST /v1/tables theme={null}
from metadata.sdk import configure
from metadata.sdk.entities import Tables
from metadata.generated.schema.api.data.createTable import CreateTableRequest

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

request = CreateTableRequest(
    name="customers",
    displayName="Customers",
    databaseSchema="snowflake_prod.analytics.public",
    description="Customer master data table",
    tableType="Regular",
    columns=[
        {"name": "id", "dataType": "INT", "constraint": "PRIMARY_KEY", "description": "Unique customer identifier"},
        {"name": "name", "dataType": "VARCHAR", "dataLength": 256, "description": "Full name of the customer"},
        {"name": "email", "dataType": "VARCHAR", "dataLength": 256, "description": "Customer email address"},
        {"name": "created_at", "dataType": "TIMESTAMP", "description": "Account creation timestamp"}
    ]
)

table = Tables.create(request)
print(f"Created: {table.fullyQualifiedName.root}")
```

```java POST /v1/tables theme={null}
import org.openmetadata.schema.entity.data.Table;
import org.openmetadata.sdk.fluent.builders.ColumnBuilder;
import org.openmetadata.sdk.fluent.builders.TableBuilder;

Table table = new TableBuilder(client)
    .name("customers")
    .schemaFQN("snowflake_prod.analytics.public")
    .columns(
        ColumnBuilder.integer("id").primaryKey(),
        ColumnBuilder.varchar("name", 256),
        ColumnBuilder.varchar("email", 256),
        ColumnBuilder.timestamp("created_at")
    )
    .create();
```

```bash POST /v1/tables theme={null}
curl -X POST "{base_url}/api/v1/tables" \
  -H "Authorization: Bearer {access_token}" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "agent_performance_summary",
    "databaseSchema": "sample_data.ecommerce_db.shopify",
    "description": "Summary of agent performance metrics derived from multiple tables including ssot_utilization_detail for comprehensive reporting.",
    "tableType": "Regular",
    "columns": [
      {"name": "agent_id", "dataType": "VARCHAR", "dataLength": 100, "description": "Agent identifier"},
      {"name": "performance_score", "dataType": "DECIMAL", "description": "Overall performance score"}
    ]
  }'
```

```json Response theme={null}
{
  "id": "455e3d9d-dbbf-455e-b3be-7191daa825f3",
  "name": "agent_performance_summary",
  "fullyQualifiedName": "sample_data.ecommerce_db.shopify.agent_performance_summary",
  "description": "Summary of agent performance metrics derived from multiple tables including ssot_utilization_detail for comprehensive reporting.",
  "version": 0.1,
  "updatedAt": 1769982651320,
  "updatedBy": "admin",
  "href": "http://localhost:8585/api/v1/tables/455e3d9d-dbbf-455e-b3be-7191daa825f3",
  "tableType": "Regular",
  "columns": [
    {
      "name": "agent_id",
      "dataType": "VARCHAR",
      "dataLength": 100,
      "dataTypeDisplay": "varchar",
      "description": "Agent identifier",
      "fullyQualifiedName": "sample_data.ecommerce_db.shopify.agent_performance_summary.agent_id",
      "tags": [],
      "ordinalPosition": 1
    },
    {
      "name": "performance_score",
      "dataType": "DECIMAL",
      "dataTypeDisplay": "decimal",
      "description": "Overall performance score",
      "fullyQualifiedName": "sample_data.ecommerce_db.shopify.agent_performance_summary.performance_score",
      "tags": [],
      "ordinalPosition": 2
    }
  ],
  "owners": [],
  "databaseSchema": {
    "id": "4dd30184-009c-4792-b296-9562eaed651f",
    "type": "databaseSchema",
    "name": "shopify",
    "fullyQualifiedName": "sample_data.ecommerce_db.shopify",
    "description": "This **mock** database contains schema related to shopify sales and orders with related dimension tables.",
    "displayName": "shopify",
    "deleted": false,
    "href": "http://localhost:8585/api/v1/databaseSchemas/4dd30184-009c-4792-b296-9562eaed651f"
  },
  "database": {
    "id": "0be090de-0941-48c4-af49-a6157c91cda0",
    "type": "database",
    "name": "ecommerce_db",
    "fullyQualifiedName": "sample_data.ecommerce_db",
    "description": "This **mock** database contains schemas related to shopify sales and orders with related dimension tables.",
    "displayName": "ecommerce_db",
    "deleted": false,
    "href": "http://localhost:8585/api/v1/databases/0be090de-0941-48c4-af49-a6157c91cda0"
  },
  "service": {
    "id": "fd2193af-fe09-4366-92b7-1e0d01cd8c09",
    "type": "databaseService",
    "name": "sample_data",
    "fullyQualifiedName": "sample_data",
    "displayName": "sample_data",
    "deleted": false,
    "href": "http://localhost:8585/api/v1/services/databaseServices/fd2193af-fe09-4366-92b7-1e0d01cd8c09"
  },
  "serviceType": "BigQuery",
  "tags": [],
  "deleted": false
}
```

***

## Returns

Returns the created table object with all specified properties, system-generated fields, and fully qualified names for each column.

## Response

**id** `string`

Unique identifier for the table (UUID format).

**name** `string`

Table name.

**fullyQualifiedName** `string`

Fully qualified name in format `service.database.schema.table`.

**displayName** `string`

Human-readable display name.

**description** `string`

Description of the table in Markdown format.

**tableType** `string`

Type of table, for example `Regular`, `View`, `MaterializedView`.

**columns** `array`

Array of column definitions.

**properties**

**name** `string`

Column name.

**dataType** `string`

Data type of the column.

**fullyQualifiedName** `string`

Fully qualified name of the column.

**description** `string`

Column description.

**constraint** `string`

Column constraint if set.

**databaseSchema** `object`

Reference to the parent database schema.

**service** `object`

Reference to the parent database service.

**serviceType** `string`

Type of database service, for example Snowflake, BigQuery, PostgreSQL.

**version** `number`

Version number for the entity (starts at 0.1).

**createdAt** `integer`

Time the table was created in OpenMetadata, in Unix epoch milliseconds. Set by the server and kept on later updates.

**createdBy** `string`

User or bot that created the table in OpenMetadata. Set by the server. The same two fields are on chart, container, dashboard, dashboard data model, database, database schema, metric, machine learning (ML) model, pipeline, query, topic, role, team, and user.

***

## Create or Update (PUT)

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

```bash theme={null}
curl -X PUT "{base_url}/api/v1/tables" \
  -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.

***

## Bulk Create or Update (PUT)

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

```bash theme={null}
curl -X PUT "{base_url}/api/v1/tables/bulk" \
  -H "Authorization: Bearer {access_token}" \
  -H "Content-Type: application/json" \
  -d '[
    { "name": "table_one", "databaseSchema": "service.db.schema", "columns": [{"name": "id", "dataType": "INT"}] },
    { "name": "table_two", "databaseSchema": "service.db.schema", "columns": [{"name": "id", "dataType": "INT"}] }
  ]'
```

***

## Error Handling

| Code | Error Type | Description |
| - | - | - |
| `400` | `BAD_REQUEST` | Invalid request body, missing required fields, or invalid column definitions |
| `401` | `UNAUTHORIZED` | Invalid or missing authentication token |
| `403` | `FORBIDDEN` | User lacks permission to create tables |
| `409` | `ENTITY_ALREADY_EXISTS` | Table with same name already exists in schema (POST only) |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.