Introduction to Keyboards
Keyboards are essential computer peripherals for typing and gaming. With numerous models available from brands like Logitech, Corsair, Razer, Keychron, and Das Keyboard, finding the right keyboard with the right features can be overwhelming. Whether you're a gamer needing mechanical switches, a programmer seeking a compact layout, or a developer building a computer peripherals marketplace, having structured keyboard product data is crucial.
Imagine being able to search for keyboards and instantly get detailed information about each device - from switch type and layout to connectivity and lighting, from keycaps to gaming features. This is exactly what a specialized Keyboard Product API can provide.
What Makes a Keyboard API Special?
A Keyboard Product API goes beyond basic product listings. It understands the unique characteristics that matter to keyboard buyers:
- Type: Mechanical, membrane, scissor switch, or hybrid
- Switches: Switch type, color, and actuation force
- Layout: Full-size, tenkeyless, compact, or 60% layout
- Connectivity: Wired USB, Bluetooth, or wireless 2.4GHz
- Features: RGB lighting, programmable keys, and media controls
- Build Quality: Keycap material, build construction, and durability
- Gaming: N-key rollover, anti-ghosting, and macro support
With this structured data, you can build powerful features like filtering by switch type, comparing layouts, or recommending keyboards based on use case.
Try It Out: Search for Keyboards
Use the search bar below to search for keyboards. Try queries like "Logitech MX Keys wireless", "Corsair K70 mechanical", or "Keychron K8 Bluetooth". The results will include detailed specifications automatically extracted from product information across the web.
Try the Keyboard API
Search for keyboards 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 Keyboard 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 Keyboard 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., "keyboard Logitech MX Keys")
- 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 Keyboard-Specific JSON Schema to pass as custom_data_schema of search request
Here's the JSON Schema we use for keyboard products:
{ "type": "object", "properties": { "keyboard_type": { "type": "string", "enum": ["mechanical", "membrane", "scissor_switch", "hybrid"], "description": "Type of keyboard" }, "switch_type": { "type": "string", "description": "Switch type (e.g., 'Cherry MX Red', 'Gateron Brown', 'Razer Green', 'Logitech Romer-G')" }, "switch_color": { "type": "string", "enum": ["red", "blue", "brown", "black", "silver", "green", "yellow", "white"], "description": "Switch color/type" }, "layout": { "type": "string", "enum": ["full_size", "tenkeyless", "compact", "60_percent", "65_percent", "75_percent", "96_percent"], "description": "Keyboard layout" }, "connectivity": { "type": "array", "items": { "type": "string" }, "description": "Connectivity options (e.g., ['USB', 'Bluetooth', 'Wireless 2.4GHz'])" }, "bluetooth": { "type": "boolean", "description": "Bluetooth connectivity" }, "wireless": { "type": "boolean", "description": "Wireless connectivity (2.4GHz)" }, "wired": { "type": "boolean", "description": "Wired USB connectivity" }, "rgb_lighting": { "type": "boolean", "description": "RGB backlighting" }, "backlighting": { "type": "boolean", "description": "Backlighting (single color or RGB)" }, "programmable_keys": { "type": "boolean", "description": "Programmable macro keys" }, "media_controls": { "type": "boolean", "description": "Media control keys" }, "wrist_rest": { "type": "boolean", "description": "Included wrist rest" }, "detachable_cable": { "type": "boolean", "description": "Detachable USB cable" }, "keycaps": { "type": "string", "description": "Keycap material (e.g., 'ABS', 'PBT', 'double-shot PBT')" }, "n_key_rollover": { "type": "boolean", "description": "N-key rollover support" }, "anti_ghosting": { "type": "boolean", "description": "Anti-ghosting technology" }, "water_resistance": { "type": "string", "description": "Water resistance rating (e.g., 'IPX4', 'IPX7')" }, "battery_life": { "type": "string", "description": "Battery life in hours (for wireless keyboards, e.g., '10 hours', '30 days')" }, "width": { "type": "string", "description": "Width in inches" }, "height": { "type": "string", "description": "Height in inches" }, "depth": { "type": "string", "description": "Depth in inches" }, "weight": { "type": "string", "description": "Weight in pounds" }, "price_range": { "type": "string", "description": "Price range category (budget, mid-range, premium)" } }, "required": ["keyboard_type", "layout"] }
Using the Category Prefix
When searching for keyboards, we prefix the search query with "keyboard" to help the AI understand the context and return more relevant results.
Example Search Queries:
keyboard Logitech MX Keys wirelesskeyboard Corsair K70 mechanicalkeyboard Keychron K8 Bluetoothkeyboard Razer BlackWidow gaming
The prefix "keyboard" ensures the API understands you're looking specifically for computer keyboards and not other products.
Complete Example: Making a Request
Here's how to make a request to The Product API with a keyboard-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=keyboard%20Logitech%20MX%20Keys&with_image=true', { method: 'POST', headers: { 'Content-Type': 'application/json', 'Authorization': 'Bearer YOUR_API_KEY' }, body: JSON.stringify({ custom_data_schema: { type: "object", properties: { keyboard_type: { type: "string", enum: ["mechanical", "membrane", "scissor_switch", "hybrid"], description: "Type of keyboard" }, switch_type: { type: "string", description: "Switch type" }, switch_color: { type: "string", enum: ["red", "blue", "brown", "black", "silver", "green", "yellow", "white"], description: "Switch color/type" }, layout: { type: "string", enum: ["full_size", "tenkeyless", "compact", "60_percent", "65_percent", "75_percent", "96_percent"], description: "Keyboard layout" }, connectivity: { type: "array", items: { type: "string" }, description: "Connectivity options" }, bluetooth: { type: "boolean", description: "Bluetooth connectivity" }, wireless: { type: "boolean", description: "Wireless connectivity" }, wired: { type: "boolean", description: "Wired USB connectivity" }, rgb_lighting: { type: "boolean", description: "RGB backlighting" }, backlighting: { type: "boolean", description: "Backlighting" }, programmable_keys: { type: "boolean", description: "Programmable macro keys" }, media_controls: { type: "boolean", description: "Media control keys" }, wrist_rest: { type: "boolean", description: "Included wrist rest" }, detachable_cable: { type: "boolean", description: "Detachable USB cable" }, keycaps: { type: "string", description: "Keycap material" }, n_key_rollover: { type: "boolean", description: "N-key rollover support" }, anti_ghosting: { type: "boolean", description: "Anti-ghosting technology" }, water_resistance: { type: "string", description: "Water resistance rating" }, battery_life: { type: "string", description: "Battery life in hours" }, width: { type: "string", description: "Width in inches" }, height: { type: "string", description: "Height in inches" }, depth: { type: "string", description: "Depth in inches" }, weight: { type: "string", description: "Weight in pounds" }, price_range: { type: "string", description: "Price range category" } }, required: ["keyboard_type", "layout"] } }) }); 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 Keys Advanced Wireless Illuminated Keyboard", "description": "The Logitech MX Keys features Perfect Stroke keys...", "brand": "Logitech", "image": "https://example.com/image.jpg", "custom_data": { "keyboard_type": "scissor_switch", "switch_type": "Logitech Perfect Stroke", "switch_color": null, "layout": "full_size", "connectivity": ["Bluetooth", "USB"], "bluetooth": true, "wireless": false, "wired": true, "rgb_lighting": false, "backlighting": true, "programmable_keys": false, "media_controls": true, "wrist_rest": false, "detachable_cable": true, "keycaps": "ABS", "n_key_rollover": false, "anti_ghosting": true, "water_resistance": null, "battery_life": "5 months", "width": "16.8 inches", "height": "5.2 inches", "depth": "0.8 inches", "weight": "1.8 lbs", "price_range": "premium" } } ] }
Conclusion
By combining the flexible Product API with a keyboard-specific JSON Schema, you can create a powerful, specialized API for keyboard products. The key is:
- Define your schema based on what keyboard data matters to your application
- Use category prefixes in search queries for better context
- 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 mice, monitors, headphones, and more!