Authentication

Learn how to authenticate with the MythicDot API using API keys. Secure your integration with best practices.

Overview

The MythicDot API uses API keys for authentication. Include your API key in the Authorization header of each request. Keep your API keys secure and never expose them in client-side code.

HTTP Header
Authorization: Bearer sk-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

API Key Types

🔑 Secret Keys

Full access to all API endpoints. Use only in secure server-side environments.

sk-...

🔐 Project Keys

Scoped access to specific projects. Ideal for microservices and team separation.

sk-proj-...

⚠️ Never expose API keys

API keys should never be included in client-side code, public repositories, or browser requests. Always call the API from your backend server.

Getting Your API Key

Create an Account

Sign up for a MythicDot account at mythicdot.ai/signup.

Go to API Keys

Navigate to the Dashboard and click on "API Keys" in the sidebar.

Create New Key

Click "Create new secret key" and give it a descriptive name like "production-server".

Copy and Store Securely

Copy your key immediately — you won't be able to see it again. Store it in a secure password manager or secrets vault.

Using API Keys

Python

Python
import os
from mythicdot import MythicDot

# Recommended: Load from environment variable
client = MythicDot(api_key=os.environ.get("MYTHICDOT_API_KEY"))

# Or: The SDK automatically reads MYTHICDOT_API_KEY from env
client = MythicDot()

# Make a request
response = client.chat.completions.create(
    model="mythic-4",
    messages=[{"role": "user", "content": "Hello!"}]
)

cURL

Bash
curl https://api.mythicdot.ai/v1/chat/completions \
  -H "Authorization: Bearer $MYTHICDOT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "mythic-4",
    "messages": [{"role": "user", "content": "Hello!"}]
  }'

Node.js

JavaScript
import MythicDot from 'mythicdot';

// Automatically reads from MYTHICDOT_API_KEY env var
const client = new MythicDot();

// Or explicitly pass the key
const client = new MythicDot({
  apiKey: process.env.MYTHICDOT_API_KEY
});

Environment Variables

The SDK recognizes these environment variables:

Variable Description
MYTHICDOT_API_KEY Your API key (required)
MYTHICDOT_ORG_ID Organization ID (optional, for multi-org accounts)
MYTHICDOT_BASE_URL API base URL (optional, for testing)

Security Best Practices

🔒 Keep Your Keys Secure

Use environment variables, never hardcode keys
Never commit API keys to version control
Use different keys for dev/staging/production
Rotate keys periodically
Restrict key permissions when possible
Monitor usage in the dashboard
Revoke compromised keys immediately
Use secrets managers (Vault, AWS Secrets)

Managing API Keys

You can manage your API keys in the Dashboard: