Citelayer® REST API Reference — WordPress Developer Documentation
On This Page
Citelayer® registers several REST API endpoints under the citelayer/v1 namespace and serves additional content through WordPress rewrite rules. All endpoints return JSON unless otherwise noted. This page documents every available endpoint with request formats, response examples, and headers.
To customize the data these endpoints return, see the Hooks & Filters Reference.
Authentication
All Citelayer® endpoints are publicly accessible and require no authentication. They serve structured data intended for search engines, AI agents, and other automated consumers. The UCP discovery endpoint includes rate limiting to prevent abuse.
REST API Endpoints
GET /wp-json/citelayer/v1/schema
Returns the full schema graph for the current site. The response includes the Organization schema (if configured) and the WebSite schema. On singular pages, the Article or BlogPosting schema is also included in the graph. See Schema & Structured Data for details on how Citelayer® builds the graph.
Request
curl -X GET https://yoursite.com/wp-json/citelayer/v1/schema
Response Headers
| Header | Value |
|---|---|
Content-Type |
application/json; charset=UTF-8 |
Cache-Control |
public, max-age=3600 |
Response Codes
| Code | Description |
|---|---|
200 |
Schema graph returned successfully. |
404 |
No schema available for the current page. |
503 |
Service temporarily unavailable due to SEO plugin conflict. |
Example Response (200)
{
"@context": "https://schema.org",
"@graph": [
{
"@context": "https://schema.org",
"@type": "Organization",
"@id": "https://yoursite.com/#organization",
"name": "Your Site",
"url": "https://yoursite.com",
"description": "Your tagline"
},
{
"@context": "https://schema.org",
"@type": "WebSite",
"@id": "https://yoursite.com/#website",
"url": "https://yoursite.com",
"name": "Your Site",
"publisher": {
"@id": "https://yoursite.com/#organization"
},
"potentialAction": {
"@type": "SearchAction",
"target": {
"@type": "EntryPoint",
"urlTemplate": "https://yoursite.com/?s={search_term_string}"
},
"query-input": "required name=search_term_string"
}
}
]
}
Error Responses
// 404
{"error": "No schema available for current page"}
// 503
{"error": "Service temporarily unavailable due to SEO plugin conflict"}
GET /wp-json/citelayer/v1/schema/organization
Returns only the Organization schema. Use this endpoint when you need the organization’s structured data without the full graph. The Organization schema must be configured in Settings → Citelayer® → Schema for this endpoint to return data.
Request
curl -X GET https://yoursite.com/wp-json/citelayer/v1/schema/organization
Response Headers
| Header | Value |
|---|---|
Content-Type |
application/json; charset=UTF-8 |
Cache-Control |
public, max-age=3600 |
Response Codes
| Code | Description |
|---|---|
200 |
Organization schema returned successfully. |
404 |
Organization schema not configured. |
503 |
Service unavailable due to SEO plugin conflict. |
Example Response (200)
{
"@context": "https://schema.org",
"@type": "Organization",
"@id": "https://yoursite.com/#organization",
"name": "Your Site",
"url": "https://yoursite.com",
"description": "Your tagline"
}
Error Response (404)
{"error": "Organization schema not configured"}
GET /wp-json/citelayer/v1/schema/website
Returns only the WebSite schema. This endpoint always returns data because Citelayer® generates the WebSite schema from your WordPress site settings (site name, URL, and tagline).
Request
curl -X GET https://yoursite.com/wp-json/citelayer/v1/schema/website
Response Headers
| Header | Value |
|---|---|
Content-Type |
application/json; charset=UTF-8 |
Cache-Control |
public, max-age=3600 |
Response Codes
| Code | Description |
|---|---|
200 |
WebSite schema returned successfully. |
503 |
Service unavailable due to SEO plugin conflict. |
Example Response (200)
{
"@context": "https://schema.org",
"@type": "WebSite",
"@id": "https://yoursite.com/#website",
"url": "https://yoursite.com",
"name": "Your Site",
"publisher": {
"@id": "https://yoursite.com/#organization"
},
"potentialAction": {
"@type": "SearchAction",
"target": {
"@type": "EntryPoint",
"urlTemplate": "https://yoursite.com/?s={search_term_string}"
},
"query-input": "required name=search_term_string"
}
}
GET /wp-json/citelayer/v1/ucp/discovery
Returns the UCP (Unified Commerce Protocol) discovery manifest. This endpoint is only available when WooCommerce is active and Citelayer® detects a compatible store. Rate limiting applies at 60 requests per minute per IP address. See UCP Commerce Protocol for full protocol documentation.
Request
curl -X GET https://yoursite.com/wp-json/citelayer/v1/ucp/discovery
Response Headers
| Header | Value |
|---|---|
Content-Type |
application/json; charset=UTF-8 |
Cache-Control |
public, max-age=300 |
X-RateLimit-Limit |
60 |
X-RateLimit-Remaining |
Remaining requests in the current window |
Response Codes
| Code | Description |
|---|---|
200 |
UCP discovery manifest returned successfully. |
429 |
Rate limit exceeded. Retry after the window resets. |
503 |
UCP feature is disabled or WooCommerce is not active. |
Example Response (200)
{
"protocol": "ucp",
"version": "1.0",
"shop": {
"name": "Your Site",
"url": "https://yoursite.com",
"platform": "WooCommerce",
"citelayer_version": "0.3.1"
},
"capabilities": {
"product_browsing": false,
"cart": false,
"checkout": false
},
"upgrade": {
"message": "Full UCP support available with Citelayer Premium",
"url": "https://citelayer.ai/woocommerce-premium"
}
}
Non-REST Endpoints (Rewrite Rules)
Citelayer® also serves content through WordPress rewrite rules. These endpoints do not use the REST API infrastructure and return non-JSON content types. They are accessed directly via clean URLs without the /wp-json/ prefix.
GET /llms.txt
Returns the site’s llms.txt file — a plain-text summary of your site optimized for consumption by large language models. See llms.txt for WordPress for the full specification and configuration options.
Request
curl -X GET https://yoursite.com/llms.txt
Response Headers
| Header | Value |
|---|---|
Content-Type |
text/plain; charset=UTF-8 |
Cache-Control |
public, max-age=3600 |
Example Response
# Your Site
> Your tagline goes here.
## Blog Posts
- [Getting Started Guide](https://yoursite.com/getting-started/)
- [Advanced Configuration](https://yoursite.com/advanced-configuration/)
## Pages
- [About Us](https://yoursite.com/about/)
- [Contact](https://yoursite.com/contact/)
You can customize this output with the citelayer_llmstxt_content filter.
GET /{post-slug}.md
Returns the content of any published post or page as Markdown. Citelayer® converts the post content to clean Markdown, making it easy for AI agents and LLMs to consume individual pieces of content. See Markdown Content Endpoint for configuration details.
Request
curl -X GET https://yoursite.com/my-blog-post.md
Response Headers
| Header | Value |
|---|---|
Content-Type |
text/markdown; charset=UTF-8 |
Cache-Control |
public, max-age=3600 |
Response Codes
| Code | Description |
|---|---|
200 |
Markdown content returned successfully. |
404 |
Post not found or not published. |
GET /.well-known/mcp/context.json
Returns the WebMCP context document — a JSON manifest describing your site’s capabilities, endpoints, and metadata for AI agent discovery. See WebMCP Context Discovery for the full specification.
Request
curl -X GET https://yoursite.com/.well-known/mcp/context.json
Response Headers
| Header | Value |
|---|---|
Content-Type |
application/json; charset=UTF-8 |
Cache-Control |
public, max-age=3600 |
You can customize this output with the citelayer_webmcp_context filter.
Using the API with PHP
You can call Citelayer® REST endpoints internally from your WordPress code using rest_do_request():
// Fetch the full schema graph internally.
$request = new WP_REST_Request( 'GET', '/citelayer/v1/schema' );
$response = rest_do_request( $request );
if ( 200 === $response->get_status() ) {
$schema = $response->get_data();
// Use the schema data in your template or plugin.
}
// Fetch UCP discovery data.
$request = new WP_REST_Request( 'GET', '/citelayer/v1/ucp/discovery' );
$response = rest_do_request( $request );
if ( 200 === $response->get_status() ) {
$ucp = $response->get_data();
$capabilities = $ucp['capabilities'];
}
Using the API with JavaScript
You can fetch Citelayer® endpoints from JavaScript using the Fetch API or the WordPress apiFetch utility:
// Using the Fetch API.
const response = await fetch( '/wp-json/citelayer/v1/schema' );
const schema = await response.json();
console.log( schema['@graph'] );
// Using WordPress apiFetch (in the block editor or admin).
import apiFetch from '@wordpress/api-fetch';
const schema = await apiFetch( { path: '/citelayer/v1/schema' } );
const org = schema['@graph'].find( item => item['@type'] === 'Organization' );
Related Documentation
- Hooks & Filters Reference — Customize all endpoint responses with PHP filters
- Schema & Structured Data — How Citelayer® builds JSON-LD graphs
- llms.txt for WordPress — AI-readable plain-text site summaries
- Markdown Content Endpoint — Per-post markdown output
- WebMCP Context Discovery — Machine-readable site capabilities
- UCP Commerce Protocol — Unified Commerce Protocol for WooCommerce
- SEO Plugin Compatibility — Conflict detection and resolution
GET /wp-json/citelayer/v1/scan
Runs the AI Readiness Scanner. Requires manage_options. Optional ?step= for single check.
{
"score": 85,
"results": { "schema": {"status":"pass"}, "robots": {"status":"pass"} }
}
POST /wp-json/citelayer/v1/scan/reset
Clears cached scanner results. Requires manage_options.
POST /wp-json/citelayer/v1/ai-referral
Records an AI referral event. No auth required. Enforces same-origin + rate limiting.
Body: url (required), referrer (optional), source (required).
Success: HTTP 201 {"ok":true}. Rate-limited: HTTP 200. Invalid origin: HTTP 400.