If your site is hosted on WordPress.com, you might notice something confusing:
- Visiting
/wp-json/wp/v2/postsreturns HTML instead of JSON - Even
curlor Postman may not work as expected - It looks like the REST API is not exposed
This leads many developers to believe there’s a configuration issue — but that’s not true.

Let’s clear this up properly.
The Common Mistake
Most tutorials online assume self-hosted WordPress, where this works perfectly:
https://example.com/wp-json/wp/v2/posts
However, on WordPress.com–hosted sites, this endpoint is not reliably exposed due to:
- CDN routing
- HTML-first optimizations
- Platform-level restrictions
You cannot fix this with settings or plugins on WordPress.com.
The Correct API for WordPress.com Sites
WordPress.com provides its own official public REST API, designed specifically for hosted sites.
✅ Base API
https://public-api.wordpress.com/wp/v2
✅ Fetch posts from a site
https://public-api.wordpress.com/wp/v2/sites/itrate.wordpress.com/posts
This endpoint:
- Always returns JSON
- Works in browser,
curl, Postman, andfetch - Is officially supported
- Requires no configuration
🧠 Why This Works
There are two different REST APIs in the WordPress ecosystem:
| Hosting Type | Recommended API |
|---|---|
| Self-hosted WordPress | /wp-json/wp/v2/* |
| WordPress.com | public-api.wordpress.com/wp/v2/* |
The public API bypasses site routing completely and talks directly to WordPress.com infrastructure.
📌 Useful Endpoints
Get all posts
/sites/itrate.wordpress.com/posts
Get pages
/sites/itrate.wordpress.com/pages
Get post by slug
/sites/itrate.wordpress.com/posts?slug=my-post-slu
Pagination
/sites/itrate.wordpress.com/posts?page=1&number=10
🚀 Example: Fetch Posts in JavaScript
fetch("https://public-api.wordpress.com/wp/v2/sites/itrate.wordpress.com/posts") .then(res => res.json()) .then(posts => { posts.forEach(post => { console.log(post.title); }); });
❗ Important Notes
- This API is read-first (perfect for blogs, docs, headless frontends)
- Authentication is limited compared to self-hosted WordPress
- Ideal for Next.js, React, mobile apps, static sites
If you need:
- Custom REST endpoints
- Full write access
- JWT or custom auth
👉 Self-hosted WordPress is the better choice.
Final Takeaway
If your site is hosted on WordPress.com,
do not rely on/wp-jsonendpoints.Use the WordPress.com Public REST API instead.
This avoids confusion, redirects, and wasted debugging time.