Inventory

The Inventory API allows you to manage products and stock across warehouses. Create, update, and organize your product catalog with support for variants, images, and stock tracking.

All endpoints require authentication via Bearer token with inventory:read or inventory:write scope.

The product model

The product model contains all the information about your products, including pricing, dimensions, customs data, and stock levels.

Properties

  • Name
    id
    Type
    integer
    Description

    Unique identifier for the product.

  • Name
    sku
    Type
    string
    Description

    Stock keeping unit (unique per account).

  • Name
    name
    Type
    string
    Description

    Product name.

  • Name
    description
    Type
    string
    Description

    Product description.

  • Name
    category
    Type
    string
    Description

    Product category name.

  • Name
    price
    Type
    number
    Description

    Product price.

  • Name
    currency
    Type
    string
    Description

    Price currency (3-letter ISO code).

  • Name
    weight
    Type
    number
    Description

    Product weight in kilograms.

  • Name
    dimensions
    Type
    object
    Description

    Product dimensions (length, width, height in cm).

  • Name
    hs_code
    Type
    string
    Description

    Harmonized System code for customs.

  • Name
    country_of_origin
    Type
    string
    Description

    Country of manufacture (2-letter ISO code).

  • Name
    stock_quantity
    Type
    integer
    Description

    Total stock across all warehouses.

  • Name
    status
    Type
    string
    Description

    Product status: active or inactive.

  • Name
    images
    Type
    array
    Description

    Array of product images with URLs.

  • Name
    created_at
    Type
    timestamp
    Description

    When the product was created.

  • Name
    updated_at
    Type
    timestamp
    Description

    When the product was last updated.


GET/v1/inventory/products

List products

Returns a paginated list of products. Use filters to narrow down results.

Query parameters

  • Name
    page
    Type
    integer
    Description

    Page number (default: 1).

  • Name
    per_page
    Type
    integer
    Description

    Items per page (default: 20, max: 100).

  • Name
    search
    Type
    string
    Description

    Search by SKU, name, or description.

  • Name
    status
    Type
    string
    Description

    Filter by status: active, inactive, or all.

  • Name
    has_stock
    Type
    boolean
    Description

    Only show products with stock available.

  • Name
    category_id
    Type
    integer
    Description

    Filter by category.

  • Name
    created_after
    Type
    datetime
    Description

    Products created after this date (ISO 8601).

  • Name
    created_before
    Type
    datetime
    Description

    Products created before this date (ISO 8601).

Request

GET
/v1/inventory/products
curl -G https://app.price2b.com/api/v1/inventory/products \
  -H "Authorization: Bearer {token}" \
  -d page=1 \
  -d per_page=20 \
  -d status=active

Response

{
  "success": true,
  "data": {
    "products": [
      {
        "id": 12345,
        "sku": "PROD-001",
        "name": "Wireless Headphones",
        "description": "High-quality Bluetooth headphones",
        "category": "Electronics",
        "price": 49.99,
        "currency": "USD",
        "weight": 0.25,
        "hs_code": "8518300000",
        "country_of_origin": "CN",
        "stock_quantity": 150,
        "status": "active",
        "images": [
          {
            "id": 1,
            "url": "https://...",
            "is_primary": true
          }
        ],
        "created_at": "2026-01-15T10:30:00Z",
        "updated_at": "2026-01-20T14:45:00Z"
      }
    ],
    "pagination": {
      "current_page": 1,
      "per_page": 20,
      "total": 150,
      "last_page": 8,
      "has_more_pages": true
    }
  }
}

POST/v1/inventory/products

Create a product

Creates a new product in your inventory.

Required attributes

  • Name
    sku
    Type
    string
    Description

    Unique SKU for the product (max: 100 characters).

  • Name
    name
    Type
    string
    Description

    Product name (max: 255 characters).

  • Name
    price
    Type
    number
    Description

    Product price (min: 0).

Optional attributes

  • Name
    description
    Type
    string
    Description

    Product description (max: 5000 characters).

  • Name
    currency
    Type
    string
    Description

    Price currency (default: USD).

  • Name
    weight
    Type
    number
    Description

    Weight in kilograms.

  • Name
    dimensions
    Type
    object
    Description

    Object with length, width, height in cm.

  • Name
    hs_code
    Type
    string
    Description

    HS/NCM code for customs (max: 12 characters).

  • Name
    country_of_origin
    Type
    string
    Description

    Country of manufacture (2-letter ISO code).

  • Name
    category_id
    Type
    integer
    Description

    Category ID.

  • Name
    initial_stock
    Type
    integer
    Description

    Initial stock quantity.

  • Name
    warehouse_id
    Type
    integer
    Description

    Warehouse for initial stock.

Request

POST
/v1/inventory/products
curl -X POST https://app.price2b.com/api/v1/inventory/products \
  -H "Authorization: Bearer {token}" \
  -H "Content-Type: application/json" \
  -d '{
    "sku": "PROD-002",
    "name": "Bluetooth Speaker",
    "description": "Portable wireless speaker",
    "price": 35.00,
    "currency": "USD",
    "weight": 0.5,
    "dimensions": {
      "length": 10,
      "width": 10,
      "height": 15
    },
    "hs_code": "8518220000",
    "country_of_origin": "CN",
    "category_id": 5,
    "initial_stock": 100,
    "warehouse_id": 1
  }'

Response (201)

{
  "success": true,
  "message": "Product created successfully",
  "data": {
    "id": 12346,
    "sku": "PROD-002",
    "name": "Bluetooth Speaker",
    "price": 35.00,
    "currency": "USD",
    "stock_quantity": 100,
    "status": "active",
    "created_at": "2026-01-31T10:00:00Z"
  }
}

GET/v1/inventory/products/:id

Get a product

Retrieves a product by its ID with full details including stock by warehouse.

Request

GET
/v1/inventory/products/12345
curl https://app.price2b.com/api/v1/inventory/products/12345 \
  -H "Authorization: Bearer {token}"

Response

{
  "success": true,
  "data": {
    "id": 12345,
    "sku": "PROD-001",
    "name": "Wireless Headphones",
    "description": "High-quality Bluetooth headphones",
    "price": 49.99,
    "currency": "USD",
    "weight": 0.25,
    "dimensions": {
      "length": 20,
      "width": 15,
      "height": 8
    },
    "hs_code": "8518300000",
    "country_of_origin": "CN",
    "stock_by_warehouse": [
      {
        "warehouse_id": 1,
        "warehouse_name": "Miami",
        "quantity": 100
      },
      {
        "warehouse_id": 2,
        "warehouse_name": "Los Angeles",
        "quantity": 50
      }
    ],
    "total_stock": 150,
    "status": "active"
  }
}

PUT/v1/inventory/products/:id

Update a product

Updates an existing product. Only include fields you want to change.

Updatable attributes

  • Name
    name
    Type
    string
    Description

    Product name.

  • Name
    description
    Type
    string
    Description

    Product description.

  • Name
    price
    Type
    number
    Description

    Product price.

  • Name
    weight
    Type
    number
    Description

    Weight in kilograms.

  • Name
    dimensions
    Type
    object
    Description

    Product dimensions.

  • Name
    hs_code
    Type
    string
    Description

    HS/NCM code.

  • Name
    country_of_origin
    Type
    string
    Description

    Country of manufacture.

  • Name
    status
    Type
    string
    Description

    active or inactive.

Request

PUT
/v1/inventory/products/12345
curl -X PUT https://app.price2b.com/api/v1/inventory/products/12345 \
  -H "Authorization: Bearer {token}" \
  -H "Content-Type: application/json" \
  -d '{
    "price": 54.99,
    "status": "active"
  }'

Response

{
  "success": true,
  "message": "Product updated successfully",
  "data": {
    "id": 12345,
    "sku": "PROD-001",
    "price": 54.99,
    "status": "active",
    "updated_at": "2026-01-31T12:00:00Z"
  }
}

DELETE/v1/inventory/products/:id

Delete a product

Soft deletes a product. The product will be marked as deleted but can be restored.

Products with pending orders cannot be deleted.

Request

DELETE
/v1/inventory/products/12345
curl -X DELETE https://app.price2b.com/api/v1/inventory/products/12345 \
  -H "Authorization: Bearer {token}"

Response (204)

// No content

GET/v1/inventory/products/:id/stock

Get product stock

Returns stock levels for a product across all warehouses.

Request

GET
/v1/inventory/products/12345/stock
curl https://app.price2b.com/api/v1/inventory/products/12345/stock \
  -H "Authorization: Bearer {token}"

Response

{
  "success": true,
  "data": {
    "product_id": 12345,
    "sku": "PROD-001",
    "warehouses": [
      {
        "warehouse_id": 1,
        "warehouse_name": "Miami",
        "quantity": 100,
        "reserved": 5,
        "available": 95
      },
      {
        "warehouse_id": 2,
        "warehouse_name": "Los Angeles",
        "quantity": 50,
        "reserved": 0,
        "available": 50
      }
    ],
    "total": {
      "quantity": 150,
      "reserved": 5,
      "available": 145
    }
  }
}

POST/v1/inventory/products/:id/stock/adjust

Adjust stock

Adjusts stock quantity for a product in a specific warehouse.

Required attributes

  • Name
    warehouse_id
    Type
    integer
    Description

    Target warehouse ID.

  • Name
    adjustment
    Type
    integer
    Description

    Quantity to adjust (positive or negative).

  • Name
    adjustment_type
    Type
    string
    Description

    Type: add, subtract, or set.

Optional attributes

  • Name
    reason
    Type
    string
    Description

    Reason for adjustment.

  • Name
    reference
    Type
    string
    Description

    External reference (e.g., inventory count ID).

Request

POST
/v1/inventory/products/12345/stock/adjust
curl -X POST https://app.price2b.com/api/v1/inventory/products/12345/stock/adjust \
  -H "Authorization: Bearer {token}" \
  -H "Content-Type: application/json" \
  -d '{
    "warehouse_id": 1,
    "adjustment": 50,
    "adjustment_type": "add",
    "reason": "Inventory count adjustment",
    "reference": "INV-2026-001"
  }'

Response

{
  "success": true,
  "message": "Stock adjusted successfully",
  "data": {
    "product_id": 12345,
    "warehouse_id": 1,
    "previous_quantity": 100,
    "adjustment": 50,
    "new_quantity": 150,
    "adjustment_type": "add"
  }
}

POST/v1/inventory/products/import

Bulk import products

Imports products from an Excel or CSV file. The import runs asynchronously.

Supported formats

  • Excel (.xlsx, .xls)
  • CSV (.csv)

Required columns

  • sku — Product SKU
  • name — Product name
  • price — Product price

Optional columns

  • description, weight, hs_code, country_of_origin, category, initial_stock

Request

POST
/v1/inventory/products/import
curl -X POST https://app.price2b.com/api/v1/inventory/products/import \
  -H "Authorization: Bearer {token}" \
  -F "file=@products.xlsx" \
  -F "warehouse_id=1"

Response (202)

{
  "success": true,
  "message": "Import started",
  "data": {
    "batch_id": "BATCH-2026-001234",
    "status": "processing",
    "status_url": "/api/v1/inventory/products/import/BATCH-2026-001234/status"
  }
}

GET/v1/inventory/products/import/:batchId/status

Get import status

Checks the status of a bulk import operation.

Request

GET
/v1/inventory/products/import/BATCH-2026-001234/status
curl https://app.price2b.com/api/v1/inventory/products/import/BATCH-2026-001234/status \
  -H "Authorization: Bearer {token}"

Response

{
  "success": true,
  "data": {
    "batch_id": "BATCH-2026-001234",
    "status": "completed",
    "total_rows": 500,
    "processed": 500,
    "created": 480,
    "updated": 15,
    "failed": 5,
    "errors": [
      {
        "row": 45,
        "sku": "INVALID-SKU",
        "error": "SKU already exists"
      }
    ],
    "started_at": "2026-01-31T10:00:00Z",
    "completed_at": "2026-01-31T10:02:30Z"
  }
}

Was this page helpful?