API Documentation

Calista Ads Report

This API reads the ads report data (read-only). Base URL: https://calista-ads-report.calista-thai-message.workers.dev

GET/api/report

Returns data for a date range. All dates follow the Google Ads account time zone (Thai time, GMT+7); currency is THB. Responses are not cached and CORS is open for browser use.

Parameters (query string)

NameDescription
typeDataset (see table below). Default: all for JSON, daily for CSV
formatjson (default) or csv
daysLast 1, 7, 14 or 30 days (default 7)
from, toDate range YYYY-MM-DD (Thai time), replaces days. Max 90 days
downloaddownload=1 returns JSON as a file (CSV is always a file)

Datasets (type)

typeContents
allEvery dataset in one response (JSON only)
summaryTotals for the whole period + CTR/CPC/cost per booking + shop-recorded bookings
dailyOne row per day (Thai-time dates)
hourlyOne row per hour, with hour_th (Thai time) and nz_hour (New Zealand time)
devicesBy device (mobile / desktop / tablet / other), aggregated over the period
keywordsPer keyword, aggregated over the period, sorted by clicks
search_termsActual search terms, aggregated over the period, sorted by clicks
bookingsBookings recorded by the shop, per day

Fields returned

FieldMeaning
impressionsTimes the ad was shown
clicksClicks to the website
costSpend (THB)
conv_clickBook Now clicks (interest)
conv_bookingCompleted Fresha bookings
ctrClicks ÷ impressions (0–1)
cpcSpend ÷ clicks (THB)
cost_per_book_click / cost_per_bookingCost per Book Now click / per completed booking (0 when not computable)

Examples

# 7-day summary (JSON)
curl "https://calista-ads-report.calista-thai-message.workers.dev/api/report?type=summary&days=7"

# Daily CSV for a date range
curl -o daily.csv "https://calista-ads-report.calista-thai-message.workers.dev/api/report?type=daily&format=csv&from=2026-10-01&to=2026-10-19"

# Everything for 30 days as a JSON file
curl -OJ "https://calista-ads-report.calista-thai-message.workers.dev/api/report?type=all&days=30&download=1"

Example response (JSON)

{
  "ok": true,
  "range": { "start": "2026-10-13", "end": "2026-10-19", "timezone": "Asia/Bangkok (GMT+7)" },
  "currency": "THB",
  "generated_at": "2026-10-19T04:00:00.000Z",
  "data": {
    "summary": [{
      "start": "2026-10-13", "end": "2026-10-19", "days": 7,
      "impressions": 420, "clicks": 31, "cost": 512.4,
      "conv_click": 6, "conv_booking": 1,
      "ctr": 0.0738, "cpc": 16.53,
      "cost_per_book_click": 85.4, "cost_per_booking": 512.4,
      "shop_recorded_bookings": 2
    }]
  }
}

Errors return {"ok": false, "error": "..."} with status 400 (bad parameter) or 500

GET/api/health

Returns {"ok": true, "daily_rows": 12} when the database is reachable

Good to know

อ่านเป็นภาษาไทย →