Public API Reference

Complete API reference for accessing your Kensaku AI PSEO project data via REST API. Includes examples for JavaScript, PHP, and cURL.

Overview

Expose your PSEO project data as a JSON API endpoint. Perfect for headless CMS setups, static site generators, or any custom integration.

The API follows JSON:API 1.1 specification.

Public API Feature

Quick Start

  1. Go to your PSEO project → Output tab
  2. Enable Public API and click Generate Token
  3. Your endpoint: https://kensakuai.com/api/pseo/public/{token}

Query Parameters

ParameterDescriptionDefault
page[number]Page number1
page[size]Items per page (max 1000)100
fields[row]Select specific columnsAll
formatjson or csvjson

Examples:

# Get page 2 with 50 items
?page[number]=2&page[size]=50

# Only fetch name and image columns
?fields[row]=name,image

# Export as CSV
?format=csv

Response Format

{
  "jsonapi": { "version": "1.1" },
  "data": [
    {
      "type": "row",
      "id": "1",
      "attributes": {
        "title": "Example Item",
        "description": "Some text content...",
        "image": {
          "url": "/api/cdn/media/...",
          "alt": "Image description",
          "date": "2025-12-03T04:36:58Z"
        },
        "location": {
          "placeId": "ChIJ...",
          "name": "Store Name",
          "embed": "https://kensakuai.com/api/maps/embed?..."
        }
      }
    }
  ],
  "meta": {
    "columns": [{ "name": "title", "type": "text" }],
    "totalRows": 100,
    "cacheGeneratedAt": "2025-12-05T03:34:45Z"
  },
  "links": {
    "self": "...",
    "first": "...",
    "last": "...",
    "prev": null,
    "next": "..."
  }
}

Data Types

TypeFormat
textString
image{ url, alt, date }
location{ placeId, name, embed }

Usage Examples

Basic Fetch (JavaScript)

const response = await fetch('https://kensakuai.com/api/pseo/public/{token}');
const { data, meta, links } = await response.json();

// Access items
data.forEach(item => {
  console.log(item.attributes.title);
});

// Check for more pages
if (links.next) {
  // Fetch next page
}

With Pagination

async function fetchAllData(token) {
  let url = `https://kensakuai.com/api/pseo/public/${token}`;
  let allItems = [];

  while (url) {
    const { data, links } = await fetch(url).then(r => r.json());
    allItems.push(...data);
    url = links.next;
  }

  return allItems;
}

Static Site Generation (Next.js / Astro / etc.)

// Fetch at build time
export async function getStaticProps() {
  const res = await fetch(API_URL);
  const { data } = await res.json();

  return {
    props: {
      items: data.map(item => item.attributes)
    }
  };
}

WordPress / PHP

$response = wp_remote_get('https://kensakuai.com/api/pseo/public/{token}');
$body = json_decode(wp_remote_retrieve_body($response), true);

foreach ($body['data'] as $item) {
    $attrs = $item['attributes'];
    echo "<h2>{$attrs['title']}</h2>";
}

cURL

curl "https://kensakuai.com/api/pseo/public/{token}?page[size]=10"

Working with Images

Image URLs are relative. Prepend the domain:

const fullUrl = `https://kensakuai.com${item.attributes.image.url}`;

Working with Locations

The embed field contains an iframe URL for Google Maps:

<iframe src="{location.embed}" width="600" height="450"></iframe>

Caching

  • Data is cached until you click Regenerate Cache
  • Check meta.cacheGeneratedAt to see when data was last updated
  • API responses are CDN-cached for 1 hour

Security

  • Endpoints are public (no auth required)
  • Token provides obscurity, not security
  • Only expose data intended for public consumption
  • Disable the toggle to revoke access immediately

Troubleshooting

IssueSolution
Empty dataRegenerate cache after adding rows
Images not loadingPrepend https://kensakuai.com to URLs
Pagination not workingUse page[number] and page[size] format

Ready to Scale Your Content?

100+ pages in 1 click with Kensaku AI. Start your programmatic SEO campaign today.

Public API Reference | Kensaku AI Docs