{
  "products": [
    {
      "id": "550e8400-e29b-41d4-a716-446655440000",
      "name": "Premium Software License",
      "description": "Annual license for our premium software suite",
      "price": 299.99,
      "currency": "USD",
      "productType": "PRODUCT",
      "status": "ACTIVE",
      "stockCount": null,
      "quantity": null,
      "weight": null,
      "unit": null,
      "images": [
        "https://devdraft-images.s3.amazonaws.com/products/software-license.jpg"
      ],
      "dateAdded": "2024-01-15T10:30:00.000Z",
      "dateUpdated": "2024-01-15T10:30:00.000Z",
      "wallet": {
        "id": "abcd1234-5678-90ef-ghij-klmnopqrstuv",
        "address": "0x742d35Cc6635C0532925a3b8d",
        "blockchain": "ETHEREUM"
      },
      "transactionCount": 45,
      "totalRevenue": 13497.55
    },
    {
      "id": "550e8400-e29b-41d4-a716-446655440001",
      "name": "Business Consultation",
      "description": "1-hour strategic business consultation",
      "price": 150.00,
      "currency": "USD",
      "productType": "SERVICE",
      "status": "ACTIVE",
      "unit": "hour",
      "quantity": 1,
      "dateAdded": "2024-01-14T15:45:00.000Z",
      "dateUpdated": "2024-01-14T15:45:00.000Z",
      "transactionCount": 12,
      "totalRevenue": 1800.00
    }
  ],
  "pagination": {
    "currentPage": 1,
    "totalPages": 3,
    "totalItems": 27,
    "itemsPerPage": 10,
    "hasNextPage": true,
    "hasPreviousPage": false
  },
  "filters": {
    "status": "ACTIVE",
    "productType": null,
    "search": null
  },
  "summary": {
    "totalProducts": 27,
    "activeProducts": 24,
    "inactiveProducts": 3,
    "totalValue": 45230.75
  }
}
The List Products endpoints enable you to retrieve product information from your catalog. You can either fetch all products with pagination support or retrieve a specific product by its ID. These endpoints provide comprehensive product details including pricing, inventory, images, and transaction history.

Endpoint Details

List All Products

method
string
GET
url
string
/api/v0/products
Authentication: Required (API Key & Secret)

Single Product

method
string
GET
url
string
/api/v0/products/{id}
Authentication: Required (API Key & Secret)

List Products Parameters

Query Parameters

page
integer
Page number for pagination (starts from 1)
Default: 1
Example: 2
limit
integer
Number of products per page (1-100)
Default: 10
Example: 25
status
string
Filter by product status
Values: "ACTIVE", "INACTIVE"
Example: "ACTIVE"
productType
string
Filter by product type
Values: "PRODUCT", "SERVICE"
Example: "PRODUCT"
Search products by name or description
Example: "software"
sortBy
string
Sort field
Values: "name", "price", "dateAdded", "dateUpdated"
Default: "dateAdded"
sortOrder
string
Sort direction
Values: "asc", "desc"
Default: "desc"

Single Product Parameters

id
string
required
Product ID to retrieve
Example: "550e8400-e29b-41d4-a716-446655440000"

Request Examples

curl -X GET "https://api.devdraft.ai/api/v0/products" \
  -H "x-client-key: YOUR_CLIENT_KEY" \
  -H "x-client-secret: YOUR_CLIENT_SECRET"

Response Format

List Products Response

{
  "products": [
    {
      "id": "550e8400-e29b-41d4-a716-446655440000",
      "name": "Premium Software License",
      "description": "Annual license for our premium software suite",
      "price": 299.99,
      "currency": "USD",
      "productType": "PRODUCT",
      "status": "ACTIVE",
      "stockCount": null,
      "quantity": null,
      "weight": null,
      "unit": null,
      "images": [
        "https://devdraft-images.s3.amazonaws.com/products/software-license.jpg"
      ],
      "dateAdded": "2024-01-15T10:30:00.000Z",
      "dateUpdated": "2024-01-15T10:30:00.000Z",
      "wallet": {
        "id": "abcd1234-5678-90ef-ghij-klmnopqrstuv",
        "address": "0x742d35Cc6635C0532925a3b8d",
        "blockchain": "ETHEREUM"
      },
      "transactionCount": 45,
      "totalRevenue": 13497.55
    },
    {
      "id": "550e8400-e29b-41d4-a716-446655440001",
      "name": "Business Consultation",
      "description": "1-hour strategic business consultation",
      "price": 150.00,
      "currency": "USD",
      "productType": "SERVICE",
      "status": "ACTIVE",
      "unit": "hour",
      "quantity": 1,
      "dateAdded": "2024-01-14T15:45:00.000Z",
      "dateUpdated": "2024-01-14T15:45:00.000Z",
      "transactionCount": 12,
      "totalRevenue": 1800.00
    }
  ],
  "pagination": {
    "currentPage": 1,
    "totalPages": 3,
    "totalItems": 27,
    "itemsPerPage": 10,
    "hasNextPage": true,
    "hasPreviousPage": false
  },
  "filters": {
    "status": "ACTIVE",
    "productType": null,
    "search": null
  },
  "summary": {
    "totalProducts": 27,
    "activeProducts": 24,
    "inactiveProducts": 3,
    "totalValue": 45230.75
  }
}

Single Product Response

{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "name": "Premium Software License",
  "description": "Annual license for our premium software suite with advanced features, priority support, and regular updates.",
  "price": 299.99,
  "currency": "USD",
  "productType": "PRODUCT",
  "status": "ACTIVE",
  "stockCount": null,
  "quantity": null,
  "weight": null,
  "unit": null,
  "images": [
    "https://devdraft-images.s3.amazonaws.com/products/software-license.jpg",
    "https://devdraft-images.s3.amazonaws.com/products/software-features.jpg"
  ],
  "variations": null,
  "paymentLink": "https://pay.devdraft.ai/550e8400-e29b-41d4-a716-446655440000",
  "walletId": "abcd1234-5678-90ef-ghij-klmnopqrstuv",
  "dateAdded": "2024-01-15T10:30:00.000Z",
  "dateUpdated": "2024-01-15T10:30:00.000Z",
  "app": {
    "id": "app_123456789",
    "name": "My Business App",
    "domain": "mybusiness.com"
  },
  "wallet": {
    "id": "abcd1234-5678-90ef-ghij-klmnopqrstuv",
    "address": "0x742d35Cc6635C0532925a3b8d",
    "blockchain": "ETHEREUM",
    "balance": 15750.25
  },
  "analytics": {
    "totalTransactions": 45,
    "totalRevenue": 13497.55,
    "averageOrderValue": 299.95,
    "conversionRate": 12.5,
    "lastSaleDate": "2024-01-20T14:22:00.000Z"
  },
  "recentTransactions": [
    {
      "id": "txn_987654321",
      "amount": 299.99,
      "currency": "USD",
      "status": "completed",
      "customerEmail": "customer@example.com",
      "date": "2024-01-20T14:22:00.000Z"
    }
  ]
}

Response Fields

Product Object

id
string
Unique product identifier
name
string
Product name as displayed to customers
description
string
Detailed product description
price
number
Product price in the specified currency
currency
string
Three-letter ISO currency code
productType
enum
Product category (PRODUCT, SERVICE)
status
enum
Product availability status (ACTIVE, INACTIVE)
stockCount
number | null
Current stock level (null for unlimited)
quantity
number | null
Available quantity
weight
number | null
Product weight for shipping calculations
unit
string | null
Unit of measurement
images
array
Array of product image URLs
Direct payment link for the product
dateAdded
string
Product creation timestamp (ISO 8601)
dateUpdated
string
Last modification timestamp (ISO 8601)

Extended Fields (Single Product)

analytics
object
Product performance metrics including total transactions, revenue, and conversion rates
recentTransactions
array
Array of recent transactions for this product
wallet
object
Associated wallet information with balance details
app
object
Application details including domain information

Error Responses

{
  "statusCode": 404,
  "message": "Product not found",
  "error": "Not Found"
}

Usage Patterns

Pagination Strategy

// Fetch products in batches
const fetchAllProducts = async () => {
  let allProducts = [];
  let currentPage = 1;
  let hasMore = true;
  
  while (hasMore) {
    const response = await catalog.getAllProducts({
      page: currentPage,
      limit: 50
    });
    
    allProducts = [...allProducts, ...response.products];
    hasMore = response.pagination.hasNextPage;
    currentPage++;
  }
  
  return allProducts;
};

Performance Optimization

// Cache frequently accessed products
const productCache = new Map();

const getCachedProduct = async (productId) => {
  if (productCache.has(productId)) {
    return productCache.get(productId);
  }
  
  const product = await catalog.getProduct(productId);
  productCache.set(productId, product);
  
  // Cache for 5 minutes
  setTimeout(() => productCache.delete(productId), 5 * 60 * 1000);
  
  return product;
};

Integration Examples

E-commerce Catalog

// Build product catalog with categories
const buildCatalog = async () => {
  const allProducts = await catalog.getAllProducts({ status: 'ACTIVE' });
  
  const catalog = {
    products: allProducts.products.filter(p => p.productType === 'PRODUCT'),
    services: allProducts.products.filter(p => p.productType === 'SERVICE'),
    active: allProducts.products.filter(p => p.status === 'ACTIVE'),
    inStock: allProducts.products.filter(p => !p.stockCount || p.stockCount > 0)
  };
  
  return catalog;
};

Next Steps

After fetching products, you can:
  1. Display in Catalog: Show products in your e-commerce interface
  2. Update Product Details: Modify product information as needed
  3. Add to Payment Links: Include products in payment workflows
  4. Track Performance: Analyze product sales and popularity
  5. Manage Inventory: Monitor stock levels and reorder points