Analytics API
Endpoints for querying sales data, revenue metrics, customer growth, and product performance across your hubs. All amounts are in cents.
Get total gross revenue for a hub by timeframe.
Example Request
curl -X GET \ "https://tina-api.venhub.com/api/v1/owners/gross_revenue/?hub_id=123&timeframe=monthly" \ --header "X-API-Key: vh_abc123..."
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
hub_id |
Integer | Required | Hub ID to retrieve revenue for |
timeframe |
String | Optional | Time window for revenue aggregation. One of: "daily", "weekly", "monthly". Omit for all-time total. |
Response
{
"gross_revenue": 125000
}
Get total count of orders for a hub.
Example Request
curl -X GET \ "https://tina-api.venhub.com/api/v1/owners/total_orders/?hub_id=123" \ --header "X-API-Key: vh_abc123..."
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
hub_id |
Integer | Required | Hub ID to retrieve order count for |
Response
{
"total_orders": 1250
}
Get total count of products stocked in a hub.
Example Request
curl -X GET \ "https://tina-api.venhub.com/api/v1/owners/total_products/?hub_id=123" \ --header "X-API-Key: vh_abc123..."
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
hub_id |
Integer | Required | Hub ID to retrieve product count for |
Response
{
"total_products": 150
}
Get total count of unique customers for a hub.
Example Request
curl -X GET \ "https://tina-api.venhub.com/api/v1/owners/total_customers/?hub_id=123" \ --header "X-API-Key: vh_abc123..."
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
hub_id |
Integer | Required | Hub ID to retrieve customer count for |
Response
{
"total_customers": 850
}
Get bestselling products ranked by sales volume.
Example Request
curl -X GET \ "https://tina-api.venhub.com/api/v1/owners/top_products/?hub_id=123" \ --header "X-API-Key: vh_abc123..."
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
hub_id |
Integer | Required | Hub ID to retrieve top products for |
Response
[ ["Organic Apple", 350, "https://storage.example.com/products/apple.jpg"], ["Milk 1 Gallon", 280, "https://storage.example.com/products/milk.jpg"] ]
Get top product categories ranked by items sold.
Example Request
curl -X GET \ "https://tina-api.venhub.com/api/v1/owners/hubs/123/top-categories" \ --header "X-API-Key: vh_abc123..."
Parameters
| Parameter | Type | Location | Required | Description |
|---|---|---|---|---|
hub_id |
Integer | Path | Required | Hub ID to retrieve top categories for |
Response
[
{ "name": "Produce", "revenue_cents": 359400, "units_sold": 1200 },
{ "name": "Dairy", "revenue_cents": 424150, "units_sold": 850 }
]
Get daily sales breakdown for the current week.
Example Request
curl -X GET \ "https://tina-api.venhub.com/api/v1/owners/weekly_sales_breakdown/?hub_id=123" \ --header "X-API-Key: vh_abc123..."
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
hub_id |
Integer | Required | Hub ID to retrieve weekly breakdown for |
Response
[ ["Monday", 15000], ["Tuesday", 18500] ]
Get monthly earnings and profit year-to-date.
Example Request
curl -X GET \ "https://tina-api.venhub.com/api/v1/owners/earnings-and-profits-ytd/?hub_id=123" \ --header "X-API-Key: vh_abc123..."
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
hub_id |
Integer | Required | Hub ID to retrieve YTD earnings for |
Response
{
"monthly_data": [
{
"month": "January",
"total_earnings": 125000,
"total_cost": 80000,
"total_profit": 45000
},
{
"month": "February",
"total_earnings": 118000,
"total_cost": 75500,
"total_profit": 42500
}
],
"highest_earning": 125000,
"highest_cost": 80000,
"highest_profit": 45000
}
Get monthly unique customer counts for the current year.
Example Request
curl -X GET \ "https://tina-api.venhub.com/api/v1/owners/customer-growth/?hub_id=123" \ --header "X-API-Key: vh_abc123..."
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
hub_id |
Integer | Required | Hub ID to retrieve customer growth for |
Response
{
"customer_growth": [
{ "month": "January", "unique_customers": 800 },
{ "month": "February", "unique_customers": 852 }
]
}
Compare monthly sales between current and previous year.
Example Request
curl -X GET \ "https://tina-api.venhub.com/api/v1/owners/monthly_sales_comparison/?hub_id=123" \ --header "X-API-Key: vh_abc123..."
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
hub_id |
Integer | Required | Hub ID to retrieve year-over-year comparison for |
Response
{
"current_year": [125000, 118000],
"previous_year": [98000, 102000]
}
Get sales overview across timeframes (daily, weekly, monthly, yearly).
Example Request
curl -X GET \ "https://tina-api.venhub.com/api/v1/owners/get_sales_overview/?hub_id=123" \ --header "X-API-Key: vh_abc123..."
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
hub_id |
Integer | Required | Hub ID to retrieve the sales overview for |
Get monthly net profit breakdown after costs.
Example Request
curl -X GET \ "https://tina-api.venhub.com/api/v1/owners/monthly_net_profit_breakdown/?hub_id=123" \ --header "X-API-Key: vh_abc123..."
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
hub_id |
Integer | Required | Hub ID to retrieve net profit breakdown for |
Response
{
"gross_revenue": 125000,
"cost_of_goods": 75000,
"net_profit": 50000
}
Get monthly sales history for a specific product by UPC.
Example Request
curl -X GET \ "https://tina-api.venhub.com/api/v1/owners/monthly_sales_breakdown_for_product/?hub_id=123&product_upc=012345678901" \ --header "X-API-Key: vh_abc123..."
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
hub_id |
Integer | Required | Hub ID to retrieve product sales for |
product_upc |
String | Required | Product UPC barcode |