REST API integration
WordPress REST API integration for Draftbit
Use WordPress content through the REST API
What is WordPress?
WordPress exposes posts, pages, media, users, and custom routes through its REST API. Public content can often be read without credentials; write operations usually require HTTPS Basic auth with an application password.
Use WordPress with Draftbit
- Built-in endpoints: List posts, Get posts, Create posts, Update posts, Delete posts, List pages.
- Bind any WordPress endpoint to a screen, list, form, or AI agent action.
- Authentication is configured once per app — secrets stay on the server.
- Add custom request and response transforms without forking WordPress's client library.
More ways to connect WordPress
Prefer GraphQL? Connect to the WPGraphQL integration instead.
Example
wordpress-example.ts // Example: fetch from WordPress
const response = await fetch("https://{site_domain}/wp-json/wp/v2/posts", {
headers: {
"Authorization": "Basic YOUR_WORDPRESS_TOKEN",
},
});
const data = await response.json();Use cases
- Drive a blog, news feed, or content section from a headless CMS
- Let non-engineers publish app content without a release
- Localize copy and assets without code changes
Authentication
Authentication uses the `Authorization` header. Paste your key once in Draftbit and every request to WordPress carries it automatically — secrets stay on the server side.
Use WordPress in a Draftbit app today
Start free, connect WordPress in minutes, and ship with AI agents that know how to use it.
Frequently asked questions
What is the WordPress REST integration?
WordPress exposes posts, pages, media, users, and custom routes through its REST API. Public content can often be read without credentials; write operations usually require HTTPS Basic auth with an application password.
How do I connect WordPress to a Draftbit app?
Go to Integrations and then REST APIs in your Draftbit app and pick WordPress from the catalog. Paste your API key or token and fill in any base URL variables, such as a project ID or host. The endpoints are then available across your screens and to the AI agents while you build.
Does WordPress require authentication?
Most WordPress endpoints expect a key or token sent as a header. The preconfigured endpoints include List posts, Get posts, Create posts, Update posts.
What can I build with WordPress and Draftbit?
Most teams use WordPress as a headless CMS for a mobile or web app. You might use WordPress to drive a blog, news feed, or content section from a headless CMS, or to let non-engineers publish app content without a release.