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

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

Create a specialized Motorcycle Product API with engine specifications, bike type, displacement, power, and safety features. Perfect for motorcycle marketplaces and dealerships.

Introduction to Motorcycles

Motorcycles come in many types and configurations, from sport bikes to cruisers, touring bikes to adventure motorcycles. Finding the right motorcycle with the right specifications can be challenging. Whether you're a motorcycle enthusiast seeking the perfect sport bike, a commuter needing a practical scooter, or a developer building a motorcycle marketplace, having structured motorcycle product data is crucial.

Imagine being able to search for motorcycles and instantly get detailed information about each bike - from engine specifications and bike type to power and safety features, from transmission to fuel capacity. This is exactly what a specialized Motorcycle Product API can provide.

What Makes a Motorcycle API Special?

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

  • Bike Type: Sport, cruiser, touring, adventure, naked, and more
  • Engine: Type, displacement, power, and torque
  • Performance: Top speed, acceleration, and handling characteristics
  • Transmission: Manual, automatic, CVT, or DCT
  • Safety: ABS, traction control, and riding modes
  • Comfort: Seat height, weight, and ergonomics
  • Fuel: Capacity, type, and efficiency

With this structured data, you can build powerful features like filtering by bike type, comparing engine specifications, or recommending motorcycles based on riding style.

Try It Out: Search for Motorcycles

Use the search bar below to search for motorcycles. Try queries like "Honda CBR sport bike", "Harley-Davidson cruiser", or "Yamaha adventure motorcycle". The results will include detailed specifications automatically extracted from product information across the web.

Try the Motorcycle API

Search for motorcycles 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 Motorcycle 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 Motorcycle 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., "motorcycle Honda CBR")
  • 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 Motorcycle-Specific JSON Schema to pass as custom_data_schema of search request

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

{
  "type": "object",
  "properties": {
    "bike_type": {
      "type": "string",
      "enum": ["sport", "cruiser", "touring", "adventure", "naked", "scooter", "dirt_bike", "dual_sport", "cafe_racer", "bobber"],
      "description": "Type of motorcycle"
    },
    "engine_type": {
      "type": "string",
      "enum": ["single_cylinder", "parallel_twin", "v_twin", "inline_four", "boxer", "v4"],
      "description": "Engine configuration"
    },
    "displacement": {
      "type": "string",
      "description": "Engine displacement in cc (cubic centimeters)"
    },
    "power": {
      "type": "string",
      "description": "Engine power in horsepower (hp)"
    },
    "torque": {
      "type": "string",
      "description": "Engine torque in lb-ft or Nm"
    },
    "transmission": {
      "type": "string",
      "enum": ["manual", "automatic", "cvt", "dct"],
      "description": "Transmission type"
    },
    "gears": {
      "type": "number",
      "description": "Number of gears"
    },
    "fuel_capacity": {
      "type": "string",
      "description": "Fuel tank capacity in gallons or liters"
    },
    "fuel_type": {
      "type": "string",
      "enum": ["gasoline", "electric", "hybrid"],
      "description": "Fuel type"
    },
    "seat_height": {
      "type": "string",
      "description": "Seat height in inches or centimeters"
    },
    "weight": {
      "type": "string",
      "description": "Motorcycle weight in pounds or kilograms"
    },
    "abs": {
      "type": "boolean",
      "description": "Anti-lock braking system availability"
    },
    "traction_control": {
      "type": "boolean",
      "description": "Traction control system availability"
    },
    "riding_modes": {
      "type": "array",
      "items": { "type": "string" },
      "description": "Available riding modes"
    },
    "top_speed": {
      "type": "string",
      "description": "Top speed in mph or km/h"
    },
    "price_range": {
      "type": "string",
      "description": "Price range category"
    }
  },
  "required": ["bike_type", "engine_type", "displacement"]
}

Using the Category Prefix

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

Example Search Queries:

  • motorcycle Honda CBR sport bike
  • motorcycle Harley-Davidson cruiser
  • motorcycle Yamaha adventure
  • motorcycle Kawasaki Ninja

The prefix "motorcycle" ensures the API understands you're looking specifically for motorcycles and not other products.

Complete Example: Making a Request

Here's how to make a request to The Product API with a motorcycle-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=motorcycle%20Honda%20CBR&with_image=true', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'Authorization': 'Bearer YOUR_API_KEY'
  },
  body: JSON.stringify({
    custom_data_schema: {
      type: "object",
      properties: {
        bike_type: {
          type: "string",
          enum: ["sport", "cruiser", "touring", "adventure", "naked", "scooter", "dirt_bike", "dual_sport", "cafe_racer", "bobber"],
          description: "Type of motorcycle"
        },
        engine_type: {
          type: "string",
          enum: ["single_cylinder", "parallel_twin", "v_twin", "inline_four", "boxer", "v4"],
          description: "Engine configuration"
        },
        displacement: {
          type: "string",
          description: "Engine displacement in cc"
        },
        power: {
          type: "string",
          description: "Engine power in horsepower"
        },
        torque: {
          type: "string",
          description: "Engine torque"
        },
        transmission: {
          type: "string",
          enum: ["manual", "automatic", "cvt", "dct"],
          description: "Transmission type"
        },
        gears: {
          type: "number",
          description: "Number of gears"
        },
        fuel_capacity: {
          type: "string",
          description: "Fuel tank capacity"
        },
        fuel_type: {
          type: "string",
          enum: ["gasoline", "electric", "hybrid"],
          description: "Fuel type"
        },
        seat_height: {
          type: "string",
          description: "Seat height"
        },
        weight: {
          type: "string",
          description: "Motorcycle weight"
        },
        abs: {
          type: "boolean",
          description: "Anti-lock braking system availability"
        },
        traction_control: {
          type: "boolean",
          description: "Traction control system availability"
        },
        riding_modes: {
          type: "array",
          items: { type: "string" },
          description: "Available riding modes"
        },
        top_speed: {
          type: "string",
          description: "Top speed"
        },
        price_range: {
          type: "string",
          description: "Price range category"
        }
      },
      required: ["bike_type", "engine_type", "displacement"]
    }
  })
});

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": "Honda CBR1000RR-R Fireblade",
      "description": "The Honda CBR1000RR-R Fireblade is a high-performance sport bike...",
      "brand": "Honda",
      "image": "https://example.com/image.jpg",
      "custom_data": {
        "bike_type": "sport",
        "engine_type": "inline_four",
        "displacement": "999cc",
        "power": "214 hp",
        "torque": "83 lb-ft",
        "transmission": "manual",
        "gears": 6,
        "fuel_capacity": "4.3 gallons",
        "fuel_type": "gasoline",
        "seat_height": "32.8 inches",
        "weight": "443 lbs",
        "abs": true,
        "traction_control": true,
        "riding_modes": ["Sport", "Track", "Rain"],
        "top_speed": "186 mph",
        "price_range": "premium"
      }
    }
  ]
}

Conclusion

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

  1. Define your schema based on what motorcycle 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 bicycles, laptops, TVs, and more!