Authentication

The Mirako API uses API key authentication to secure access to all endpoints. This guide covers how to create, manage, and use API keys effectively.

Authentication Method

Mirako uses Bearer token authentication. All API requests must include your API key in the Authorization header:

Authorization: Bearer your_api_key_here

Creating API Keys

  1. Log in to your Mirako Developer Portal
  2. Navigate to DashboardAPI Keys
  3. Click Generate New API Key
  4. Provide a descriptive label (e.g., "Production App", "Development")
  5. Copy and securely store your API key

Using API Keys

You can test if you api key is working by listing your avatars:

sh
curl -X GET "https://mirako.co/v1/avatar/list" \
  -H "Authorization: Bearer your_api_key_here" \
  -H "Content-Type: application/json"

When using it in your application, store the key as an environment variable or in a secure configuration file.

python
import os
from dotenv import load_dotenv

# Load environment variables from .env file
load_dotenv()

API_KEY = os.getenv('MIRAKO_API_KEY')
if not API_KEY:
    raise ValueError("MIRAKO_API_KEY environment variable not set")

.env file:

MIRAKO_API_KEY=your_api_key_here

Note: Avoid hardcoding your API key directly in your code. Instead, use environment variables or secure vaults / parameter management system (e.g. AWS Parameter Store / GCP Secret Manager).

Dive Deeper