Authentication overview

Hume AI employs API keys as the primary method for authenticating requests to its platform. This approach grants controlled access to its services, including the Empathic Voice Interface (EVI) and Expression Measurement API. API keys serve as a unique identifier for your application or user, linking API calls to your Hume AI account and ensuring that only authorized entities can consume resources and data. All communication with Hume AI APIs is secured using HTTPS/TLS, encrypting data in transit to protect credentials and payload information from interception.

Using API keys simplifies the integration process for developers by requiring a single token for authorization, rather than more complex protocols like OAuth 2.0 for user delegation. While straightforward, proper management of these keys is critical to maintain the security of your applications and prevent unauthorized access to your Hume AI services and associated data.

Supported authentication methods

Hume AI's authentication strategy focuses on API keys. This method is suitable for server-to-server communication where a backend application or service makes calls to Hume AI APIs. It is also applicable for client-side applications that can securely manage and transmit the API key without exposing it to unauthorized parties or public repositories.

The table below summarizes the authentication method supported by Hume AI:

Method When to Use Security Level
API Key Backend services, server-side applications, secure client environments where the key can be protected. Ideal for direct application-to-API communication. High (when properly managed and transmitted over HTTPS)

While API keys are efficient for service authentication, developers should be aware of the security considerations. Unlike OAuth 2.0, API keys do not provide granular permissions or refresh tokens; a compromised API key grants the same level of access as the original keyholder within the scope defined by Hume AI. For a general overview of API key security, refer to the Google Maps Platform API key guide.

Getting your credentials

To obtain an API key for Hume AI, you must register for an account and access the Hume AI Developer Portal. This portal serves as the central hub for managing your API keys, monitoring usage, and accessing documentation.

  1. Account Creation: Navigate to the Hume AI homepage and sign up for an account. If you are new, you may opt for the free tier to begin.
  2. Access Developer Portal: Once registered and logged in, locate the section designated for API key management, typically found under 'Account Settings', 'API Access', or 'Credentials' within the developer portal.
  3. Generate API Key: Follow the instructions to generate a new API key. The portal will typically provide a unique string of characters that represents your key. It is crucial to copy this key immediately upon generation, as some platforms do not display the key again for security reasons.
  4. Environment Configuration: Store your API key securely. Best practices suggest using environment variables or a secure configuration management system rather than hardcoding the key directly into your application's source code. This approach prevents accidental exposure of the key in version control systems or public repositories.

Hume AI's documentation provides specific instructions on how to generate and manage API keys for their Empathic Voice Interface and Expression Measurement APIs. Refer to the Hume AI documentation portal for detailed, up-to-date guidance on credential setup.

Authenticated request example

Once you have obtained your Hume AI API key, you can include it in your API requests. The key is typically sent in the Authorization header using the Bearer scheme, or as a query parameter, depending on the specific API endpoint. Hume AI's APIs generally expect the API key in the request header.

Below is an example of an authenticated request using Python, demonstrating how to include your API key when interacting with a Hume AI endpoint. This example assumes you want to use the Expression Measurement API.


import requests
import os

# It's recommended to store your API key as an environment variable
HUME_API_KEY = os.getenv("HUME_API_KEY") 

if not HUME_API_KEY:
    raise ValueError("HUME_API_KEY environment variable not set.")

# Example endpoint for Expression Measurement API
# Replace with the actual endpoint you intend to call
api_endpoint = "https://api.hume.ai/v0/expression/" 

headers = {
    "Authorization": f"Bearer {HUME_API_KEY}",
    "Content-Type": "application/json"
}

# Example payload (adjust based on the specific API you are calling)
payload = {
    "data": "base64_encoded_audio_or_image_data",
    "config": {
        "face": {
            "detect_faces": True
        },
        "prosody": {
            "detect_prosody": True
        }
    }
}

try:
    response = requests.post(api_endpoint, headers=headers, json=payload)
    response.raise_for_status() # Raise an exception for HTTP errors (4xx or 5xx)

    print("Request successful!")
    print("Response:", response.json())

except requests.exceptions.HTTPError as http_err:
    print(f"HTTP error occurred: {http_err}")
    print("Response content:", response.text)
except Exception as err:
    print(f"An error occurred: {err}")

For JavaScript examples or details on specific API endpoints and their expected payloads, consult the Hume AI Empathic Voice Interface API reference and other relevant documentation sections.

Security best practices

Securing your Hume AI API keys is paramount to preventing unauthorized access, abuse of your account, and potential data breaches. Adhering to established security practices for API keys is essential.

  • Environment Variables: Always store API keys as environment variables rather than hardcoding them directly into your application's source code. This prevents keys from being committed to version control systems like Git and exposed in public repositories. For example, in a local development environment, you might set export HUME_API_KEY="your_api_key_here".
  • Secure Configuration Management: For production deployments, use secure configuration management tools or secrets management services (e.g., AWS Secrets Manager, Google Cloud Secret Manager, Azure Key Vault) to store and retrieve API keys. These services provide encrypted storage and controlled access to sensitive credentials.
  • HTTPS/TLS Enforcement: Ensure all communications with Hume AI APIs are conducted over HTTPS/TLS. This encrypts data in transit, protecting your API key and request payloads from eavesdropping and man-in-the-middle attacks. Hume AI inherently enforces HTTPS, but it's crucial to confirm your client library or HTTP client is configured to validate SSL certificates. The Internet Engineering Task Force (IETF) provides detailed specifications for Hypertext Transfer Protocol Version 2 (HTTP/2) and its security mechanisms.
  • Access Control: Implement strict access controls for systems or individuals who can access and manage API keys. Limit who can generate, view, or revoke keys within your organization.
  • Key Rotation: Periodically rotate your API keys. This practice reduces the window of opportunity for a compromised key to be exploited. If a key is suspected of being compromised, revoke it immediately and generate a new one.
  • IP Whitelisting (if available): If Hume AI offers IP whitelisting capabilities, configure your API keys to only accept requests originating from a predefined list of trusted IP addresses. This adds an additional layer of security by restricting where requests can come from.
  • Monitor Usage: Regularly monitor your API key usage logs within the Hume AI Developer Portal. Unusual spikes in activity or requests from unexpected locations could indicate a compromised key.
  • Client-Side Exposure Mitigation: Avoid embedding API keys directly into client-side code (e.g., JavaScript in a web browser) if the key provides broad access. If a key must be used client-side, consider using a proxy server to mediate requests, or ensure the key has highly restricted permissions and is scope-bound to prevent abuse.