Introduction
The Hunch Tools API allows you to programmatically run tools and retrieve their results. This enables you to integrate Hunch’s powerful AI capabilities into your own applications, scripts, or workflows. Whether you’re building a custom integration or automating repetitive tasks, the Tools API provides a flexible way to leverage Hunch’s functionality.Generating an API Key
Before you can use the Tools API, you’ll need to generate an API key:- Log in to your Hunch account
- Click on your avatar in the upper left corner
- Select “API Key” section
- Click “Generate API Key”
- Copy and securely store your new API key
Finding a Tool UID
Each tool in Hunch has a unique identifier (UID). You’ll need this UID to run a specific tool via the API. To find a tool’s UID:- Open the tool in the Hunch interface
- Look at the URL in your browser
- The tool UID is the first alphanumeric string after
/tool/in the URL
https://app.hunch.tools/app/tool/4p2QJ/NZmZN, the tool UID is 4p2QJ.
Making API Requests
The Tools API has two main endpoints:POST /v1beta2/tool/start-run: Starts a new run of a toolGET /v1beta2/tool/run-status/{tool_run_uid}: Checks the status of a tool run
Authorization header:
Example: Starting a Tool Run
tool_run_uid, which you’ll use to check the run status.
Example: Checking Tool Run Status
Workflow Integration
Hunch tools can be easily integrated into popular workflow automation platforms like Zapier and Make.com (formerly Integromat). These platforms allow you to create complex workflows that can trigger Hunch tools based on various events or schedules, and then use the results in subsequent steps of your workflow.Best Practices
- Rate Limiting: Be mindful of AI provider rate limits.
- Secure Storage: Always store your API key securely and never expose it in client-side code.
- Asynchronous Processing: For tools that may take longer to run, implement asynchronous processing by starting the run and then periodically checking its status.
- Error Handling: Implement robust error handling to manage potential API errors or unexpected responses.
Next Steps
- Explore the full API documentation for detailed information on request and response structures.
- Experiment with different tools to see how they can enhance your workflows and applications.
- Join our community Discord to share your integrations and get help from other developers.
Bonus: Complete Python Example
Here’s a complete Python script that starts a tool run and waits for it to complete:Python