analytics

Get workspace analytics

Changed on

Plan: Business or higher

Scope: workspaces:read

Returns website traffic time series for the workspace, including historical traffic from projects that have since been deleted. The response covers the requested date range without pagination. Date ranges are limited to 365 days, or 31 days with hourly granularity.

get/v1/workspaces/{workspace_id}/analytics

Request

  • Base URL
    https://api.lovable.dev
  • Auth
    • API key in header Lovable-API-Key
    • or HTTP bearer

Path parameters

workspace_idstring required

Workspace ID.

Example:workspace_01jw3k9m2xq8r5v0c7d4e6f2gh

Query parameters

starts_atstring date-time required

Start of the time range as an RFC 3339 timestamp, such as 2026-07-01T00:00:00Z. Any offset is accepted and converted to UTC before the range is applied.

Example:2026-07-01T00:00:00Z
ends_atstring date-time required

End of the time range as an RFC 3339 timestamp, such as 2026-07-08T00:00:00Z. Any offset is accepted and converted to UTC before the range is applied.

Example:2026-07-08T00:00:00Z
granularity'hourly' | 'daily'

Time-bucket size: hourly or daily. Defaults to daily when omitted; any other value returns 400. Daily buckets cover complete UTC calendar dates from the UTC date of starts_at through the UTC date of ends_at; hourly buckets use the supplied instants inclusively and support at most 31 days.

Example:daily

Headers

Lovable-Versionstring

Stable API version to serve, as a YYYY-MM-DD date. Omit for the oldest supported stable version, currently 2026-09-11.

Lovable-Betastring

Comma-separated beta revision strings to enable on top of the stable version.

Response

OK

Example response

{
  "time_series": {
    "bounce_rate": {
      "data": [
        {
          "timestamp": "2026-01-15T00:00:00Z",
          "value": 1280
        }
      ],
      "label": "visitors",
      "total": 1280
    },
    "pageviews": {
      "data": [
        {
          "timestamp": "2026-01-15T00:00:00Z",
          "value": 1280
        }
      ],
      "label": "visitors",
      "total": 1280
    },
    "pageviews_per_visit": {
      "data": [
        {
          "timestamp": "2026-01-15T00:00:00Z",
          "value": 1280
        }
      ],
      "label": "visitors",
      "total": 1280
    },
    "session_duration": {
      "data": [
        {
          "timestamp": "2026-01-15T00:00:00Z",
          "value": 1280
        }
      ],
      "label": "visitors",
      "total": 1280
    },
    "visitors": {
      "data": [
        {
          "timestamp": "2026-01-15T00:00:00Z",
          "value": 1280
        }
      ],
      "label": "visitors",
      "total": 1280
    }
  }
}

Changes

    • breaking

      added the new required query request parameter ends_at

    • breaking

      added the new required query request parameter starts_at

    • warning

      deleted the query request parameter end_date

    • warning

      deleted the query request parameter start_date

    • info

      for the header request parameter Lovable-Version, the format was generalized from date to no format

    • info

      added the non-success response with the status

    • info

      added the non-success response with the status