Skip to content

Authentication Info

The auth resource lets you retrieve metadata about the API key currently being used to authenticate with Honeycomb.

Use Cases

  • Verify your API key is working correctly
  • Discover which team/environment a key belongs to
  • Check key permissions and scopes
  • Audit key expiration dates

Basic Usage

Get auth info using a configuration key (v1) $HONEYCOMB_API_KEY:

async def get_auth_info_basic(client: HoneycombClient):
    """Get auth info using an API key (v1).

    Args:
        client: Authenticated HoneycombClient with API key

    Returns:
        AuthInfo object with team and environment details
    """
    auth_info = await client.auth.get_async()

    print(f"Team: {auth_info.team.name}")
    print(f"Environment: {auth_info.environment.name}")
    print(f"Key Type: {auth_info.type}")
    return auth_info

Management Key

Get auth info using a management key (v2) $HONEYCOMB_MANAGEMENT_KEY and $HONEYCOMB_MANAGEMENT_SECRET:

async def get_auth_info_management(client: HoneycombClient):
    """Get auth info using management credentials (v2).

    Args:
        client: HoneycombClient with management_key and management_secret

    Returns:
        AuthInfoV2 object with scopes and team details
    """
    auth_info = await client.auth.get_async()  # Auto-detects v2
    print(f"Key Name: {auth_info.data.attributes.name}")
    print(f"Scopes: {auth_info.data.attributes.scopes}")
    # Team info is in included resources (JSON:API format)
    if auth_info.included:
        for resource in auth_info.included:
            if resource.type == "teams":
                print(f"Team: {resource.attributes.get('name')}")
    return auth_info

Explicit Version Selection

Force v2 endpoint (errors if not using management key):

async def get_auth_explicit_v2(client: HoneycombClient):
    """Force v2 endpoint (errors if not using management key).

    Args:
        client: HoneycombClient with management credentials

    Returns:
        AuthInfoV2 object
    """
    auth_info = await client.auth.get_async(use_v2=True)
    return auth_info

Force v1 endpoint (even with management key):

async def get_auth_explicit_v1(client: HoneycombClient):
    """Force v1 endpoint (even with management key).

    Args:
        client: HoneycombClient

    Returns:
        AuthInfo object
    """
    auth_info = await client.auth.get_async(use_v2=False)
    return auth_info

Response Models

AuthInfo (v1)

Field Type Description
id str API key identifier
type str configuration or ingest
team_name str Team name
team_slug str Team URL slug
environment_name str Environment name
environment_slug str Environment URL slug
api_key_access dict Key capabilities
time_to_live str? Expiration time (RFC3339)

AuthInfoV2 (v2 - Management Key)

Field Type Description
id str Management key identifier
name str Human-readable name
key_type str Always management
disabled bool Whether key is disabled
scopes list[str] Authorized scopes
team_id str Team identifier
team_name str? Team name
team_slug str? Team URL slug
created_at datetime? Creation timestamp
updated_at datetime? Last update timestamp