HubDB API Overview

HubDB is a relational data store that represents data as rows, columns, and cells in a table, much like a spreadsheet.

Data in a HubDB table can be accessesd from HubSpot pages using HubL or the JSON REST APIs. Endpoints that support GET also support CORS, so you can access the data in a table client-side using JavaScript, using only a Portal ID (often called Hub ID) to access the data. Note: this only applies to GET methods. Other methods require authentication, and will not support CORS.

HubDB tables can be modified using the HubSpot app, making it easy for anyone to add or modify tables or data in those tables, but you can also use the REST API to manage the data.

For more details, and for more information on using data in a HubDB table on a HubSpot site, see the description on our Designers site.

Individual tables will have the following data, see creating a table for more details on the data types available for each column:

{
  "id": 300081,
  // Integer, read-only; The unique ID of the table
  "name": "Example HubDB Table",
  // String; The name of the table
  "createdAt": 1479479977286,
  // Integer, read-only; A Unix timestamp (in milliseconds) of the time that the table was created.
  "publishedAt": 1479480005606,
  // Integer, read-only; A Unix timestamp (in milliseconds) of the time that the published.
  // A table is considered published if this value is populated with a value representing a time before the current time.
  // Only tables that are published can be accessed using unauthenticated GET methods.
  "updatedAt": 1483746758882,
  // Integer, read-only; A Unix timestamp (in milliseconds) of the time that the table was last updated.
  "columns": [
  // A list of objects defining the columns in the table.
  // It is possible for thist list to be empty if there are no user defined columns.
    // Columns will have the following format:
    {
      "name": "number_column",
      // String; The internal name of the column
      "label": "Number Column",
      // String; The human readable label of the column. This is displayed when editing the table in HubSpot
      "id": 3,
      // Integer, read-only; The unique ID of the column.
      // Column IDs are assigned automatically by the incrementing (read-only) columnCount field.
      "width": 200,
      // Integer; The visual width of the column when editing the table in HubSpot.
      // This field will only be populated if a user has resized the column in HubSpot.
      "type": "NUMBER"
      // String, one of TEXT, RICHTEXT, NUMBER, BOOLEAN, DATE, DATETIME, SELECT, URL, LOCATION, IMAGE
      // The data type of the column. See creating a table for more details on these data types.
    },
    // SELECT columns have additional data
    {
      "name": "choices",
      // String; The internal name of the column
      "label": "Choices",
      // String; The human readable label of the column, this is displayed when editing the table in HubSpot
      "id": 8,
      // Integer, read-only; The unique ID of the column.
      "options": [
      // A list of valid options for the SELECT column.
        {
          "id": 1,
          // Integer; The unique ID of the option
          "name": "a",
          // String; The internal name of the option
          "type": "option"
          // String; This field will always be "option"
        },
        {
          "id": 2,
          "name": "b",
          "type": "option"
        },
        {
          "id": 3,
          "name": "c",
          "type": "option"
        }
      ],
      "type": "SELECT",
      // String, one of TEXT, RICHTEXT, NUMBER, BOOLEAN, DATE, DATETIME, SELECT, URL, LOCATION, IMAGE
      // The data type of the column. See creating a table for more details on these data types.
      "optionCount": 3
      // Integer, read-only; The number of options set up for the column
    }
  ],
  "deleted": false,
  // Boolean, read-only; Whether or not the table has been deleted.
  // This will effectively be false for all tables, as deleted tables will not appear in the API. 
  "rowCount": 6,
  // Integer, read-only; The number of rows in the table
  "columnCount": 2
  // Integer, read-only; The number of columns in the table
}

Inividual rows will have the following format. See creating a row for more details about the formats for each column type.

{
  "id": 4682015823,
  // Integer, read-only; The unique ID for the row
  "createdAt": 1483564738680,
  // Integer, read-only; A Unix timestamp (in milliseconds) of the time that the row was created.
  "path": null,
  // Reserved for future use
  "values": {
  // An object containing the values for the cells of the row
  // Each entry has the format of { column ID : cell value}
  // The column ID must be a string matching the ID of a defined column
  // The cell value format will depend on the column type. See below for some examples, and creating a row for more details.
  // The column ID will match the ID of the column in the table definition
    "3": 7,
    // A NUMBER value for column ID 3
    "4": "Example Text",
    // A TEXT value for column ID 4
    "5": 1484265600000,
    // A DATE value for column ID 5. Both DATE and DATETIME fields must be set as Unix timestamps in milliseconds.
    "6": 1485057600000,
    // A DATETIME value for column ID 6
    "7": "<p>This is some text.</p>",
    // A RICHTEXT value containing HTML for column ID 7
    "8": {
    // This is an option value for a SELECT column with ID 8
      "id": 2,
      // Integer; The ID of the option from the column definition in the table definition.
      "name": "b",
      // String; The name of the option.
      "type": "option"
      // String; The type of the value. For SELECT values, this must "option"
    },
    "9": {
    // This is a LOCATION value for the column with ID 9
      "lat": 41.836826,
      //Float; The latitude coordinate of the location
      "long": -88.461914,
      // Float; The longitude coordinate of the location
      "type": "location"
      // String; for location values, this must be "location"
    },
    "10": {
    // This is an IMAGE value for the column with ID 10
      "url": "http://s3.amazonaws.com/cdn1.hubspot.com/StockImages/Expressions/7K0A0014-2.jpg",
      // String; the URL of the image
      "type": "image"
      // String, this must be "image" for image values
    },
    "11": "https://integrate.hubspot.com/"
    // A string value for a URL column with ID 11
  }
}

Docs for this section or API