WordPress REST API v2, Daypress v1 & Headless Authentication
Daypress implements both the standard WordPress REST API v2 (/wp-json/wp/v2/*) for ecosystem compatibility and high-throughput Daypress v1 endpoints (/wp-json/daypress/v1/*) for AST layouts, FTS5 search, analytics, and operational automation.
Three authentication modes
Public GET endpoints for published posts, pages, CPTs, taxonomies, and FTS5 search require zero authentication. Write operations and draft/private queries support three standard credential flows:
| Auth Mechanism | Header / Endpoint | Best For |
|---|---|---|
| Application Passwords (Recommended) | Authorization: Basic base64(user:app_password) | CI/CD scripts, server-to-server headless builds, CLI automation, and HTTP MCP agents. Revocable per token in /d-admin/profile. |
| HS256 JWT Bearer Token | POST /wp-json/jwt-auth/v1/token → Authorization: Bearer <jwt> | Decoupled mobile/SPA clients. Supports 2FA verification and instant invalidation via session_ver when sessions are revoked. |
| Session Cookie + Nonce | GET /wp-json/daypress/v1/auth/nonce → X-WP-Nonce: <token> | Same-origin browser requests inside DayStudio and /d-admin/*. |
# 1. Basic Auth with an Application Password
curl -u "admin:abcd efgh ijkl mnop" https://example.com/wp-json/wp/v2/posts?status=any
# 2. Issue & validate an HS256 JWT token
TOKEN=$(curl -s -X POST https://example.com/wp-json/jwt-auth/v1/token \
-H "Content-Type: application/json" \
-d '{"username":"admin","password":"YourLoginPassword"}' | jq -r .token)
curl -X POST https://example.com/wp-json/jwt-auth/v1/token/validate \
-H "Authorization: Bearer $TOKEN"WordPress REST v2 endpoints & pagination headers
Every collection endpoint under /wp-json/wp/v2/* returns standard WordPress JSON envelopes and exposes X-WP-Total and X-WP-TotalPages headers (with Access-Control-Expose-Headers preconfigured):
| Endpoint | Methods | Query & Payload Highlights |
|---|---|---|
/wp-json/wp/v2/posts & /pages | GET, POST, PUT, PATCH, DELETE | Filter by slug, status, categories, tags, author, search, page, per_page. Includes acf object and pre-rendered HTML. |
/wp-json/wp/v2/{cpt_slug} | GET, POST, PUT, PATCH, DELETE | Auto-registered for every public Custom Post Type (e.g. /wp-json/wp/v2/docs, /wp-json/wp/v2/portfolio). |
/wp-json/wp/v2/media | GET, POST, DELETE | 100 MB multipart upload limit; auto-generates AVIF + WebP derivatives and responsive metadata. |
/wp-json/wp/v2/taxonomies/{tax}/terms | GET, POST, PATCH, DELETE | Manage built-in categories/tags and custom taxonomy terms. |
/wp-json/wp/v2/users & /comments | GET, POST, PATCH, DELETE | Manage user profiles, Application Passwords, and threaded comment moderation. |
Daypress v1 extension endpoints
| Route Group | Representative Endpoints |
|---|---|
| Visual AST & Templates | GET|POST /wp-json/daypress/v1/layout/{id}, /theme-builder/templates, /collection-query |
| Search, SEO & OG Cards | GET /wp-json/daypress/v1/search?q=..., POST /seo/audit, GET /og-image?post_id=... |
| Forms, Newsletters & Growth | POST /forms/{id}/submit, POST /newsletters/subscribe, /shortlinks, /webhooks, /ab-tests |
| Migration, Deploy & Health | POST /import, POST /import-wxr, POST /import/analyze, POST /publish/run, GET /security/audit, POST /benchmarks/run |
Headless Next.js / Astro fetch & CORS allowlist
For security, Daypress never emits wildcard Access-Control-Allow-Origin: * on authenticated routes. Same-origin requests and your configured siteurl/home are allowed automatically; to authorize external headless frontends (such as Vercel, Cloudflare Workers, or Astro dev servers), pass a comma-separated allowlist in DAYPRESS_CORS_ORIGINS:
# Allow your production frontend and staging preview origin
export DAYPRESS_CORS_ORIGINS="https://app.example.com,https://staging.example.com"
# Fetch structured CPT entries + typed ACF fields in Next.js / Astro
const res = await fetch("https://cms.example.com/wp-json/wp/v2/docs?per_page=50", {
next: { revalidate: 60 },
});
const guides = await res.json();