v1

latestOpenAPI 3.1.02026-07-2419603.1 MB
Analytics

Fetch sessions

API that allows fetching raw sessions from the database (event-level data is not available in this API). Please note that each request must be authenticated.

Compression

When requesting large amount of data, make sure to include an Accept-Encoding: gzip header to enable compression.

post/api/analytics/v1/sessions/

Request body

website_idstring uuid required

ID of a website or a meta site.

relative_date'today' | 'yesterday' | 'last_week' | 'last_month' | 'last_year' | 'last_X_days'

Use relative date in query. Cannot be used with absolute date fields at the same time. X in last_X_days must be in range 1 <= X <= 365. Note that last_X_days does not include data from today. Mandatory if absolute date fields are not used.

offsetinteger

Number of rows to skip before beginning to return rows.

limitinteger

Number of rows to return.

format'json' | 'json-kv' | 'csv'

Data format of a successful response (error responses are always in json).

column_format'id' | 'name'

Format of the columns header (in CSV responses) and metadata labels (in JSON responses). By default uses identifiers (id option), set to name to use human-readable names.

Example request

{
  "website_id": "70236925-724f-404e-b634-7b5633bc0bcc",
  "columns": [
    {
      "column_id": "resolution"
    },
    {
      "column_id": "device_type"
    }
  ],
  "date_from": "2020-02-10",
  "date_to": "2020-02-10",
  "filters": {
    "operator": "and",
    "conditions": [
      {
        "column_id": "browser_name",
        "condition": {
          "operator": "eq",
          "value": "FF"
        }
      }
    ]
  },
  "offset": 0,
  "limit": 100,
  "format": "json"
}

Response

OK

dataobject[]

Rows with results for the query.

Example response

{
  "data": [
    [
      "2132601",
      "2ecf33167d400648",
      "2018-12-03T00:21:03",
      "375x667",
      [
        1,
        "Smartphone"
      ]
    ]
  ],
  "meta": {
    "columns": [
      "session_id",
      "visitor_id",
      "timestamp",
      "resolution",
      "device_type"
    ],
    "scope": "session",
    "blended_datasets": [],
    "count": 1
  }
}