Get project analytics
This endpoint lets you pull traffic statistics for any published project over a custom date range. You can view visitor trends broken down by hour or day.
Anyone on a Business plan or higher who wants to display or export published project traffic data in an external tool or custom dashboard.
Do this, in order
- 1
Upgrade your workspace to a Business plan or higher if it is not already.
This endpoint is restricted to Business and Enterprise tiers and will reject requests on lower plans.
- 2
Create an API key with the projects:read scope under your workspace settings at lovable.dev/settings/api-keys.
Requests without an API key or missing the read scope will be rejected with an authentication error.
- 3
Gather your project ID and ensure the project has been published.
Analytics are only tracked and returned for published web projects.
- 4
Send a GET request to https://api.lovable.dev/v1/projects/{project_id}/analytics including starts_at and ends_at query parameters in UTC format.
The service requires a defined date window to return traffic data.
- 5
Choose your granularity parameter: set it to hourly for windows under 31 days, or daily for up to 365 days.
Hourly breakdowns fail validation if the requested range exceeds 31 days.
Paste this into your project
Create a traffic dashboard component with input fields for a Lovable API key and project ID. Include date pickers for start and end times and a toggle between hourly and daily views. Fetch data from https://api.lovable.dev/v1/projects/{project_id}/analytics using the Lovable-API-Key header, handle loading and error states cleanly, and plot the returned time series points onto a responsive line chart.Words decoded
- Time series
- A set of numbers tracked over time intervals, such as hourly or daily visitor counts.
- Granularity
- The size of each time slice used to group data, such as hourly or daily buckets.
- RFC 3339 timestamp
- A standardized way of writing dates and times, written out like 2026-04-01T00:00:00Z.
Where people get stuck
- Requesting hourly granularity for a date window longer than 31 days will fail validation.
- Requesting a date window longer than 365 days will fail validation.
- Expecting data older than 90 days on projects with standard retention will return zeroed-out numbers.
- Using an API key without the projects:read scope will return an insufficient scope error.
The short version, steps, decoder and prompt on this page are written automatically from Lovable's own documentation and can lag or misread it. The official page is always the authority.