Creating and Managing API Keys

API keys are used to authenticate your requests to the ViaHuman API. Each key is tied to your account and tracks usage for billing purposes.

Creating an API Key

  1. Navigate to your Dashboard
  2. Click on API Keys in the quick actions menu
  3. Click Create New API Key
  4. Enter a descriptive name for your key (e.g., "Production n8n Workflow")
  5. Click Create
  6. Important: Copy your API key immediately - it will only be shown once!

API Key Format

ViaHuman uses two types of API keys:

  • Live keys: vh_live_ + 32 hexadecimal characters

    • Used for production environments
    • Counts toward your billing usage
  • Test keys: vh_test_ + 32 hexadecimal characters

    • Used for development and testing
    • Currently not available (coming soon)

Example: vh_live_abcd1234567890abcdef1234567890ab

Using Your API Key

Include your API key in the Authorization header of all API requests:

curl -X POST https://api.viahuman.xyz/v1/approvals \
  -H "Authorization: Bearer vh_live_your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{"title": "Test Approval"}'

In JavaScript/TypeScript

const response = await fetch('https://api.viahuman.xyz/v1/approvals', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer vh_live_your_api_key_here',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    title: 'Review AI Email',
    description: 'Please review before sending'
  })
});

In Python

import requests

headers = {
    'Authorization': 'Bearer vh_live_your_api_key_here',
    'Content-Type': 'application/json'
}

data = {
    'title': 'Review AI Email',
    'description': 'Please review before sending'
}

response = requests.post(
    'https://api.viahuman.xyz/v1/approvals',
    headers=headers,
    json=data
)

API Key Security

Best Practices

  • Never commit API keys to version control (Git, SVN, etc.)
  • Use environment variables to store API keys
  • Rotate keys regularly for enhanced security
  • Delete unused keys to reduce attack surface
  • Use separate keys for different environments (dev, staging, prod)

Example: Using Environment Variables

# .env file (add to .gitignore!)
VIAHUMAN_API_KEY=vh_live_your_api_key_here
// In your code
const apiKey = process.env.VIAHUMAN_API_KEY;

Rate Limiting

Each API key has a rate limit to prevent abuse:

  • Default limit: 60 requests per minute
  • Rate limit headers are included in every response:
    • X-RateLimit-Limit: Maximum requests per minute
    • X-RateLimit-Remaining: Remaining requests in current window
    • X-RateLimit-Reset: When the limit resets

If you exceed the rate limit, you'll receive a 429 Too Many Requests response.

Usage Tracking

ViaHuman tracks your API usage for billing purposes:

  • Invocation count: Number of successful approval creations
  • Last used: Timestamp of the most recent API call
  • Status: Whether the key is active or deactivated

You can view usage statistics in your Dashboard.

Deleting an API Key

To delete an API key:

  1. Go to your API Keys page
  2. Find the key you want to delete
  3. Click the Delete button
  4. Confirm the deletion

Note: Deleting a key is permanent. Any applications using that key will immediately stop working.

Troubleshooting

"Invalid API key" Error

  • Verify you copied the entire key (starts with vh_live_ or vh_test_)
  • Check that the key hasn't been deleted
  • Ensure you're using the Authorization: Bearer header format

"Rate limit exceeded" Error

  • Wait for the rate limit window to reset (shown in X-RateLimit-Reset header)
  • Reduce the frequency of your API calls
  • Contact support if you need a higher rate limit

Key Not Working After Creation

  • Make sure you copied the key correctly when it was first shown
  • Check that you're using the correct API endpoint
  • Verify your account is in good standing

Need Help?