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

# Update an existing table

> Update an existing HubDB table. You can use this endpoint to add or remove columns to the table as well as restore an archived table. Tables updated using the endpoint will only modify the draft verion of the table. Use the `/publish` endpoint to push all the changes to the published version. To restore a table, include the query parameter `archived=true` and `"archived": false` in the json body.
**Note:** You need to include all the columns in the input when you are adding/removing/updating a column. If you do not include an already existing column in the request, it will be deleted.

export const ScopesList = ({scopes = [], description = "この API には、次のいずれかのスコープが必要です。"}) => {
  if (!scopes || scopes.length === 0) {
    return null;
  }
  const sortedScopes = scopes.sort((a, b) => a.localeCompare(b));
  return <div>
      <div className="text-sm mb-2">{description}</div>
      <div>
        {sortedScopes.map((scope, index) => <div key={index}>
            <code>
              <span className="text-xs">{scope}</span>
            </code>
          </div>)}
      </div>
    </div>;
};

export const SupportedProducts = ({marketing, sales, service, cms, marketingLevel, salesLevel, serviceLevel, cmsLevel}) => {
  const translations = {
    header: "サポートされる製品",
    description: "次のいずれかの製品またはそれ以上が必要です。",
    productNames: {
      marketing: "Marketing Hub",
      sales: "Sales Hub",
      service: "Service Hub",
      cms: "Content Hub"
    },
    tiers: {
      free: "無料ツール",
      starter: "Starter",
      professional: "Professional",
      enterprise: "Enterprise"
    }
  };
  const translateTier = tier => {
    if (!tier) return '';
    const lowerTier = tier.toLowerCase();
    return translations.tiers[lowerTier] || tier;
  };
  const products = [{
    name: marketing ? translations.productNames.marketing : '',
    level: translateTier(marketingLevel),
    icon: "https://mintlify-assets.b-cdn.net/Icons/marketing-bolt.svg",
    alt: "Marketing Hub"
  }, {
    name: sales ? translations.productNames.sales : '',
    level: translateTier(salesLevel),
    icon: "https://mintlify-assets.b-cdn.net/Icons/sales-star.svg",
    alt: "Sales Hub"
  }, {
    name: service ? translations.productNames.service : '',
    level: translateTier(serviceLevel),
    icon: "https://mintlify-assets.b-cdn.net/Icons/service-heart.svg",
    alt: "Service Hub"
  }, {
    name: cms ? translations.productNames.cms : '',
    level: translateTier(cmsLevel),
    icon: "https://mintlify-assets.b-cdn.net/Icons/content-play.svg",
    alt: "Content Hub"
  }].filter(product => product.name && product.level);
  if (products.length === 0) return null;
  return <div>
      <div className="text-sm mb-2">{translations.description}</div>
      <div className={`grid ${products.length === 1 ? 'grid-cols-1' : 'grid-cols-2'} gap-1.5`}>
        {products.map((product, index) => <div key={index} style={{
    display: 'flex',
    alignItems: 'center'
  }}>
            <img src={product.icon} alt={product.alt} className="w-3.5 h-3.5 mr-1.5 mt-2.5 mb-2.5 flex-shrink-0 align-middle" />
            <span className="font-medium mr-1 text-sm">{product.name} -</span>
            <span className="text-sm">{product.level}</span>
          </div>)}
      </div>
    </div>;
};

<AccordionGroup>
  <Accordion title="Supported products" defaultOpen="true" icon="cubes">
    <SupportedProducts marketing={true} sales={true} service={true} cms={true} marketingLevel="PROFESSIONAL" salesLevel="FREE" serviceLevel="FREE" cmsLevel="PROFESSIONAL" />
  </Accordion>

  <Accordion title="Required Scopes" icon="key">
    <ScopesList
      scopes={[
  'hubdb'
]}
    />
  </Accordion>
</AccordionGroup>


## OpenAPI

````yaml specs/legacy/v3/cms-hubdb-v3.json PATCH /cms/v3/hubdb/tables/{tableIdOrName}/draft
openapi: 3.0.1
info:
  title: Hubdb
  description: Basepom for all HubSpot Projects
  version: v3
  x-hubspot-product-tier-requirements:
    marketing: PROFESSIONAL
    sales: FREE
    service: FREE
    cms: PROFESSIONAL
    commerce: FREE
    crmHub: FREE
    dataHub: FREE
servers:
  - url: https://api.hubapi.com
security: []
tags:
  - name: Rows
  - name: Tables
paths:
  /cms/v3/hubdb/tables/{tableIdOrName}/draft:
    patch:
      tags:
        - Tables
      summary: Update an existing table
      description: >-
        Update an existing HubDB table. You can use this endpoint to add or
        remove columns to the table as well as restore an archived table. Tables
        updated using the endpoint will only modify the draft verion of the
        table. Use the `/publish` endpoint to push all the changes to the
        published version. To restore a table, include the query parameter
        `archived=true` and `"archived": false` in the json body.

        **Note:** You need to include all the columns in the input when you are
        adding/removing/updating a column. If you do not include an already
        existing column in the request, it will be deleted.
      operationId: patch-/cms/v3/hubdb/tables/{tableIdOrName}/draft_updateDraftTable
      parameters:
        - name: tableIdOrName
          in: path
          description: ''
          required: true
          style: simple
          explode: false
          schema:
            type: string
        - name: archived
          in: query
          description: Whether to return only results that have been archived.
          required: false
          style: form
          explode: true
          schema:
            type: boolean
        - name: includeForeignIds
          in: query
          description: ''
          required: false
          style: form
          explode: true
          schema:
            type: boolean
        - name: isGetLocalizedSchema
          in: query
          description: ''
          required: false
          style: form
          explode: true
          schema:
            type: boolean
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/HubDbTableV3Request'
        required: true
      responses:
        '200':
          description: successful operation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HubDbTableV3'
        default:
          $ref: '#/components/responses/Error'
          description: ''
      security:
        - oauth2:
            - hubdb
        - oauth2:
            - hubdb.tables.write
components:
  schemas:
    HubDbTableV3Request:
      required:
        - allowChildTables
        - allowPublicApiAccess
        - columns
        - dynamicMetaTags
        - enableChildTablePages
        - label
        - name
        - useForPages
      type: object
      properties:
        allowChildTables:
          type: boolean
          description: Specifies whether child tables can be created
        allowPublicApiAccess:
          type: boolean
          description: >-
            Specifies whether the table can be read by public without
            authorization
        columns:
          type: array
          description: List of columns in the table
          items:
            $ref: '#/components/schemas/ColumnRequest'
        dynamicMetaTags:
          type: object
          additionalProperties:
            type: integer
            format: int32
          description: >-
            Specifies the key value pairs of the [metadata
            fields](https://developers.hubspot.com/docs/cms/guides/dynamic-pages/hubdb#dynamic-pages)
            with the associated column IDs.
        enableChildTablePages:
          type: boolean
          description: Specifies creation of multi-level dynamic pages using child tables
        label:
          type: string
          description: Label of the table
        name:
          type: string
          description: Name of the table
        useForPages:
          type: boolean
          description: >-
            Specifies whether the table can be used for creation of dynamic
            pages
    HubDbTableV3:
      required:
        - allowChildTables
        - allowPublicApiAccess
        - columnCount
        - columns
        - createdAt
        - deleted
        - deletedAt
        - dynamicMetaTags
        - enableChildTablePages
        - id
        - label
        - name
        - published
        - publishedAt
        - rowCount
        - updatedAt
        - useForPages
      type: object
      properties:
        allowChildTables:
          type: boolean
          description: Specifies whether child tables can be created
        allowPublicApiAccess:
          type: boolean
          description: >-
            Specifies whether the table can be read by public without
            authorization
        columnCount:
          type: integer
          description: Number of columns including deleted
          format: int64
        columns:
          type: array
          description: List of columns in the table
          items:
            $ref: '#/components/schemas/Column'
        createdAt:
          type: string
          description: Timestamp at which the table is created
          format: date-time
        createdBy:
          $ref: '#/components/schemas/SimpleUser'
        deleted:
          type: boolean
          description: Specifies whether the table is marked as deleted.
        deletedAt:
          type: string
          description: The timestamp indicating when the table was deleted.
          format: date-time
        dynamicMetaTags:
          type: object
          additionalProperties:
            type: integer
            format: int32
          description: >-
            Specifies the key value pairs of the [metadata
            fields](https://developers.hubspot.com/docs/cms/guides/dynamic-pages/hubdb#dynamic-pages)
            with the associated column IDs.
        enableChildTablePages:
          type: boolean
          description: Specifies creation of multi-level dynamic pages using child tables
        id:
          type: string
          description: Id of the table
        isOrderedManually:
          type: boolean
          description: Indicates whether the table rows are ordered manually.
        label:
          type: string
          description: Label of the table
        name:
          type: string
          description: Name of the table
        published:
          type: boolean
          description: Indicates whether the table is currently published.
        publishedAt:
          type: string
          description: Timestamp at which the table is published recently
          format: date-time
        rowCount:
          type: integer
          description: Number of rows in the table
          format: int32
        updatedAt:
          type: string
          description: Timestamp at which the table is updated recently
          format: date-time
        updatedBy:
          $ref: '#/components/schemas/SimpleUser'
        useForPages:
          type: boolean
          description: >-
            Specifies whether the table can be used for creation of dynamic
            pages
    ColumnRequest:
      required:
        - id
        - label
        - name
        - options
        - type
      type: object
      properties:
        foreignColumnId:
          type: integer
          description: >-
            The id of the column from another table to which the column
            refers/points to.
          format: int32
        foreignTableId:
          type: integer
          description: The id of another table to which the column refers/points to.
          format: int64
        id:
          type: integer
          description: Column Id
          format: int32
        label:
          type: string
          description: Label of the column
        maxNumberOfCharacters:
          type: integer
          description: Defines the maximum number of characters allowed in the column.
          format: int32
        maxNumberOfOptions:
          type: integer
          description: >-
            Specifies the maximum number of options that can be set for select
            and multi-select columns.
          format: int32
        name:
          type: string
          description: Name of the column
        options:
          type: array
          description: Options to choose for select and multi-select columns
          items:
            $ref: '#/components/schemas/Option'
        type:
          type: string
          description: Type of the column
          enum:
            - BOOLEAN
            - CODE
            - COMPOSITE
            - CTA
            - CURRENCY
            - DATE
            - DATETIME
            - EMBED
            - FILE
            - FOREIGN_ID
            - HUBSPOT_VIDEO
            - IMAGE
            - JSON
            - LOCATION
            - MULTISELECT
            - 'NULL'
            - NUMBER
            - RICHTEXT
            - SELECT
            - TEXT
            - URL
            - VIDEO
    Column:
      required:
        - deleted
        - description
        - id
        - label
        - name
        - type
      type: object
      properties:
        createdAt:
          type: string
          description: The timestamp when the column was created.
          format: date-time
        createdBy:
          $ref: '#/components/schemas/SimpleUser'
        createdByUserId:
          type: integer
          description: The ID of the user who created the column.
          format: int32
        deleted:
          type: boolean
          description: Indicates whether the column has been deleted.
        description:
          type: string
          description: The description of the column.
        foreignColumnId:
          type: integer
          description: Foreign Column id
          format: int32
        foreignIds:
          type: array
          description: Foreign Ids
          items:
            $ref: '#/components/schemas/ForeignId'
        foreignIdsById:
          type: object
          additionalProperties:
            $ref: '#/components/schemas/ForeignId'
          description: Foreign ids
        foreignIdsByName:
          type: object
          additionalProperties:
            $ref: '#/components/schemas/ForeignId'
          description: Foreign ids by name
        foreignTableId:
          type: integer
          description: Foreign table id referenced
          format: int64
        id:
          type: string
          description: Column Id
        label:
          type: string
          description: Label of the column
        name:
          type: string
          description: Name of the column
        optionCount:
          type: integer
          description: Number of options available
          format: int32
        options:
          type: array
          description: Options to choose for select and multi-select columns
          items:
            $ref: '#/components/schemas/Option'
        type:
          type: string
          description: Type of the column
          enum:
            - BOOLEAN
            - CODE
            - COMPOSITE
            - CTA
            - CURRENCY
            - DATE
            - DATETIME
            - EMBED
            - FILE
            - FOREIGN_ID
            - HUBSPOT_VIDEO
            - IMAGE
            - JSON
            - LOCATION
            - MULTISELECT
            - 'NULL'
            - NUMBER
            - RICHTEXT
            - SELECT
            - TEXT
            - URL
            - VIDEO
        updatedAt:
          type: string
          description: The timestamp when the column was last updated.
          format: date-time
        updatedBy:
          $ref: '#/components/schemas/SimpleUser'
        updatedByUserId:
          type: integer
          description: The ID of the user who last updated the column.
          format: int32
        width:
          type: integer
          description: Column width for HubDB UI
          format: int32
    SimpleUser:
      required:
        - email
        - firstName
        - id
        - lastName
      type: object
      properties:
        email:
          type: string
          description: The email address of the user.
        firstName:
          type: string
          description: The first name of the user.
        id:
          type: string
          description: The unique identifier for the user.
        lastName:
          type: string
          description: The last name of the user.
    Error:
      required:
        - category
        - correlationId
        - message
      type: object
      properties:
        category:
          type: string
          description: The error category
        context:
          type: object
          additionalProperties:
            type: array
            items:
              type: string
          description: Context about the error condition
          example: >-
            {invalidPropertyName=[propertyValue], missingScopes=[scope1,
            scope2]}
        correlationId:
          type: string
          description: >-
            A unique identifier for the request. Include this value with any
            error reports or support tickets
          format: uuid
          example: aeb5f871-7f07-4993-9211-075dc63e7cbf
        errors:
          type: array
          description: further information about the error
          items:
            $ref: '#/components/schemas/ErrorDetail'
        links:
          type: object
          additionalProperties:
            type: string
          description: >-
            A map of link names to associated URIs containing documentation
            about the error or recommended remediation steps
        message:
          type: string
          description: >-
            A human readable message describing the error along with remediation
            steps where appropriate
          example: An error occurred
        subCategory:
          type: string
          description: >-
            A specific category that contains more specific detail about the
            error
      example:
        message: Invalid input (details will vary based on the error)
        correlationId: aeb5f871-7f07-4993-9211-075dc63e7cbf
        category: VALIDATION_ERROR
        links:
          knowledge-base: https://www.hubspot.com/products/service/knowledge-base
    Option:
      required:
        - createdAt
        - id
        - label
        - name
        - order
        - type
        - updatedAt
      type: object
      properties:
        createdAt:
          type: string
          description: The timestamp when the option was created, in ISO 8601 format.
          format: date-time
        createdBy:
          $ref: '#/components/schemas/SimpleUser'
        createdByUserId:
          type: integer
          description: The ID of the user who created the option.
          format: int32
        id:
          type: string
          description: The unique ID of the option.
        label:
          type: string
          description: A user-friendly label that identifies the option.
        name:
          type: string
          description: An internal name assigned to the option, distinct from the label.
        order:
          type: integer
          description: The order in which the option appears, represented as an integer.
          format: int32
        type:
          type: string
          description: >-
            Indicates the category or data type of the option (e.g., string,
            number).
        updatedAt:
          type: string
          description: The timestamp when the option was last updated, in ISO 8601 format.
          format: date-time
        updatedBy:
          $ref: '#/components/schemas/SimpleUser'
        updatedByUserId:
          type: integer
          description: The ID of the user who last updated the option.
          format: int32
      description: A HubSpot property option
    ForeignId:
      required:
        - id
        - name
        - type
      type: object
      properties:
        id:
          type: string
          description: Unique identifier for the foreign ID.
        name:
          type: string
          description: Name of the foreign ID.
        type:
          type: string
          description: Type of the foreign ID.
    ErrorDetail:
      required:
        - message
      type: object
      properties:
        code:
          type: string
          description: The status code associated with the error detail
        context:
          type: object
          additionalProperties:
            type: array
            items:
              type: string
          description: Context about the error condition
          example: >-
            {invalidPropertyName=[propertyValue], missingScopes=[scope1,
            scope2]}
        in:
          type: string
          description: The name of the field or parameter in which the error was found.
        message:
          type: string
          description: >-
            A human readable message describing the error along with remediation
            steps where appropriate
        subCategory:
          type: string
          description: >-
            A specific category that contains more specific detail about the
            error
  responses:
    Error:
      description: An error occurred.
      content:
        '*/*':
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    oauth2:
      type: oauth2
      flows:
        authorizationCode:
          authorizationUrl: https://app.hubspot.com/oauth/authorize
          tokenUrl: https://api.hubapi.com/oauth/v1/token
          scopes:
            hubdb: ''

````