Search icon

Query and filter customer data from HubSpot

Search your HubSpot CRM with Kestra to pull the 10 most recently created companies, returning name, domain, and industry properties for downstream pipelines.

Categories
Business
id: hubspot-query-company
namespace: company.team
tasks:
  - id: search_companies
    type: io.kestra.plugin.hubspot.companies.Search
    apiKey: "{{ secret('HUBSPOT_API_KEY') }}"
    properties:
      - name
      - domain
      - industry
    limit: 10
    sorts:
      - propertyName: "createdate"
        direction: "DESCENDING"

Pulling fresh company records out of your HubSpot CRM usually means glue code, manual API calls, or brittle scripts that nobody maintains. This blueprint turns that into a single declarative Kestra flow that searches HubSpot companies, sorts them by creation date, and returns the latest 10 with exactly the CRM properties you care about (name, domain, industry). It gives revenue, marketing, and data teams a repeatable, auditable way to surface new accounts and feed them into reporting, enrichment, or downstream automation.

How it works

The flow runs a single task, search_companies, of type io.kestra.plugin.hubspot.companies.Search. It authenticates to the HubSpot CRM API using an apiKey resolved from {{ secret('HUBSPOT_API_KEY') }}, so no credentials live in the flow definition. The task requests the name, domain, and industry properties, applies a limit of 10, and sorts results by createdate in DESCENDING order so the newest companies come back first. The output is the matching set of company records, ready to pass to later tasks.

What you get

  • The 10 most recently created HubSpot companies on each run.
  • A clean property set: company name, domain, and industry.
  • Secret-based authentication, no hardcoded API keys.
  • A reusable task you can extend with filters, larger limits, or additional properties.

Who it's for

  • RevOps and sales operations teams tracking newly created accounts.
  • Marketing teams syncing company data into campaigns and enrichment tools.
  • Data and analytics engineers feeding CRM data into warehouses and reports.

Why orchestrate this with Kestra

HubSpot workflows can react inside HubSpot, but they cannot orchestrate the steps that come before and after a query across your wider stack. With Kestra you can attach event or schedule triggers, add automatic retries when the CRM API rate limits or times out, chain the company records into enrichment, warehouse loads, and alerts, and keep full execution lineage for every run. Everything is declarative YAML you can version, review, and reuse, filling the gap HubSpot's own automation leaves between the CRM and the rest of your data platform.

Prerequisites

  • A running Kestra instance.
  • A HubSpot account with CRM API access and a private app or API key scoped to read companies.

Secrets

  • HUBSPOT_API_KEY: your HubSpot API key (or private app token) used to authenticate the company search.

Quick start

  1. Add the HUBSPOT_API_KEY secret to your Kestra instance.
  2. Copy this blueprint into a flow in your namespace.
  3. Execute the flow and inspect the returned company records in the execution outputs.
  4. Adjust the properties, limit, or sorts to match your reporting needs.

How to extend

  • Increase limit or page through results to capture more companies.
  • Add CRM properties such as lifecyclestage, city, or numberofemployees.
  • Add a schedule or webhook trigger to run the query automatically.
  • Pipe the output into a database, data warehouse, Slack alert, or enrichment task.

Links

Tasks
Share this Blueprint
See How

New to Kestra?

Use blueprints to kickstart your first workflows.