Skip to main contentSkip to navigation
[email protected]
Client AreaSupport
Hosting Mammoth
HostingMammothYour Data, Our Responsibility
Home
Solutions
Hosting Services
Store
Pricing
About
Blog
API
Contact

Stay Ahead of the Curve

Get the latest insights on cybersecurity, AI innovations, and enterprise data solutions delivered to your inbox.

Hosting Mammoth
HostingMammothEnterprise Solutions

Enterprise-grade data solutions. Hosting, recovery, cybersecurity, and AI-powered services for businesses worldwide.

[email protected]
Sun - Fri, 9:00am - 5:00pm

Services

  • Cloud Hosting
  • Data Recovery
  • Cybersecurity
  • Legal Support
  • MSP Services
  • Web Development
  • AI Services
  • Free Server Migration

Hosting

  • VPS Hosting (NVMe SSD)
  • VDS Hosting (NVMe)
  • Storage VPS (High SSD)
  • GPU Servers
  • Managed Services
  • Cloud Firewall
  • Load Balancer
  • One-Click Apps
  • n8n Hosting
  • Object Storage
  • FAQ

Company

  • Store
  • Pricing
  • About Us
  • Locations
  • Blog
  • Testimonials
  • Contact
  • Affiliate Program
  • White-Label
  • Terms of Service
  • Privacy Policy
  • Browser Cookies
  • SLA

Support

  • Client Area
  • Submit Ticket
  • Knowledge Base
  • Server Status
  • API Documentation

© 2026 Hosting Mammoth. All rights reserved.

Knowledge Base
Getting StartedAccount ManagementVPS HostingGPU ServersStorage VPSCloud FirewallLoad BalancerServer ManagementBilling & PaymentsSupport & TicketsAffiliate ProgramReseller ProgramMarketplace & Appsn8n HostingManaged ServicesServer MigrationAPI & DevelopersSecurityTroubleshootingGlossaryInstall Guides
  1. Home
  2. /
  3. Support
  4. /
  5. API & Developers
  6. /
  7. Api Authentication
GUIDEAPI & Developers

API Authentication — Keys & JWT

4 min read

Every request to the Data Mammoth API must be authenticated. This guide covers how to generate API credentials, authenticate requests using API keys and JWT tokens, and follow security best practices.

Authentication Methods

Data Mammoth supports two authentication methods:

MethodBest ForExpiration
API KeysServer-to-server communication, scripts, automationNo expiration (until revoked)
JWT TokensShort-lived sessions, higher security requirementsConfigurable expiration

API Key Authentication

Generating an API Key

  • Log in to your Data Mammoth dashboard.
  • Navigate to Account Settings > API or API Keys.
  • Click Generate API Key.
  • Enter a descriptive label (e.g., "Production Automation", "CI/CD Pipeline").
  • Click Create.
  • Copy the API key and secret immediately — the secret is shown only once.
  • Using API Keys in Requests

    Include your API key in the Authorization header as a Bearer token:

    bash
    curl -X GET "https://api.datamammoth.com/v1/servers" \
      -H "Authorization: Bearer dm_key_abc123def456" \
      -H "Content-Type: application/json"

    API Key Format

    API keys follow the format: dm_key_ followed by a random alphanumeric string. Keep this key confidential.

    JWT Authentication

    JWT (JSON Web Token) authentication provides time-limited tokens for enhanced security.

    Obtaining a JWT Token

    Exchange your API credentials for a JWT token:

    bash
    curl -X POST "https://api.datamammoth.com/v1/auth/token" \
      -H "Content-Type: application/json" \
      -d '{
        "api_key": "dm_key_abc123def456",
        "api_secret": "your_api_secret"
      }'

    Response:

    json
    {
      "token": "eyJhbGciOiJIUzI1NiIs...",
      "expires_at": "2026-03-17T12:00:00Z",
      "token_type": "Bearer"
    }

    Using JWT Tokens in Requests

    bash
    curl -X GET "https://api.datamammoth.com/v1/servers" \
      -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIs..." \
      -H "Content-Type: application/json"

    Token Expiration and Refresh

    JWT tokens expire after a set period. When a token expires:

  • Your API requests will return a 401 Unauthorized error.
  • Request a new token using your API credentials.
  • Update your application with the new token.
  • Implement token refresh logic in your application to handle expiration automatically.

    Managing API Keys

    Viewing Active Keys

    Navigate to Account Settings > API to see all your API keys, including:

    • Key label
    • Creation date
    • Last used date
    • Status (active/revoked)

    Revoking a Key

    If a key is compromised or no longer needed:

  • Navigate to Account Settings > API.
  • Find the key to revoke.
  • Click Revoke or Delete.
  • Confirm the action.
  • The key is immediately invalidated. Update any applications using the revoked key.

    Key Rotation

    Regularly rotate your API keys for security:

  • Generate a new API key.
  • Update your applications to use the new key.
  • Verify everything works with the new key.
  • Revoke the old key.
  • Security Best Practices

    Protect Your Credentials

  • Never hardcode keys — Use environment variables or secret management systems.
  • bash
    export DM_API_KEY="dm_key_abc123def456"
    python
    import os
    api_key = os.environ.get('DM_API_KEY')

  • Never commit to version control — Add credential files to .gitignore.
  • Never share publicly — Do not post keys in forums, issue trackers, or documentation.
  • Limit Key Scope

    • Use separate keys for different environments (development, staging, production).
    • Use separate keys for different applications or team members.
    • Revoke keys for applications or team members that no longer need access.

    Monitor Usage

    • Review API key activity regularly.
    • Investigate any unexpected usage patterns.
    • Set up alerts for unusual API activity if available.

    Use HTTPS

    All API communication must use HTTPS. The API does not accept unencrypted HTTP requests.

    Troubleshooting Authentication

    401 Unauthorized

    • Verify the API key is correct and has not been revoked.
    • Check that the Authorization header format is correct: Bearer YOUR_KEY.
    • If using JWT, check if the token has expired.

    403 Forbidden

    • The API key may not have permission for the requested action.
    • Check if the key has the required scope or permissions.

    Invalid Token Format

    • Ensure there are no extra spaces or characters in the token.
    • Copy the token directly from the dashboard — do not retype it.

    What to Do Next

    • API Quickstart — Your First API Call — Make your first authenticated request.
    • API Overview — Understand the API architecture.
    • API Rate Limits & Best Practices — Optimize your usage.
    • API Error Codes & Handling — Handle errors gracefully.

    Was this article helpful?

    ← Back to API & DevelopersBrowse all categories →

    Still have questions?

    Contact Support →Submit a Ticket