> ## Documentation Index
> Fetch the complete documentation index at: https://dev.kloo.li/llms.txt
> Use this file to discover all available pages before exploring further.

# Retrieve all

> Statistics — Retrieve all. `GET /statistics/`

Interactive playground for `GET /statistics/`.

<Tip>
  Paste your API key in the Authorization field as `Bearer {api_key}`.
</Tip>

<RequestExample dropdown>
  ```bash cURL theme={null}
  curl --request GET \
    --url 'https://api.kloo.li/v1/statistics/?start_date=2026-01-01&end_date=2026-01-31' \
    --header 'Authorization: Bearer {api_key}'
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch('https://api.kloo.li/v1/statistics/?start_date=2026-01-01&end_date=2026-01-31', {
    method: 'GET',
    headers: {
      Authorization: 'Bearer {api_key}',
      Accept: 'application/json'
    }
  });
  const data = await response.json();
  console.log(data);
  ```

  ```javascript Node.js theme={null}
  const response = await fetch('https://api.kloo.li/v1/statistics/?start_date=2026-01-01&end_date=2026-01-31', {
    method: 'GET',
    headers: {
      Authorization: 'Bearer {api_key}',
      Accept: 'application/json'
    }
  });
  const data = await response.json();
  console.log(data);
  ```

  ```python Python theme={null}
  import requests

  url = 'https://api.kloo.li/v1/statistics/?start_date=2026-01-01&end_date=2026-01-31'
  headers = {
      'Authorization': 'Bearer {api_key}',
      'Accept': 'application/json'
  }
  response = requests.request('GET', url, headers=headers)
  print(response.json())
  ```

  ```php PHP theme={null}
  <?php
  $ch = curl_init('https://api.kloo.li/v1/statistics/?start_date=2026-01-01&end_date=2026-01-31');
  curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_CUSTOMREQUEST => 'GET',
    CURLOPT_HTTPHEADER => [
      'Authorization: Bearer {api_key}',
      'Accept: application/json',
    ],
  ]);
  echo curl_exec($ch);
  curl_close($ch);
  ```

  ```go Go theme={null}
  package main

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

  func main() {
    req, _ := http.NewRequest("GET", "https://api.kloo.li/v1/statistics/?start_date=2026-01-01&end_date=2026-01-31", nil)
    req.Header.Set("Authorization", "Bearer {api_key}")
    req.Header.Set("Accept", "application/json")
    res, _ := http.DefaultClient.Do(req)
    defer res.Body.Close()
    body, _ := io.ReadAll(res.Body)
    fmt.Println(string(body))
  }
  ```

  ```java Java theme={null}
  HttpRequest request = HttpRequest.newBuilder()
    .uri(URI.create("https://api.kloo.li/v1/statistics/?start_date=2026-01-01&end_date=2026-01-31"))
    .header("Authorization", "Bearer {api_key}")
    .header("Accept", "application/json")
    .method("GET", HttpRequest.BodyPublishers.noBody())
    .build();
  HttpResponse<String> response = HttpClient.newHttpClient()
    .send(request, HttpResponse.BodyHandlers.ofString());
  System.out.println(response.body());
  ```

  ```csharp C# theme={null}
  using var client = new HttpClient();
  client.DefaultRequestHeaders.Add("Authorization", "Bearer {api_key}");
  client.DefaultRequestHeaders.Add("Accept", "application/json");
  var response = await client.SendAsync(new HttpRequestMessage(HttpMethod.Get, "https://api.kloo.li/v1/statistics/?start_date=2026-01-01&end_date=2026-01-31"));
  Console.WriteLine(await response.Content.ReadAsStringAsync());
  ```

  ```ruby Ruby theme={null}
  require 'net/http'
  require 'uri'

  uri = URI('https://api.kloo.li/v1/statistics/?start_date=2026-01-01&end_date=2026-01-31')
  req = Net::HTTP::Get.new(uri)
  req['Authorization'] = 'Bearer {api_key}'
  req['Accept'] = 'application/json'
  res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |http| http.request(req) }
  puts res.body
  ```
</RequestExample>

<ResponseExample>
  ```json 200 theme={null}
  {
    "data": [
      {
        "pageviews": 20,
        "visitors": 5,
        "formatted_date": "2021-01"
      },
      {
        "pageviews": 35,
        "visitors": 10,
        "formatted_date": "2021-02"
      },
      {
        "pageviews": 50,
        "visitors": 25,
        "formatted_date": "2021-03"
      }
    ],
    "meta": {
      "page": 1,
      "results_per_page": 25,
      "total": 1,
      "total_pages": 1
    },
    "links": {
      "first": "https://api.kloo.li/v1/statistics?page=1",
      "last": "https://api.kloo.li/v1/statistics?page=1",
      "next": null,
      "prev": null,
      "self": "https://api.kloo.li/v1/statistics?page=1"
    }
  }
  ```
</ResponseExample>


## OpenAPI

````yaml openapi.yaml GET /statistics/
openapi: 3.0.3
info:
  title: Kloo Public API
  version: 1.0.0
  description: User API for Kloo — short links, QR codes, domains, teams, analytics.
servers:
  - url: https://api.kloo.li/v1
security:
  - bearerAuth: []
paths:
  /statistics/:
    get:
      tags:
        - Statistics
      summary: Retrieve all (statistics)
      operationId: statistics_retrieve_all_get_statistics
      parameters:
        - name: start_date
          in: query
          required: true
          schema:
            type: string
          description: Start date in `Y-m-d` format
        - name: end_date
          in: query
          required: true
          schema:
            type: string
          description: End date in `Y-m-d` format
        - name: project_id
          in: query
          required: false
          schema:
            type: integer
          description: Filter by project id.
        - name: type
          in: query
          required: false
          schema:
            type: string
            enum:
              - email
              - webhook
              - slack
              - discord
              - telegram
              - microsoft_teams
              - twilio
              - twilio_call
              - whatsapp
              - x
              - google_chat
              - push_subscriber_id
          description: 'Allowed values: `---`.'
        - name: country_code
          in: query
          required: false
          schema:
            type: string
          description: 'Available when: type = city_name'
        - name: utm_source
          in: query
          required: false
          schema:
            type: string
          description: 'Available when: type = utm_medium, utm_campaign'
        - name: utm_medium
          in: query
          required: false
          schema:
            type: string
          description: 'Available when: type = utm_campaign'
        - name: referrer_host
          in: query
          required: false
          schema:
            type: string
          description: 'Available when: type = referrer_path'
      responses:
        '200':
          description: Success
        '201':
          description: Created
        '400':
          description: Bad request
        '401':
          description: Unauthorized
        '404':
          description: Not found
        '429':
          description: Rate limit
      security:
        - bearerAuth: []
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: '{api_key}'
      x-default: '{api_key}'
      description: >-
        Get your API key at https://kloo.li/account-api. Use `Authorization:
        Bearer {api_key}`.

````