Create API Token

Generate new API tokens for authentication using the create_api_token() method.

Example

from mira_network import MiraClient

async def create_token():
    async with MiraClient(api_key="your-api-key") as client:
        # Create new API token
        new_token = await client.create_api_token({
            "description": "Production API Key"
        })
        print(f"New token created: {new_token}")

Response Structure

{
    "token": "sk-mira-xxxx...",  # API keys start with sk-mira-
    "description": "Production API Key",
    "created_at": "2024-01-01T00:00:00Z"
}

Usage Notes

  • Store tokens securely
  • Use descriptive names for easy identification
  • Keep track of token creation dates
  • Monitor usage metrics in Mira Console with detailed analytics
  • API keys always start with sk-mira-