{"openapi":"3.0.0","info":{"title":"API: Analytics","version":"3.0.0","description":"API for retrieving various analytics reports"},"servers":[{"url":"https://da.liteapi.travel","description":"LiteAPI Dashboard API base URL"}],"components":{"securitySchemes":{"apikeyAuth":{"type":"apiKey","in":"header","name":"X-Api-Key","description":"API key required for authorization"}}},"security":[{"apikeyAuth":[]}],"tags":[{"name":"Analytics","description":"Operations related to retrieving analytics reports."}],"paths":{"/analytics/weekly":{"post":{"tags":["Analytics"],"summary":"Retrieve weekly analytics","description":"## Overview\n\nGet weekly aggregated sales and booking data broken down by week. Perfect for tracking week-over-week performance trends.\n\n## When to Use\n\n- **Weekly performance dashboards** - Show sales trends by week\n- **Week-over-week comparisons** - Identify growth patterns\n- **Business reporting** - Generate weekly reports for stakeholders\n- **Performance monitoring** - Track weekly sales metrics\n\n## What You Get\n\n- **Weekly sales totals** - Aggregated sales revenue per week\n- **Week labels** - Human-readable week identifiers (e.g., \"week 12\")\n- **Time-series data** - Ordered by week for easy charting\n\n## Quick Start\n\nProvide a date range (`from` and `to` dates). The endpoint returns sales data grouped by week within that range.","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"from":{"type":"string","format":"date","description":"Start date for the analytics data YYYY-MM-DD (ISO 8601)"},"to":{"type":"string","format":"date","description":"End date for the analytics data YYYY-MM-DD (ISO 8601)"}},"required":["from","to"]},"example":{"from":"2026-07-01","to":"2026-07-07"}}}},"responses":{"200":{"description":"Weekly analytics data retrieved successfully","content":{"application/json":{"example":{"message":"Weekly analytics data retrieved successfully","data":{"success":true,"data":{"arr":[{"weeks":"week 12","sales":112828},{"weeks":"week 13","sales":275628},{"weeks":"week 14","sales":235668}]}}}}}}}}},"/analytics/report":{"post":{"tags":["Analytics"],"summary":"Retrieve detailed analytics report","description":"## Overview\n\nGet comprehensive analytics covering sales, bookings, commissions, and revenue for your date range. This is your complete business intelligence endpoint.\n\n## When to Use\n\n- **Executive dashboards** - Complete business overview\n- **Financial reporting** - Track revenue, sales, and commissions\n- **Booking analysis** - Monitor confirmed vs cancelled bookings\n- **Performance tracking** - Daily breakdowns of key metrics\n\n## What You Get\n\n- **Sales revenue** - Daily sales totals with currency\n- **Booking counts** - Confirmed and cancelled bookings per day\n- **Commission data** - Commission earned per day\n- **Revenue breakdown** - Total revenue calculations\n- **Aggregated totals** - Summary statistics for the entire period\n\n## Key Features\n\n- **Daily granularity** - See day-by-day performance\n- **Multiple currencies** - Currency information included\n- **Complete metrics** - Sales, bookings, commissions, and revenue in one response\n- **Time-series ready** - Data formatted for easy charting\n\n## Quick Start\n\nProvide start and end dates. Returns detailed daily analytics plus aggregated totals for the period.","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"from":{"type":"string","format":"date","description":"Start date for the report YYYY-MM-DD (ISO 8601)"},"to":{"type":"string","format":"date","description":"End date for the report YYYY-MM-DD (ISO 8601)"}},"required":["from","to"]},"example":{"from":"2026-07-01","to":"2026-07-31"}}}},"responses":{"200":{"description":"Detailed analytics report retrieved successfully","content":{"application/json":{"example":{"message":"Detailed analytics report retrieved successfully","data":{"success":true,"data":{"salesRevenue":[{"salesRevenue":41293.76,"currency":"EUR","date":"2026-07-16T00:00:00.000Z"},{"salesRevenue":41406.99,"currency":"EUR","date":"2026-07-17T00:00:00.000Z"}],"uniqueDates":["2026-07-16T00:00:00.000Z","2026-07-17T00:00:00.000Z"],"confirmed_booking":[{"confirmed_booking":144,"date":"2026-07-16T00:00:00.000Z"},{"confirmed_booking":144,"date":"2026-07-17T00:00:00.000Z"}],"sales":[{"sales":41293.76,"currency":"EUR","date":"2026-07-16T00:00:00.000Z"},{"sales":41406.99,"currency":"EUR","date":"2026-07-17T00:00:00.000Z"}],"commission":[{"commission":3753.43,"currency":"EUR","date":"2026-07-16T00:00:00.000Z"},{"commission":3763.39,"currency":"EUR","date":"2026-07-17T00:00:00.000Z"}],"revenue":[{"revenue":4129.38,"currency":"EUR","date":"2026-07-16T00:00:00.000Z"},{"revenue":4140.7,"currency":"EUR","date":"2026-07-17T00:00:00.000Z"}],"totalRevenue":62356,"bookings":[{"date":"2026-07-16T00:00:00.000Z","booking":144},{"date":"2026-07-17T00:00:00.000Z","booking":144}],"cancelled_booking":[{"cancelled_booking":1,"date":"2026-07-22T00:00:00.000Z"}],"totalSales":623562,"totalCommission":56729,"totalBooking":2309,"totalConfirmedBooking":2308,"totalCancelledBooking":1}}}}}}}}},"/analytics/markets":{"post":{"tags":["Analytics"],"summary":"Retrieve market analytics","description":"## Overview\n\nAnalyze your bookings and sales by customer nationality/market. Understand which countries drive the most business.\n\n## When to Use\n\n- **Market analysis** - Identify top-performing markets\n- **Geographic insights** - Understand customer distribution\n- **Marketing optimization** - Focus efforts on high-value markets\n- **Business intelligence** - Track performance by nationality\n\n## What You Get\n\n- **Sales by nationality** - Total sales per customer country\n- **Booking counts** - Number of bookings per market\n- **Currency information** - Sales currency for each market\n- **Ranked results** - Markets sorted by performance\n\n## Quick Start\n\nProvide a date range. Returns sales and booking data grouped by customer nationality (ISO country code).","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"from":{"type":"string","format":"date","description":"Start date for the market analytics YYYY-MM-DD (ISO 8601)"},"to":{"type":"string","format":"date","description":"End date for the market analytics YYYY-MM-DD (ISO 8601)"}},"required":["from","to"]},"example":{"from":"2026-07-01","to":"2026-08-01"}}}},"responses":{"200":{"description":"Market analytics data retrieved successfully","content":{"application/json":{"example":{"message":"Market analytics data retrieved successfully","data":{"success":true,"data":[{"totalBooking":2307,"sales":622563,"currency":"EUR","nationality":"US"},{"totalBooking":1,"sales":998,"currency":"EUR","nationality":"FR"}]}}}}}}}},"/analytics/hotels":{"post":{"tags":["Analytics"],"summary":"Most booked hotels","description":"## Overview\n\nGet a ranked list of your top-performing hotels by booking volume and sales. Perfect for identifying your best-selling properties.\n\n## When to Use\n\n- **Hotel performance dashboards** - Show top hotels by bookings\n- **Sales analysis** - Identify highest-revenue properties\n- **Inventory insights** - Understand which hotels drive business\n- **Partnership optimization** - Focus on high-performing hotel relationships\n\n## What You Get\n\n- **Hotel rankings** - Hotels sorted by total bookings\n- **Booking counts** - Total bookings per hotel\n- **Sales totals** - Revenue generated per hotel\n- **Location data** - City and country for each hotel\n- **Hotel identifiers** - Hotel ID and name for reference\n\n## Quick Start\n\nProvide a date range. Returns hotels ranked by total bookings, including booking counts, sales, and location information.","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"from":{"type":"string","format":"date","description":"Start date YYYY-MM-DD (ISO 8601)"},"to":{"type":"string","format":"date","description":"End date YYYY-MM-DD (ISO 8601)"}},"required":["from","to"]},"example":{"from":"2026-07-01","to":"2026-07-31"}}}},"responses":{"200":{"description":"Hotel analytics data retrieved successfully","content":{"application/json":{"example":{"message":"Hotel analytics data retrieved successfully","data":{"success":true,"data":[{"hotel_id":"lp1987","name":"New York Marriott Downtown","total":1151,"city":"New York","country":"USA","sales":"289835","currency":"EUR"},{"hotel_id":"lp123456","total":520,"name":"Omni Berkshire Place","city":"New York","country":"USA","sales":"327925","currency":"EUR"}]}}}}}}}},"/commissions/report":{"post":{"tags":["Analytics"],"summary":"Commission earnings report","description":"## Overview\n\nReturns commission earnings on the account for the given date range. Each day in the range includes the total commission amount and the average commission percentage.\n\n## When to Use\n\n- **Commission tracking** - Monitor daily commission earnings\n- **Revenue analysis** - Understand commission as a percentage of sales\n- **Financial reporting** - Report commission totals and averages by day\n- **Performance dashboards** - Chart commission trends over time\n\n## What You Get\n\n- **Daily amounts** - Total commission earned per day\n- **Daily percentage** - Average commission percentage per day\n- **Time-series data** - One entry per day, ordered by date\n\n## Quick Start\n\nProvide a date range (`from` and `to`) and optionally `sandbox` to filter by environment. Returns an array of daily commission amounts and percentages.","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"from":{"type":"string","format":"date","description":"Start date for the report YYYY-MM-DD (ISO 8601)"},"to":{"type":"string","format":"date","description":"End date for the report YYYY-MM-DD (ISO 8601)"},"sandbox":{"type":"string","description":"Filter by environment: \"true\" for sandbox, \"false\" for production"}},"required":["from","to"]},"example":{"from":"2026-01-24","to":"2026-02-23","sandbox":"false"}}}},"responses":{"200":{"description":"Commission earnings report retrieved successfully","content":{"application/json":{"example":{"success":true,"data":[{"date":"2025-12-24","amount":41522.48,"percentage":11.43},{"date":"2025-12-25","amount":39784.89,"percentage":10.92},{"date":"2026-01-01","amount":49683.22,"percentage":12.01}]}}}}}}},"/bookings/guest-nationality-report":{"get":{"tags":["Analytics"],"summary":"Guest nationality (source market) report","description":"## Overview\n\nReturns analytics on the source markets (guest nationality) of bookings. Compares the current period to the previous period of equal length, with per-nationality booking counts, sales in USD, average booking value, and period-over-period change.\n\n## When to Use\n\n- **Source market analysis** - See which nationalities drive the most bookings and sales\n- **Period comparison** - Compare current vs previous period totals and per-nationality growth\n- **Geographic dashboards** - Track performance by guest country (ISO code)\n- **Marketing and sales planning** - Identify growing or declining markets\n\n## What You Get\n\n- **Period definition** - Date ranges for current and previous periods\n- **Summary** - Total sales (USD), change percent/amount, and count of nationalities\n- **Per-nationality data** - For each guest nationality: booking count, total sales USD, avg booking value; current and previous period; and change (sales percent/amount, booking count change)\n- **New markets** - Nationalities with no previous-period data have `previous_period: null` and change expressed as 100% growth\n\n## Quick Start\n\nPass query parameters `from`, `to`, and `sandbox`. The API derives the previous period (same length, immediately before). Returns period metadata, summary totals, and an array of nationality-level metrics.","parameters":[{"name":"from","in":"query","required":true,"schema":{"type":"string","format":"date"},"description":"Start date of the current period YYYY-MM-DD (ISO 8601)"},{"name":"to","in":"query","required":true,"schema":{"type":"string","format":"date"},"description":"End date of the current period YYYY-MM-DD (ISO 8601)"},{"name":"sandbox","in":"query","required":false,"schema":{"type":"string"},"description":"Filter by environment: \"true\" for sandbox, \"false\" for production"}],"responses":{"200":{"description":"Guest nationality report retrieved successfully","content":{"application/json":{"example":{"period":{"current":{"from":"2026-01-24","to":"2026-02-23"},"previous":{"from":"2025-12-24","to":"2026-01-23"}},"summary":{"current_period_total_sales_usd":15653388.56,"previous_period_total_sales_usd":13029255.91,"total_sales_change_percent":20.14,"total_sales_change_amount":2624132.65,"total_nationalities":44},"data":[{"nationality":"AT","current_period":{"from":"2026-01-24","to":"2026-02-23","booking_count":423,"total_sales_usd":188613.21,"avg_booking_value_usd":445.89},"previous_period":{"from":"2025-12-24","to":"2026-01-23","booking_count":346,"total_sales_usd":170627.99,"avg_booking_value_usd":493.14},"change":{"sales_change_percent":10.54,"sales_change_amount":17985.22,"booking_count_change":77}},{"nationality":"AU","current_period":{"from":"2026-01-24","to":"2026-02-23","booking_count":118,"total_sales_usd":42812.91,"avg_booking_value_usd":362.82},"previous_period":null,"change":{"sales_change_percent":100,"sales_change_amount":42812.91,"booking_count_change":118}}]}}}}}}},"/bookings/source-markets-report":{"get":{"tags":["Analytics"],"summary":"Destinations report (by destination country)","description":"## Overview\n\nReturns analytics on **destinations** (the country where the hotel is located). Compares the current period to the previous period of equal length, with per-destination booking count, hotel count, sales in USD, average booking value, and period-over-period change.\n\n## When to Use\n\n- **Destination performance** - See which countries (hotel locations) drive the most bookings and sales\n- **Period comparison** - Compare current vs previous period totals and per-destination growth\n- **Geographic dashboards** - Track performance by destination country (ISO code)\n- **Inventory and commercial planning** - Identify growing or declining destinations\n\n## What You Get\n\n- **Period definition** - Date ranges for current and previous periods\n- **Summary** - Total sales (USD), change percent/amount, and count of destination countries\n- **Per-destination data** - For each country: booking count, hotel count, total sales USD, avg booking value; current and previous period; and change (sales percent/amount, booking count change)\n- **New or inactive destinations** - Countries with no previous-period data have `previous_period: null`; destinations with no current-period activity may have zeros and negative change\n\n## Quick Start\n\nPass query parameters `from`, `to`, and `sandbox`. The API derives the previous period (same length, immediately before). Returns period metadata, summary totals, and an array of destination-level metrics.","parameters":[{"name":"from","in":"query","required":true,"schema":{"type":"string","format":"date"},"description":"Start date of the current period YYYY-MM-DD (ISO 8601)"},{"name":"to","in":"query","required":true,"schema":{"type":"string","format":"date"},"description":"End date of the current period YYYY-MM-DD (ISO 8601)"},{"name":"sandbox","in":"query","required":false,"schema":{"type":"string"},"description":"Filter by environment: \"true\" for sandbox, \"false\" for production"}],"responses":{"200":{"description":"Destinations (source markets) report retrieved successfully","content":{"application/json":{"example":{"period":{"current":{"from":"2026-01-24","to":"2026-02-23"},"previous":{"from":"2025-12-24","to":"2026-01-23"}},"summary":{"current_period_total_sales_usd":15653388.57,"previous_period_total_sales_usd":13011342.93,"total_sales_change_percent":20.31,"total_sales_change_amount":2642045.64,"total_countries":174},"data":[{"country":"AD","current_period":{"from":"2026-01-24","to":"2026-02-23","booking_count":59,"hotel_count":44,"total_sales_usd":34010.36,"avg_booking_value_usd":576.45},"previous_period":{"from":"2025-12-24","to":"2026-01-23","booking_count":73,"hotel_count":44,"total_sales_usd":51572.27,"avg_booking_value_usd":706.47},"change":{"sales_change_percent":-34.05,"sales_change_amount":-17561.91,"booking_count_change":-14}},{"country":"AO","current_period":{"from":"2026-01-24","to":"2026-02-23","booking_count":2,"hotel_count":1,"total_sales_usd":3875.13,"avg_booking_value_usd":1937.56},"previous_period":null,"change":{"sales_change_percent":100,"sales_change_amount":3875.13,"booking_count_change":2}}]}}}}}}},"/bookings/hotels-sales-report":{"get":{"tags":["Analytics"],"summary":"Properties (hotels) sales report","description":"## Overview\n\nReturns analytics on **properties** (hotels): per-hotel sales, buying price, profit, and profit margin. Compares the current period to the previous period of equal length. Results are ordered by current-period sales (highest first) and limited by the `limit` parameter.\n\n## When to Use\n\n- **Property performance** - See which hotels drive the most sales and profit\n- **Period comparison** - Compare current vs previous period sales, profit, and bookings per hotel\n- **Profit analysis** - Track total_buying_price_usd, total_profit_usd, and profit_margin_percent by property\n- **Top properties dashboards** - Rank hotels by sales or profit\n\n## What You Get\n\n- **Period definition** - Date ranges for current and previous periods\n- **Summary** - Totals for sales (USD), profit (USD), bookings, count of hotels in the result, and average profit margin percent; all with period-over-period change\n- **Per-hotel data** - For each property: hotel_id, hotel_name, city, country; current and previous period (booking_count, total_sales_usd, avg_booking_value_usd, total_buying_price_usd, total_profit_usd, profit_margin_percent); and change (sales/profit percent and amount, booking_count_change)\n- **New properties** - Hotels with no previous-period data have `previous_period: null`\n\n## Quick Start\n\nPass query parameters `from`, `to`, `sandbox`, and optionally `limit` (default controls how many top hotels are returned). The API derives the previous period (same length, immediately before). Returns period metadata, summary totals, and an array of hotel-level metrics.","parameters":[{"name":"from","in":"query","required":true,"schema":{"type":"string","format":"date"},"description":"Start date of the current period YYYY-MM-DD (ISO 8601)"},{"name":"to","in":"query","required":true,"schema":{"type":"string","format":"date"},"description":"End date of the current period YYYY-MM-DD (ISO 8601)"},{"name":"sandbox","in":"query","required":false,"schema":{"type":"string"},"description":"Filter by environment: \"true\" for sandbox, \"false\" for production"},{"name":"limit","in":"query","required":false,"schema":{"type":"integer"},"description":"Maximum number of hotels to return (ordered by current-period sales, highest first)"}],"responses":{"200":{"description":"Properties (hotels) sales report retrieved successfully","content":{"application/json":{"example":{"period":{"current":{"from":"2026-01-24","to":"2026-02-23"},"previous":{"from":"2025-12-24","to":"2026-01-23"}},"summary":{"current_period_total_sales_usd":1878964.02,"previous_period_total_sales_usd":13011343.35,"total_sales_change_percent":-85.56,"total_sales_change_amount":-11132379.33,"current_period_total_profit_usd":232995.17,"previous_period_total_profit_usd":1460306.42,"total_profit_change_percent":-84.04,"total_profit_change_amount":-1227311.25,"current_period_total_bookings":846,"previous_period_total_bookings":31554,"total_bookings_change":-30708,"total_hotels":100,"avg_profit_margin_percent":12.4},"data":[{"hotel_id":"lp6556acf7","hotel_name":"Atlantis The Royal","city":"Dubai","country":"AE","current_period":{"from":"2026-01-24","to":"2026-02-23","booking_count":28,"total_sales_usd":145726.91,"avg_booking_value_usd":5204.53,"total_buying_price_usd":130888.55,"total_profit_usd":14838.36,"profit_margin_percent":10.18},"previous_period":{"from":"2025-12-24","to":"2026-01-23","booking_count":25,"total_sales_usd":120754.01,"avg_booking_value_usd":4830.16,"total_buying_price_usd":105483.18,"total_profit_usd":15270.84,"profit_margin_percent":12.65},"change":{"sales_change_percent":20.68,"sales_change_amount":24972.9,"booking_count_change":3,"profit_change_percent":-2.83,"profit_change_amount":-432.48}},{"hotel_id":"lp74d7e","hotel_name":"45 Park Lane - Dorchester Collection","city":"London","country":"GB","current_period":{"from":"2026-01-24","to":"2026-02-23","booking_count":5,"total_sales_usd":27682.91,"avg_booking_value_usd":5536.58,"total_buying_price_usd":26364.71,"total_profit_usd":1318.2,"profit_margin_percent":4.76},"previous_period":null,"change":{"sales_change_percent":100,"sales_change_amount":27682.91,"booking_count_change":5,"profit_change_percent":100,"profit_change_amount":1318.2}}]}}}}}}},"/bookings/search":{"post":{"tags":["Analytics"],"operationId":"searchBookings","summary":"Search bookings by text","description":"## Overview\n\nSearch for bookings by free-text query. Matches guest names, booking IDs, hotel names, and other booking-related fields. Results are paginated.\n\n## When to Use\n\n- **Admin or support lookup** - Find bookings by guest name, hotel name, or partial ID\n- **Text search** - Search across multiple fields with a single query string\n- **Paginated results** - Control page size and page index via request body\n\n## What You Get\n\n- **Matching bookings** - List of bookings matching the query with key fields\n- **Pagination** - `page`, `rowsPerPage`, and the search `query` echoed back\n- **Credit line billing** - When applicable, billing info (credit line ID, billed amount USD, billed at date, payment ID)\n\n## Request Body\n\n- **query** (required) - Text to search for (e.g. guest name, hotel name, booking ID)\n- **page** - Zero-based page index (default 0)\n- **rowsPerPage** - Number of results per page (e.g. 5)\n- **sand_box** - Filter by environment (e.g. \"false\" for production)\n\n## Quick Start\n\nPOST a JSON body with `query`, `page`, and `rowsPerPage`. Response includes `data` array, `success`, and pagination fields.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["query"],"properties":{"query":{"type":"string","description":"Text to search for (guest name, hotel name, booking ID, etc.)."},"page":{"type":"integer","default":0,"description":"Zero-based page index for pagination."},"rowsPerPage":{"type":"integer","description":"Number of results per page."},"sand_box":{"type":"string","description":"Filter by sandbox environment (e.g. \"true\" or \"false\")."}}},"example":{"query":"John","page":0,"rowsPerPage":5,"sand_box":"false"}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"Whether the request succeeded."},"data":{"type":"array","items":{"type":"object","properties":{"booking_id":{"type":"string","description":"The unique identifier for the booking."},"first_name":{"type":"string","description":"Guest first name."},"last_name":{"type":"string","description":"Guest last name."},"created_at":{"type":"string","format":"date-time","description":"When the booking was created (ISO 8601)."},"hotel_name":{"type":"string","description":"Name of the hotel."},"credit_line_billing":{"type":"object","nullable":true,"description":"Credit line billing details when the booking is billed to a credit line.","properties":{"credit_line_id":{"type":"integer","description":"ID of the credit line."},"billed_at":{"type":"string","format":"date-time","description":"Date the booking was billed (ISO 8601)."},"amount_usd":{"type":"number","description":"Amount billed in USD."},"payment_id":{"type":"integer","nullable":true,"description":"ID of the payment if paid."}}}}}},"page":{"type":"integer","description":"Zero-based page index returned."},"rowsPerPage":{"type":"integer","description":"Number of results per page returned."},"query":{"type":"string","description":"The search query echoed back."}}},"example":{"success":true,"data":[{"booking_id":"AO12x0KGD","first_name":"John","last_name":"Doe","created_at":"2026-01-11T21:40:10.000Z","hotel_name":"Aloft London Excel","credit_line_billing":{"credit_line_id":131,"billed_at":"2026-03-23T00:00:00.000Z","amount_usd":400.25,"payment_id":null}}],"page":0,"rowsPerPage":5,"query":"John"}}}}}}}}}