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 Code Examples Curl
GUIDEAPI & Developers

API Code Examples — cURL

4 min read

cURL is the simplest way to test and interact with the Data Mammoth API from the command line. These examples provide a quick reference for common API operations that you can run directly in your terminal.

Setup

Set your API key as an environment variable:

bash
export DM_API_KEY="dm_key_abc123def456"

Account

Get Account Details

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

Server Management

List All Servers

bash
curl -X GET "https://api.datamammoth.com/v1/servers" \
  -H "Authorization: Bearer $DM_API_KEY"

List Running Servers Only

bash
curl -X GET "https://api.datamammoth.com/v1/servers?status=running" \
  -H "Authorization: Bearer $DM_API_KEY"

Get Server Details

bash
curl -X GET "https://api.datamammoth.com/v1/servers/srv_abc123" \
  -H "Authorization: Bearer $DM_API_KEY"

Create a Server

bash
curl -X POST "https://api.datamammoth.com/v1/servers" \
  -H "Authorization: Bearer $DM_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "web-production",
    "plan": "vps-standard",
    "region": "us-east",
    "os": "ubuntu-24.04",
    "hostname": "web01.example.com",
    "tags": ["production", "web"]
  }'

Start a Server

bash
curl -X POST "https://api.datamammoth.com/v1/servers/srv_abc123/actions" \
  -H "Authorization: Bearer $DM_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"action": "start"}'

Stop a Server

bash
curl -X POST "https://api.datamammoth.com/v1/servers/srv_abc123/actions" \
  -H "Authorization: Bearer $DM_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"action": "stop"}'

Restart a Server

bash
curl -X POST "https://api.datamammoth.com/v1/servers/srv_abc123/actions" \
  -H "Authorization: Bearer $DM_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"action": "restart"}'

Update Server Name and Tags

bash
curl -X PATCH "https://api.datamammoth.com/v1/servers/srv_abc123" \
  -H "Authorization: Bearer $DM_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "web-staging",
    "tags": ["staging", "web"]
  }'

Delete a Server

bash
curl -X DELETE "https://api.datamammoth.com/v1/servers/srv_abc123" \
  -H "Authorization: Bearer $DM_API_KEY"

Get Server Metrics

bash
curl -X GET "https://api.datamammoth.com/v1/servers/srv_abc123/metrics?metric=cpu&period=24h" \
  -H "Authorization: Bearer $DM_API_KEY"

Available Plans and Regions

List Plans

bash
curl -X GET "https://api.datamammoth.com/v1/plans" \
  -H "Authorization: Bearer $DM_API_KEY"

List Regions

bash
curl -X GET "https://api.datamammoth.com/v1/regions" \
  -H "Authorization: Bearer $DM_API_KEY"

List OS Images

bash
curl -X GET "https://api.datamammoth.com/v1/images" \
  -H "Authorization: Bearer $DM_API_KEY"

Billing

List All Invoices

bash
curl -X GET "https://api.datamammoth.com/v1/billing/invoices" \
  -H "Authorization: Bearer $DM_API_KEY"

List Unpaid Invoices

bash
curl -X GET "https://api.datamammoth.com/v1/billing/invoices?status=unpaid" \
  -H "Authorization: Bearer $DM_API_KEY"

Get Invoice Details

bash
curl -X GET "https://api.datamammoth.com/v1/billing/invoices/inv_2026_0042" \
  -H "Authorization: Bearer $DM_API_KEY"

Check Account Balance

bash
curl -X GET "https://api.datamammoth.com/v1/billing/balance" \
  -H "Authorization: Bearer $DM_API_KEY"

List Subscriptions

bash
curl -X GET "https://api.datamammoth.com/v1/billing/subscriptions" \
  -H "Authorization: Bearer $DM_API_KEY"

Support Tickets

List Open Tickets

bash
curl -X GET "https://api.datamammoth.com/v1/support/tickets?status=open" \
  -H "Authorization: Bearer $DM_API_KEY"

Create a Ticket

bash
curl -X POST "https://api.datamammoth.com/v1/support/tickets" \
  -H "Authorization: Bearer $DM_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "subject": "High CPU usage on web server",
    "department": "technical",
    "priority": "high",
    "server_id": "srv_abc123",
    "message": "CPU usage above 90% for the past 3 hours."
  }'

Reply to a Ticket

bash
curl -X POST "https://api.datamammoth.com/v1/support/tickets/tkt_12345/replies" \
  -H "Authorization: Bearer $DM_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "message": "The issue has been resolved after optimizing MySQL queries."
  }'

Webhooks

Create a Webhook

bash
curl -X POST "https://api.datamammoth.com/v1/webhooks" \
  -H "Authorization: Bearer $DM_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://yourapp.example.com/webhooks/datamammoth",
    "events": ["server.status_changed", "billing.invoice_created"],
    "secret": "your_webhook_secret"
  }'

List Webhooks

bash
curl -X GET "https://api.datamammoth.com/v1/webhooks" \
  -H "Authorization: Bearer $DM_API_KEY"

Tips for Using cURL

  • Pretty-print JSON — Pipe output through jq for readable formatting:
  • bash
    curl -s -X GET "https://api.datamammoth.com/v1/servers" \
      -H "Authorization: Bearer $DM_API_KEY" | jq .

  • View response headers — Add -i to include headers:
  • bash
    curl -i -X GET "https://api.datamammoth.com/v1/servers" \
      -H "Authorization: Bearer $DM_API_KEY"

  • Verbose output — Add -v for debugging:
  • bash
    curl -v -X GET "https://api.datamammoth.com/v1/servers" \
      -H "Authorization: Bearer $DM_API_KEY"

  • Save response to file:
  • bash
    curl -s -X GET "https://api.datamammoth.com/v1/servers" \
      -H "Authorization: Bearer $DM_API_KEY" -o servers.json

    What to Do Next

    • API Code Examples — Python — Python examples.
    • API Code Examples — JavaScript — Node.js examples.
    • API Code Examples — PHP — PHP examples.
    • API Overview — Full API documentation.

    Was this article helpful?

    ← Back to API & DevelopersBrowse all categories →

    Still have questions?

    Contact Support →Submit a Ticket