Skip to main content
GET
/
v0
/
top_pages
Get top pages by sessions or visitors, optionally restricted to entry or exit pages
curl --request GET \
  --url https://api.formo.so/v0/top_pages \
  --header 'Authorization: Bearer <token>'
import requests

url = "https://api.formo.so/v0/top_pages"

headers = {"Authorization": "Bearer <token>"}

response = requests.get(url, headers=headers)

print(response.text)
const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};

fetch('https://api.formo.so/v0/top_pages', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://api.formo.so/v0/top_pages",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
package main

import (
"fmt"
"net/http"
"io"
)

func main() {

url := "https://api.formo.so/v0/top_pages"

req, _ := http.NewRequest("GET", url, nil)

req.Header.Add("Authorization", "Bearer <token>")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.get("https://api.formo.so/v0/top_pages")
.header("Authorization", "Bearer <token>")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.formo.so/v0/top_pages")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'

response = http.request(request)
puts response.read_body
{
  "meta": [
    {
      "name": "project_id",
      "type": "String"
    },
    {
      "name": "origin",
      "type": "String"
    },
    {
      "name": "pathname",
      "type": "String"
    },
    {
      "name": "hits",
      "type": "UInt64"
    },
    {
      "name": "sessions",
      "type": "UInt64"
    },
    {
      "name": "visitors",
      "type": "UInt64"
    }
  ],
  "data": [
    {
      "project_id": "proj_abc",
      "origin": "app.example.com",
      "pathname": "/",
      "hits": 1456,
      "sessions": 1284,
      "visitors": 982
    },
    {
      "project_id": "proj_abc",
      "origin": "app.example.com",
      "pathname": "/trade",
      "hits": 1024,
      "sessions": 612,
      "visitors": 487
    },
    {
      "project_id": "proj_abc",
      "origin": "app.example.com",
      "pathname": "/earn",
      "hits": 587,
      "sessions": 412,
      "visitors": 318
    }
  ],
  "rows": 3,
  "rows_before_limit_at_least": 24
}
{
"error": {
"message": "<string>",
"doc_url": "<string>",
"param": "<string>",
"details": {}
}
}
{
"error": {
"message": "<string>",
"doc_url": "<string>",
"param": "<string>",
"details": {}
}
}
Returns the most-visited pages, ranked by visits, with unique visitor counts. Use limit and offset for pagination.

Authorizations

Authorization
string
header
required

Workspace API key (e.g. formo_xxx). Create one in the Formo dashboard under Team Settings > API Keys.

Query Parameters

date_from
string<date>

Inclusive start date (YYYY-MM-DD). Defaults to 7 days before date_to.

date_to
string<date>

Inclusive end date (YYYY-MM-DD). Defaults to today.

limit
integer
default:50

Maximum results to return (default 50, max 1000)

Required range: 1 <= x <= 1000
offset
integer
default:0

Number of results to skip for pagination (default 0)

Required range: 0 <= x <= 100000
mode
enum<string>
default:all

Page-flow mode. all (default) returns project-wide page metrics with anon-per-session visitor counts (sessions, visitors, hits). entry returns landing pages with bounce_rate. exit returns exit pages with exit_rate. The visitor count is omitted in entry/exit modes since those metrics are session-scoped.

Available options:
all,
entry,
exit

Response

Top pages

Analytics endpoint response. The data array contains the rows; the exact row shape depends on the endpoint. meta carries column type information for rendering, rows is the row count, and statistics holds query timing metadata.

data
object[]
meta
object[]
rows
integer
rows_before_limit_at_least
integer
statistics
object