--- title: "Automate Historical Search with Python" slug: "automate-historical-search-with-python" tags: ["EDR with Forensics (EDRF)", "Endpoint Security", "Incident Responder"] updated: 2026-09-22T17:50:50Z published: 2026-09-22T17:51:17Z canonical: "docs.trellix.com/automate-historical-search-with-python" stale: true --- > ## Documentation Index > Fetch the complete documentation index at: https://docs.trellix.com/llms.txt > Use this file to discover all available pages before exploring further. # Automate Historical Search with Python You can programmatically run a historical search using Python scripts. These scripts communicate with the Endpoint Security (HX) Historical Search API, allowing you to run the same TQL statements used directly in the console. Use this package to: - Integrate EDR telemetry into third-party solutions. - Create custom automation workflows. - Develop security orchestration scripts. For more information about automation, see [Historical Search Python Scripts](https://github.com/trellix-enterprise/EDRF-HS-Scripts). ### Prerequisites Before you begin, ensure that your environment meets the following requirements: - Python version 3.8 or later is installed on the endpoints. - The Endpoint Security (HX) server is active, with the Historical Search module installed and enabled. - The Historical Search module is configured and connected to the EDR Telemetry Store server. - A valid Endpoint Security (HX) user API token is available for script authentication. ###### Generate API token To generate an API token, run the following command: ```plaintext curl -s -k GET "https://:3000/hx/api/v3/token" -H "accept: application/json" -i --user admin ``` > [!NOTE] > Note > > The API token is valid for 2.5 hours and expires after 15 minutes of inactivity. To avoid frequent API token renewal, use an API username and password. For more information about generating tokens, see [Access Token](/v1/docs/endpoint-security-api-documentation-module-user-guide-release-1-0-0#access-token).