Authentication is required to securely access the Hive V2 API. Each project is equipped with two unique API keys, designed to ensure uninterrupted access and flexibility during key rotation.
Where to Find Your API Keys
Your project’s API keys are available in the Project Dashboard. Each project is assigned two API keys, which can be used interchangeably. Having two keys allows for seamless transitions during key refreshes without interrupting your API access.
Why Two API Keys?
While only one API key is needed to authenticate requests, having two keys offers additional flexibility:
- You can rotate one key while keeping the other active, ensuring no downtime for your submissions.
- Each key can be refreshed independently, allowing for secure and convenient key management.
How to Use Your API Key
To authenticate requests, include your API key in the HTTP header:
authorization: token <YOUR_API_KEY>
This header is required for all API calls. For example, when making a request to the V2 API, your endpoint should look like this:
- Asynchronous endpoint:
https://api.thehive.ai/api/v2/task/async
- Synchronous endpoint:
https://api.thehive.ai/api/v2/task/sync
Example Request
Here’s a sample curl
command demonstrating how to include the authorization
header:
curl -X POST \
-H "authorization: token <YOUR_API_KEY>" \
-H "accept: application/json" \
-d '{"some_data_here"}' \
https://api.thehive.ai/api/v2/task/async
For more details on submitting tasks, check out Creating Tasks in the API.