Authentication

    Generate API keys, understand scopes, and authenticate requests.

    Overview

    DNScale uses API keys for authentication. Each API key is scoped to a customer account and carries specific permissions that control what operations it can perform.

    Customer Context

    Your API key automatically provides customer context. You don't need to specify a customer ID in API requests—the system determines your customer from the authenticated key.

    Creating API Keys

    Via the Dashboard

    1. Navigate to DNScale Dashboard → Settings → API Keys
    2. Click Create API Key
    3. Enter a name and select the required scopes
    4. Copy and securely store the key—it's only shown once

    Via the API

    Create a key for a specific user:

    curl -X POST https://api.dnscale.eu/v1/users/{user_id}/apikeys \
      -H "Authorization: Bearer YOUR_API_KEY" \
      -H "Content-Type: application/json" \
      -d '{
        "name": "Terraform Automation",
        "scopes": ["zones:read", "zones:write", "records:read", "records:write"]
      }'

    Response:

    {
      "status": "success",
      "data": {
        "id": "key_abc123",
        "name": "Terraform Automation",
        "key": "dnscale_live_xxxxxxxxxxxxxxxxxxxx",
        "scopes": ["zones:read", "zones:write", "records:read", "records:write"],
        "created_at": "2025-01-15T10:30:00Z"
      }
    }
    Store Securely

    The API key is only returned once. Store it securely in a secrets manager or environment variable.

    Using API Keys

    Include your API key in the Authorization header:

    curl https://api.dnscale.eu/v1/zones \
      -H "Authorization: Bearer dnscale_live_xxxxxxxxxxxxxxxxxxxx"

    Managing API Keys

    List API Keys

    curl https://api.dnscale.eu/v1/users/{user_id}/apikeys \
      -H "Authorization: Bearer YOUR_API_KEY"

    Get API Key Details

    curl https://api.dnscale.eu/v1/users/{user_id}/apikeys/{key_id} \
      -H "Authorization: Bearer YOUR_API_KEY"

    Delete API Key

    curl -X DELETE https://api.dnscale.eu/v1/users/{user_id}/apikeys/{key_id} \
      -H "Authorization: Bearer YOUR_API_KEY"

    Deletion is immediate and revokes all active sessions using that key.

    Scopes Reference

    Scopes control what operations an API key can perform. Use the principle of least privilege—grant only the scopes required for your use case.

    Core Resource Scopes

    ScopeGrants
    zones:readList and view DNS zones
    zones:writeCreate, update, and delete DNS zones
    records:readList and view DNS records
    records:writeCreate, update, and delete DNS records
    dnssec:readView DNSSEC status and keys
    dnssec:writeEnable/disable DNSSEC, manage cryptographic keys

    Account Management Scopes

    ScopeGrants
    users:readList and view team members
    users:writeCreate, update, and delete users
    apikeys:readList and view API keys
    apikeys:writeCreate and delete API keys
    customers:readView customer account details
    customers:writeUpdate customer account settings

    Usage & Billing Scopes

    ScopeGrants
    usage:readView usage statistics
    billing:readView billing summaries and history
    alerts:readView usage alerts
    alerts:writeCreate, update, and delete alerts

    DNS Automation (Terraform, Ansible)

    ["zones:read", "zones:write", "records:read", "records:write"]

    ACME DNS-01 Challenge (Let's Encrypt)

    ["zones:read", "records:read", "records:write"]

    Read-Only Monitoring

    ["zones:read", "records:read", "usage:read"]

    Full Account Management

    ["zones:read", "zones:write", "records:read", "records:write", "dnssec:read", "dnssec:write", "users:read", "users:write", "apikeys:read", "apikeys:write", "usage:read", "billing:read"]

    Security Best Practices

    1. Use separate keys for different automation tools and environments
    2. Rotate keys regularly - Delete old keys and create new ones periodically
    3. Grant minimal scopes - Only include the permissions actually needed
    4. Never commit keys to version control
    5. Use environment variables or secrets managers to store keys
    6. Monitor key usage via the dashboard audit log