Menu

Developers / API Endpoints

Content Endpoints

API endpoints for summaries, schema markup, and page content.

Page Summaries

Get AI-generated summaries for all pages on a site.

text
GET /sites/{id}/summaries

Request

Bash
curl -X GET "https://topmast.app/api/sites/{id}/summaries" \
  -H "Authorization: Bearer tm_sk_your_api_key"

Response

JSON
{
  "data": {
    "summaries": [
      {
        "page_id": "123",
        "title": "Our Services",
        "url": "https://example.com/our-services",
        "summary": "An overview of the services Example Co offers, including consultations, installation and ongoing support. Experienced staff, clear pricing and local service.",
        "generated_at": "2024-01-15T10:30:00Z",
        "model": "gpt-4o"
      }
    ],
    "total": 25,
    "with_summaries": 20,
    "pending": 5
  }
}

Summary Object

FieldTypeDescription
page_idstringWordPress post ID
titlestringPage title
urlstringFull page URL
summarystringAI-generated summary (150-200 words)
generated_atstringISO 8601 generation timestamp
modelstringLLM model used for generation

Schema Templates

Get JSON-LD schema markup templates for a site.

text
GET /sites/{id}/schema

Request

Bash
curl -X GET "https://topmast.app/api/sites/{id}/schema" \
  -H "Authorization: Bearer tm_sk_your_api_key"

Query Parameters

ParameterTypeDefaultDescription
formatstringjsonOutput format: json or script

Response (JSON format)

JSON
{
  "data": {
    "schemas": {
      "organization": {
        "@context": "https://schema.org",
        "@type": "LocalBusiness",
        "name": "Example Co",
        "url": "https://example.com",
        "description": "Friendly local services since 2010"
      },
      "website": {
        "@context": "https://schema.org",
        "@type": "WebSite",
        "name": "Example Co",
        "url": "https://example.com"
      },
      "breadcrumbs": {
        "@context": "https://schema.org",
        "@type": "BreadcrumbList",
        "itemListElement": []
      }
    },
    "detected_business_type": "LocalBusiness"
  }
}

Response (Script format)

JSON
{
  "data": {
    "scripts": [
      "<script type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"LocalBusiness\",...}</script>",
      "<script type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",...}</script>"
    ]
  }
}

Schema Types Generated

  • Organization/LocalBusiness - Business information
  • WebSite - Site metadata
  • Product / item types - Item pages for your sector (detected automatically)
  • BreadcrumbList - Navigation breadcrumbs

Page by Slug

Get page content by URL slug.

text
GET /sites/{id}/pages/by-slug

Request

Bash
curl -X GET "https://topmast.app/api/sites/{id}/pages/by-slug?slug=our-services" \
  -H "Authorization: Bearer tm_sk_your_api_key"

Query Parameters

ParameterTypeRequiredDescription
slugstringYesURL slug or partial URL to match

Response

JSON
{
  "data": {
    "page_id": "123",
    "title": "Our Services",
    "url": "https://example.com/our-services",
    "content": "---\ntitle: Our Services\nurl: https://example.com/our-services\ntype: page\nword_count: 1500\nmodified: 2024-01-15\nsource: full_content\n---\n\nEverything we offer, in one place...",
    "format": "markdown",
    "source": "full_content"
  }
}

Content Source Priority

  1. full_content - Complete page content from sync
  2. content_excerpt - Excerpt if full content not available
  3. summary - AI summary as fallback (with explicit note)

Page by ID (Markdown)

Get page content as Markdown by WordPress post ID.

text
GET /sites/{id}/pages/{pageId}/markdown

Request

Bash
curl -X GET "https://topmast.app/api/sites/{id}/pages/123/markdown" \
  -H "Authorization: Bearer tm_sk_your_api_key"

Response

text
---
title: Our Services
url: https://example.com/our-services
type: page
word_count: 1500
last_modified: 2024-01-15T10:30:00Z
source: full_content
---

# Our Services

Everything Example Co offers, in one place...

## Highlights

- Free consultations
- Installation
- Ongoing support

## Get in Touch

Contact us to book a consultation.

The response is returned as text/markdown content type with YAML frontmatter.