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

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

Create a specialized Smartphone Product API with custom schemas for screen size, processor, RAM, camera specs, and more. Perfect for tech comparison sites and mobile marketplaces.

Introduction to Smartphones

Smartphones have become essential devices in our daily lives, with new models released constantly by manufacturers like Apple, Samsung, Google, and others. Whether you're a tech enthusiast comparing the latest models, a developer building a mobile device marketplace, or a researcher analyzing smartphone trends, having access to structured smartphone product data is crucial.

Imagine being able to search for smartphones and instantly get detailed information about each device - from screen size and resolution to processor specifications, from camera capabilities to battery life. This is exactly what a specialized Smartphone Product API can provide.

What Makes a Smartphone API Special?

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

  • Screen Specifications: Size, resolution, and display technology
  • Performance: Processor, RAM, and storage options
  • Camera System: Rear and front camera specifications
  • Battery Life: Capacity and estimated usage time
  • Connectivity: 5G, Wi-Fi standards, Bluetooth versions
  • Operating System: iOS or Android version

With this structured data, you can build powerful features like comparing specifications side-by-side, filtering by performance requirements, or recommending phones based on user needs.

Try It Out: Search for Smartphones

Use the search bar below to search for smartphones. Try queries like "iPhone 15 Pro", "Samsung Galaxy S24", or "Google Pixel 8". The results will include detailed specifications automatically extracted from product information across the web.

Try the Smartphone API

Search for smartphones 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 Smartphone 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 Smartphone 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., "smartphone iPhone 15 Pro")
  • 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 Smartphone-Specific JSON Schema to pass as custom_data_schema of search request

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

{
  "type": "object",
  "properties": {
    "screen_size": {
      "type": "string",
      "description": "Screen size in inches (e.g., '6.1', '6.7')"
    },
    "screen_resolution": {
      "type": "string",
      "description": "Screen resolution (e.g., '2532x1170', '1080x2400')"
    },
    "processor": {
      "type": "string",
      "description": "Processor/chipset name (e.g., 'A17 Pro', 'Snapdragon 8 Gen 2')"
    },
    "ram": {
      "type": "string",
      "description": "RAM capacity (e.g., '8GB', '12GB', '16GB')"
    },
    "storage_options": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Available storage options (e.g., ['128GB', '256GB', '512GB'])"
    },
    "rear_camera": {
      "type": "string",
      "description": "Rear camera specifications (e.g., '48MP main + 12MP ultra-wide')"
    },
    "front_camera": {
      "type": "string",
      "description": "Front camera specifications (e.g., '12MP TrueDepth')"
    },
    "battery_capacity": {
      "type": "string",
      "description": "Battery capacity (e.g., '3274 mAh', '5000 mAh')"
    },
    "operating_system": {
      "type": "string",
      "description": "Operating system and version (e.g., 'iOS 17', 'Android 14')"
    },
    "connectivity": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Connectivity options (e.g., ['5G', 'Wi-Fi 6', 'Bluetooth 5.3'])"
    },
    "price_range": {
      "type": "string",
      "description": "Price range category (budget, mid-range, flagship, premium)"
    }
  },
  "required": ["screen_size", "processor", "ram"]
}

Using the Category Prefix

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

Example Search Queries:

  • smartphone iPhone 15 Pro Max
  • smartphone Samsung Galaxy S24 Ultra
  • smartphone Google Pixel 8 Pro
  • smartphone OnePlus 12

The prefix "smartphone" ensures the API understands you're looking specifically for smartphone products and not other devices or accessories.

Complete Example: Making a Request

Here's how to make a request to The Product API with a smartphone-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=smartphone%20iPhone%2015%20Pro&with_image=true', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'Authorization': 'Bearer YOUR_API_KEY'
  },
  body: JSON.stringify({
    custom_data_schema: {
      type: "object",
      properties: {
        screen_size: {
          type: "string",
          description: "Screen size in inches"
        },
        screen_resolution: {
          type: "string",
          description: "Screen resolution"
        },
        processor: {
          type: "string",
          description: "Processor/chipset name"
        },
        ram: {
          type: "string",
          description: "RAM capacity"
        },
        storage_options: {
          type: "array",
          items: { type: "string" },
          description: "Available storage options"
        },
        rear_camera: {
          type: "string",
          description: "Rear camera specifications"
        },
        front_camera: {
          type: "string",
          description: "Front camera specifications"
        },
        battery_capacity: {
          type: "string",
          description: "Battery capacity"
        },
        operating_system: {
          type: "string",
          description: "Operating system and version"
        },
        connectivity: {
          type: "array",
          items: { type: "string" },
          description: "Connectivity options"
        },
        price_range: {
          type: "string",
          description: "Price range category"
        }
      },
      required: ["screen_size", "processor", "ram"]
    }
  })
});

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": "Apple iPhone 15 Pro",
      "description": "The iPhone 15 Pro features the A17 Pro chip...",
      "brand": "Apple",
      "image": "https://example.com/image.jpg",
      "custom_data": {
        "screen_size": "6.1",
        "screen_resolution": "2556x1179",
        "processor": "A17 Pro",
        "ram": "8GB",
        "storage_options": ["128GB", "256GB", "512GB", "1TB"],
        "rear_camera": "48MP main + 12MP ultra-wide + 12MP telephoto",
        "front_camera": "12MP TrueDepth",
        "battery_capacity": "3274 mAh",
        "operating_system": "iOS 17",
        "connectivity": ["5G", "Wi-Fi 6E", "Bluetooth 5.3"],
        "price_range": "flagship"
      }
    }
  ]
}

Conclusion

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

  1. Define your schema based on what smartphone 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 guitars, drills, cars, and more!