Invoke an external GET API and store the data retrieved from API in HubSpot HubDB

Hi @Teun ,

I was able to locate the documentation of migrating to private app and tried out the approach suggested in there. I was able to get the Custom Code action working with the Access token instead of API KEY.

Pre-requisite: Create a private app with your deveopers HubSpot account

For new internal integrations, HubSpot recommends using Service Keys under Settings > Integrations > Service Keys. Creation of legacy private apps is being phased out in September–October 2026.

Here is the final code snippet which could help someone else as well:

const hubspot = require(‘@hubspot/api-client’);

exports.main = async (event, callback) => {

const hubspotClient = new hubspot.Client({
accessToken: process.env.ACCESSTOKEN
});

// Make sure ACCESSTOKEN is added in SecretKey
const values = {

“id”:“3”,
“userid”: “16”,
“title”: “Test new row”,
“completed”: “true”,
};

const HubDbTableRowV3Request = { path: “test_path11”, name: “test_title11”, values };
const tableIdOrName = “test_table”;

try {
const apiResponse = await hubspotClient.cms.hubdb.rowsApi.createTableRow(tableIdOrName, HubDbTableRowV3Request);
console.log(JSON.stringify(apiResponse.body, null, 2));
} catch (e) {
e.message === ‘HTTP request failed’ ? console.error(JSON.stringify(e.response, null, 2)) : console.error(e)
}
};

Thank you so much on working this with me and taking this to resolution. I really appreciate it. :slightly_smiling_face:

Have a great day ahead.

Best Regards,
Swapnil

Moderator Note: this post was reviewed for relevancy and optimized for clarity on October 22, 2026. Thank you for your contributions to the HubSpot Community!