Takazudo Modular Docs

Type to search...

to open search from anywhere

GET /api/keyword-logs

Retrieve search keyword analytics from Netlify Blobs

Keyword Logs API Specification

This document specifies the GET /api/keyword-logs Netlify serverless function for retrieving search keyword analytics.

Overview

PropertyValue
EndpointGET /api/keyword-logs
AuthenticationNone (public)
Rate LimitingNone (Netlify default)
CachingCache-Control: no-cache
CORSAccess-Control-Allow-Origin: *
Rewrite Rule[[redirects]] in netlify.toml: /api/keyword-logs -> /.netlify/functions/keyword-logs

Request

Method

GET

Query Parameters

ParameterTypeRequiredDefaultDescription
fromstring (ISO 8601)No30 days agoStart of date range filter
tostring (ISO 8601)NonowEnd of date range filter
limitnumberNo1000Max entries to return (range: 1-5000)

Examples

# Recent logs (last 30 days, up to 1000)
GET /api/keyword-logs

# Last 7 days
GET /api/keyword-logs?from=2026-02-28T00:00:00Z

# Specific date range with limit
GET /api/keyword-logs?from=2026-03-01T00:00:00Z&to=2026-03-07T23:59:59Z&limit=500

Response

Success (200)

{
  "logs": [
    {
      "keyword": "eurorack power",
      "timestamp": "2026-03-07T10:30:00.000Z",
      "resultCount": 5
    },
    {
      "keyword": "ADDAC",
      "timestamp": "2026-03-07T09:15:00.000Z",
      "resultCount": 12
    }
  ],
  "total": 2
}

Response Fields

FieldTypeDescription
logsarrayArray of keyword log entries, sorted by timestamp descending (newest first)
totalnumberTotal number of matching entries (before limit is applied)

Log Entry Fields

FieldTypeDescription
keywordstringThe search query
timestampstringISO 8601 timestamp of when the search was performed
resultCountnumberNumber of search results returned

Data Source

Keyword logs are written by the Search function as a fire-and-forget side effect of every search query. Data is stored in Netlify Blobs store keyword-logs.

Both the writer (search function) and reader (this function) use context-based getStore('keyword-logs') for automatic Netlify runtime authentication.

Viewer App

The keyword-viewer sub-package (sub-packages/keyword-viewer/) provides a web UI for browsing keyword analytics. It includes:

  • Dashboard with stats, top keywords, and daily volume
  • Sortable keyword list with search counts
  • Falls back to mock data when the API is unreachable (local development)

Implementation

  • Function: netlify/functions/keyword-logs.ts
  • Storage: Netlify Blobs store keyword-logs