Banners
Example Request
curl -X GET \
"https://tina-api.venhub.com/api/v1/owners/owner/banners?hub_id=123" \
--header "X-API-Key: vh_abc123..."
Parameters
| Parameter | Type | Location | Required | Description |
hub_id | Integer | Query | Required | Hub ID to retrieve banners for |
Response
[
{
"id": 1,
"name": "Summer Sale",
"image_url": "https://storage.example.com/banners/summer.jpg",
"order_by": 1
},
{
"id": 2,
"name": "New Products",
"image_url": "https://storage.example.com/banners/new.jpg",
"order_by": 2
}
]
ℹ️
This endpoint uses multipart/form-data for file upload. Include the hub_id as a query parameter.
Example Request
curl -X POST \
"https://tina-api.venhub.com/api/v1/owners/owner/banners?hub_id=123" \
--header "X-API-Key: vh_abc123..." \
--form 'name=Summer Sale' \
--form 'order_by=1' \
--form '[email protected]'
Parameters
| Parameter | Type | Location | Required | Description |
hub_id | Integer | Query | Required | Hub ID to create the banner for |
name | String | Form | Required | Banner display name |
order_by | Integer | Form | Required | Display order position |
file | File | Form | Required | Banner image file |
Response
{
"id": 3,
"name": "Summer Sale",
"image_url": "https://storage.example.com/banners/abc123.jpg",
"order_by": 1
}
Example Request
curl -X DELETE \
"https://tina-api.venhub.com/api/v1/owners/owner/banners/3?hub_id=123" \
--header "X-API-Key: vh_abc123..."
Parameters
| Parameter | Type | Location | Required | Description |
banner_id | Integer | Path | Required | ID of the banner to delete |
hub_id | Integer | Query | Required | Hub ID the banner belongs to |
Response
ℹ️
200 OK with an empty body. This endpoint doesn't return {success: true} or any other JSON, so check the status code to confirm the delete succeeded.
Deals
How Deals Work
A deal is made up of one or more triggers (what activates it), one or more rewards (what the customer gets), and optional constraints (limits on redemption). When a cart meets all of a deal's triggers and constraints, the deal is eligible and its reward can be calculated against the cart. Each is passed as an object in the triggers, rewards and constraints arrays when you create a deal. See Trigger, Reward and Constraint Objects for their fields.
ℹ️
Deals can also be created and managed in TINA, the VenHub dashboard. Use Quick Deal for simple discounts or New Promotion for full campaigns. TINA also suggests deals for expiring and overstocked items. Deals created in TINA and through the API are the same objects and are returned by the same endpoints.
Pricing
Each product has a retail price and a purchase (cost) price, both integers in cents. Deals discount from the retail price. Set them with update_price and update_purchase_price. Because both prices are tracked, the Analytics API can report revenue, cost and profit, including the effect of discounts.
Trigger Types
Triggers define what activates a deal. Set the type with the trigger's trigger_type field. The fields column lists what each type reads.
| Type | Activates when | Fields | Example |
CARTVAL | The cart total is at least min_val_trigger cents | min_val_trigger | Spend $10 or more to unlock the deal |
CONTAINSITEM | The cart has at least min_val_trigger units across the listed products | min_val_trigger, product_id | Buy 3 energy drinks |
CONTAINSCAT | The cart has at least min_val_trigger units across the listed subcategories | min_val_trigger, subcategory_id | Buy 2 items from Chips |
FIRSTORDER | It's the customer's first order | - | Welcome discount for new customers |
NTHORDER | It's the customer's nth_orderth order | nth_order | 10% off your 5th purchase |
TIME | The order falls inside the daily time window on one of the listed days | time_window_start, time_window_end, days_of_the_week | Happy hour pricing, weekend flash sales |
⚠️
CONTAINSCAT matches on subcategory_id only. When you create a deal with
POST /deals/, pass the subcategories in
subcategory_id. A trigger with only
category_id is accepted but never qualifies.
/deals/create_from_owner expands categories into their subcategories for you.
⚠️
BDAY and REFERRAL aren't implemented yet. Both trigger types are accepted but currently treat every cart as eligible, so don't use them in live deals.
Reward Types
Rewards define what the customer receives. Set the type with reward_type and the amount with discount_pct_or_price, whose meaning depends on the type.
| Type | Effect | discount_pct_or_price | Example |
ITEMVAL | Fixed amount off one matching unit | Cents off | $0.50 off one water bottle |
MULTVAL | Fixed amount off every matching unit | Cents off each unit | $0.50 off every energy drink |
ITEMDISC | Percentage off one matching unit | Percent | 15% off one candy bar; 100 makes it free |
MULTDISC | Percentage off every matching unit | Percent | 20% off all snacks |
CARTDISC | Percentage off the cart total | Percent | 10% off the entire order |
CARTVAL | Sets the cart total to a fixed amount | Final total in cents | Your whole cart for $10.00 |
ℹ️
Rewards have no quantity field. ITEMVAL and ITEMDISC apply to one matching unit per checkout, and MULTVAL and MULTDISC apply to every matching unit. Discounting a set number of units, such as exactly two, isn't supported. A discount_pct_or_price of 0 is skipped, so use ITEMDISC at 100 for a free item.
Constraint Types
Constraints limit how often a deal can be redeemed. Set the type with constraint_type.
| Type | Effect | Fields | Example |
REDEMPTIONS | Limits each customer to redemption_limit paid orders with this deal within a rolling period of days. Omit period for a lifetime limit. | redemption_limit, period | Max 1 use per customer per day: redemption_limit: 1, period: 1 |
SALEAMT | Ends the deal after redemption_limit paid orders have used it, counted across all customers and every hub the deal is assigned to | redemption_limit | Deal ends after the first 100 orders |
ℹ️
SALEAMT counts paid orders that used the deal, not units sold. It has no per-hub setting. To give each hub its own limit, create a separate deal for each hub.
Deal Properties
Alongside its triggers, rewards and constraints, every deal has:
| Field | Description |
name | Display name for the deal |
hub_id | The hubs the deal runs at, as an array of hub IDs |
start / end | When the deal becomes active and when it expires. Both are required. |
stackable | Whether this deal is meant to combine with other deals. Returned by check_eligibility for you to act on; not enforced when rewards are calculated |
priority | Higher numbers sort first in active and eligible deal lists; ties sort newest first. Not enforced when rewards are calculated |
Common Deal Recipes
Combine triggers, rewards and constraints to build common promotions:
| Promotion | Trigger | Reward | Constraint |
| Buy one, get one | CONTAINSCAT (2 from a subcategory) | ITEMDISC at 100 on the same subcategory | - |
| Flash sale | TIME (set hours and days) | MULTDISC (% off a category) | - |
| Holiday sale | TIME, with the deal's start and end set to the holiday | CARTDISC (% off cart) | - |
| Expiring stock | CONTAINSITEM (the expiring product) | ITEMDISC on the same product | SALEAMT set to the units on hand (one discounted unit per order) |
| Free gift over a spend | CARTVAL ($15+) | ITEMDISC at 100 on the gift product | - |
| Free gift with a purchase | CONTAINSCAT (e.g. 1 from Chips) | ITEMDISC at 100 on the gift product | - |
| Spend-and-save | CARTVAL ($50+) | CARTDISC (20% off) | - |
| New customer welcome | FIRSTORDER | CARTDISC (15% off) | - |
| Loyalty milestone | NTHORDER (10th order) | CARTDISC | - |
ℹ️
For a free gift, the gift product must already be in the cart. The reward discounts it; it doesn't add it.
Deals at Checkout
Deals are evaluated server-side against the customer's cart. Checking eligibility and calculating a reward are two separate calls, so you choose which deals to show and use:
| Step | Endpoint | What happens |
| 1. Preview | POST /deals/check_eligibility | Returns the active deals the cart qualifies for and each deal's potential_savings. Nothing is applied yet. |
| 2. Calculate | POST /deals/apply_reward | Calculates the chosen deals against the cart and returns the discounted line items and cart total. Nothing is saved. |
| 3. Pay | Your checkout flow | The order is placed with the selected deal. VenHub recalculates the discount and stores it on the order, and the redemption counts once the order's payment succeeds. |
| 4. Track | GET /deals/{deal_id}/redemption_status | Returns a deal's aggregate redemption count and limit status. |
ℹ️
apply_reward is calculation-only and records nothing. Redemptions are counted from successfully paid orders, not from apply_reward calls. It doesn't save the deal against the order, and it doesn't re-check eligibility, stackable or priority. It calculates whichever deal_ids you send. Pass only deals that check_eligibility returned, and decide yourself which ones to combine.
ℹ️
Deals can only match what you send with the cart. Include subcategory_id on each cart item so CONTAINSCAT deals can match, and pass user_order_count so FIRSTORDER and NTHORDER deals can be evaluated.
Deal Endpoints
Example Request
curl -X GET \
"https://tina-api.venhub.com/api/v1/deals/active/123" \
--header "X-API-Key: vh_abc123..."
Parameters
| Parameter | Type | Location | Required | Description |
hub_id | Integer | Path | Required | Hub ID to retrieve active deals for |
Response
[
{
"id": 1,
"name": "Buy 2 Get 1 Free",
"description": "Buy any 2 bags of chips, get a third free",
"display_text": "Buy any 2 bags of chips, get 1 free!",
"display_image": "https://storage.example.com/deals/bogo.jpg",
"priority": 1
}
]
Example Request
curl -X GET \
"https://tina-api.venhub.com/api/v1/deals/1" \
--header "X-API-Key: vh_abc123..."
Parameters
| Parameter | Type | Location | Required | Description |
deal_id | Integer | Path | Required | ID of the deal to retrieve |
Response
ℹ️
Same fields as the
create body, plus
id,
created_at and
modified_at on the deal and an
id on every trigger, reward and constraint.
{
"id": 1,
"name": "Buy 2 Get 1 Free",
"description": "Buy any 2 bags of chips, get a third free",
"hub_id": [123],
"is_deal_active": true,
"start": "2027-01-01T00:00:00Z",
"end": "2027-01-31T23:59:59Z",
"stackable": false,
"priority": 1,
"created_at": "2026-11-02T09:12:00Z",
"modified_at": "2026-11-02T09:12:00Z",
"triggers": [
{ "id": 10, "name": "3 bags of chips in cart", "trigger_type": "CONTAINSCAT", "min_val_trigger": 3, "subcategory_id": [52] }
],
"rewards": [
{ "id": 11, "name": "1 free bag of chips", "reward_type": "ITEMDISC", "discount_pct_or_price": 100, "subcategory_id": [52] }
],
"constraints": [
{ "id": 12, "name": "1 per customer per day", "constraint_type": "REDEMPTIONS", "redemption_limit": 1, "period": 1 }
]
}
Example Request
curl -X GET \
"https://tina-api.venhub.com/api/v1/deals/hub/123" \
--header "X-API-Key: vh_abc123..."
Parameters
| Parameter | Type | Location | Required | Description |
hub_id | Integer | Path | Required | Hub ID to retrieve all deals for |
Response
[
{
"id": 1,
"name": "Buy 2 Get 1 Free",
"description": "Buy any 2 bags of chips, get a third free",
"hub_id": [123],
"is_deal_active": true,
"start": "2027-01-01T00:00:00Z",
"end": "2027-01-31T23:59:59Z",
"stackable": false,
"priority": 1,
"created_at": "2026-11-02T09:12:00Z",
"modified_at": "2026-11-02T09:12:00Z",
"triggers": [
{ "id": 10, "name": "3 bags of chips in cart", "trigger_type": "CONTAINSCAT", "min_val_trigger": 3, "subcategory_id": [52] }
],
"rewards": [
{ "id": 11, "name": "1 free bag of chips", "reward_type": "ITEMDISC", "discount_pct_or_price": 100, "subcategory_id": [52] }
],
"constraints": [
{ "id": 12, "name": "1 per customer per day", "constraint_type": "REDEMPTIONS", "redemption_limit": 1, "period": 1 }
]
}
]
ℹ️
Deal configuration is passed as a JSON-encoded string in the dealData field, with a single trigger and reward. In this endpoint, category_id and subcategory_id accept IDs or names, and categories are expanded into their subcategories automatically.
Example Request
curl -X POST \
"https://tina-api.venhub.com/api/v1/deals/create_from_owner" \
--header "X-API-Key: vh_abc123..." \
--form 'dealData={"deal":{"name":"Chips Week","hub_id":[123],"start":"2027-01-01T00:00:00Z","end":"2027-01-07T23:59:59Z"},"trigger":{"name":"2+ bags of chips in cart","trigger_type":"CONTAINSCAT","min_val_trigger":2,"category_id":["Chips"]},"reward":{"name":"20% off chips","reward_type":"MULTDISC","discount_pct_or_price":20,"category_id":["Chips"]},"constraints":[]}' \
--form '[email protected]'
Parameters
| Parameter | Type | Location | Required | Description |
dealData | JSON String | Form | Required | JSON-encoded deal configuration |
file | File | Form | Optional | Banner image for the deal |
dealData Fields
| Field | Type | Required | Description |
deal.name | String | Required | Display name for the deal |
deal.hub_id | Array<Integer> | Required | Hubs the deal runs at |
deal.description | String | Optional | Internal description |
deal.start | Timestamp | Required | When the deal becomes active (ISO 8601, UTC) |
deal.end | Timestamp | Required | When the deal expires (ISO 8601, UTC) |
deal.stackable | Boolean | Optional | Whether the deal is meant to combine with other deals. Informational; not enforced |
deal.priority | Integer | Optional | Higher numbers sort first in active and eligible deal lists; ties sort newest first |
trigger | Object | Required | A single trigger object |
reward | Object | Required | A single reward object |
constraints | Array | Optional | Constraint objects |
Response
{
"id": 3,
"name": "Summer Sale",
"is_deal_active": true,
"display_image": "https://storage.example.com/deals/abc123.jpg"
}
Example Request
curl -X PUT \
"https://tina-api.venhub.com/api/v1/deals/1" \
--header "X-API-Key: vh_abc123..." \
--header "Content-Type: application/json" \
--data '{"name": "Updated Deal Name", "is_deal_active": false}'
Parameters
| Parameter | Type | Location | Required | Description |
deal_id | Integer | Path | Required | ID of the deal to update |
name | String | Body | Optional | Updated display name for the deal |
is_deal_active | Boolean | Body | Optional | Enable or disable the deal |
start | Timestamp | Body | Optional | Updated start (ISO 8601, UTC) |
end | Timestamp | Body | Optional | Updated end (ISO 8601, UTC) |
stackable | Boolean | Body | Optional | Whether the deal is meant to combine with other deals. Informational; not enforced |
priority | Integer | Body | Optional | Higher numbers sort first in active and eligible deal lists; ties sort newest first |
Response
{
"id": 1,
"name": "Updated Deal Name",
"description": "Buy any 2 bags of chips, get a third free",
"hub_id": [123],
"is_deal_active": false,
"start": "2027-01-01T00:00:00Z",
"end": "2027-01-31T23:59:59Z",
"stackable": false,
"priority": 1,
"created_at": "2026-11-02T09:12:00Z",
"modified_at": "2026-11-02T09:12:00Z",
"triggers": [
{ "id": 10, "name": "3 bags of chips in cart", "trigger_type": "CONTAINSCAT", "min_val_trigger": 3, "subcategory_id": [52] }
],
"rewards": [
{ "id": 11, "name": "1 free bag of chips", "reward_type": "ITEMDISC", "discount_pct_or_price": 100, "subcategory_id": [52] }
],
"constraints": [
{ "id": 12, "name": "1 per customer per day", "constraint_type": "REDEMPTIONS", "redemption_limit": 1, "period": 1 }
]
}
Example Request
curl -X DELETE \
"https://tina-api.venhub.com/api/v1/deals/1" \
--header "X-API-Key: vh_abc123..."
Parameters
| Parameter | Type | Location | Required | Description |
deal_id | Integer | Path | Required | ID of the deal to delete |
Response
{
"success": true,
"message": "Deal 1 deleted successfully"
}
Errors
| Error Code | Description |
| deal_not_found | The specified deal does not exist |
Additional Deal Routes
Example Request
curl -X POST \
"https://tina-api.venhub.com/api/v1/deals/" \
--header "X-API-Key: vh_abc123..." \
--header "Content-Type: application/json" \
--data '{"name":"Buy 2 Get 1 Free","hub_id":[123],"description":"Buy any 2 bags of chips, get a third free","start":"2027-01-01T00:00:00Z","end":"2027-01-31T23:59:59Z","stackable":false,"priority":1,"triggers":[{"name":"3 bags of chips in cart","trigger_type":"CONTAINSCAT","min_val_trigger":3,"subcategory_id":[52]}],"rewards":[{"name":"1 free bag of chips","reward_type":"ITEMDISC","discount_pct_or_price":100,"subcategory_id":[52]}],"constraints":[{"name":"1 per customer per day","constraint_type":"REDEMPTIONS","redemption_limit":1,"period":1}]}'
Body
| Field | Type | Required | Description |
name | String | Required | Display name for the deal |
hub_id | Array<Integer> | Required | Hubs the deal runs at |
description | String | Optional | Internal description |
start | Timestamp | Required | When the deal becomes active (ISO 8601, UTC) |
end | Timestamp | Required | When the deal expires (ISO 8601, UTC) |
stackable | Boolean | Optional | Whether the deal is meant to combine with other deals. Informational; not enforced |
priority | Integer | Optional | Higher numbers sort first in active and eligible deal lists; ties sort newest first |
triggers | Array | Required | One or more trigger objects |
rewards | Array | Required | One or more reward objects |
constraints | Array | Optional | Constraint objects |
Trigger Object
| Field | Type | Required | Description |
name | String | Required | Name for the trigger |
trigger_type | String | Required | One of the trigger types |
min_val_trigger | Integer | Optional | Threshold: cart total in cents for CARTVAL, minimum quantity for CONTAINSITEM and CONTAINSCAT |
product_id | Array<Integer> | Optional | Products to match, for CONTAINSITEM |
subcategory_id | Array<Integer> | Optional | Subcategories to match, for CONTAINSCAT |
category_id | Array<Integer> | Optional | Accepted but not checked at checkout. Use subcategory_id for CONTAINSCAT |
nth_order | Integer | Optional | Order number that activates NTHORDER |
time_window_start | Time | Optional | Start of the daily window, for TIME |
time_window_end | Time | Optional | End of the daily window, for TIME |
days_of_the_week | Array | Optional | Days the window applies, for TIME |
Reward Object
| Field | Type | Required | Description |
name | String | Required | Name for the reward |
reward_type | String | Required | One of the reward types |
discount_pct_or_price | Integer | Required | Percent for ITEMDISC, MULTDISC and CARTDISC; cents off for ITEMVAL and MULTVAL; final cart total in cents for CARTVAL. 0 is skipped |
product_id | Array<Integer> | Optional | Products the reward applies to |
category_id | Array<Integer> | Optional | Categories the reward applies to |
subcategory_id | Array<Integer> | Optional | Subcategories the reward applies to |
Constraint Object
| Field | Type | Required | Description |
name | String | Required | Name for the constraint |
constraint_type | String | Required | One of the constraint types |
redemption_limit | Integer | Required | Uses per customer for REDEMPTIONS; total orders for SALEAMT |
period | Integer | Optional | Rolling window in days, for REDEMPTIONS. Omit for a lifetime limit |
Response
{
"id": 4,
"name": "Buy 2 Get 1 Free",
"description": "Buy any 2 bags of chips, get a third free",
"hub_id": [123],
"is_deal_active": true,
"start": "2027-01-01T00:00:00Z",
"end": "2027-01-31T23:59:59Z",
"stackable": false,
"priority": 1,
"created_at": "2026-11-02T09:12:00Z",
"modified_at": "2026-11-02T09:12:00Z",
"triggers": [
{ "id": 13, "name": "3 bags of chips in cart", "trigger_type": "CONTAINSCAT", "min_val_trigger": 3, "subcategory_id": [52] }
],
"rewards": [
{ "id": 14, "name": "1 free bag of chips", "reward_type": "ITEMDISC", "discount_pct_or_price": 100, "subcategory_id": [52] }
],
"constraints": [
{ "id": 15, "name": "1 per customer per day", "constraint_type": "REDEMPTIONS", "redemption_limit": 1, "period": 1 }
]
}
Example Request
curl -X POST \
"https://tina-api.venhub.com/api/v1/deals/check_eligibility" \
--header "X-API-Key: vh_abc123..." \
--header "Content-Type: application/json" \
--data '{"hub_id":123,"cart_items":[{"product_id":456,"category_id":14,"subcategory_id":52,"quantity":3,"unit_price":299}],"cart_total":897}'
Body
| Field | Type | Required | Description |
hub_id | Integer | Required | Hub the cart belongs to |
user_id | Integer | Optional | Customer placing the order |
cart_items | Array | Required | Each item: product_id, category_id (optional), subcategory_id (optional, but needed for CONTAINSCAT deals to match), quantity, unit_price |
cart_total | Integer | Required | Cart total in cents |
user_order_count | Integer | Optional | Customer's prior order count, for first-time-buyer style deals |
device_uuid | String | Optional | Device identifier |
Response
{
"eligible_deals": [
{
"deal_id": 1,
"deal_name": "Buy 2 Get 1 Free",
"description": "Buy any 2 bags of chips, get a third free",
"display_text": "Buy any 2 bags of chips, get 1 free!",
"reward_description": "1 free item",
"potential_savings": 299,
"start": "2027-01-01T00:00:00Z",
"end": "2027-01-31T23:59:59Z",
"stackable": false
}
]
}
ℹ️
description and
display_text are optional and may be absent. This is a preview only. Results are sorted by
priority, highest first;
stackable is returned so you can decide which deals to combine. Use
apply_reward to calculate the discounted cart.
Example Request
curl -X POST \
"https://tina-api.venhub.com/api/v1/deals/apply_reward" \
--header "X-API-Key: vh_abc123..." \
--header "Content-Type: application/json" \
--data '{"deal_ids":[1],"hub_id":123,"cart_items":[{"product_id":456,"category_id":14,"subcategory_id":52,"quantity":3,"unit_price":299}]}'
Body
| Field | Type | Required | Description |
deal_ids | Array<Integer> | Required | Deals to calculate. Not re-checked for eligibility or stacking |
hub_id | Integer | Required | Hub the cart belongs to |
user_id | Integer | Optional | Customer placing the order |
cart_items | Array | Required | Same shape as check_eligibility's cart_items |
device_uuid | String | Optional | Device identifier |
Response
ℹ️
deal_applied is a string naming the deals that were calculated. On each item, discount_applied is a boolean.
{
"success": true,
"deal_applied": "Buy 2 Get 1 Free",
"modified_cart_items": [
{
"product_id": 456,
"category_id": 14,
"subcategory_id": 52,
"quantity": 3,
"original_unit_price": 299,
"discounted_unit_price": 0,
"discount_applied": true,
"quantity_discounted": 1
}
],
"original_cart_total": 897,
"discounted_cart_total": 598,
"total_savings": 299,
"message": "Deal applied successfully"
}
Example Request
curl -X GET \
"https://tina-api.venhub.com/api/v1/deals/123/redemption_status" \
--header "X-API-Key: vh_abc123..."
Parameters
| Parameter | Type | Location | Required | Description |
deal_id | Integer | Path | Required | ID of the deal to check |
Response
{
"deal_id": 123,
"deal_name": "Buy 2 Get 1 Free",
"total_redemptions": 42,
"redemption_limit": 100,
"limit_reached": false,
"is_active": true
}
ℹ️
total_redemptions counts successfully paid orders that used the deal. redemption_limit comes from the deal's SALEAMT constraint and is null when it has none. is_active reflects the deal's stored is_deal_active flag only; it doesn't check whether the current time is between start and end.