> For the complete documentation index, see [llms.txt](https://docs.rewst.help/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.rewst.help/documentation/automations/subworkflows/prod-task-huntress-get-license-counts.md).

# \[PROD - TASK] Huntress: Get License Counts

This workflow queries the Huntress security platform to retrieve and compile license usage data across all client organizations, serving as a critical building block for license management, billing reconciliation, and capacity planning automations. For MSPs, this function provides essential visibility for client billing accuracy, license compliance tracking, and identifying opportunities to optimize security coverage across the client base. Technically, the workflow first authenticates with Huntress, then retrieves the complete list of managed organizations, calculates agent deployment counts per organization, and compiles this data for integration with other systems like PSAs for billing or reporting tools for client reviews. This data can be particularly valuable when integrated with onboarding/offboarding workflows or when preparing for quarterly business reviews to assess security tool adoption and coverage gaps.

This workflow contains 6 tasks.

### Inputs

### Outputs

* **automation\_log**: Standardized Rewst automation log
* **huntress\_count**: List of Huntress companies and their counts.

### Key tasks

* **huntress\_list\_organizations**: Huntress integration: List Organizations
* **get\_huntress\_agent\_count**: Data retrieval
* **build automation log**: Logging
* **BEGIN**: Core integration: noop
* **action\_error**: Core integration: noop

### Jinja examples

#### Example 1

```jinja
{{ [ { "company": org.name |d, "count": org.agents_count |d, "company_id": org.id |d } for org in CTX.huntress_orgs ] }}
```

This expression creates a structured list of all client organizations with their Huntress agent deployment statistics. It iterates through each organization in your Huntress integration (`CTX.huntress_orgs`), extracting the company name, agent count, and company ID into a list of dictionaries, with the `|d` filter providing empty string defaults for any missing values.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.rewst.help/documentation/automations/subworkflows/prod-task-huntress-get-license-counts.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
