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 fetch analytics data about companies based on user-defined queries and filters. It is designed to retrieve aggregated insights such as counts or statistics related to companies matching specific criteria.

Typical use cases include:

  • Market research teams analyzing company segments by industry, location, or size.
  • Sales teams identifying potential leads filtered by business attributes.
  • Data analysts generating reports on company demographics or technology usage.

For example, a user might query for companies in the "technology" industry with more than 100 employees and then fetch analytics like monthly visitors or revenue distribution.

Properties

Name Meaning
Query A set of conditions defining the segmentation filter for companies. Each condition includes:
- Attribute (e.g., "About > business type", "Finances > revenue")
- Blocked operator (boolean)
- Operator ("And" / "Or")
- Sign ("Equals", "Greater", etc.)
- Values (one or multiple strings)
Size Number specifying how many results to return (default 25).
Sort Order to sort the results by the selected attribute; options are Ascending ("asc") or Descending ("desc").
Attribute The company attribute to analyze or sort by, e.g., "about.businessType", "analytics.monthlyVisitors", "finances.revenue".
List ID Numeric identifier of a company list to filter analytics within a specific list.
Action ID Numeric identifier of an action to filter analytics related to a particular enrichment or event.

Output

The node outputs JSON data containing the analytics results returned by The Companies API. The structure typically includes aggregated metrics or counts relevant to the queried companies.

Example output JSON structure (simplified):

{
  "data": {
    "attribute": "finances.revenue",
    "results": [
      {
        "value": "1000000-5000000",
        "count": 123
      },
      {
        "value": "5000000-10000000",
        "count": 45
      }
    ]
  }
}

If binary data were supported (not indicated here), it would represent downloadable analytics reports or exports.

Dependencies

  • Requires an API token credential for authenticating with The Companies API.
  • Uses the official SDK from @thecompaniesapi/sdk.
  • Requires network access to The Companies API endpoints.
  • No additional environment variables beyond the API token credential are needed.

Troubleshooting

  • Unknown operation error: If the operation parameter is invalid or misspelled, the node throws an error indicating the unknown operation. Ensure the operation name matches exactly "fetchCompaniesAnalytics".
  • Missing or invalid API token: Authentication failures occur if the API token credential is missing or incorrect. Verify the API key is valid and properly configured in n8n credentials.
  • Invalid query parameters: If required query fields are missing or malformed, the API may reject the request. Double-check that all required properties (like attribute, operator, values) are correctly set.
  • Empty or no results: This can happen if the query filters are too restrictive or do not match any companies. Try broadening the query conditions.
  • SDK method not found: Indicates a mismatch between the operation and available SDK methods. This should not occur if using the provided operation names.

Links and References

Discussion