Skip to main content

Authentication

InstaVM uses API keys for authentication. You can create and manage your API keys through the InstaVM Dashboard.

Getting an API Key

  1. Sign up at InstaVM Dashboard
  2. Navigate to the API Keys section
  3. Click "Create New API Key"
  4. Copy your API key (it starts with Iben...)
Keep Your API Key Secure

Never commit API keys to version control or share them publicly. Treat them like passwords.

Using API Keys

Store your API key as an environment variable:

export INSTAVM_API_KEY="Ibenx6XQetSm8Nvcngy3H18nyAwqKM8RtFDhHUid7aE"

Then use it in your code:

import os
from instavm import InstaVM

# Load from environment variable
api_key = os.getenv('INSTAVM_API_KEY')
vm = InstaVM(api_key)

Direct Usage

You can also pass the API key directly (not recommended for production):

from instavm import InstaVM

vm = InstaVM("Ibenx6XQetSm8Nvcngy3H18nyAwqKM8RtFDhHUid7aE")

API Key Management

Creating Multiple Keys

You can create multiple API keys for different environments or applications:

  • Production: prod_Iben...
  • Development: dev_Iben...
  • Testing: test_Iben...

Rotating Keys

For security best practices:

  1. Generate a new API key
  2. Update your application configuration
  3. Test the new key works
  4. Delete the old key

Key Permissions

Currently, all API keys have full access to your account. Future versions will support scoped permissions.

Authentication Errors

Common authentication errors and solutions:

Invalid API Key

AuthenticationError: Invalid API key or session expired

Solutions:

  • Verify your API key is correct
  • Check for extra spaces or characters
  • Ensure the key hasn't been deleted

Session Expired

SessionError: Session expired

Solutions:

  • Start a new session
  • Check your session timeout settings

Rate Limited

RateLimitError: Rate limit exceeded

Solutions:

  • Wait before making more requests
  • Implement exponential backoff
  • Contact support for higher limits

Security Best Practices

Storage

  • ✅ Use environment variables or secure vaults
  • ✅ Use configuration files (excluded from version control)
  • ❌ Never hardcode in source code
  • ❌ Never commit to repositories

Usage

  • ✅ Use HTTPS for all API calls (default)
  • ✅ Rotate keys regularly
  • ✅ Monitor usage for anomalies
  • ✅ Delete unused keys

Example: Secure Configuration

# config.py
import os
from dataclasses import dataclass

@dataclass
class Config:
instavm_api_key: str = os.getenv('INSTAVM_API_KEY')

def __post_init__(self):
if not self.instavm_api_key:
raise ValueError("INSTAVM_API_KEY environment variable required")

# main.py
from instavm import InstaVM
from config import Config

config = Config()
vm = InstaVM(config.instavm_api_key)

Next Steps