The Companies API icon

The Companies API

Access company data, enrichment, analytics and more using The Companies API

Overview

This node integrates with The Companies API to query detailed company data using a flexible segmentation engine. Specifically, the "Ask company" operation allows users to pose complex queries about companies based on various attributes and receive AI-powered answers or insights.

Common scenarios where this node is beneficial include:

  • Market research teams wanting to segment companies by industry, size, location, or technologies used.
  • Sales or business development professionals seeking targeted company information filtered by custom criteria.
  • Data analysts looking to enrich datasets with company metadata or generate insights from company profiles.
  • Product managers or strategists querying company data with natural language questions for decision support.

Practical example:

  • Asking "Which companies in the software industry have more than 100 employees and are headquartered in California?" by building a query with multiple rules.
  • Requesting an AI-generated summary or explanation about a specific company or group of companies using the question property.

Properties

Name Meaning
Query A collection of one or more rules defining conditions for filtering companies. Each rule specifies an attribute (e.g., industry, revenue), an operator (and/or), a comparison sign (equals, greater, etc.), and values.
Domain The domain name of the company to query.
Model The AI model size to use for answering the question. Options: "Small", "Large".
Explain Boolean flag indicating whether to return an explanation for the answer.
Fields List of specific fields to include in the response.
Question The natural language question to ask about the company or companies matching the query.
List ID Numeric identifier of a predefined list of companies to filter within.

Details on Query Rules (within Query property):

Each rule includes:

  • Attribute: Company attribute to filter on (e.g., "about.businessType", "finances.revenue", "locations.headquarters.country.code").
  • Blocked operator: Boolean flag (purpose not explicitly described).
  • Operator: Logical operator connecting rules ("And" / "Or").
  • Sign: Comparison operator ("Equals", "Exact equals", "Greater", "Lower", "Not equals").
  • Values: One or more string values to compare against.

Output

The node outputs JSON data containing the response from The Companies API for the "askCompany" operation. This typically includes:

  • The AI-generated answer or insight related to the question posed.
  • Possibly additional metadata or explanation if the "Explain" option is enabled.
  • The output is paired with the input item index for traceability.

No binary data output is indicated for this operation.

Dependencies

  • Requires an API token credential for authenticating with The Companies API.
  • Uses the official SDK from @thecompaniesapi/sdk.
  • The node expects the API token to be configured in n8n credentials before execution.

Troubleshooting

  • Unknown operation error: If an invalid operation name is provided, the node throws an error "Unknown operation". Ensure the operation is set exactly to "askCompany".
  • SDK method not found: If the SDK does not expose the expected method, verify that the SDK version matches the node implementation.
  • Empty or invalid query parameters: The node cleans empty or null parameters before sending; however, missing required query rules or malformed inputs may cause API errors.
  • API authentication failures: Ensure the API token credential is valid and has necessary permissions.
  • Continue on fail: If enabled, errors per item will be returned as JSON with an error message instead of stopping execution.

Links and References

Discussion