{
  "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": 150,
  "quantity": 150,
  "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",
    "https://devdraft-images.s3.amazonaws.com/products/software-dashboard.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-20T14:22:00.000Z",
  "app": {
    "id": "app_123456789",
    "name": "My Business App",
    "domain": "mybusiness.com",
    "description": "Enterprise business management platform"
  },
  "wallet": {
    "id": "abcd1234-5678-90ef-ghij-klmnopqrstuv",
    "address": "0x742d35Cc6635C0532925a3b8d",
    "blockchain": "ETHEREUM",
    "balance": 15750.25,
    "currency": "USDC"
  },
  "analytics": {
    "totalTransactions": 45,
    "totalRevenue": 13497.55,
    "averageOrderValue": 299.95,
    "conversionRate": 12.5,
    "lastSaleDate": "2024-01-20T14:22:00.000Z",
    "monthlyRevenue": [
      { "month": "2024-01", "revenue": 13497.55, "transactions": 45 }
    ],
    "topCustomers": [
      {
        "email": "enterprise@example.com",
        "totalSpent": 1499.95,
        "transactions": 5
      }
    ]
  },
  "recentTransactions": [
    {
      "id": "txn_987654321",
      "amount": 299.99,
      "currency": "USD",
      "status": "completed",
      "customerEmail": "customer@example.com",
      "paymentMethod": "crypto",
      "date": "2024-01-20T14:22:00.000Z",
      "referenceId": "ref_abc123"
    },
    {
      "id": "txn_987654320",
      "amount": 299.99,
      "currency": "USD",
      "status": "completed",
      "customerEmail": "business@example.com",
      "paymentMethod": "bank_transfer",
      "date": "2024-01-19T11:15:00.000Z",
      "referenceId": "ref_xyz789"
    }
  ],
  "relatedProducts": [
    {
      "id": "550e8400-e29b-41d4-a716-446655440001",
      "name": "Premium Support Package",
      "price": 99.99,
      "currency": "USD"
    }
  ],
  "integrations": {
    "paymentLinks": [
      {
        "id": "pl_123456789",
        "url": "https://pay.devdraft.ai/pl_123456789",
        "status": "active"
      }
    ],
    "invoices": [
      {
        "id": "inv_987654321",
        "status": "paid",
        "amount": 299.99,
        "customer": "customer@example.com"
      }
    ]
  }
}
The Fetch Product endpoint enables you to retrieve comprehensive information about a specific product, including detailed analytics, transaction history, performance metrics, and all associated data. This endpoint is essential for product management, analytics dashboards, and detailed product views.

Endpoint Details

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

Parameters

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

Request Examples

curl -X GET "https://api.devdraft.ai/api/v0/products/550e8400-e29b-41d4-a716-446655440000" \
  -H "x-client-key: YOUR_CLIENT_KEY" \
  -H "x-client-secret: YOUR_CLIENT_SECRET"

Response Format

Complete 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": 150,
  "quantity": 150,
  "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",
    "https://devdraft-images.s3.amazonaws.com/products/software-dashboard.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-20T14:22:00.000Z",
  "app": {
    "id": "app_123456789",
    "name": "My Business App",
    "domain": "mybusiness.com",
    "description": "Enterprise business management platform"
  },
  "wallet": {
    "id": "abcd1234-5678-90ef-ghij-klmnopqrstuv",
    "address": "0x742d35Cc6635C0532925a3b8d",
    "blockchain": "ETHEREUM",
    "balance": 15750.25,
    "currency": "USDC"
  },
  "analytics": {
    "totalTransactions": 45,
    "totalRevenue": 13497.55,
    "averageOrderValue": 299.95,
    "conversionRate": 12.5,
    "lastSaleDate": "2024-01-20T14:22:00.000Z",
    "monthlyRevenue": [
      { "month": "2024-01", "revenue": 13497.55, "transactions": 45 }
    ],
    "topCustomers": [
      {
        "email": "enterprise@example.com",
        "totalSpent": 1499.95,
        "transactions": 5
      }
    ]
  },
  "recentTransactions": [
    {
      "id": "txn_987654321",
      "amount": 299.99,
      "currency": "USD",
      "status": "completed",
      "customerEmail": "customer@example.com",
      "paymentMethod": "crypto",
      "date": "2024-01-20T14:22:00.000Z",
      "referenceId": "ref_abc123"
    },
    {
      "id": "txn_987654320",
      "amount": 299.99,
      "currency": "USD",
      "status": "completed",
      "customerEmail": "business@example.com",
      "paymentMethod": "bank_transfer",
      "date": "2024-01-19T11:15:00.000Z",
      "referenceId": "ref_xyz789"
    }
  ],
  "relatedProducts": [
    {
      "id": "550e8400-e29b-41d4-a716-446655440001",
      "name": "Premium Support Package",
      "price": 99.99,
      "currency": "USD"
    }
  ],
  "integrations": {
    "paymentLinks": [
      {
        "id": "pl_123456789",
        "url": "https://pay.devdraft.ai/pl_123456789",
        "status": "active"
      }
    ],
    "invoices": [
      {
        "id": "inv_987654321",
        "status": "paid",
        "amount": 299.99,
        "customer": "customer@example.com"
      }
    ]
  }
}

Response Fields

Core Product Information

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)

Inventory Information

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

Analytics Data

analytics
object
Comprehensive performance metrics including revenue, transactions, conversion rates, and trends
recentTransactions
array
Array of recent transactions with customer and payment details
topCustomers
array
List of top customers by spending for this product
app
object
Application details including domain and description
wallet
object
Associated wallet information with balance and blockchain details
Array of related or complementary products
integrations
object
Integration details including payment links and invoices using this product

Error Responses

{
  "statusCode": 404,
  "message": "Product not found",
  "error": "Not Found",
  "details": {
    "productId": "550e8400-e29b-41d4-a716-446655440000",
    "suggestion": "Verify the product ID is correct and the product exists in your catalog"
  }
}

Enhanced Examples

Product Dashboard Integration

// Create a comprehensive product dashboard
const createProductDashboard = async (productId) => {
  const product = await analytics.getProductDetails(productId);
  
  return {
    overview: {
      name: product.name,
      status: product.status,
      price: `${product.currency} ${product.price}`,
      lastUpdated: new Date(product.dateUpdated).toLocaleDateString()
    },
    performance: {
      totalRevenue: product.analytics?.totalRevenue || 0,
      totalSales: product.analytics?.totalTransactions || 0,
      conversionRate: `${product.analytics?.conversionRate || 0}%`,
      avgOrderValue: product.analytics?.averageOrderValue || 0
    },
    inventory: {
      stockLevel: product.stockCount || 'Unlimited',
      status: product.stockCount === 0 ? 'Out of Stock' : 
              product.stockCount < 10 ? 'Low Stock' : 'In Stock',
      lastRestocked: product.dateUpdated
    },
    alerts: await analytics.validateProductHealth(productId)
  };
};

Status Analysis

// Monitor product status and alert on issues
const monitorProductStatus = async (productId) => {
  const product = await analytics.getProductDetails(productId);
  const statusChecks = {
    isActive: product.status === 'ACTIVE',
    hasImages: product.images && product.images.length > 0,
    hasStock: !product.stockCount || product.stockCount > 0,
    hasPaymentLink: !!product.paymentLink,
    recentActivity: product.analytics?.lastSaleDate ? 
      new Date(product.analytics.lastSaleDate) > new Date(Date.now() - 30 * 24 * 60 * 60 * 1000) : false
  };
  
  const alerts = [];
  if (!statusChecks.isActive) alerts.push('Product is inactive');
  if (!statusChecks.hasImages) alerts.push('Missing product images');
  if (!statusChecks.hasStock) alerts.push('Out of stock');
  if (!statusChecks.hasPaymentLink) alerts.push('No payment link configured');
  if (!statusChecks.recentActivity) alerts.push('No recent sales activity');
  
  return {
    productId,
    overallHealth: alerts.length === 0 ? 'excellent' : 
                   alerts.length <= 2 ? 'good' : 'needs-attention',
    statusChecks,
    alerts,
    lastChecked: new Date().toISOString()
  };
};

Implementation Examples

Product Validation

// Comprehensive product validation
const validateProduct = async (productId) => {
  const product = await analytics.getProductDetails(productId);
  const validation = {
    errors: [],
    warnings: [],
    recommendations: []
  };
  
  // Required fields validation
  if (!product.name || product.name.length < 3) {
    validation.errors.push('Product name must be at least 3 characters');
  }
  
  if (!product.description || product.description.length < 10) {
    validation.errors.push('Product description must be at least 10 characters');
  }
  
  if (product.price <= 0) {
    validation.errors.push('Product price must be greater than 0');
  }
  
  // Best practices warnings
  if (!product.images || product.images.length === 0) {
    validation.warnings.push('Consider adding product images for better conversion');
  }
  
  if (product.images && product.images.length < 3) {
    validation.recommendations.push('Add more product images to showcase features');
  }
  
  // SEO recommendations
  if (product.description.length > 2000) {
    validation.warnings.push('Product description is very long, consider summarizing');
  }
  
  return {
    isValid: validation.errors.length === 0,
    score: Math.max(0, 100 - (validation.errors.length * 20) - (validation.warnings.length * 5)),
    ...validation
  };
};

Risk Assessment

// Assess product-related business risks
const assessProductRisk = async (productId) => {
  const product = await analytics.getProductDetails(productId);
  const risks = [];
  let riskScore = 0;
  
  // Revenue dependency risk
  if (product.analytics?.totalRevenue > 10000) {
    const revenueShare = product.analytics.totalRevenue; // Would need total app revenue for comparison
    if (revenueShare > 5000) { // Significant revenue contributor
      risks.push({
        type: 'revenue_dependency',
        level: 'medium',
        message: 'High revenue dependency on this product'
      });
      riskScore += 15;
    }
  }
  
  // Inventory risk
  if (product.stockCount !== null && product.stockCount < 5) {
    risks.push({
      type: 'inventory',
      level: product.stockCount === 0 ? 'high' : 'medium',
      message: product.stockCount === 0 ? 'Out of stock' : 'Very low stock levels'
    });
    riskScore += product.stockCount === 0 ? 25 : 10;
  }
  
  // Performance risk
  if (product.analytics?.conversionRate < 2) {
    risks.push({
      type: 'performance',
      level: 'medium',
      message: 'Low conversion rate may indicate pricing or presentation issues'
    });
    riskScore += 10;
  }
  
  return {
    productId,
    overallRisk: riskScore < 15 ? 'low' : riskScore < 35 ? 'medium' : 'high',
    riskScore,
    risks,
    mitigationSuggestions: generateMitigationSuggestions(risks)
  };
};

const generateMitigationSuggestions = (risks) => {
  return risks.map(risk => {
    switch (risk.type) {
      case 'inventory':
        return 'Restock product or adjust availability status';
      case 'performance':
        return 'Review product pricing, description, and images';
      case 'revenue_dependency':
        return 'Diversify product portfolio to reduce dependency';
      default:
        return 'Monitor closely and take corrective action';
    }
  });
};

Next Steps

After fetching product details, you can:
  1. Update Product Information: Use the update endpoint to modify details
  2. Upload New Images: Add or replace product images
  3. Analyze Performance: Use analytics data for business decisions
  4. Create Payment Links: Generate direct payment links for the product
  5. Monitor Health: Set up automated health checks and alerts