{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/amazon-s3/json-schema/amazon-s3-create-table-request-schema.json",
  "title": "CreateTableRequest",
  "x-generated": "2026-11-11",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/amazon-s3-tables-api-openapi.yml#/components/schemas/CreateTableRequest",
  "type": "object",
  "properties": {
    "tableBucketARN": {
      "type": "string",
      "description": "The Amazon Resource Name (ARN) of the table bucket to create the table in."
    },
    "namespace": {
      "type": "string",
      "description": "The namespace to associated with the table."
    },
    "name": {
      "type": "string",
      "description": "The name for the table."
    },
    "format": {
      "type": "string",
      "enum": [
        "ICEBERG"
      ],
      "description": "The format for the table."
    },
    "metadata": {
      "$ref": "#/$defs/TableMetadata"
    },
    "encryptionConfiguration": {
      "$ref": "#/$defs/S3TablesEncryptionConfiguration"
    },
    "storageClassConfiguration": {
      "$ref": "#/$defs/StorageClassConfiguration"
    },
    "tags": {
      "type": "object",
      "additionalProperties": {
        "type": "string"
      },
      "description": "A map of user-defined tags that you would like to apply to the table that you are creating. A tag is a key-value pair that you apply to your resources. Tags can help you organize, track costs for, and control access to resources. For more information, see Tagging for cost allocation or attribute-based access control (ABAC). You must have the s3tables:TagResource permission in addition to s3tables:CreateTable permission to create a table with tags."
    }
  },
  "required": [
    "tableBucketARN",
    "namespace",
    "name",
    "format"
  ],
  "$defs": {
    "IcebergMetadata": {
      "type": "object",
      "properties": {
        "schema": {
          "$ref": "#/$defs/IcebergSchema"
        },
        "schemaV2": {
          "$ref": "#/$defs/IcebergSchemaV2"
        },
        "partitionSpec": {
          "$ref": "#/$defs/IcebergPartitionSpec"
        },
        "writeOrder": {
          "$ref": "#/$defs/IcebergSortOrder"
        },
        "properties": {
          "type": "object",
          "additionalProperties": {
            "type": "string"
          },
          "description": "A map of custom configuration properties for the Iceberg table."
        }
      }
    },
    "IcebergPartitionField": {
      "type": "object",
      "properties": {
        "sourceId": {
          "type": "integer",
          "description": "The ID of the source schema field to partition by. This must reference a valid field ID from the table schema."
        },
        "transform": {
          "type": "string",
          "description": "The partition transform to apply to the source field. Supported transforms include identity, year, month, day, hour, bucket, and truncate. For more information, see the Apache Iceberg partition transforms documentation."
        },
        "name": {
          "type": "string",
          "description": "The name for this partition field. This name is used in the partitioned file paths."
        },
        "fieldId": {
          "type": "integer",
          "description": "An optional unique identifier for this partition field. If not specified, S3 Tables automatically assigns a field ID."
        }
      },
      "required": [
        "sourceId",
        "transform",
        "name"
      ]
    },
    "IcebergPartitionSpec": {
      "type": "object",
      "properties": {
        "fields": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/IcebergPartitionField"
          },
          "description": "The list of partition fields that define how the table data is partitioned. Each field specifies a source field and a transform to apply. This field is required if partitionSpec is provided."
        },
        "specId": {
          "type": "integer",
          "description": "The unique identifier for this partition specification. If not specified, defaults to 0."
        }
      },
      "required": [
        "fields"
      ]
    },
    "IcebergSchema": {
      "type": "object",
      "properties": {
        "fields": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/SchemaField"
          },
          "description": "The schema fields for the table"
        }
      },
      "required": [
        "fields"
      ]
    },
    "IcebergSchemaV2": {
      "type": "object",
      "properties": {
        "type": {
          "type": "string",
          "enum": [
            "struct"
          ],
          "description": "The type of the top-level schema, which is always a struct type as defined in the Apache Iceberg specification. This value must be struct."
        },
        "fields": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/SchemaV2Field"
          },
          "description": "The schema fields for the table. Each field defines a column in the table, including its name, type, and whether it is required."
        },
        "schemaId": {
          "type": "integer",
          "description": "An optional unique identifier for the schema. Schema IDs are used by Apache Iceberg to track schema evolution."
        },
        "identifierFieldIds": {
          "type": "array",
          "items": {
            "type": "integer"
          },
          "description": "A list of field IDs that are used as the identifier fields for the table. Identifier fields uniquely identify a row in the table."
        }
      },
      "required": [
        "type",
        "fields"
      ]
    },
    "IcebergSortField": {
      "type": "object",
      "properties": {
        "sourceId": {
          "type": "integer",
          "description": "The ID of the source schema field to sort by. This must reference a valid field ID from the table schema."
        },
        "transform": {
          "type": "string",
          "description": "The transform to apply to the source field before sorting. Use identity to sort by the field value directly, or specify other transforms as needed."
        },
        "direction": {
          "type": "string",
          "enum": [
            "asc",
            "desc"
          ],
          "description": "The sort direction. Valid values are asc for ascending order or desc for descending order."
        },
        "nullOrder": {
          "type": "string",
          "enum": [
            "nulls-first",
            "nulls-last"
          ],
          "description": "Specifies how null values are ordered. Valid values are nulls-first to place nulls before non-null values, or nulls-last to place nulls after non-null values."
        }
      },
      "required": [
        "sourceId",
        "transform",
        "direction",
        "nullOrder"
      ]
    },
    "IcebergSortOrder": {
      "type": "object",
      "properties": {
        "orderId": {
          "type": "integer",
          "description": "The unique identifier for this sort order. If not specified, defaults to 1. The order ID is used by Apache Iceberg to track sort order evolution."
        },
        "fields": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/IcebergSortField"
          },
          "description": "The list of sort fields that define how data is sorted within files. Each field specifies a source field, sort direction, and null ordering. This field is required if writeOrder is provided."
        }
      },
      "required": [
        "orderId",
        "fields"
      ]
    },
    "S3TablesEncryptionConfiguration": {
      "type": "object",
      "properties": {
        "sseAlgorithm": {
          "type": "string",
          "enum": [
            "AES256",
            "aws:kms"
          ],
          "description": "The server-side encryption algorithm to use. Valid values are AES256 for S3-managed encryption keys, or aws:kms for Amazon Web Services KMS-managed encryption keys. If you choose SSE-KMS encryption you must grant the S3 Tables maintenance principal access to your KMS key. For more information, see Permissions requirements for S3 Tables SSE-KMS encryption."
        },
        "kmsKeyArn": {
          "type": "string",
          "description": "The Amazon Resource Name (ARN) of the KMS key to use for encryption. This field is required only when sseAlgorithm is set to aws:kms."
        }
      },
      "required": [
        "sseAlgorithm"
      ]
    },
    "SchemaField": {
      "type": "object",
      "properties": {
        "id": {
          "type": "integer",
          "description": "An optional unique identifier for the schema field. Field IDs are used by Apache Iceberg to track schema evolution and maintain compatibility across schema changes. If not specified, S3 Tables automatically assigns field IDs."
        },
        "name": {
          "type": "string",
          "description": "The name of the field."
        },
        "type": {
          "type": "string",
          "description": "The field type. S3 Tables supports all Apache Iceberg primitive types. For more information, see the Apache Iceberg documentation."
        },
        "required": {
          "type": "boolean",
          "description": "A Boolean value that specifies whether values are required for each row in this field. By default, this is false and null values are allowed in the field. If this is true the field does not allow null values."
        }
      },
      "required": [
        "name",
        "type"
      ]
    },
    "SchemaV2Field": {
      "type": "object",
      "properties": {
        "id": {
          "type": "integer",
          "description": "The unique identifier for the schema field. Field IDs are used by Apache Iceberg to track schema evolution and maintain compatibility across schema changes."
        },
        "name": {
          "type": "string",
          "description": "The name of the field."
        },
        "type": {
          "type": "object",
          "description": "The data type of the field. This can be a primitive type string such as boolean, int, long, float, double, string, binary, date, timestamp, or timestamptz, or a complex type represented as a JSON object for nested types such as struct, list, or map. For more information, see the Apache Iceberg schemas and data types documentation."
        },
        "required": {
          "type": "boolean",
          "description": "A Boolean value that specifies whether values are required for each row in this field. If this is true, the field does not allow null values."
        },
        "doc": {
          "type": "string",
          "description": "An optional description of the field."
        }
      },
      "required": [
        "id",
        "name",
        "type",
        "required"
      ]
    },
    "StorageClassConfiguration": {
      "type": "object",
      "properties": {
        "storageClass": {
          "type": "string",
          "enum": [
            "STANDARD",
            "INTELLIGENT_TIERING"
          ],
          "description": "The storage class for the table or table bucket. Valid values include storage classes optimized for different access patterns and cost profiles."
        }
      },
      "required": [
        "storageClass"
      ]
    },
    "TableMetadata": {
      "type": "object",
      "properties": {
        "iceberg": {
          "$ref": "#/$defs/IcebergMetadata"
        }
      },
      "description": "Exactly one member is set."
    }
  }
}