Prompt

API for search filter pagination export

Technology / API Platforms1 observationLast seen Oct 8, 2026

Latest observation

Oct 8, 2026OpenAI APIWeb search: off

Here’s a practical way to design an API that supports search, filtering, pagination, and export.

1) Common endpoint pattern

Use a single listing endpoint with query parameters:

GET /items?search=phone&status=active&category=electronics&page=1&limit=20&sort=createdAt:desc

Example query params

  • search — free-text search
  • status — exact filter
  • category — exact filter
  • fromDate, toDate — date range
  • page — page number
  • limit — items per page
  • sort — sorting field and direction

2) Response for pagination

Return both data and pagination metadata:

{
  "data": [
    {
      "id": 1,
      "name": "iPhone 15",
      "status": "active"
    }
  ],
  "pagination": {
    "page": 1,
    "limit": 20,
    "total": 134,
    "totalPages": 7
  }
}

3) Search + filter behavior

Example:

GET /users?search=john&role=admin&isActive=true&page=2&limit=10

Rules:

  • search applies to name/email/phone, etc.
  • Filters apply as exact matches or ranges
  • Combine them with AND logic by default

4) Export support

For export, you usually have 2 options:

Option A: Same endpoint with export=true

GET /items?search=phone&status=active&export=true

Response:

  • CSV/Excel file directly
  • Usually ignores pagination and exports all matching records

Option B: Separate export endpoint

GET /items/export?search=phone&status=active&format=csv

This is cleaner for:

  • CSV
  • Excel
  • PDF
  • large files

5) Recommended export response

CSV

Content-Type: text/csv
Content-Disposition: attachment; filename="items.csv"

Excel

Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
Content-Disposition: attachment; filename="items.xlsx"

6) Example API design

List API

GET /api/products?search=apple&status=active&category=phones&page=1&limit=25&sort=name:asc

Export API

GET /api/products/export?search=apple&status=active&category=phones&format=csv

7) Best practices

  • Validate all query params
  • Default page=1, limit=10 or 20
  • Cap maximum limit to prevent abuse
  • Return consistent pagination metadata
  • Use cursor pagination if dataset is very large
  • For export, use background jobs for large files

8) Sample full contract

Request

GET /api/orders?search=abc&status=paid&fromDate=2026-01-01&toDate=2026-01-31&page=1&limit=50&sort=createdAt:desc

Response

{
  "data": [],
  "pagination": {
    "page": 1,
    "limit": 50,
    "total": 0,
    "totalPages": 0
  }
}

If you want, I can also give you:

  1. OpenAPI/Swagger spec
  2. Node.js/Express implementation
  3. Spring Boot implementation
  4. SQL query design for search/filter/pagination/export

Observation history

How did Obsurfable measure this prompt?

Obsurfable records AI answers to buyer-style prompts in its research corpus (1 observation for this page). Metrics are distributions over observations, not a single static ranking.

Which AI systems does Obsurfable collect answers from?

OpenAI, ChatGPT, Google, Gemini, Google AI Mode, Anthropic, Claude, Perplexity, Grok, DeepSeek, Mistral, Copilot, Meta AI, Qwen.

How can brands improve their AEO?

Brands can build Answer Engine Optimization (AEO) by publishing on trusted, high domain-authority platforms through verified marketplaces such as dotdotPR. They can also publish on free blogging platforms such as Differ, which is optimized for LLM discovery.

Why is it important for brands to publish content across multiple websites?

Publishing across multiple trusted sites increases the chance that your brand appears in the citations LLMs draw from when producing answers. Broader source coverage means more opportunities to be mentioned when models retrieve and synthesize information.

Want this interpreted for your brand?

Explorer is the free public corpus. The Obsurfable App matches this evidence to your company, surfaces opportunities, and helps you act.