API Reference

NativePress REST API

A clean, read-only REST API that extends the WordPress REST API with Markdown content delivery. Build native mobile apps powered by WordPress — without WebView.

Protocol HTTPS
Format JSON
Auth None (public)
WP Version 6.0+
PHP Version 7.4+
Base URL https://your-site.com/wp-json/nativepress/v1

Authentication

All NativePress endpoints are public and require no authentication. No API keys, tokens, or credentials are needed.

All endpoints respect WordPress’s standard post visibility rules. Only published posts with post_status = 'publish' are returned. Password-protected and private posts are automatically excluded.

Base URL

Replace your-site.com with your WordPress installation domain. The REST namespace is always nativepress/v1.

URL Pattern
https://your-site.com/wp-json/nativepress/v1/{endpoint}

In the NativePress Expo app, this is set in constants/config.ts as WP_BASE_URL — the only value buyers need to change.

Error Handling

Errors follow the standard WordPress REST API error format. HTTP status codes reflect the error type.

Error Response Shape
{
  "code":    "rest_post_invalid_id",
  "message": "Invalid post ID.",
  "data":    { "status": 404 }
}
HTTP Status Meaning
200 OK Request succeeded.
404 Not Found Post or resource does not exist, or is not published.
400 Bad Request Invalid parameters (e.g., non-numeric ID, per_page exceeding 50).
500 Server Error Unexpected server error. Check WordPress debug log.
GET /posts

Returns a paginated list of published posts. Each post includes the full body converted to Markdown. Supports filtering by category, keyword search, and pagination.

Query Parameters
Parameter Type Default Max Description
page optional integer 1 Page number for pagination.
per_page optional integer 10 50 Number of posts to return per page. Capped at 50.
category_id optional integer Filter posts by WordPress category ID.
search optional string Search posts by keyword (searches title and content).
Example Request
curl
curl -s "https://your-site.com/wp-json/nativepress/v1/posts?page=1&per_page=10"

# With category filter
curl -s "https://your-site.com/wp-json/nativepress/v1/posts?category_id=5&per_page=20"

# With search
curl -s "https://your-site.com/wp-json/nativepress/v1/posts?search=getting+started"
Response
JSON — 200 OK
{
  "posts": [
    {
      "id":                123,
      "title":             "Getting Started with NativePress",
      "slug":              "getting-started-with-nativepress",
      "date":              "2026-03-11T10:00:00",
      "modified":          "2026-03-11T10:00:00",
      "excerpt":           "A short summary of the post content...",
      "content_markdown":  "# Getting Started\n\nWelcome to NativePress...",
      "featured_image": {
        "url":    "https://your-site.com/wp-content/uploads/hero.jpg",
        "width":  1200,
        "height": 600,
        "alt":    "Hero image alt text"
      },
      "author": {
        "id":     1,
        "name":   "Jane Smith",
        "avatar": "https://secure.gravatar.com/avatar/abc123"
      },
      "categories": [
        { "id": 5, "name": "Tech", "slug": "tech" }
      ]
    }
  ],
  "total":       42,
  "total_pages": 5,
  "page":        1,
  "per_page":    10
}
Pagination tip: Use total_pages to determine when to stop loading. When page >= total_pages, you have reached the last page. The app implements infinite scroll by incrementing page and appending results.
GET /posts/{id}

Returns a single published post by its WordPress ID. The response is a post object (not wrapped in an array). Returns 404 if the post does not exist or is not published.

Path Parameters
Parameter Type Description
id integer The WordPress post ID. Must be a positive integer.
Example Request
curl
curl -s "https://your-site.com/wp-json/nativepress/v1/posts/123"
Response — 200 OK
JSON
{
  "id":                123,
  "title":             "Getting Started with NativePress",
  "slug":              "getting-started-with-nativepress",
  "date":              "2026-03-11T10:00:00",
  "modified":          "2026-03-11T10:00:00",
  "excerpt":           "A short summary of the post content...",
  "content_markdown":  "# Getting Started\n\nWelcome to **NativePress**...",
  "featured_image": {
    "url":    "https://your-site.com/wp-content/uploads/hero.jpg",
    "width":  1200,
    "height": 600,
    "alt":    "Hero image alt text"
  },
  "author": {
    "id":     1,
    "name":   "Jane Smith",
    "avatar": "https://secure.gravatar.com/avatar/abc123"
  },
  "categories": [
    { "id": 5, "name": "Tech", "slug": "tech" }
  ]
}
Error Response — 404 Not Found
JSON
{
  "code":    "rest_post_invalid_id",
  "message": "Invalid post ID.",
  "data":    { "status": 404 }
}
GET /categories

Returns all enabled categories in the order configured in the NativePress admin panel. Categories marked as disabled in the admin are excluded from the response. Only categories with at least one published post are included by default.

Example Request
curl
curl -s "https://your-site.com/wp-json/nativepress/v1/categories"
Response
JSON — 200 OK
{
  "categories": [
    {
      "id":          5,
      "name":        "Technology",
      "slug":        "technology",
      "description": "Tech articles and tutorials",
      "count":       14,
      "parent":      0
    },
    {
      "id":          8,
      "name":        "Design",
      "slug":        "design",
      "description": "UI/UX and visual design",
      "count":       9,
      "parent":      0
    }
  ]
}
Category order and visibility are controlled via the NativePress admin panel under Settings > Categories. Changes take effect immediately in the API. The parent field is 0 for top-level categories.
GET /settings

Returns the public application configuration set in the NativePress admin panel. The Expo app calls this on startup to populate the Zustand store and apply theming.

Example Request
curl
curl -s "https://your-site.com/wp-json/nativepress/v1/settings"
Response
JSON — 200 OK
{
  "app_name":            "My App",
  "primary_color":       "#6200EE",
  "posts_per_page":      10,
  "show_featured_image": true,
  "show_author":         true,
  "show_date":           true,
  "show_categories":     true,
  "terms_url":           "https://example.com/terms",
  "privacy_url":         "https://example.com/privacy",
  "support_email":       "support@example.com"
}
Field Type Description
app_name string Display name shown in the app header and splash screen.
primary_color string Hex color code used for buttons, links, and accent elements throughout the app.
posts_per_page integer Default number of posts per page (mirrors the per_page default in /posts).
show_featured_image boolean Whether to display the hero image at the top of a post detail screen.
show_author boolean Whether to display the author name and avatar on post cards and detail screens.
show_date boolean Whether to display the publication date on post cards and detail screens.
show_categories boolean Whether to show category chips/tags on post cards.
terms_url string URL to the Terms of Service page, opened in expo-web-browser.
privacy_url string URL to the Privacy Policy page, opened in expo-web-browser.
support_email string Support email address surfaced in the app settings screen.
Post Object

All post endpoints return data using this shape. Every field is always present; fields with no value return null.

Field Type Description
id integer WordPress post ID.
title string Post title, HTML entities decoded.
slug string URL-safe post slug.
date string Publication date in ISO 8601 format (site timezone).
modified string Last modified date in ISO 8601 format.
excerpt string Plain-text excerpt. Uses the manual excerpt if set; otherwise auto-generated from content.
content_markdown string Full post body converted to Markdown by league/html-to-markdown. Gutenberg block comments are stripped. This is what the app renders via react-native-markdown-display.
featured_image object | null Featured image data. null if no featured image is set.
featured_image.url string Absolute URL to the full-size featured image.
featured_image.width integer Image width in pixels.
featured_image.height integer Image height in pixels.
featured_image.alt string Image alt text (empty string if not set).
author object Post author information.
author.id integer WordPress user ID.
author.name string Author display name.
author.avatar string Gravatar URL at 96px.
categories array Array of category objects this post belongs to. Empty array if uncategorized.
categories[].id integer Category term ID.
categories[].name string Category display name.
categories[].slug string URL-safe category slug.
Category Object
Field Type Description
id integer WordPress term ID. Use this as category_id when filtering posts.
name string Category display name.
slug string URL-safe category slug.
description string Category description (empty string if not set).
count integer Number of published posts in this category.
parent integer Parent category ID. 0 for top-level categories.
Settings Object

The settings object maps directly to the AppSettings TypeScript interface in types/index.ts.

TypeScript — types/index.ts
export interface AppSettings {
  app_name:            string;
  primary_color:       string;
  posts_per_page:      number;
  show_featured_image: boolean;
  show_author:         boolean;
  show_date:           boolean;
  show_categories:     boolean;
  terms_url:           string;
  privacy_url:         string;
  support_email:       string;
}
Changelog
Version Date Notes
v1.0.0 2026-03-11 Initial release. Endpoints: /posts, /posts/{id}, /categories, /settings. Markdown conversion via league/html-to-markdown.
This is a read-only API. Write operations (creating, updating, or deleting posts) are not supported through the NativePress namespace and must be done via the standard WordPress admin or the core WordPress REST API with proper authentication.