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 Pagination
GUIDEAPI & Developers

API Pagination & Filtering

4 min read

When API endpoints return large collections of data, results are paginated to keep responses fast and manageable. This guide explains how pagination and filtering work in the Data Mammoth API.

Pagination

Query Parameters

ParameterTypeDefaultDescription
pageinteger1The page number to retrieve
per_pageinteger25Number of results per page (max: 100)

Example Request

bash
curl -X GET "https://api.datamammoth.com/v1/servers?page=2&per_page=10" \
  -H "Authorization: Bearer dm_key_abc123def456"

Pagination Metadata

Every paginated response includes a meta object with pagination details:

json
{
  "data": [...],
  "meta": {
    "total": 47,
    "page": 2,
    "per_page": 10,
    "total_pages": 5,
    "has_next": true,
    "has_prev": true
  }
}
FieldDescription
totalTotal number of records matching the query
pageCurrent page number
per_pageNumber of results per page
total_pagesTotal number of pages
has_nextWhether a next page exists
has_prevWhether a previous page exists

Iterating Through All Pages

To retrieve all records, iterate through pages until has_next is false:

python
import requests

all_servers = [] page = 1 headers = {"Authorization": "Bearer dm_key_abc123def456"}

while True: response = requests.get( f"https://api.datamammoth.com/v1/servers?page={page}&per_page=50", headers=headers ) data = response.json() all_servers.extend(data["data"])

if not data["meta"]["has_next"]: break page += 1

print(f"Total servers: {len(all_servers)}")

Filtering

Most list endpoints support query parameters for filtering results server-side, reducing the amount of data transferred and processed.

Common Filters

Servers

bash
GET /v1/servers?status=running&region=us-east&tag=production
ParameterDescriptionExample Values
statusServer statusrunning, stopped, provisioning
regionData center regionus-east, eu-west
tagServer tag/labelproduction, staging
nameSearch by server nameweb- (partial match)

Invoices

bash
GET /v1/billing/invoices?status=unpaid&date_from=2026-01-01&date_to=2026-03-31
ParameterDescriptionExample Values
statusInvoice statuspaid, unpaid, overdue, cancelled
date_fromStart date (ISO 8601)2026-01-01
date_toEnd date (ISO 8601)2026-03-31

Support Tickets

bash
GET /v1/support/tickets?status=open&priority=high&department=technical
ParameterDescriptionExample Values
statusTicket statusopen, in_progress, resolved, closed
priorityTicket prioritylow, medium, high, critical
departmentSupport departmenttechnical, billing, sales

Combining Filters

Apply multiple filters simultaneously. All filters are combined with AND logic:

bash
# Servers that are running AND in us-east AND tagged as production
GET /v1/servers?status=running&region=us-east&tag=production

Sorting

Some endpoints support sorting with the sort parameter:

bash
GET /v1/servers?sort=created_at&order=desc
ParameterDescription
sortField to sort by (e.g., created_at, name, status)
orderSort direction: asc (ascending) or desc (descending)

Best Practices

1. Filter Server-Side

Always use query parameters to filter data rather than fetching everything and filtering locally:

bash
# Good — filter on the server
GET /v1/servers?status=running

Avoid — fetching all and filtering locally

GET /v1/servers # then filter in code

2. Request Only What You Need

Use smaller page sizes when you only need a few records:

bash
# If you only need the first 5 results
GET /v1/servers?per_page=5&page=1

3. Use Consistent Page Sizes

Keep per_page consistent across requests to avoid confusion with offsets.

4. Handle Empty Results

Your code should handle the case where no results match the filters:

json
{
  "data": [],
  "meta": {
    "total": 0,
    "page": 1,
    "per_page": 25,
    "total_pages": 0,
    "has_next": false,
    "has_prev": false
  }
}

5. Cache Where Appropriate

Cache paginated results for data that changes infrequently to reduce API calls.

What to Do Next

  • API Rate Limits & Best Practices — Optimize your API usage.
  • API Error Codes & Handling — Handle pagination errors.
  • Server Management API — Filter and paginate servers.
  • Billing API — Filter and paginate invoices.

Was this article helpful?

← Back to API & DevelopersBrowse all categories →

Still have questions?

Contact Support →Submit a Ticket