Skip to main content
The commands below are available for interacting with HubDB using the HubSpot CLI. Use these commands to create, delete, fetch, and clear all rows of a HubDB table. The HubSpot account must have access to HubDB to use these commands.

Create HubDB table

Create a new HubDB table in the HubSpot account.
hs hubdb create --path [path] --account [account]
Flags
FlagDescription
--path RequiredThe local JSON file to use to generate the HubDB table.
--accountSpecify a accountId or name to create HubDB in. Supports an alias of --portal for backward compatibility with older versions of the CLI.

Fetch HubDB Table

Download a HubDB table’s data to your local machine.
hs hubdb fetch <table-id> <dest>
Arguments
ArgumentDescription
table-id RequiredHubDB table id found in the HubDB dashboard.
destThe local path destination to store the hubdb.json file.
When you fetch a HubDB the data is stored as tablename.hubdb.json. When you create a new table you must specify a source JSON file. Below is an example of a table in JSON format.
{
  "name": "store_locations",
  "useForPages": true,
  "label": "Store locations",
  "allowChildTables": false,
  "allowPublicApiAccess": true,
  "dynamicMetaTags": { "DESCRIPTION": 3, "FEATURED_IMAGE_URL": 7 },
  "enableChildTablePages": false,
  "columns": [
    { "name": "name", "label": "Name", "type": "TEXT" },
    {
      "name": "physical_location",
      "label": "Physical Location",
      "type": "LOCATION"
    },
    { "name": "street_address", "label": "Street address", "type": "TEXT" },
    { "name": "city", "label": "City", "type": "TEXT" },
    {
      "name": "state",
      "label": "State",
      "options": [
        { "id": 1, "name": "Wisconsin", "type": "option", "order": null },
        { "id": 2, "name": "Minnesota", "type": "option", "order": null },
        { "id": 3, "name": "Maine", "type": "option", "order": null },
        { "id": 4, "name": "New York", "type": "option", "order": null },
        { "id": 5, "name": "Massachusetts ", "type": "option", "order": null },
        { "id": 6, "name": "Mississippi", "type": "option", "order": null },
        { "id": 7, "name": "Arkansas", "type": "option", "order": null },
        { "id": 8, "name": "Texas", "type": "option", "order": null },
        { "id": 9, "name": "Florida", "type": "option", "order": null },
        { "id": 10, "name": "South Dakota", "type": "option", "order": null },
        { "id": 11, "name": "North Dakota", "type": "option", "order": null },
        { "id": 12, "name": "n/a", "type": "option", "order": null }
      ],
      "type": "SELECT",
      "optionCount": 12
    },
    { "name": "phone_number", "label": "Phone Number", "type": "TEXT" },
    { "name": "photo", "label": "Store Photo", "type": "IMAGE" }
  ],
  "rows": [
    {
      "path": "super_store",
      "name": "Super Store",
      "isSoftEditable": false,
      "values": {
        "name": "Super Store",
        "physical_location": {
          "lat": 43.01667,
          "long": -88.00608,
          "type": "location"
        },
        "street_address": "1400 75th Greenfield Ave",
        "city": "West Allis",
        "state": { "id": 1, "name": "Wisconsin", "type": "option", "order": 0 },
        "phone_number": "(123) 456-7890"
      }
    },
    {
      "path": "store_123",
      "name": "Store #123",
      "isSoftEditable": false,
      "values": {
        "name": "Store #123",
        "physical_location": {
          "lat": 32.094803,
          "long": -166.85889,
          "type": "location"
        },
        "street_address": "Pacific Ocean",
        "city": "at sea",
        "state": { "id": 12, "name": "n/a", "type": "option", "order": 11 },
        "phone_number": "(123) 456-7891"
      }
    }
  ]
}

Clear rows in a HubDB table

Clear all of the rows in a HubDB table.
hs hubdb clear <tableId>
Arguments
ArgumentDescription
tableId RequiredHubDB table id found in the HubDB dashboard.
Flags
FlagDescription
--accountSpecify a accountId or name to clear HubDB rows from.Supports an alias of --portal for backward compatibility with older versions of the CLI.

Delete HubDB table

Deletes the specified HubDB table from the account. You will be prompted to confirm the deletion before proceeding. You can use the --force flag to bypass this confirmation.
hs hubdb delete <table-id>
Arguments
ArgumentDescription
table-id RequiredHubDB table ID found in the HubDB dashboard.
Flags
FlagDescription
--accountSpecify a accountId or name to delete HubDB from. Supports an alias of --portal for backward compatibility with older versions of the CLI.
--forceBypass the confirmation prompt and immediately delete the table once the command is executed.
Last modified on February 9, 2026