Back to API Presets
API Preset
November 14, 2025By Product API TeamMouse

Building a Mouse API with The Product API: A Complete Guide

Create a specialized Mouse Product API with sensor specifications, connectivity, DPI settings, and ergonomic features. Perfect for gaming marketplaces and computer peripherals retailers.

Introduction to Mice

Mice are essential computer peripherals for navigation and interaction. With numerous models available from brands like Logitech, Razer, Corsair, SteelSeries, and Microsoft, finding the right mouse with the right features can be overwhelming. Whether you're a gamer needing high DPI and low latency, a designer requiring precision tracking, or a developer building a computer peripherals marketplace, having structured mouse product data is crucial.

Imagine being able to search for mice and instantly get detailed information about each device - from sensor specifications and DPI to connectivity and ergonomic features, from buttons to battery life. This is exactly what a specialized Mouse Product API can provide.

What Makes a Mouse API Special?

A Mouse Product API goes beyond basic product listings. It understands the unique characteristics that matter to mouse buyers:

  • Type: Gaming, office, ergonomic, wireless, or trackball
  • Sensor: Sensor type, DPI range, and polling rate
  • Connectivity: Wired USB, Bluetooth, or wireless 2.4GHz
  • Features: Programmable buttons, RGB lighting, and onboard memory
  • Ergonomics: Hand orientation, grip style, and weight
  • Performance: Maximum DPI, polling rate, and tracking accuracy
  • Battery: Battery life and charging method (for wireless mice)

With this structured data, you can build powerful features like filtering by DPI, comparing connectivity options, or recommending mice based on grip style.

Try It Out: Search for Mice

Use the search bar below to search for mice. Try queries like "Logitech MX Master wireless", "Razer DeathAdder gaming", or "Microsoft Surface Precision". The results will include detailed specifications automatically extracted from product information across the web.

Try the Mouse API

Search for mouses and see detailed specifications automatically extracted from product information.

How It Works: Technical Implementation

Now that you've seen the API in action, let's dive into how it's implemented. This specialized Mouse API is built on top of The Product API which is an AI-based product search API that works with any product and any type of query. It responds with structured JSON and supports custom structured responses, allowing you to build specialized APIs for any product category.

The Product API's powerful custom_data_schema feature allows you to define additional structured fields specific to your product category, enabling you to create category-specific APIs like this Mouse API. For more details on how the API works, see the full documentation.

Understanding APIs for Product Data

An API (Application Programming Interface) enables different software applications to communicate. For product data:

  • Input: You send a search query (e.g., "mouse Logitech MX Master")
  • Processing: The API searches across multiple sources and uses AI to extract relevant information
  • Output: You receive structured product data in JSON format

The flexibility of a product API means you can customize it for specific categories by defining additional data fields through JSON Schema.

Creating a Mouse-Specific JSON Schema to pass as custom_data_schema of search request

Here's the JSON Schema we use for mouse products:

{
  "type": "object",
  "properties": {
    "mouse_type": {
      "type": "string",
      "enum": ["gaming", "office", "ergonomic", "wireless", "trackball", "vertical"],
      "description": "Type of mouse"
    },
    "connectivity": {
      "type": "array",
      "items": { "type": "string" },
      "description": "Connectivity options (e.g., ['USB', 'Bluetooth', 'Wireless 2.4GHz'])"
    },
    "wired": {
      "type": "boolean",
      "description": "Wired USB connectivity"
    },
    "wireless": {
      "type": "boolean",
      "description": "Wireless connectivity (2.4GHz)"
    },
    "bluetooth": {
      "type": "boolean",
      "description": "Bluetooth connectivity"
    },
    "sensor_type": {
      "type": "string",
      "description": "Sensor type (e.g., 'optical', 'laser', 'PixArt PMW3360', 'Hero')"
    },
    "dpi": {
      "type": "string",
      "description": "DPI range (e.g., '200-12000 DPI', '100-16000 DPI')"
    },
    "max_dpi": {
      "type": "number",
      "description": "Maximum DPI (e.g., 12000, 16000)"
    },
    "polling_rate": {
      "type": "string",
      "description": "Polling rate in Hz (e.g., '1000Hz', '125Hz', '250Hz')"
    },
    "buttons": {
      "type": "number",
      "description": "Number of buttons"
    },
    "programmable_buttons": {
      "type": "number",
      "description": "Number of programmable buttons"
    },
    "rgb_lighting": {
      "type": "boolean",
      "description": "RGB lighting"
    },
    "ambidextrous": {
      "type": "boolean",
      "description": "Ambidextrous design"
    },
    "hand_orientation": {
      "type": "string",
      "enum": ["right_handed", "left_handed", "ambidextrous"],
      "description": "Hand orientation"
    },
    "grip_style": {
      "type": "string",
      "enum": ["palm", "claw", "fingertip"],
      "description": "Recommended grip style"
    },
    "weight": {
      "type": "string",
      "description": "Weight in grams or ounces (e.g., '80g', '2.8 oz')"
    },
    "adjustable_weight": {
      "type": "boolean",
      "description": "Adjustable weight system"
    },
    "battery_life": {
      "type": "string",
      "description": "Battery life in hours or days (for wireless mice, e.g., '70 days', '10 hours')"
    },
    "charging": {
      "type": "string",
      "description": "Charging method (e.g., 'USB-C', 'Micro USB', 'AA battery', 'rechargeable')"
    },
    "onboard_memory": {
      "type": "boolean",
      "description": "Onboard memory for profiles"
    },
    "software": {
      "type": "string",
      "description": "Companion software (e.g., 'Logitech G HUB', 'Razer Synapse', 'Corsair iCUE')"
    },
    "width": {
      "type": "string",
      "description": "Width in inches"
    },
    "height": {
      "type": "string",
      "description": "Height in inches"
    },
    "depth": {
      "type": "string",
      "description": "Depth in inches"
    },
    "price_range": {
      "type": "string",
      "description": "Price range category (budget, mid-range, premium)"
    }
  },
  "required": ["mouse_type", "connectivity"]
}

Using the Category Prefix

When searching for mice, we prefix the search query with "mouse" to help the AI understand the context and return more relevant results.

Example Search Queries:

  • mouse Logitech MX Master wireless
  • mouse Razer DeathAdder gaming
  • mouse Microsoft Surface Precision
  • mouse Corsair Scimitar RGB

The prefix "mouse" ensures the API understands you're looking specifically for computer mice and not other products.

Complete Example: Making a Request

Here's how to make a request to The Product API with a mouse-specific schema. For complete API reference including authentication, endpoints, and all parameters, see the documentation:

const response = await fetch('https://api.example.com/api?search=mouse%20Logitech%20MX%20Master&with_image=true', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'Authorization': 'Bearer YOUR_API_KEY'
  },
  body: JSON.stringify({
    custom_data_schema: {
      type: "object",
      properties: {
        mouse_type: {
          type: "string",
          enum: ["gaming", "office", "ergonomic", "wireless", "trackball", "vertical"],
          description: "Type of mouse"
        },
        connectivity: {
          type: "array",
          items: { type: "string" },
          description: "Connectivity options"
        },
        wired: {
          type: "boolean",
          description: "Wired USB connectivity"
        },
        wireless: {
          type: "boolean",
          description: "Wireless connectivity"
        },
        bluetooth: {
          type: "boolean",
          description: "Bluetooth connectivity"
        },
        sensor_type: {
          type: "string",
          description: "Sensor type"
        },
        dpi: {
          type: "string",
          description: "DPI range"
        },
        max_dpi: {
          type: "number",
          description: "Maximum DPI"
        },
        polling_rate: {
          type: "string",
          description: "Polling rate in Hz"
        },
        buttons: {
          type: "number",
          description: "Number of buttons"
        },
        programmable_buttons: {
          type: "number",
          description: "Number of programmable buttons"
        },
        rgb_lighting: {
          type: "boolean",
          description: "RGB lighting"
        },
        ambidextrous: {
          type: "boolean",
          description: "Ambidextrous design"
        },
        hand_orientation: {
          type: "string",
          enum: ["right_handed", "left_handed", "ambidextrous"],
          description: "Hand orientation"
        },
        grip_style: {
          type: "string",
          enum: ["palm", "claw", "fingertip"],
          description: "Recommended grip style"
        },
        weight: {
          type: "string",
          description: "Weight in grams or ounces"
        },
        adjustable_weight: {
          type: "boolean",
          description: "Adjustable weight system"
        },
        battery_life: {
          type: "string",
          description: "Battery life in hours or days"
        },
        charging: {
          type: "string",
          description: "Charging method"
        },
        onboard_memory: {
          type: "boolean",
          description: "Onboard memory for profiles"
        },
        software: {
          type: "string",
          description: "Companion software"
        },
        width: {
          type: "string",
          description: "Width in inches"
        },
        height: {
          type: "string",
          description: "Height in inches"
        },
        depth: {
          type: "string",
          description: "Depth in inches"
        },
        price_range: {
          type: "string",
          description: "Price range category"
        }
      },
      required: ["mouse_type", "connectivity"]
    }
  })
});

const data = await response.json();
console.log(data.products);

Expected Response

The API will return products with standard fields plus your custom custom_data field:

{
  "status": "success",
  "products": [
    {
      "name": "Logitech MX Master 3 Advanced Wireless Mouse",
      "description": "The Logitech MX Master 3 features Darkfield tracking...",
      "brand": "Logitech",
      "image": "https://example.com/image.jpg",
      "custom_data": {
        "mouse_type": "office",
        "connectivity": ["Bluetooth", "USB"],
        "wired": true,
        "wireless": false,
        "bluetooth": true,
        "sensor_type": "Darkfield",
        "dpi": "200-4000 DPI",
        "max_dpi": 4000,
        "polling_rate": "125Hz",
        "buttons": 7,
        "programmable_buttons": 7,
        "rgb_lighting": false,
        "ambidextrous": false,
        "hand_orientation": "right_handed",
        "grip_style": "palm",
        "weight": "141g",
        "adjustable_weight": false,
        "battery_life": "70 days",
        "charging": "USB-C",
        "onboard_memory": true,
        "software": "Logitech Options",
        "width": "3.3 inches",
        "height": "2.0 inches",
        "depth": "5.2 inches",
        "price_range": "premium"
      }
    }
  ]
}

Conclusion

By combining the flexible Product API with a mouse-specific JSON Schema, you can create a powerful, specialized API for mouse products. The key is:

  1. Define your schema based on what mouse data matters to your application
  2. Use category prefixes in search queries for better context
  3. Leverage the custom_data field to build rich, category-specific features

The same approach works for any product category - you just need to define the right schema for your needs!

Ready to get started? Create your own product API on The Product API and start building your own category-specific APIs today!


Ready to build your own category-specific API? Check out our other API preset guides for keyboards, monitors, headphones, and more!