{
  "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": [],
  "variations": null,
  "paymentLink": null,
  "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"
  },
  "wallet": {
    "id": "abcd1234-5678-90ef-ghij-klmnopqrstuv",
    "address": "0x742d35Cc6635C0532925a3b8d",
    "blockchain": "ETHEREUM"
  },
  "transactions": []
}
The Create Product endpoint enables you to create products that can be sold through payment links, invoices, or direct checkout flows. Products support both digital and physical goods with comprehensive inventory management, image uploads, and flexible pricing options.

Endpoint Details

method
string
POST
url
string
/api/v0/products
content-type
string
multipart/form-data (for image uploads) or application/json
Authentication: Required (API Key & Secret)
Idempotency: Supported (recommended for create operations)

Request Parameters

Required Fields

name
string
required
Product name as it appears to customers (1-200 characters)
Example: "Premium Software License"
description
string
required
Detailed product description (max 2000 characters)
Example: "Annual license for our premium software suite"
price
number
required
Product price (must be > 0.01)
Example: 299.99

Optional Fields

currency
string
3-letter ISO currency code
Default: "USD"
Example: "EUR"
type
string
Product classification
Example: "DIGITAL"
productType
enum
Product category
Values: "PRODUCT", "SERVICE"
Default: "PRODUCT"
status
enum
Product availability status
Values: "ACTIVE", "INACTIVE"
Default: "ACTIVE"
weight
number
Product weight for shipping
Example: 0.5
unit
string
Unit of measurement
Example: "kg"
quantity
number
Available quantity
Example: 100
stockCount
number
Current stock level
Example: 50
images
array
Product image files or URLs
Example: ["https://example.com/image1.jpg"]

Enums

ProductType

  • PRODUCT - Physical or digital product
  • SERVICE - Service offering

ProductStatus

  • ACTIVE - Available for purchase
  • INACTIVE - Not available for purchase

Supported Currencies

  • USD - US Dollar
  • EUR - Euro
  • USDC - USD Coin (stablecoin)
  • EURC - Euro Coin (stablecoin)

Request Examples

curl -X POST "https://api.devdraft.ai/api/v0/products" \
  -H "x-client-key: YOUR_CLIENT_KEY" \
  -H "x-client-secret: YOUR_CLIENT_SECRET" \
  -H "x-idempotency-key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{
    "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"
  }'

Response Format

Success Response (201 Created)

{
  "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": [],
  "variations": null,
  "paymentLink": null,
  "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"
  },
  "wallet": {
    "id": "abcd1234-5678-90ef-ghij-klmnopqrstuv",
    "address": "0x742d35Cc6635C0532925a3b8d",
    "blockchain": "ETHEREUM"
  },
  "transactions": []
}

Product with Images Response

{
  "id": "550e8400-e29b-41d4-a716-446655440001",
  "name": "Gaming Laptop",
  "description": "High-performance gaming laptop with RTX graphics",
  "price": 1299.99,
  "currency": "USD",
  "productType": "PRODUCT",
  "status": "ACTIVE",
  "stockCount": 25,
  "images": [
    "https://devdraft-images.s3.amazonaws.com/products/laptop1.jpg",
    "https://devdraft-images.s3.amazonaws.com/products/laptop2.jpg"
  ],
  "weight": null,
  "unit": null,
  "dateAdded": "2024-01-15T10:30:00.000Z",
  "dateUpdated": "2024-01-15T10:30:00.000Z"
}

Error Responses

{
  "statusCode": 400,
  "message": [
    "Product name cannot be empty",
    "Price must be greater than 0",
    "Currency must be a valid 3-letter ISO code"
  ],
  "error": "Bad Request"
}

Image Upload Guidelines

Supported Formats

  • File Types: JPEG, PNG, WebP, GIF
  • Maximum Size: 10MB per image
  • Maximum Count: 10 images per product
  • Recommended Dimensions: 1200x1200px or larger

Upload Methods

  1. Form Data Upload: Include images as files in multipart/form-data request
  2. Pre-uploaded URLs: Provide existing image URLs in the images array

Image Processing

  • Images are automatically optimized and resized
  • Multiple sizes are generated for different use cases
  • Images are served via CDN for fast loading

Business Logic

Inventory Management

  • Digital Products: stockCount and quantity are optional
  • Physical Products: Stock tracking is recommended
  • Services: Use quantity for available slots/hours

Wallet Assignment

  • Products are automatically linked to your app’s default wallet
  • If no wallet exists, the product is created without wallet assignment
  • Wallet linking enables payment processing and revenue tracking

Currency Handling

  • Prices are stored exactly as provided (no conversion)
  • Payment processing respects the product’s currency setting
  • Stablecoin pricing (USDC/EURC) provides price stability

Integration Tips

Product Organization

// Group products by type for better management
const productTypes = {
  digital: { productType: 'PRODUCT', type: 'DIGITAL' },
  physical: { productType: 'PRODUCT', type: 'PHYSICAL' },
  service: { productType: 'SERVICE' }
};

Next Steps

After creating a product, you can:
  1. Add to Payment Links: Include products in payment link configurations
  2. Create Invoices: Add products to customer invoices
  3. Upload Additional Images: Use the product images endpoint
  4. Update Product Details: Modify pricing, inventory, or descriptions
  5. Track Sales: Monitor product performance through transaction reports