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

---
id: 5d2e6149-e5bb-4af3-82d6-20a20cd32186
---

# CMS API | HubDB

> The HubDB endpoints are used to get and manage data in your HubDB data tables.

export const PostmanCard = ({title, collectionId}) => {
  return <div className="card-condensed-cta">
      <Card title={title ? title : "Postman collection"} href={`https://app.getpostman.com/run-collection/${collectionId}`} horizontal={true} cta="Run in Postman" icon={<svg xmlns="http://www.w3.org/2000/svg" width={25} height={25} preserveAspectRatio="xMidYMid" viewBox="0 0 256 256">
              <path fill="#FF6C37" d="M254.953 144.253c8.959-70.131-40.569-134.248-110.572-143.206C74.378-7.912 10.005 41.616 1.047 111.619c-8.959 70.003 40.569 134.248 110.572 143.334 70.131 8.959 134.248-40.569 143.334-110.7Z" />
              <path fill="#FFF" d="m174.2 82.184-54.007 54.007-15.229-15.23c53.11-53.11 58.358-48.503 69.236-38.777Z" />
              <path fill="#FF6C37" d="M120.193 137.47c-.384 0-.64-.128-.895-.384l-15.358-15.229a1.237 1.237 0 0 1 0-1.792c54.007-54.006 59.638-48.887 71.028-38.649.255.256.383.512.383.896s-.128.64-.383.896l-54.007 53.878c-.128.256-.512.384-.768.384Zm-13.437-16.509 13.437 13.438 52.087-52.087c-9.47-8.446-15.87-11.006-65.524 38.65Z" />
              <path fill="#FFF" d="m135.679 151.676-14.718-14.718 54.007-54.006c14.46 14.59-7.167 38.265-39.29 68.724Z" />
              <path fill="#FF6C37" d="M135.679 152.956c-.384 0-.64-.128-.896-.384l-14.718-14.718c-.256-.256-.256-.512-.256-.896s.128-.64.384-.895L174.2 82.056a1.237 1.237 0 0 1 1.791 0 15.58 15.58 0 0 1 4.991 11.902c-.256 14.206-16.38 32.25-44.28 58.614-.383.256-.767.384-1.023.384Zm-12.926-15.998c8.19 8.319 11.646 11.646 12.926 12.926 21.5-20.476 42.36-41.464 42.488-55.926.128-3.327-1.152-6.655-3.327-9.214l-52.087 52.214Z" />
              <path fill="#FFF" d="m105.22 121.345 10.878 10.878c.256.256.256.512 0 .768-.128.128-.128.128-.256.128l-22.524 4.863c-1.152.128-2.175-.64-2.431-1.791-.128-.64.128-1.28.512-1.664l13.053-13.054c.256-.256.64-.384.768-.128Z" />
              <path fill="#FF6C37" d="M92.934 139.262c-1.92 0-3.327-1.536-3.327-3.455 0-.896.384-1.792 1.024-2.432l13.053-13.054c.768-.64 1.792-.64 2.56 0l10.878 10.878c.768.64.768 1.792 0 2.56-.256.256-.512.384-.896.512l-22.524 4.863c-.256 0-.512.128-.768.128Zm11.902-16.51-12.542 12.543c-.256.256-.383.64-.128 1.024.128.383.512.511.896.383l21.116-4.607-9.342-9.342Z" />
              <path fill="#FFF" d="M202.739 52.238c-8.191-7.935-21.373-7.679-29.307.64-7.935 8.318-7.679 21.372.64 29.306A20.678 20.678 0 0 0 199.155 85l-14.59-14.59 18.174-18.172Z" />
              <path fill="#FF6C37" d="M188.405 89.223c-12.158 0-22.012-9.854-22.012-22.012 0-12.158 9.854-22.012 22.012-22.012 5.631 0 11.134 2.176 15.23 6.143.255.256.383.512.383.896s-.128.64-.384.895L186.357 70.41l13.566 13.566c.512.512.512 1.28 0 1.792l-.256.256c-3.327 2.047-7.295 3.199-11.262 3.199Zm0-41.337c-10.75 0-19.452 8.703-19.324 19.453 0 10.75 8.702 19.452 19.452 19.324 2.944 0 5.887-.64 8.575-2.047l-13.438-13.31c-.256-.256-.384-.512-.384-.896s.128-.64.384-.895l17.149-17.15c-3.456-2.943-7.807-4.479-12.414-4.479Z" />
              <path fill="#FFF" d="m203.122 52.622-.255-.256-18.301 18.044 14.461 14.462c1.408-.896 2.816-1.92 3.967-3.072a20.51 20.51 0 0 0 .128-29.178Z" />
              <path fill="#FF6C37" d="M199.155 86.28c-.384 0-.64-.128-.896-.384l-14.589-14.59c-.256-.256-.384-.512-.384-.896s.128-.64.384-.895l18.173-18.173a1.237 1.237 0 0 1 1.791 0l.384.256c8.575 8.574 8.575 22.396.128 31.098-1.28 1.28-2.687 2.432-4.223 3.328-.384.128-.64.256-.768.256Zm-12.798-15.87 12.926 12.926c1.024-.64 2.048-1.536 2.816-2.304 7.294-7.294 7.678-19.196.64-26.875L186.357 70.41Z" />
              <path fill="#FFF" d="M176.375 84.488a7.879 7.879 0 0 0-11.134 0l-48.247 48.247 8.063 8.063 51.062-44.792c3.328-2.816 3.584-7.807.768-11.134-.256-.128-.384-.256-.512-.384Z" />
              <path fill="#FF6C37" d="M124.929 142.077c-.384 0-.64-.128-.896-.383l-8.063-8.063a1.237 1.237 0 0 1 0-1.792l48.247-48.247a9.115 9.115 0 0 1 12.926 0 9.115 9.115 0 0 1 0 12.926l-.384.384-51.063 44.792c-.128.255-.384.383-.767.383Zm-6.143-9.342 6.27 6.271 50.167-44.024c2.816-2.304 3.072-6.527.768-9.342-2.303-2.816-6.526-3.072-9.342-.768-.128.128-.256.256-.512.384l-47.351 47.48Z" />
              <path fill="#FFF" d="M80.009 187.637c-.512.256-.768.768-.64 1.28l2.175 9.214c.512 1.28-.256 2.816-1.663 3.2-1.024.384-2.176 0-2.816-.768l-14.077-13.95 45.943-45.943 15.87.256 10.75 10.75c-2.56 2.175-18.045 17.149-55.542 35.961Z" />
              <path fill="#FF6C37" d="M78.985 202.61c-1.024 0-2.048-.383-2.688-1.151l-13.95-13.95c-.255-.256-.383-.512-.383-.896 0-.383.128-.64.384-.895l45.944-45.944c.256-.256.64-.384.895-.384l15.87.256c.383 0 .64.128.895.384l10.75 10.75c.256.256.384.64.384 1.024s-.128.64-.512.896l-.895.767c-13.566 11.902-31.995 23.804-54.902 35.194l2.175 9.086c.384 1.664-.384 3.456-1.92 4.352-.767.384-1.407.512-2.047.512Zm-14.078-15.997 13.182 13.054c.384.64 1.152.896 1.792.512.64-.384.896-1.152.512-1.792l-2.176-9.214c-.256-1.152.256-2.176 1.28-2.688 22.652-11.39 40.952-23.163 54.39-34.81l-9.47-9.47-14.718-.256-44.792 44.664Z" />
              <path fill="#FFF" d="m52.11 197.62 11.006-11.007 16.38 16.381-26.107-1.791c-1.151-.128-1.92-1.152-1.791-2.304 0-.512.128-1.024.512-1.28Z" />
              <path fill="#FF6C37" d="m79.497 204.146-26.236-1.791c-1.92-.128-3.199-1.792-3.071-3.712.128-.768.384-1.535 1.024-2.047L62.22 185.59a1.237 1.237 0 0 1 1.792 0l16.38 16.38c.385.385.512.897.257 1.408-.256.512-.64.768-1.152.768Zm-16.381-15.74-10.11 10.11c-.384.255-.384.895 0 1.151.127.128.255.256.511.256l22.652 1.536-13.053-13.054ZM104.452 146.557c-.768 0-1.28-.64-1.28-1.28 0-.384.128-.64.384-.896l12.414-12.414a1.237 1.237 0 0 1 1.792 0l8.062 8.063c.384.384.512.768.384 1.28-.128.384-.512.767-1.023.895l-20.477 4.352h-.256Zm12.414-11.902-8.446 8.446 13.821-2.943-5.375-5.503Z" />
              <path fill="#FFF" d="m124.8 140.926-14.077 3.071c-1.024.256-2.048-.384-2.303-1.408-.128-.64 0-1.28.511-1.791l7.807-7.807 8.063 7.935Z" />
              <path fill="#FF6C37" d="M110.467 145.277a3.168 3.168 0 0 1-3.2-3.2c0-.895.385-1.663.897-2.303l7.806-7.807a1.237 1.237 0 0 1 1.792 0l8.062 8.063c.384.384.512.768.384 1.28-.128.384-.512.767-1.023.895l-14.078 3.072h-.64Zm6.399-10.622-6.91 6.91c-.257.257-.257.512-.129.768s.384.384.768.384l11.774-2.56-5.503-5.502ZM203.25 64.907c-.256-.767-1.151-1.151-1.92-.895-.767.255-1.151 1.151-.895 1.92 0 .127.128.255.128.383.768 1.536.512 3.455-.512 4.863-.512.64-.384 1.536.128 2.048.64.512 1.536.384 2.048-.256 1.92-2.432 2.303-5.503 1.023-8.063Z" />
            </svg>} />
    </div>;
};

export const ScopesList = ({scopes = [], description = "This API requires one of the following scopes:"}) => {
  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>;
};

<PostmanCard collectionId="26126890-29c4653a-37a8-43aa-87dc-9e35b11d76b8" />

<Accordion title="Scope requirements">
  <ScopesList
    scopes={[
  'hubdb'
]}
  />
</Accordion>

HubDB is a relational data store that presents data as rows, columns, and cells in a table, much like a spreadsheet. HubDB tables can be added or modified [within your HubSpot account](/cms/start-building/features/storage/hubdb#create-a-hubdb-table), but you can also use the HubDB API to create and manage your HubDB tables. For information on using data from HubDB tables on your website or in [programmable emails](/cms/start-building/features/data-driven-content/emails-with-programmable-content), check out [HubSpot's CMS developer documentation](/cms/start-building/features/storage/hubdb).

Similar to HubSpot website pages, HubDB tables support `draft` and `published` versions. This allows you to update data in the table, either for testing or to allow for a manual approval process, without affecting any live pages. Learn more about [drafted versus live tables](#draft-vs-live-tables).

If a table is set to be [allowed for public access](https://knowledge.hubspot.com/website-and-landing-pages/create-and-hubdb-tables#manage-table-settings-content-hub-professional-and-enterprise-only), you can access the published version of the table and rows without any authentication by specifying your HubSpot account ID via the query parameter `portalId`.

<Warning>
  **Please note:**

  Endpoints that support `GET` also support `CORS`, so you can access data in a table client-side using JavaScript and your account ID. Other methods and the *Get all tables* endpoint require authentication and do not support `CORS`.
</Warning>

## Rate limits

HubDB API requests have different rate limits, depending on the type of request:

* Any `GET` requests made that don't require authentication (including client-side JavaScript requests) are limited to 10 requests per second. These requests won't count towards the daily limit.
* All other requests [using authentication](/api-reference/latest/authentication/manage-oauth-tokens) follow the [standard limits](/developer-tooling/platform/usage-guidelines).

## Draft vs live tables

HubDB tables have both draft and live versions and live versions can be published or unpublished. This will allow you to update data in the table, either for page previews or testing or to allow for a manual approval process, without affecting any live pages.

In this API, separate endpoints are designated for the draft and published versions of a table. For example, you can retrieve the published version of a table by making a `GET` request to `/cms/hubdb/2026-03/tables/{tableIdOrName}`.

To retrieve any content that has been drafted but not yet published, you would add `/draft` to the end of the URL: `/cms/hubdb/2026-03/tables/{tableIdOrName}/draft`.

Draft data can be reviewed and then pushed in HubSpot, or with the `/push-live` endpoint. The draft data can also be discarded via the `/reset` endpoint, allowing you to revert to the current live version of the data without disruption.

## Create a HubDB table

To create a HubDB table, make a `POST` request to `/cms/hubdb/2026-03/tables`.

In the request body, specify the following required fields:

| Field   | Type   | Description                                                                                                                                                                              | Example              |
| ------- | ------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------- |
| `name`  | String | The internal name of the table. This name cannot be changed once the table is created. Names can only include lowercase letters, digits, and underscores and cannot begin with a number. | `"name": "my_table"` |
| `label` | String | The label of the table that users see when editing the table in HubSpot.                                                                                                                 | `"label":"My table"` |

In addition, you can specify the following optional fields:

| Field                   | Type    | Description                                                                                                                                 | Example                                 |
| ----------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------- |
| `useForPages`           | Boolean | Whether the table can be used for [creating dynamic pages](#configuring-hubdb-tables-for-dynamic-pages).                                    | `"useForPages": false`                  |
| `allowPublicAPIAccess`  | Boolean | Whether the table can be read without authorization.                                                                                        | `"allowPublicApiAccess": false`         |
| `allowChildTables`      | Boolean | Whether child tables can be created for the table.                                                                                          | `"allowChildTables": false`             |
| `enableChildTablePages` | Boolean | Whether [multilevel dynamic pages](/cms/start-building/features/data-driven-content/hubdb/multilevel) should be created using child tables. | `"enableChildTablePages": false`        |
| `columns`               | Object  | The columns of the table. Learn more about column properties in the [Add table columns](#add-table-columns) sections.                       | `See "Add table columns" section below` |

Without any columns added yet, your create request might look like the following:

```json theme={null}
{
  "name": "test_table",
  "label": "Test Table",
  "useForPages": false,
  "allowPublicApiAccess": false,
  "allowChildTables": true,
  "enableChildTablePages": false,
  "columns": []
}
```

### Add table columns

Each column in a HubDB table can be defined with the following properties:

| Field     | Type   | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            | Example                                                                                    |
| --------- | ------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------ |
| `name`    | String | Required. The internal name of the column. Cannot be changed after the column is created.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              | `"name": "row_name"`                                                                       |
| `label`   | String | Optional. The label for the column that users will see when editing the table in HubSpot.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              | `"label": "Row label"`                                                                     |
| `type`    | String | The data type of the column. Must be one of the following:<ul><li>`TEXT`: a text field.</li><li>`RICHTEXT`: a text field that supports basic HTML formatting. Not recommended for raw HTML, as it may impact whether the HTML is editable in HubSpot. Editing the code in HubSpot may also impact the way the code is rendered. </li><li>`NUMBER`: a number field.</li><li>`BOOLEAN`: represented as a checkbox in HubSpot. Use `0` for unchecked and `1` for checked.</li><li>`DATE`: stores a specific date as a millisecond timestamp set to midnight UTC.</li><li>`DATETIME`: stores a date and a time as a millisecond timestamp.</li><li>`SELECT`: the column can only be set to one of a set of options. See the `options` field below for required properties.</li><li>`MULTISELECT`: the column can be set to one or more of a set of options. See the `options` field below for required properties.</li><li>`LOCATION`: stores a latitude and longitude location.</li><li>`IMAGE`: stores the URL of an image.</li><li>`VIDEO`: stores the player ID of the video.</li><li>`FOREIGN_ID`: the column will reference a column from another HubDB table. In addition, you must define the other HubDB table with the following properties:<ul><li>foreignTableId: the ID of the other HubDB table. </li><li>foreignColumnId: the ID of the column in the other HubDB table.</li></ul></li><li>`CURRENCY`: stores the number as a currency value.</li><li>`FILE`: stores a file from the file manager. You'll also need to include a `fileType` field to specify whether the field can store all file types (`FILE`) or only document types such as PDF (`DOCUMENT`).</li></ul> | `"type": "type"`                                                                           |
| `options` | Object | A list of options for select and multiselect columns. Each option is defined with a `name` along with a `type` equal to `option`.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      | `"option": [{"name":"Option 1", "type":"option"}, {"name": "Option 2", "type": "option"}]` |

Using the above fields, your request to create a new HubDB table might look like the following:

```json theme={null}
{
  "label": "Test Table",
  "name": "test_table",
  "columns": [
    {
      "name": "text_column",
      "label": "Text Column",
      "archived": false,
      "type": "TEXT"
    },
    {
      "name": "number_column",
      "label": "Number Column",
      "archived": false,
      "type": "NUMBER"
    },
    {
      "name": "multiselect",
      "label": "Multi Select Column",
      "archived": false,
      "type": "multiselect",
      "options": [
        {
          "name": "Option 1",
          "type": "option"
        },
        {
          "name": "Option 2",
          "type": "option"
        }
      ]
    }
  ],
  "useForPages": true,
  "allowChildTables": true,
  "enableChildTablePages": false,
  "allowPublicApiAccess": false
}
```

After creating a table, columns will be assigned IDs in ascending order. When updating existing columns, include the column's `id` field in the input object.

### Add table rows

You can add rows either manually through the API, or you can [import rows from a CSV file](#import-rows-from-csv).

To add rows to a HubDB table, make a `POST` request to `/cms/hubdb/2026-03/tables/{tableIdOrName}/rows`.

For each table row, you can include the following fields:

| Field          | Type   | Description                                                                                                                                                                                                           | Example                                                          |
| -------------- | ------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------- |
| `values`       | Object | A list of key-value pairs with the column name and the value you want to add to it.<br /><br />If you don't want to set a specific value for a column, you can omit the column name from the list of key-value pairs. | `"values": { "text_column": "sample text", "number_column": 76}` |
| `path`         | String | For tables [enabled for dynamic pages](/cms/start-building/features/data-driven-content/hubdb/overview), `path` is the path suffix used for the page created for this row.                                            | `"path": "example_url_path"`                                     |
| `name`         | String | For tables [enabled for dynamic pages](/cms/start-building/features/data-driven-content/hubdb/overview), `name` is the HTML title used for the page created for this row.                                             | `"name": "Example Title"`                                        |
| `childTableId` | Number | When creating [multilevel dynamic pages](/cms/start-building/features/data-driven-content/hubdb/multilevel), `childTableId` specifies the child table ID.                                                             | `"childTableId": 123456`                                         |

Using the above fields, your request might look similar to the following:

```json theme={null}
{
  "values": {
    "text_column": "sample text value",
    "number_column": 76,
    "rich_text_column": "<strong>This is a styled paragraph.</strong>",
    "date_column": 1591228800000,
    "date_time_column": 1604450520000,
    "boolean_column": 1,
    "select_column": {
      "name": "option 1",
      "type": "option"
    },
    "multiselect_column": [
      {
        "name": "Option 1",
        "type": "option"
      },
      {
        "name": "Option 2",
        "type": "option"
      }
    ],
    "url_column": "https://www.hubspot.com/marketing",
    "video_column": 3392210008,
    "image_column": {
      "url": "https://f.hubspotusercontentqa00.net/hubfs/99992002/image3%20(1).jpg",
      "width": 1600,
      "height": 900,
      "type": "image"
    },
    "foreign_id_column": [
      {
        "id": "4364402239",
        "type": "foreignid"
      },
      {
        "id": "4364402240",
        "type": "foreignid"
      }
    ]
  },
  "path": "test_path",
  "name": "test_title",
  "childTableId": "1902373"
}
```

### Import rows from CSV

To import data into a HubDB table from a CSV file, make a `POST` request to `/cms/hubdb/2026-03/tables/{tableIdOrName}/draft/import`.

The import endpoint takes a `multipart/form-data` `POST` request:

* `config`: a set of JSON-formatted options for the import.
* `file`: the CSV file that you want to import.

In `config`, include the following fields as a JSON string:

| Field                    | Type    | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               | Example                                                                                 |
| ------------------------ | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------- |
| `skipRows`               | Number  | The number of header rows that should be skipped over. This field defaults to `1`, skipping the first row and treating it as a header. Set this to `0` if all of the rows are valid data.                                                                                                                                                                                                                                                                                                                                                                                                                                 | `"skipRows": 0`                                                                         |
| `separator`              | String  | The column delimiter in the CSV file. Set to `","` by default.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            | `"separator": ","`                                                                      |
| `idSourceColumn`         | Number  | The index of the column in the source file containing the row’s ID (`hs_id`).If this column is specified, the import will update the existing rows in the table for the matching row IDs from the CSV file. This is optional and you can ignore this during the first time you import data into a table.See the [Reset options](#reset-options) section below more detailed information.                                                                                                                                                                                                                                  | `"idSourceColumn": 1`                                                                   |
| `resetTable`             | Boolean | Defaults to `false`, meaning that the table's rows will be updated without removing any existing rows. If set to `true`, the spreadsheet rows will overwrite table data, meaning that any rows in the table that aren't in the spreadsheet will be deleted.See the [Reset options](#reset-options) section below more detailed information.                                                                                                                                                                                                                                                                               | `"resetTable": true`                                                                    |
| `nameSourceColumn`       | Number  | For tables [enabled for dynamic pages](/cms/start-building/features/data-driven-content/hubdb/overview), `nameSourceColumn` specifies the column in the CSV file that contains the row's `name`. Column numbers are in ascending order, with the first column being `1`.                                                                                                                                                                                                                                                                                                                                                  | `"nameSourcecolumn": 5`                                                                 |
| `pathSourceColumn`       | Number  | For tables [enabled for dynamic pages](/cms/start-building/features/data-driven-content/hubdb/overview), `pathSourceColumn` specifies the column in the CSV file that contains the row's `path`. Column numbers are in ascending order, with the first column being `1`.                                                                                                                                                                                                                                                                                                                                                  | `"pathSourcecolumn": 6`                                                                 |
| `childTableSourceColumn` | Number  | Specifies the column in the CSV file that contains the row's `childTableId`. Column numbers are in ascending order, with the first column being `1`.                                                                                                                                                                                                                                                                                                                                                                                                                                                                      | `"childTableSourcecolumn": 3`                                                           |
| `columnMappings`         | Array   | A list of mappings for the columns in the source file to the columns in the destination HubDB table.Each mapping must have the following format: `{"source":1,"target”:"columnIdOrName"}` <ul><li>`source`: the column index in the source file. For example, `2` for the second column.</li><li>`target`: the ID or name of the HubDB table column. You can get the ID or name of a column by [getting the details for the table](#retrieve-hubdb-data).</li></ul>If your file has an `hs_id` column, you shouldn't include it in `columnMappings`. Instead, include it as the `idSourceColumn` to update existing rows. | `"columnMappings": [{"source":1, "target": 2}, {"source": 2, "target": "column_name"}]` |
| `primaryKeyColumn`       | String  | The name of a column in the target HubDB table that will be used for deduplication. The column's ID cannot be used for this field.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        | `"primaryKeyColumn": "column_name"`                                                     |
| `encoding`               | String  | The file's encoding type. For example, `utf-8`, `ascii`, `iso-8859-2`, `iso-8859-5`, `iso-2022-jp`, `windows-1252`.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       | `"encoding": "utf-8"`                                                                   |
| `format`                 | String  | Only CSV is supported.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    | `"format": "csv"`                                                                       |

Using the above table, your `config` JSON might look like the following:

```json theme={null}
{
  "skipRows": 1,
  "separator": ",",
  "idSourceColumn": 1,
  "resetTable": false,
  "columnMappings": [
    {
      "target": 1,
      "source": 2
    },
    {
      "target": 2,
      "source": "zip_code"
    }
  ],
  "primaryKeyColumn": "name",
  "encoding": "utf-8",
  "format": "csv"
}
```

If using cURL, your command might look like the following:

```shell theme={null}
curl -L -X POST 'https://api.hubspotqa.com/hubdb/api/v2/tables/xxxxxx/import?portalId=xxxxxxx' \
-H 'Content-Type: multipart/form-data' \
-F 'config="{\"skipRows\":1,\"format\":\"csv\",\"separator\":\",\",\"encoding\":\"iso-8859-1\",\"columnMappings\":[{\"target\":1,\"source\":7},{\"target\":3,\"source\":8}],\"idSourceColumn\":1,\"pathSourceColumn\":null,\"nameSourceColumn\":null,\"childTableSourceColumn\":null,\"resetTable\":true}"' \
-F 'file=@"/Users/xxxxxxxxxxxxx/Downloads/filename.csv"'
```

### Date formatting

There are several formats you can use when importing data into a date-type column.

**Integers**

* `yyyy/mm/dd`
* `yyyy/mm/dd`
* `mm/dd/yyyy`
* `mm/dd/yy`

These formats require the month to precede the day (i.e., `dd/mm/yy` is not accepted). Integers can be separated by hyphens (`-`) or slashes (`/`).

**Relaxed dates**

You can also import date formats that are less standardized than integer-based dates. For example:

* `The 1st of March in the year 2022`
* `Fri Mar 4 2022`
* `March 4th '22`

**Relative dates**

HubSpot will parse the following date formats relative to the current day:

* `next Thursday`
* `Today`
* `tomorrow`
* `3 days from now`

### Reset options

When importing data from a CSV file into a HubDB table, you can set the `resetTable` field to `true` or `false` (default) to manage whether HubDB row data is overwritten.

* If `resetTable` is set to `true`:

  * If the rows in the CSV file does not have a row ID column (`hs_id` or row ID is specified as `0`, those rows will be inserted with the new row IDs generated.
  * If the row IDs in the CSV file already exists in the target table, the existing rows in the table will be updated with the new values from the input file.
  * If the table has rows but the input CSV file does not have those row IDs, those rows will be deleted from the target table.
  * If the row IDs in the input CSV file do not exist in the target table, those rows will be inserted with the new row IDs generated and the row IDs given in the input file will be ignored.
  * If the input CSV file does not contain the row ID column at all, all the rows will be deleted from the target table and the rows from the input file will be inserted with the new row IDs generated.

* If `resetTable` is set to `false` (default):

  * If the row IDs in the CSV file already exists in the target table, the existing rows in the table will be updated with the new values from the input file.
  * If the table has rows but the input CSV file does not have those row IDs, those rows will *not* be deleted from the target table and those rows will remain unchanged.
  * If the row IDs in the input CSV file do not exist in the target table, those rows will be inserted with the new row IDs generated and the row IDs given in the input file will be ignored.
  * If the rows in the CSV file does not have a row ID column or row ID is specified as `0`, those rows will be inserted with the new row IDs generated.

## Retrieve HubDB data

There are multiple ways to retrieve HubDB data, depending on whether you're looking for table details or the rows of a table:

* To retrieve table details from all published tables, make a `GET` request to `/cms/hubdb/2026-03/tables`.
* To retrieve table details from a specific published table, make a `GET` request to `/cms/hubdb/2026-03/tables/{tableIdOrName}`.
* To retrieve all rows from a specific table, make a `GET` request to `/cms/hubdb/2026-03/tables/{tableIdOrName}/rows`.
* To retrieve a specific row from a table, make a `GET` request to `/cms/hubdb/2026-03/tables/{tableIdOrName}/rows/{rowId}`.

When retrieving row data, you can further filter and sort the results.

If a table is set to be [allowed for public access](https://knowledge.hubspot.com/website-and-landing-pages/create-and-hubdb-tables#manage-table-settings-content-hub-professional-and-enterprise-only), you can access the published version of the table and rows without any authentication by specifying your HubSpot account ID via the query parameter `portalId`.

### Filter returned rows

When retrieving HubDB table data, you can apply filters as query parameters to receive specific data. Filter query parameters are constructed as follows: `columnName__operator`.

For example, if you have a number column named *bar*, you can filter results to only include rows where *bar* is greater than 10: `&bar__gt=10`.

All filters are ANDed together (OR filters are not currently supported).

When filtering, keep the following in mind:

* When passing values for `multiselect` columns, the values should be comma-separated (e.g. `multiselect_column__contains=1,2`).

* For `datetime` filters, you can use relative dates in place of timestamps in order to specify a value relative to the current time. For example, `-3h` would correspond to the timestamp 3 hours before now, whereas `10s` would correspond to 10 seconds in the future. Supported time units are ms (milliseconds), s (seconds), m (minutes), h (hours), d (days). Current time can be used by specifying a zero value: 0s

* For the purposes of these filters, the built in column `hs_id` is a `number` column, the `hs_created_at` column is a `datetime`, and the `hs_path` and `hs_name` columns are `text` columns.

Below, learn which operators can be applied to which column types:

| Operator       | Name                     | Description                                                                                                                                                                                                                                                  |
| -------------- | ------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `eq (or none)` | Equals                   | All column types.This filter is applied if no operator is used. When used with multiselect columns, returns rows that exact match supplied values.                                                                                                           |
| `ne`           | Not equal to             | All column types.                                                                                                                                                                                                                                            |
| `contains`     | Contains                 | Text, richtext, and multiselect.When used with multiselect columns, returns rows that contain all of the supplied values. This filter is <u>case sensitive</u>.                                                                                              |
| `lt`           | Less than                | Number, date, and datetime.                                                                                                                                                                                                                                  |
| `lte`          | Less than or equal to    | Number, date, and datetime.                                                                                                                                                                                                                                  |
| `gt`           | Greater than             | Number, date, and datetime.                                                                                                                                                                                                                                  |
| `gte`          | Greater than or equal to | Number, date, and datetime.                                                                                                                                                                                                                                  |
| `is_null`      | Null                     | All column types except boolean.This filter doesn't require a value (e.g. `&exampleColumn__is_null=`).                                                                                                                                                       |
| `not_null`     | Not null                 | All column types except boolean.This filter doesn't require a value (e.g. `&exampleColumn__not_null=`).                                                                                                                                                      |
| `like`         | Like                     | Text and richtext.                                                                                                                                                                                                                                           |
| `not_like`     | Not like                 | Text and richtext.                                                                                                                                                                                                                                           |
| `icontains`    | Contains                 | Text and richtext.This filter is <u>case insensitive</u>.                                                                                                                                                                                                    |
| `startswith`   | Starts with              | Text and richtext.                                                                                                                                                                                                                                           |
| `in`           | In                       | Number, select, and multiselect.Returns rows where the column includes at least one of the passed options. When there is no other `sort` in the query parameter, the results will be sorted in the order in which values are specified in the `in` operator. |

### Sort returned rows

When retrieving HubDB data, you can apply sorting as a query parameter to determine the order of the returned data. To sort data, add a `sort` query parameter and specify the column name: `&sort=columnName`.

By default, data will be returned in the natural order of the specified column. You can reverse the sort by adding a `-` before the column name: `&sort=-columnName`.

You can include this parameter multiple times to sort by multiple columns.

In addition to sorting by a column, there are three functions that can be used:

* `geo_distance(location_column_name, latitude, longitude)`: takes the name of a location column and coordinates, returns the rows ordered by how far away the values of the specified location column are from the provided coordinates.

* `length(column_name)`: takes the name of a column, returns the rows ordered by the length of the column value (calculated as a string)

* `random()`: returns the rows in random order.

These functions also support reverse ordering. For example, the following `geo_distance` sort returns items that are the farthest away first:

`sort=-geo_distance(location_column,42.37,-71.07)`

<Tip>
  Sorting methods can vary slightly depending on how you're fetching HubDB data. For example, to sort results returned by the [`hubdb_table_rows` function](/cms/reference/hubl/functions#hubdb-table-rows), you'll use the `orderBy` parameter instead of `sort`.
</Tip>

## Configuring HubDB tables for dynamic pages

Using HubSpot's CMS, you can use a HubDB table as a data source to [generate dynamic pages](/cms/start-building/features/data-driven-content/hubdb/overview). For example, you can create a table that contains a row for each member of your executive team, with columns containing information that you want to display on a page. After selecting that table as the dynamic data source for a page, that page will generate a listing page that displays all rows as summary items, along with separate pages for each row, similar to a blog listing page and blog post pages.

To enable a table to be selected as a data source in the content editor, you'll need to set `useForPage` to `true`. You can optionally include `dynamicMetaTags` to specify which columns to use for each page's metadata.

<Warning>
  **Please note:**

  When specifying `dynamicMetaTags`, you'll need to ensure that the page is using `page_meta` HubL tags instead of `content`. Learn more in the [dynamic pages guide](/cms/start-building/features/data-driven-content/hubdb/overview#metadata).
</Warning>

For example, the code below would create a table that can be used for dynamic pages, and specifies the three columns to use for page metadata.

```json theme={null}
{
  "name": "dynamic_page_table",
  "label": "Dynamic page table",
  "useForPages": true,
  "columns": [
    {
      "name": "meta_description",
      "label": "Meta description",
      "archived": false,
      "type": "TEXT"
    },
    {
      "name": "featured_image",
      "label": "Featured image",
      "archived": false,
      "type": "IMAGE"
    },
    {
      "name": "canonical_url",
      "label": "Canonical URL",
      "archived": false,
      "type": "URL"
    }
  ],
  "dynamicMetaTags": {
    "DESCRIPTION": 1,
    "FEATURED_IMAGE_URL": 2,
    "LINK_REL_CANONICAL_URL": 3
  }
}
```

| Parameter                | Type    | Description                                                                                                                                                                                                                                                                          |
| ------------------------ | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `useForPages`            | Boolean | Set to `true` to enable the table to be used as a data source for dynamic pages.                                                                                                                                                                                                     |
| `dynamicMetaTags`        | Object  | Specifies the columns by ID to use for metadata on each dynamic page. Can contain:<ul><li>`DESCRIPTION`</li><li>`FEATURED_IMAGE_URL`</li><li>`LINK_REL_CANONICAL_URL`</li></ul>For any metadata fields not specified, pages will inherit the respective values from its parent page. |
| `DESCRIPTION`            | Number  | The numeric ID of the column to use for each page's meta description.                                                                                                                                                                                                                |
| `FEATURED_IMAGE_URL`     | Number  | The numeric ID of the column to use for each page's featured image URL.                                                                                                                                                                                                              |
| `LINK_REL_CANONICAL_URL` | Number  | The numeric ID of the column to use for each page's canonical URL.                                                                                                                                                                                                                   |
