Replace YOUR_API_KEY with your actual API key in all examples.

Search API

The Search API offers intelligent product discovery for AI shopping agents using natural language queries and various filters.

Basic Discovery

Search for products matching “cotton shirt” using natural language understanding:

// Search for "cotton shirt"
(async () => {
  const API_KEY = "YOUR_API_KEY"; // Replace with your actual key
  
  const response = await fetch("https://catalogai.vercel.app/api/products", {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
      'x-api-key': API_KEY
    },
    body: JSON.stringify({ query: "cotton shirt" })
  });

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

Using Filters

Fine-tune your AI shopping agent’s discovery by vendor, availability, and price range:

// Filter by vendor, availability, price
(async () => {
  const API_KEY = "YOUR_API_KEY"; // Replace with your actual key
  
  const response = await fetch("https://catalogai.vercel.app/api/products", {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
      'x-api-key': API_KEY
    },
    body: JSON.stringify({
      filters: {
        vendor: "EcoWear",
        is_available: true,
        price_min: 20.00,
        price_max: 50.00
      }
    })
  });

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

Filtering by Attributes

Enable your AI shopping agents to discover products by specific attributes like color and fabric:

// Filter by attributes (color, fabric)
(async () => {
  const API_KEY = "YOUR_API_KEY"; // Replace with your actual key
  
  const response = await fetch("https://catalogai.vercel.app/api/products", {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
      'x-api-key': API_KEY
    },
    body: JSON.stringify({
      filters: {
        attributes: {
          color: "Green",
          fabric: {
            cotton: true
          }
        }
      }
    })
  });

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

Pagination

Get the second page of search results for “shoes”:

// Search with pagination (page 2)
(async () => {
  const API_KEY = "YOUR_API_KEY"; // Replace with your actual key
  
  const response = await fetch("https://catalogai.vercel.app/api/products", {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
      'x-api-key': API_KEY
    },
    body: JSON.stringify({
      query: "shoes",
      page: 2
    })
  });

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

Feed API

The Catalog Feed API allows you to get a paginated feed of products from a specific vendor.

Basic Feed Request

Get the first page of products from a specific vendor:

// Get first page of products from Saintlaurent
(async () => {
  const API_KEY = "YOUR_API_KEY"; // Replace with your actual key
  
  const response = await fetch("https://catalogai.vercel.app/api/feed", {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
      'x-api-key': API_KEY
    },
    body: JSON.stringify({
      vendor: "Saintlaurent",
      page: 1
    })
  });

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

Feed Pagination

Get the second page of products from a vendor:

// Get second page of products from Jennikayne
(async () => {
  const API_KEY = "YOUR_API_KEY"; // Replace with your actual key
  
  const response = await fetch("https://catalogai.vercel.app/api/feed", {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
      'x-api-key': API_KEY
    },
    body: JSON.stringify({
      vendor: "Jennikayne",
      page: 2
    })
  });

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