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
Authentication : Required (API Key & Secret)
Single Product
Authentication : Required (API Key & Secret)
List Products Parameters
Query Parameters
Page number for pagination (starts from 1) Default : 1
Example : 2
Number of products per page (1-100) Default : 10
Example : 25
Filter by product status Values : "ACTIVE"
, "INACTIVE"
Example : "ACTIVE"
Filter by product type Values : "PRODUCT"
, "SERVICE"
Example : "PRODUCT"
Search products by name or description Example : "software"
Sort field Values : "name"
, "price"
, "dateAdded"
, "dateUpdated"
Default : "dateAdded"
Sort direction Values : "asc"
, "desc"
Default : "desc"
Single Product Parameters
Product ID to retrieve Example : "550e8400-e29b-41d4-a716-446655440000"
Request Examples
List All Products
Paginated Products
Filtered Products
Sorted Products
Single Product
JavaScript
Python
PHP
curl -X GET "https://api.devdraft.ai/api/v0/products" \
-H "x-client-key: YOUR_CLIENT_KEY" \
-H "x-client-secret: YOUR_CLIENT_SECRET"
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
Unique product identifier
Product name as displayed to customers
Detailed product description
Product price in the specified currency
Three-letter ISO currency code
Product category (PRODUCT, SERVICE)
Product availability status (ACTIVE, INACTIVE)
Current stock level (null for unlimited)
Product weight for shipping calculations
Array of product image URLs
Direct payment link for the product
Product creation timestamp (ISO 8601)
Last modification timestamp (ISO 8601)
Extended Fields (Single Product)
Product performance metrics including total transactions, revenue, and conversion rates
Array of recent transactions for this product
Associated wallet information with balance details
Application details including domain information
Error Responses
404 Not Found
401 Unauthorized
400 Bad Request
{
"statusCode" : 404 ,
"message" : "Product not found" ,
"error" : "Not Found"
}
Usage Patterns
Efficient Pagination
Search and Filter
// 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 ;
};
Caching Strategy
Batch Operations
// 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
Product Catalog
Inventory Dashboard
// 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:
Display in Catalog : Show products in your e-commerce interface
Update Product Details : Modify product information as needed
Add to Payment Links : Include products in payment workflows
Track Performance : Analyze product sales and popularity
Manage Inventory : Monitor stock levels and reorder points
For more information, see: