SEO API Reference

Public runtime endpoints for Next.js websites and authenticated management endpoints for technical SEO, JSON-LD, sitemaps, robots.txt, redirects, and audits.

Website Runtime Endpoints

Scoped by website slug (:key). Require Authorization: Bearer sf_tok_... (or JWT) on every request.

GET/api/v1/public/websites/:key/seo/metadata

Get SEO Metadata & JSON-LD by Path

Returns resolved title, meta description, canonical URL, OpenGraph/Twitter tags, robots directives, and structured JSON-LD entries for a route path.

Bearer JWT / sf_tok_
ParameterInTypeDescription
key*pathstringWebsite slug key (e.g. acme).
pathquerystringNormalized route path (defaults to /).
Request
bash
curl -X GET "https://api.sitefabric.space/api/v1/public/websites/acme/seo/metadata?path=/about" \
  -H "Accept: application/json" \
  -H "Authorization: Bearer sf_tok_your_auth_token"
Response200 OK
json
{
  "path": "/about",
  "title": "About Acme — Modern Solutions",
  "description": "Learn how Acme delivers high-reliability services.",
  "canonicalUrl": "https://acme.com/about",
  "robots": "index, follow",
  "openGraph": {
    "title": "About Acme",
    "description": "Learn how Acme delivers high-reliability services.",
    "image": "https://media.sitefabric.space/acme/og-about.png"
  },
  "structuredData": [
    {
      "@context": "https://schema.org",
      "@type": "Organization",
      "name": "Acme",
      "url": "https://acme.com"
    }
  ]
}
GET/api/v1/public/websites/:key/sitemap

Get Dynamic Sitemap Entries

Returns all indexable URLs, lastModified timestamps, changeFrequency, and priority values for Next.js app/sitemap.ts or XML sitemap generation.

Bearer JWT / sf_tok_
ParameterInTypeDescription
key*pathstringWebsite slug key.
Request
bash
curl -X GET "https://api.sitefabric.space/api/v1/public/websites/acme/sitemap" \
  -H "Accept: application/json" \
  -H "Authorization: Bearer sf_tok_your_auth_token"
Response200 OK
json
{
  "websiteKey": "acme",
  "entries": [
    {
      "url": "https://acme.com/",
      "lastModified": "2026-12-03T18:00:00.000Z",
      "changeFrequency": "weekly",
      "priority": 1
    },
    {
      "url": "https://acme.com/about",
      "lastModified": "2026-12-03T18:00:00.000Z",
      "changeFrequency": "monthly",
      "priority": 0.8
    }
  ]
}
GET/api/v1/public/websites/:key/robots

Get Robots.txt Directives

Returns allow/disallow rules, custom user-agent directives, and sitemap URLs for app/robots.ts.

Bearer JWT / sf_tok_
ParameterInTypeDescription
key*pathstringWebsite slug key.
Request
bash
curl -X GET "https://api.sitefabric.space/api/v1/public/websites/acme/robots" \
  -H "Accept: application/json" \
  -H "Authorization: Bearer sf_tok_your_auth_token"
Response200 OK
json
{
  "websiteKey": "acme",
  "rules": [
    { "userAgent": "*", "allow": ["/"], "disallow": ["/api/", "/admin/"] }
  ],
  "sitemap": "https://acme.com/sitemap.xml"
}
GET/api/v1/public/websites/:key/redirects

Get Active Redirect Rules

Returns all active 301/302/307/308 redirect rules configured for the website. Consumed automatically by @sitefabric/next/middleware.

Bearer JWT / sf_tok_
ParameterInTypeDescription
key*pathstringWebsite slug key.
Request
bash
curl -X GET "https://api.sitefabric.space/api/v1/public/websites/acme/redirects" \
  -H "Accept: application/json" \
  -H "Authorization: Bearer sf_tok_your_auth_token"
Response200 OK
json
{
  "websiteKey": "acme",
  "redirects": [
    {
      "sourcePath": "/old-services",
      "targetUrl": "/services",
      "statusCode": 301,
      "enabled": true
    }
  ]
}
GET/api/v1/public/websites/:key/seo/runtime

Get Edge Runtime Bundle (Redirects + Maintenance Mode)

Single lightweight endpoint used by Edge middleware to evaluate maintenance mode (HTTP 503) and live redirect rules in one round-trip.

Bearer JWT / sf_tok_
ParameterInTypeDescription
key*pathstringWebsite slug key.
Request
bash
curl -X GET "https://api.sitefabric.space/api/v1/public/websites/acme/seo/runtime" \
  -H "Accept: application/json" \
  -H "Authorization: Bearer sf_tok_your_auth_token"
Response200 OK
json
{
  "websiteKey": "acme",
  "status": "active",
  "maintenanceMode": false,
  "canonicalDomain": "acme.com",
  "redirects": [
    { "sourcePath": "/legacy", "targetUrl": "/", "statusCode": 301 }
  ]
}

Management Endpoints

Require Authorization: Bearer sf_tok_... (or JWT) with the corresponding seo:* permission.

PUT/api/v1/seo/metadata-by-path

Upsert SEO Metadata by Path

Creates or updates SEO metadata, OpenGraph fields, and JSON-LD structured data for any route path on a website.

Bearer JWT / sf_tok_seo:metadata
ParameterInTypeDescription
websiteId*bodyObjectIdTarget website ID.
path*bodystringRoute path (e.g. /pricing).
title*bodystringMeta title (recommended 30–60 chars).
descriptionbodystringMeta description (recommended 120–160 chars).
structuredDatabodyobject[]Optional JSON-LD schema objects.
Request
bash
curl -X PUT "https://api.sitefabric.space/api/v1/seo/metadata-by-path" \
  -H "Accept: application/json" \
  -H "Authorization: Bearer sf_tok_your_auth_token" \
  -H "Content-Type: application/json" \
  -d '{"websiteId":"674f1c2e9a1b2c3d4e5f6a7b","path":"/pricing","title":"Pricing | Acme","description":"Transparent plans for growing teams.","robots":"index, follow"}'
Response200 OK
json
{
  "id": "674f1c2e9a1b2c3d4e5f6b01",
  "websiteId": "674f1c2e9a1b2c3d4e5f6a7b",
  "path": "/pricing",
  "title": "Pricing | Acme",
  "description": "Transparent plans for growing teams.",
  "robots": "index, follow"
}
GET/api/v1/seo/metadata-list

List All SEO Metadata Records

Returns all path and page SEO metadata records configured for a website.

Bearer JWT / sf_tok_seo:metadata
ParameterInTypeDescription
websiteId*queryObjectIdWebsite ID.
Request
bash
curl -X GET "https://api.sitefabric.space/api/v1/seo/metadata-list?websiteId=674f1c2e9a1b2c3d4e5f6a7b" \
  -H "Accept: application/json" \
  -H "Authorization: Bearer sf_tok_your_auth_token"
Response200 OK
json
[
  { "path": "/", "title": "Acme Home", "robots": "index, follow" },
  { "path": "/pricing", "title": "Pricing | Acme", "robots": "index, follow" }
]
POST/api/v1/seo/sitemap/generate

Regenerate Sitemap

Rebuilds sitemap entries from registered CLI routes, published CMS pages, and blogs, and enqueues cache revalidation.

Bearer JWT / sf_tok_seo:sitemap
ParameterInTypeDescription
websiteId*bodyObjectIdWebsite ID.
Request
bash
curl -X POST "https://api.sitefabric.space/api/v1/seo/sitemap/generate" \
  -H "Accept: application/json" \
  -H "Authorization: Bearer sf_tok_your_auth_token" \
  -H "Content-Type: application/json" \
  -d '{"websiteId":"674f1c2e9a1b2c3d4e5f6a7b"}'
Response200 OK
json
{
  "websiteId": "674f1c2e9a1b2c3d4e5f6a7b",
  "generatedCount": 12,
  "generatedAt": "2026-12-03T20:15:00.000Z"
}
PUT/api/v1/seo/robots

Upsert Robots.txt Configuration

Updates crawler directives and sitemap references for a website.

Bearer JWT / sf_tok_seo:robots
Request
bash
curl -X PUT "https://api.sitefabric.space/api/v1/seo/robots" \
  -H "Accept: application/json" \
  -H "Authorization: Bearer sf_tok_your_auth_token" \
  -H "Content-Type: application/json" \
  -d '{"websiteId":"674f1c2e9a1b2c3d4e5f6a7b","rules":[{"userAgent":"*","allow":["/"],"disallow":["/api/"]}]}'
Response200 OK
json
{
  "websiteId": "674f1c2e9a1b2c3d4e5f6a7b",
  "rules": [{ "userAgent": "*", "allow": ["/"], "disallow": ["/api/"] }]
}
PUT/api/v1/seo/redirects

Upsert Redirect Rule

Creates or updates a URL redirect rule (301, 302, 307, 308) with loop and chain detection.

Bearer JWT / sf_tok_seo:redirects
Request
bash
curl -X PUT "https://api.sitefabric.space/api/v1/seo/redirects" \
  -H "Accept: application/json" \
  -H "Authorization: Bearer sf_tok_your_auth_token" \
  -H "Content-Type: application/json" \
  -d '{"websiteId":"674f1c2e9a1b2c3d4e5f6a7b","sourcePath":"/old-blog","targetUrl":"/blog","statusCode":301,"enabled":true}'
Response200 OK
json
{
  "id": "674f1c2e9a1b2c3d4e5f6c10",
  "sourcePath": "/old-blog",
  "targetUrl": "/blog",
  "statusCode": 301,
  "enabled": true
}
POST/api/v1/seo/audit

Run Technical SEO Audit

Evaluates missing titles/descriptions, duplicate canonicals, broken redirect chains, and structured data coverage for a website.

Bearer JWT / sf_tok_seo:audit
Request
bash
curl -X POST "https://api.sitefabric.space/api/v1/seo/audit" \
  -H "Accept: application/json" \
  -H "Authorization: Bearer sf_tok_your_auth_token" \
  -H "Content-Type: application/json" \
  -d '{"websiteId":"674f1c2e9a1b2c3d4e5f6a7b"}'
Response200 OK
json
{
  "score": 94,
  "checkedPages": 12,
  "issues": [
    { "severity": "warning", "path": "/contact", "message": "Meta description is shorter than 120 characters" }
  ]
}