Analytics

The Analytics API provides profit and loss analysis, DDP landed cost calculations, and cross-marketplace comparisons. Make data-driven decisions with real-time margin calculations and competitive insights.

All endpoints require authentication via Bearer token with analytics:read scope. Analytics endpoints are read-only and aggregate data from other areas.


POST/v1/analytics/profit

Calculate profit

Calculate profit and margin for a product sold on a specific marketplace. Includes all costs: product, shipping, customs, and marketplace fees.

Required attributes

  • Name
    product_id
    Type
    integer
    Description

    Product ID from inventory.

  • Name
    destination_country
    Type
    string
    Description

    Destination country (2-letter ISO code).

  • Name
    selling_price
    Type
    number
    Description

    Selling price on marketplace.

Optional attributes

  • Name
    selling_currency
    Type
    string
    Description

    Currency of selling price (default: USD).

  • Name
    marketplace
    Type
    string
    Description

    Marketplace for fee calculation: amazon, meli, shopify, ebay.

  • Name
    include_fees
    Type
    boolean
    Description

    Include marketplace fees (default: true).

Request

POST
/v1/analytics/profit
curl -X POST https://app.price2b.com/api/v1/analytics/profit \
  -H "Authorization: Bearer {token}" \
  -H "Content-Type: application/json" \
  -d '{
    "product_id": 12345,
    "destination_country": "AR",
    "selling_price": 150.00,
    "selling_currency": "USD",
    "marketplace": "meli",
    "include_fees": true
  }'

Response

{
  "success": true,
  "data": {
    "product": {
      "id": 12345,
      "sku": "PROD-001",
      "name": "Wireless Headphones",
      "cost": 25.00,
      "currency": "USD"
    },
    "selling": {
      "price": 150.00,
      "currency": "USD",
      "marketplace": "meli",
      "country": "AR"
    },
    "costs": {
      "product_cost": 25.00,
      "shipping": 45.00,
      "customs_duties": 28.80,
      "marketplace_fees": 22.50,
      "payment_fees": 4.50,
      "total_costs": 125.80,
      "currency": "USD"
    },
    "profit": {
      "gross_profit": 24.20,
      "margin_percentage": 16.13,
      "roi_percentage": 19.24,
      "currency": "USD"
    },
    "breakdown": {
      "revenue": 150.00,
      "cogs": 25.00,
      "shipping_landed": 73.80,
      "marketplace_fees": 22.50,
      "payment_fees": 4.50,
      "net_profit": 24.20
    }
  }
}

GET/v1/analytics/profit/report

Generate P&L report

Generates a profit and loss report for a date range.

Query parameters

  • Name
    date_from
    Type
    date
    Description

    Start date (YYYY-MM-DD).

  • Name
    date_to
    Type
    date
    Description

    End date (YYYY-MM-DD).

  • Name
    group_by
    Type
    string
    Description

    Group results: product, channel, country, day, month.

  • Name
    channel
    Type
    string
    Description

    Filter by channel.

  • Name
    country
    Type
    string
    Description

    Filter by destination country.

Request

GET
/v1/analytics/profit/report
curl -G https://app.price2b.com/api/v1/analytics/profit/report \
  -H "Authorization: Bearer {token}" \
  -d date_from=2026-01-01 \
  -d date_to=2026-01-31 \
  -d group_by=channel

Response

{
  "success": true,
  "data": {
    "period": {
      "from": "2026-01-01",
      "to": "2026-01-31"
    },
    "summary": {
      "total_revenue": 15000.00,
      "total_costs": 12500.00,
      "total_profit": 2500.00,
      "average_margin": 16.67,
      "orders_count": 150,
      "currency": "USD"
    },
    "by_channel": [
      {
        "channel": "amazon",
        "revenue": 8000.00,
        "costs": 6800.00,
        "profit": 1200.00,
        "margin": 15.00,
        "orders": 80
      },
      {
        "channel": "meli",
        "revenue": 5000.00,
        "costs": 4000.00,
        "profit": 1000.00,
        "margin": 20.00,
        "orders": 50
      },
      {
        "channel": "shopify",
        "revenue": 2000.00,
        "costs": 1700.00,
        "profit": 300.00,
        "margin": 15.00,
        "orders": 20
      }
    ]
  }
}

POST/v1/analytics/ddp

Get DDP landed cost

Calculates the full DDP (Delivered Duty Paid) landed cost for a product to a destination.

Request

POST
/v1/analytics/ddp
curl -X POST https://app.price2b.com/api/v1/analytics/ddp \
  -H "Authorization: Bearer {token}" \
  -H "Content-Type: application/json" \
  -d '{
    "product_id": 12345,
    "destination_country": "AR",
    "quantity": 1
  }'

Response

{
  "success": true,
  "data": {
    "product": {
      "id": 12345,
      "sku": "PROD-001",
      "cost": 25.00
    },
    "destination": "AR",
    "landed_cost": {
      "product_cost": 25.00,
      "shipping_estimate": 45.00,
      "customs_duties": 28.80,
      "total_ddp": 98.80,
      "currency": "USD"
    },
    "suggested_price": {
      "min_price": 118.56,
      "target_price": 148.80,
      "notes": "Target price includes 50% margin"
    }
  }
}

GET/v1/analytics/ddp/countries

List supported countries

Returns a list of countries with DDP calculation support and their basic rates.

Request

GET
/v1/analytics/ddp/countries
curl https://app.price2b.com/api/v1/analytics/ddp/countries \
  -H "Authorization: Bearer {token}"

Response

{
  "success": true,
  "data": {
    "countries": [
      {
        "code": "AR",
        "name": "Argentina",
        "de_minimis": 400.00,
        "vat_rate": 21.0,
        "currency": "USD"
      },
      {
        "code": "BR",
        "name": "Brazil",
        "de_minimis": 50.00,
        "vat_rate": 17.0,
        "currency": "USD",
        "notes": "Remessa Conforme program"
      },
      {
        "code": "MX",
        "name": "Mexico",
        "de_minimis": 50.00,
        "vat_rate": 16.0,
        "currency": "USD"
      }
    ],
    "total_countries": 170
  }
}

GET/v1/analytics/comparison/:productId

Compare across marketplaces

Compares profit potential for a product across multiple marketplaces.

Request

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

Response

{
  "success": true,
  "data": {
    "product": {
      "id": 12345,
      "sku": "PROD-001",
      "name": "Wireless Headphones",
      "cost": 25.00
    },
    "comparisons": [
      {
        "marketplace": "meli",
        "country": "AR",
        "suggested_price": 180.00,
        "landed_cost": 148.80,
        "profit_margin": 17.3,
        "competitor_prices": {
          "min": 165.00,
          "max": 220.00,
          "avg": 185.00
        },
        "demand_score": 8.5
      },
      {
        "marketplace": "amazon",
        "country": "MX",
        "suggested_price": 160.00,
        "landed_cost": 135.20,
        "profit_margin": 15.5,
        "competitor_prices": {
          "min": 145.00,
          "max": 195.00,
          "avg": 165.00
        },
        "demand_score": 7.2
      },
      {
        "marketplace": "amazon",
        "country": "US",
        "suggested_price": 89.99,
        "landed_cost": 55.00,
        "profit_margin": 38.9,
        "competitor_prices": {
          "min": 69.99,
          "max": 119.99,
          "avg": 89.99
        },
        "demand_score": 9.1
      }
    ],
    "recommendation": {
      "best_margin": "amazon_us",
      "best_volume": "meli_ar"
    }
  }
}

GET/v1/analytics/comparison/:productId/countries

Compare across countries

Compares landed costs and suggested prices across destination countries.

Query parameters

  • Name
    countries
    Type
    string
    Description

    Comma-separated list of country codes (default: top 10 destinations).

Request

GET
/v1/analytics/comparison/12345/countries
curl -G https://app.price2b.com/api/v1/analytics/comparison/12345/countries \
  -H "Authorization: Bearer {token}" \
  -d countries=AR,BR,MX,CL,CO

Response

{
  "success": true,
  "data": {
    "product": {
      "id": 12345,
      "sku": "PROD-001",
      "cost": 25.00
    },
    "countries": [
      {
        "country": "AR",
        "country_name": "Argentina",
        "landed_cost": 98.80,
        "customs_duties": 28.80,
        "shipping": 45.00,
        "suggested_price": 148.80,
        "margin_at_suggested": 33.6
      },
      {
        "country": "BR",
        "country_name": "Brazil",
        "landed_cost": 112.50,
        "customs_duties": 42.50,
        "shipping": 45.00,
        "suggested_price": 168.75,
        "margin_at_suggested": 33.3
      },
      {
        "country": "MX",
        "country_name": "Mexico",
        "landed_cost": 85.20,
        "customs_duties": 15.20,
        "shipping": 45.00,
        "suggested_price": 127.80,
        "margin_at_suggested": 33.3
      }
    ],
    "best_margin_country": "AR",
    "lowest_landed_cost": "MX"
  }
}

GET/v1/analytics/product/:id

Get product analytics

Returns analytics summary for a specific product including sales, margins, and performance.

Request

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

Response

{
  "success": true,
  "data": {
    "product": {
      "id": 12345,
      "sku": "PROD-001",
      "name": "Wireless Headphones"
    },
    "period": "last_30_days",
    "sales": {
      "units_sold": 45,
      "revenue": 4500.00,
      "average_price": 100.00
    },
    "profitability": {
      "total_profit": 750.00,
      "average_margin": 16.67,
      "best_margin_channel": "amazon",
      "worst_margin_channel": "ebay"
    },
    "inventory": {
      "current_stock": 150,
      "days_of_stock": 100,
      "reorder_point": 50
    },
    "by_channel": [
      {
        "channel": "amazon",
        "units": 25,
        "revenue": 2500.00,
        "margin": 18.5
      },
      {
        "channel": "meli",
        "units": 15,
        "revenue": 1500.00,
        "margin": 15.2
      }
    ]
  }
}

GET/v1/analytics/product/:id/pricing-history

Get pricing history

Returns historical pricing data for a product across channels.

Query parameters

  • Name
    date_from
    Type
    date
    Description

    Start date.

  • Name
    date_to
    Type
    date
    Description

    End date.

  • Name
    channel
    Type
    string
    Description

    Filter by channel.

Request

GET
/v1/analytics/product/12345/pricing-history
curl -G https://app.price2b.com/api/v1/analytics/product/12345/pricing-history \
  -H "Authorization: Bearer {token}" \
  -d date_from=2026-01-01 \
  -d date_to=2026-01-31

Response

{
  "success": true,
  "data": {
    "product_id": 12345,
    "history": [
      {
        "date": "2026-01-01",
        "channel": "amazon",
        "price": 95.00,
        "competitor_min": 89.99,
        "competitor_max": 115.00
      },
      {
        "date": "2026-01-15",
        "channel": "amazon",
        "price": 99.00,
        "competitor_min": 92.00,
        "competitor_max": 119.00
      },
      {
        "date": "2026-01-31",
        "channel": "amazon",
        "price": 99.00,
        "competitor_min": 89.99,
        "competitor_max": 110.00
      }
    ]
  }
}

Was this page helpful?