Check a company and VAT number from HubSpot with a workflow HTTP step

This is a recipe, not a HubSpot app and not a marketplace listing. A custom code action in a HubSpot workflow reads a company's country, register number and VAT number, calls the Prometiam API with a key held as a HubSpot secret, and returns the legal name, status, legal form and VAT result for a later step to write to company properties.

What exists, and what does not

There is no Prometiam app in the HubSpot marketplace and no native HubSpot connector. What works today is HubSpot's own Custom code workflow action, which runs a short Node.js function, and our REST API. The pages under Integrations say which channels are live: the n8n node, Postman, the SDKs and the MCP server. HubSpot is not one of them, so this page is code you paste into your own workflow, nothing you install.

What HubSpot says about the action

Read from HubSpot's developer page on custom code actions on 26 November 2026 (developers.hubspot.com, "Workflows | Custom Code Actions"; its robots.txt allows reading it). Check the page again before you build, because HubSpot changes it.

  • Plan condition, as HubSpot states it: the page opens by saying the Custom code action in workflows is for accounts with Data Hub Professional or Enterprise. It names no other subscription for the action.
  • Runtime: JavaScript on the Node.js runtime, or Python (beta), run as a serverless function by HubSpot on AWS Lambda. The page says Node.js 16 and 20 no longer receive security updates, asks you to upgrade to Node.js 24 before 17 November 2026, and says that from 3 November 2026 new actions can no longer use Node.js 20.
  • Shape: exports.main = (event, callback) => { ... }. event.inputFields holds the properties you add under "Properties to include in code" (up to 50). callback({ outputFields: { ... } }) returns the values.
  • Secrets: added in the action, then read as environment variables, for example process.env.SECRET_NAME. The total length of all secret values must not exceed 1,000 characters.
  • Outputs: you declare each output with a data type (number, string, boolean, datetime, enum, date, phone number). A later Edit records action can copy an output into a property. A string output is limited to 65,000 characters.
  • Limits: the code must finish within 20 seconds and use at most 128 MB of memory.
  • Libraries: axios ^1.2.0 is on the supported list, so the code below uses it.
  • Retries: if the call fails with a rate-limit error, or a 429 or 5XX error from axios or @hubspot/api-client, HubSpot reattempts for up to three days, starting one minute after the failure.

The page's sample event shows a contact ("objectType": "CONTACT"). The code below does not use the object at all, only the input fields, so it does not depend on the object type. Confirm in your portal that the action is offered in a company-based workflow.

The action

Add three properties under "Properties to include in code" and name them exactly: country (two letters, for example ES), register_number and vat_number (with its country prefix). Add the secret PROMETIAM_API_KEY. Declare seven string outputs, named as in the code. The function makes up to two calls of 1 credit each: the company record from GET /companies/by-identifier, then the VAT number from GET /vat/{number}.

const axios = require('axios');

const BASE = 'https://api.prometiam.com/functions/v1/risk-api';

exports.main = async (event, callback) => {
  const key = process.env.PROMETIAM_API_KEY; // the HubSpot secret
  const http = axios.create({
    baseURL: BASE,
    headers: { Authorization: `Bearer ${key}` },
    timeout: 8000,
    // 429 and 5xx throw an axios error, which HubSpot retries; every other status is read below
    validateStatus: (status) => status < 429,
  });

  const country = (event.inputFields['country'] || '').trim().toUpperCase();
  const registerNumber = (event.inputFields['register_number'] || '').trim();
  const vat = (event.inputFields['vat_number'] || '').replace(/[\s.-]/g, '');

  const out = {
    legal_name: '', company_status: '', legal_form: '',
    vat_check: 'not_checked', vat_vies_name: '', vat_register_match: '', check_note: '',
  };

  // Call 1 (1 credit): the company record, by register number or, without one, by VAT number.
  let params = null;
  if (country && registerNumber) params = { type: 'company_number', country, value: registerNumber };
  else if (vat) params = { type: 'vat', value: vat };
  if (params) {
    const r = await http.get('/companies/by-identifier', { params });
    if (r.status === 200) {
      const c = r.data.data;
      out.legal_name = c.company_name || '';
      out.company_status = c.status || '';
      out.legal_form = c.legal_form || '';
    } else if (r.status === 404) {
      out.company_status = 'not_found';
    } else {
      out.check_note = `record call refused: ${r.status} ${r.data?.error?.code || ''}`;
    }
  }

  // Call 2 (1 credit): the VAT number against VIES. EU numbers only (no NO, no CH, no GB).
  if (vat) {
    const v = await http.get(`/vat/${encodeURIComponent(vat)}`);
    if (v.status === 200) {
      out.vat_check = v.data.data.is_valid ? 'valid' : 'invalid';
      out.vat_vies_name = v.data.data.name || ''; // VIES withholds the name for some member states
      out.vat_register_match = v.data.data.registry_match?.company_name || ''; // our register's company under that number, not a VIES answer
    } else if (v.status === 400) {
      out.vat_check = 'not_an_eu_number';
    } else {
      out.vat_check = 'error';
    }
  }

  callback({ outputFields: out });
};

The choices in it: with a register number and a country it finds the company by that number, and without one it falls back to the VAT number. vat_check is valid, invalid, not_an_eu_number or error. VIES withholds the registered name for some member states, so vat_vies_name can be empty; vat_register_match is the company our register holds under that number, which is register data and not a VIES answer. A 429 or a 5xx makes axios throw, which is the case HubSpot says it retries.

Run on 26 November 2026

The function above was run locally with a test event shaped like HubSpot's sample (portal id 1, action id 2, object id 4, and the three input fields) against the live API with the public demo key, the key read from PROMETIAM_API_KEY in the environment. Telefonica's Spanish NIF and VAT number went in. It made two calls, used 2 credits and returned:

{
  "outputFields": {
    "legal_name": "TELEFONICA SA",
    "company_status": "active",
    "legal_form": "SA",
    "vat_check": "valid",
    "vat_vies_name": "",
    "vat_register_match": "TELEFONICA SA",
    "check_note": ""
  }
}

With a simulated 503 from the VAT call the function ends in an axios error (Request failed with status code 503), which is the case HubSpot's page says it retries.

What was not run: the code inside a HubSpot portal. That needs a Data Hub account, so the workflow editor, the secret store, the output types and the retry behaviour are described from HubSpot's page, not observed. Test the action with HubSpot's own "Test action" on a dedicated test record before you turn the workflow on, as its page recommends.

Map the outputs to company properties

After the custom code action, add an Edit records action and copy each output into a company property you create for it: legal_name to a text property, company_status and legal_form to text or dropdown properties, vat_check to a dropdown with the four values above. A later branch can use vat_check or company_status to route a record to a person. HubSpot's page links its list of compatible source and target property types.

What each output tells you

OutputWhat it tells you
legal_nameThe name the register holds for the company. Empty when no company was found.
company_statusThe register's status, normalised (active for Telefonica above), or not_found.
legal_formThe normalised legal form, such as SA.
vat_checkThe VIES result for the VAT number: valid means the number is registered for VAT, nothing more.
vat_vies_nameThe name VIES returned, often empty.
vat_register_matchThe company our register holds under that VAT number. Not confirmation of VAT registration.
check_noteA short note when a call was refused, for example a 400 for a malformed number.

What it costs

  • Up to 2 credits a run: 1 for the company record, 1 for the VAT check. With a register number and no VAT number it is 1; with a VAT number alone it is 2, because the record is then found by the VAT number.
  • An error costs nothing. The 14-day trial includes 500 credits (a card is required, nothing is charged during the trial, then Starter EUR 9.99 a month unless you cancel). Starter includes 1,000 credits a month at 60 requests a minute, Professional EUR 29.99 10,000 at 120, Scale EUR 99.99 50,000 at 300, Enterprise on request.
  • The public demo key is for trying the call by hand. It is shared, capped at 30 calls a minute and 1,000 a day, and should not sit in a production workflow.

Limits

  • It does not enrich a company with phone numbers, websites, employee counts or contacts. It returns register facts: name, status, legal form and a VAT result.
  • GET /vat/{number} covers the 27 EU member states and Northern Ireland (XI). VIES has no Norway or Switzerland, and GB VAT is out of scope after Brexit; those numbers come back as not_an_eu_number.
  • A VAT number shown by our register can be built by rule from the company identifier (vat_number_source rule): the format is right and the registration is not confirmed. Only the VIES result confirms it.
  • Each country's register has its own scope and limits, listed in the API documentation. Not every live country publishes a VAT number.
  • It does not match the HubSpot company name against the register name. Add a comparison step if you need one.
  • It does not check insolvency or sanctions. Insolvency notices (GET /insolvency/search, 2 credits) are corporate only, in sixteen markets, and no notice is not proof of solvency. Sanctions screening is beta.

Related pages

Sign up · API documentation

The free trial lasts 14 days and includes 500 credits. A card is required and nothing is charged during the trial; it then continues as Starter (EUR 9.99/month) unless you cancel.

Frequently asked questions

Is there a Prometiam app in the HubSpot marketplace?
No. This page is a recipe for HubSpot's own Custom code workflow action. Nothing is installed from a marketplace and Prometiam is not a HubSpot partner listing.
Which HubSpot plan do I need?
HubSpot's page for custom code actions, read on 26 November 2026, says the Custom code action in workflows is for accounts with Data Hub Professional or Enterprise. Check HubSpot's current pricing and the page itself, because the plan conditions are HubSpot's to change.
Where does the API key go?
In a HubSpot secret on the action, read in the code as process.env.PROMETIAM_API_KEY. Do not paste a key into the code field, which is visible to everyone who can edit the workflow.
Why use axios and not fetch?
HubSpot's page lists axios among the supported Node.js libraries and says it retries 429 and 5XX errors raised by axios. It does not list fetch.
What if my company records carry no register number?
Fill vat_number instead. The action then finds the company by VAT number, which works for the countries whose register publishes or derives one. Without either, the action returns empty outputs and calls nothing.