# tangble — Complete LLM Context & Platform Overview (llms-full.txt)
> tangble helps businesses design and build websites, custom web applications, and digital products that solve real problems and create better user experiences.
- Primary Site: https://www.tangble.com/
- Contact: https://www.tangble.com/contact (hello@tangble.com)
- Privacy Policy: https://www.tangble.com/privacy-policy
- Terms of Service: https://www.tangble.com/terms-of-service
- Concise Summary (llms.txt): https://www.tangble.com/llms.txt
================================================================================
# SECTION 1: PRODUCT SUITE & ACTIVE PLATFORMS
================================================================================
## 1. Pottr (v1.12.2)
A WordPress plugin for structured collections, a REST API, app-user logins and webhooks.
- Product Overview: https://www.tangble.com/pottr
- Full Pottr Context: https://www.tangble.com/pottr/llms-full.txt
- Documentation: https://www.tangble.com/pottr/docs
- Free download: https://pottr.tangble.com/downloads/pottr-v1.12.2.zip
- Plans:
* Free ($0 forever): 3 collections, 1,000 entries per collection, 5,000 API calls/month, 1 webhook, 3-day log retention, 10MB media files. Includes the REST API with exact-match filters, sorting, typed fields, relation expansion, optional app-user JWT auth, API keys, HMAC-signed webhooks, blueprints and the zero-config handshake. GPLv2+.
* Pro ($6.99 / month, 1 site): Everything in Free plus 15 collections, 10,000 entries per collection, 100,000 API calls/month, 10 webhooks, 30-day log retention, 25MB media files, live events (SSE) streaming and webhook test diagnostics.
* Business ($11.99 / month, unlimited sites): Everything in Pro plus unlimited collections, entries, API calls and webhooks, 365-day log retention, 50MB media files and unlimited site activations. Pro covers 1 site, and you can move the license between sites yourself.
### Pottr Documentation Index:
- Chapter 1: [Introduction](https://www.tangble.com/pottr/docs/) — Pottr is a WordPress plugin that gives WordPress an application backend: structured collections, a REST API, separate app-user accounts, blueprints, webhooks, media uploads and live events.
- Chapter 2: [How Pottr Works](https://www.tangble.com/pottr/docs/how-pottr-works) — Pottr bridges client-friendly WordPress management and modern frontend engineering: where your data lives, how requests flow, and who does what.
- Chapter 3: [Installation & Requirements](https://www.tangble.com/pottr/docs/installation) — System prerequisites, server checklist, and activation steps for running Pottr on WordPress.
- Chapter 4: [Quickstart Guide](https://www.tangble.com/pottr/docs/quickstart) — Connect a frontend application to Pottr, declare your schema, and make your first verified API request in 5 minutes.
- Chapter 5: [Plans, Limits & Licensing](https://www.tangble.com/pottr/docs/plans-and-limits) — What Free, Pro and Business include, how API-call metering works, and how to activate a license key.
- Chapter 6: [System Configuration & Environment](https://www.tangble.com/pottr/docs/configuration) — wp-config.php constants for CORS origins, local development, email URLs, and trusted reverse proxies.
- Chapter 7: [Collections & Fields](https://www.tangble.com/pottr/docs/collections-and-fields) — How Pottr models structured application entities using 9 field types, strict validation, and normalized schemas.
- Chapter 8: [Relationships & Expansion](https://www.tangble.com/pottr/docs/relationships) — Connecting entities across collections and resolving linked records with single-level relation expansion.
- Chapter 9: [User-Owned Data & Row-Level Security](https://www.tangble.com/pottr/docs/user-owned-data) — Automatic data isolation and row-level privacy for multi-tenant portals, user dashboards, and private application stores.
- Chapter 10: [API Overview & Conventions](https://www.tangble.com/pottr/docs/api-overview) — Base URLs, authentication headers, payload conventions, response structures, and standard error handling.
- Chapter 11: [Working with Data (CRUD)](https://www.tangble.com/pottr/docs/working-with-data) — Full reference for creating, reading, updating, partially patching, and soft-deleting entries.
- Chapter 12: [Querying Data (Filtering & Sorting)](https://www.tangble.com/pottr/docs/querying-data) — Pagination parameters, sorting directives, field equality filters, and batch ID retrieval.
- Chapter 13: [Media Uploads](https://www.tangble.com/pottr/docs/media-uploads) — Upload images and PDFs through the REST API into the WordPress media library and attach them to entries.
- Chapter 14: [Live Events (SSE)](https://www.tangble.com/pottr/docs/realtime-events) — Stream collection changes to browsers with Server-Sent Events. Available on Pro and Business.
- Chapter 15: [API Keys & Connect Tokens](https://www.tangble.com/pottr/docs/api-keys) — Understanding the Public Key vs Secret Key security model and endpoint permission gates.
- Chapter 16: [App Users & JWT Authentication](https://www.tangble.com/pottr/docs/app-users) — Decoupled end-user authentication, JWT lifecycles, profile management, and password reset flows.
- Chapter 17: [Blueprints & Schema Migrations](https://www.tangble.com/pottr/docs/blueprints) — Declarative schema definitions for automated, non-destructive application provisioning on boot or deploy.
- Chapter 18: [Connecting Apps](https://www.tangble.com/pottr/docs/connecting-apps) — Let an external app request a connection and get API keys after one click of admin approval, with no manual setup.
- Chapter 19: [Webhooks & Event Dispatching](https://www.tangble.com/pottr/docs/webhooks) — Subscribing to collection data changes with HMAC-SHA256 signature verification.
- Chapter 20: [PHP Helpers](https://www.tangble.com/pottr/docs/php-helpers) — Read Pottr data from themes and plugins on the same WordPress site without HTTP requests.
================================================================================
# SECTION 2: POTTR COMPLETE DOCUMENTATION REPOSITORY
================================================================================
--------------------------------------------------------------------------------
## POTTR DOCS - CHAPTER 1: INTRODUCTION
--------------------------------------------------------------------------------
# Introduction
> Pottr is a WordPress plugin that gives WordPress an application backend: structured collections, a REST API, separate app-user accounts, blueprints, webhooks, media uploads and live events.
- **Category:** Getting Started
- **Canonical Guide:** https://pottr.tangble.com/docs/
---
>
Pottr is a WordPress plugin that gives WordPress an application backend: structured collections, a REST API, separate app-user accounts, blueprints, webhooks, media uploads and live events.
## The Developer Mental Model
WordPress is built for content: posts, pages and custom fields stored in `wp_posts` and `wp_postmeta`. When you build a web app, a client portal, a directory or a small SaaS product, forcing app data into posts means stitching plugins together and fighting complex queries.
Pottr gives WordPress a dedicated application layer instead. Your frontend talks to a clean REST API, and your data stays in your own WordPress database:
Your Frontend
React · Next.js · Vue · Mobile · SPA
REST JSON
Pottr Engine
REST API · Auth · Schema · Webhooks
**Underneath:** Runs inside your existing WordPress and MySQL server. No external backend service, no per-request fees, no vendor lock-in.
## What Pottr Provides
**Collections:** Define structured data with 9 field types, in the WordPress admin or in code, without touching custom post types or postmeta.
**A predictable REST API:** Create, read, update, patch and delete entries, with equality filters, pagination, sorting, single-level relation expansion and an optional standardized response envelope.
**API keys:** Public keys (`pk_live_...`) for frontends and secret keys (`sk_live_...`) for servers and pipelines.
**App-user authentication:** Sign up, log in and manage sessions for your app's users with 15-minute access tokens and rotating 30-day refresh tokens, without creating `wp_users` accounts.
**Row-level security:** Add a `user_id` field to a collection and each user only sees and changes their own entries.
**Blueprints:** Describe your collections and auth profile in JSON and provision them on deploy or app boot, additively and safely.
**Zero-config connections:** An external app can ask to connect, and you approve it with one click in the WordPress admin.
**Signed webhooks:** Get `entry.created`, `entry.updated` and `entry.deleted` notifications verified with HMAC-SHA256.
**Media uploads:** Upload images and PDFs through the API into the WordPress media library.
**Live events:** Stream collection changes to browsers with Server-Sent Events on Pro and Business.
**Logs and limits:** Activity logs, monthly API-call metering and plan limits, all visible in the admin.
## One Plugin, Three Plans
Pottr is a single plugin. You download one zip from [pottr.tangble.com](/pottr), install it, and it starts on the **Free** plan with no license. **Pro** and **Business** unlock inside the same plugin when you paste a license key under **Pottr › License**. Nothing is reinstalled and nothing is deleted if you later go back to Free. See [Plans, Limits & Licensing](/pottr/docs/plans-and-limits) for the limits.
Self-Contained Architecture
Pottr is 100% self-hosted on your WordPress server. Collections, entries and app-user profiles live in your own MySQL database. Entries are stored as JSON documents in one table (`wp_pottr_entries`), so it suits app-sized data rather than replacing a purpose-built database for very large workloads.
## Where to Go Next
[Installation & Requirements](/pottr/docs/installation) to get the plugin running.
[Quickstart Guide](/pottr/docs/quickstart) to make your first API request.
[API Overview](/pottr/docs/api-overview) for authentication, response formats and errors.
--------------------------------------------------------------------------------
## POTTR DOCS - CHAPTER 2: HOW POTTR WORKS
--------------------------------------------------------------------------------
# How Pottr Works
> Pottr bridges client-friendly WordPress management and modern frontend engineering: where your data lives, how requests flow, and who does what.
- **Category:** Getting Started
- **Canonical Guide:** https://pottr.tangble.com/docs/how-pottr-works
---
>
Pottr bridges client-friendly WordPress management and modern frontend engineering: where your data lives, how requests flow, and who does what.
## The End-to-End Workflow
**Install Pottr in WordPress:** Download the zip from [pottr.tangble.com](/pottr), upload it under **Plugins › Add New › Upload Plugin** and activate it. Pottr is not on the WordPress.org directory.
**Define your application data:** Create collections visually in the WordPress admin, declare them in code with a Blueprint, or let an external app request a connection that you approve with one click.
**The REST API exists immediately:** Pottr serves JSON at `/wp-json/pottr/v1/collections/{slug}` with filtering, sorting and pagination.
**Connect your frontend:** Use your public key (`pk_live_...`) in your React, Next.js, Vue or mobile app to read and write entries.
**Add capabilities as you need them:** Turn on app-user authentication, scope collections to their owners, add webhooks, accept media uploads, stream live events, or automate deployments with Blueprints.
## A Request, Start to Finish
Your app sends a request to `/wp-json/pottr/v1/...` with an `Authorization: Bearer` header (and, for signed-in users, an `X-Pottr-User-Token` header).
Pottr checks CORS, then the API key or token, then your monthly API-call quota.
The schema validates the request body: required fields, field types and unknown keys.
The entry is read from or written to `wp_pottr_entries`, scoped to the user if the collection is user-owned.
Pottr records an activity log event, queues any matching webhooks and publishes the change to live event streams.
## Where Your Data Lives
**Entries:** One JSON document per entry in `wp_pottr_entries`, tagged with its collection slug. Deleting an entry through the API is a soft delete.
**Schema:** Your collections and fields are stored in the `pottr_schema` WordPress option.
**App users:** Each app that declares authentication gets its own users and refresh-token tables, separate from `wp_users`.
**Logs, webhooks and events:** Dedicated tables for activity logs, webhook deliveries and the short-lived live-event buffer.
**Uploads:** Files go to the WordPress uploads folder under `pottr/{app}/` and are registered as media attachments.
Deleting the plugin keeps all of this by default. Data is only erased if you switch on **Also erase all Pottr data when the plugin is deleted** under **Pottr › Settings**.
## WordPress vs. Pottr Responsibilities
Layer
Component
Responsibilities
**WordPress**
Hosting & runtime
PHP and MySQL runtime, admin UI, media library, transactional mail (`wp_mail`), WP-Cron scheduling.
**Pottr**
Application engine
Schema, REST routes, API keys, app-user JWT authentication, webhooks, metering, logs and live events.
**Your frontend**
User experience
The client UI (React, Vue, Next.js, mobile), user interaction and client-side state.
## The Pottr Admin
Everything above can be managed from the **Pottr** menu in WordPress:
**Pottr (dashboard):** Usage at a glance, plus tabs for Collections, Webhooks, Logs and, when you use app authentication, your app users. Open a collection to edit its fields and browse, add, import and delete entries.
**API Keys:** View, copy and regenerate your public and secret keys, copy a ready-made `.env` snippet and see connected apps.
**License:** See your plan, activate or deactivate a license key and manage billing.
**Settings:** Choose whether Pottr keeps an activity log and whether data is erased when the plugin is deleted.
**Getting started:** A guided first request, available from the top bar at any time.
--------------------------------------------------------------------------------
## POTTR DOCS - CHAPTER 3: INSTALLATION & REQUIREMENTS
--------------------------------------------------------------------------------
# Installation & Requirements
> System prerequisites, server checklist, and activation steps for running Pottr on WordPress.
- **Category:** Getting Started
- **Canonical Guide:** https://pottr.tangble.com/docs/installation
---
>
System prerequisites, server checklist, and activation steps for running Pottr on WordPress.
## Verified System Requirements
Requirement
Minimum Version
Notes
**WordPress**
`6.0+`
Requires active REST API support.
**PHP**
`7.4+`
Compatible with PHP 8.0, 8.1, 8.2, and 8.3+.
**MySQL / MariaDB**
`MySQL 5.7+` or `MariaDB 10.2.3+`
Strictly required for native JSON storage and extraction functions.
**Permalinks**
Pretty Permalinks Enabled
Pretty permalinks keep `/wp-json/` routes clean. If your site uses Plain permalinks, WordPress also serves the API at `/?rest_route=/pottr/v1/...`.
**Outbound HTTP**
HTTPS / cURL
Required for outgoing webhooks, license validation and update checks.
## Installation Steps
Pottr is distributed from [pottr.tangble.com](/pottr), not the WordPress.org plugin directory.
Download the latest `pottr-v{version}.zip` from the [Pottr page](/pottr).
In WordPress Admin, go to **Plugins › Add New › Upload Plugin**, choose the zip and click **Install Now**.
Click **Activate Plugin**. Pottr registers the `/wp-json/pottr/v1/` API namespace and creates its database tables.
Open the new **Pottr** menu item. The **Getting started** checklist walks you through copying your keys and making a first request.
Pottr starts on the Free plan with no license required.
## Upgrade to Pro or Business
Pottr starts on the Free plan. Pro and Business unlock inside the same plugin, so there is nothing new to install:
Choose a plan on the [pricing page](/pottr#pricing) and complete checkout. Polar emails you a license key.
In WordPress, open **Pottr › License**, paste the key, and click **Activate**. The new limits apply immediately.
If a subscription is cancelled or expires, the site returns to the Free limits. Your collections, entries, schemas and webhooks are never deleted. Pro licenses cover one site, and you can move the license to another site yourself by deactivating and reactivating it; Business licenses cover unlimited sites.
## Updates
Pottr announces new versions on the WordPress **Plugins** screen on every plan. Click **Update now** to install; the download is checked for integrity first, and your data and settings are kept. Updates never require a license.
## Uninstalling
Deactivating or deleting Pottr keeps your collections, entries and settings, so reinstalling picks up where you left off. To remove everything on delete, switch on **Also erase all Pottr data when the plugin is deleted** under **Pottr › Settings** first.
Permalink Structure Notice
If you receive 404 errors when querying `/wp-json/pottr/v1/*`, make sure Pretty Permalinks are enabled under **Settings › Permalinks** (select "Post name" or any non-plain format), then save the page once to flush rewrite rules.
--------------------------------------------------------------------------------
## POTTR DOCS - CHAPTER 4: QUICKSTART GUIDE
--------------------------------------------------------------------------------
# Quickstart Guide
> Connect a frontend application to Pottr, declare your schema, and make your first verified API request in 5 minutes.
- **Category:** Getting Started
- **Canonical Guide:** https://pottr.tangble.com/docs/quickstart
---
>
Connect a frontend application to Pottr, declare your schema, and make your first verified API request in 5 minutes.
## 1. Retrieve Your API Keys
In the WordPress Admin, navigate to **Pottr › API Keys**. Copy your **Public Key** (starts with `pk_live_`).
## 2. Configure Environment Variables
In your frontend project (e.g. Next.js, Vite, React, Vue), configure your environment variables:
**File: `.env.local`**
```text
NEXT_PUBLIC_POTTR_API_URL="https://example.com/wp-json/pottr/v1"
NEXT_PUBLIC_POTTR_PUBLIC_KEY="pk_live_your_public_key_here"
```
## 3. Allow Your Frontend Origin
Browsers only let your app call Pottr from origins you allow. Add this to `wp-config.php` (use `POTTR_ALLOWED_ORIGINS` for a comma-separated list):
**File: `wp-config.php`**
```php
define( 'POTTR_ALLOWED_ORIGIN', 'http://localhost:3000' );
```
See [Configuration](/pottr/docs/configuration) for all options.
## 4. Declare Schema via Bootstrap (Optional)
You can create collections in the WordPress Admin, or send a declarative bootstrap request using your Public Key when your app boots:
**File: `bootstrap.js`**
```javascript
const response = await fetch('https://example.com/wp-json/pottr/v1/auth/bootstrap', {
method: 'POST',
headers: {
'Authorization': `Bearer ${process.env.NEXT_PUBLIC_POTTR_PUBLIC_KEY}`,
'Content-Type': 'application/json'
},
body: JSON.stringify({
app: 'task-manager',
version: '1.0.0',
collections: [
{
slug: 'tasks',
name: 'Tasks',
fields: [
{ key: 'title', type: 'text', required: true },
{ key: 'priority', type: 'text' },
{ key: 'completed', type: 'boolean' }
]
}
]
})
});
const result = await response.json();
console.log(result);
```
Bootstrap is additive and safe to call on every app boot. The response reports what happened to each collection:
**File: `Response`**
```json
{
"app": "task-manager",
"version": "1.0.0",
"version_status": "new",
"auth": null,
"results": [
{ "slug": "tasks", "status": "created" }
]
}
```
Each result is `created`, `existing` or `failed` (for example when your plan's collection limit is reached). See [Blueprints](/pottr/docs/blueprints).
## 5. Create and Query Entries
Create a task entry via `POST /collections/tasks`:
**File: `create-entry.js`**
```javascript
const createRes = await fetch('https://example.com/wp-json/pottr/v1/collections/tasks', {
method: 'POST',
headers: {
'Authorization': `Bearer ${process.env.NEXT_PUBLIC_POTTR_PUBLIC_KEY}`,
'Content-Type': 'application/json'
},
body: JSON.stringify({
title: 'Ship documentation',
priority: 'high',
completed: false
})
});
const newEntry = await createRes.json();
console.log(newEntry); // HTTP 201, the stored entry (id, collection, data, created_at, updated_at)
```
Fetch the list of tasks with pagination:
**File: `fetch-entries.js`**
```javascript
const res = await fetch('https://example.com/wp-json/pottr/v1/collections/tasks?limit=10&order_by=created_at&order=DESC', {
headers: {
'Authorization': `Bearer ${process.env.NEXT_PUBLIC_POTTR_PUBLIC_KEY}`
}
});
const { data, meta } = await res.json();
console.log(data); // Array of entries; each has a string id, created_at and your fields
console.log(meta); // { total: 1, limit: 10, offset: 0, has_more: false }
```
--------------------------------------------------------------------------------
## POTTR DOCS - CHAPTER 5: PLANS, LIMITS & LICENSING
--------------------------------------------------------------------------------
# Plans, Limits & Licensing
> What Free, Pro and Business include, how API-call metering works, and how to activate a license key.
- **Category:** Getting Started
- **Canonical Guide:** https://pottr.tangble.com/docs/plans-and-limits
---
>
What Free, Pro and Business include, how API-call metering works, and how to activate a license key.
## Plan Limits
There is one plugin. The plan only changes the limits and unlocks a few features.
Limit
Free
Pro
Business
Collections
3
15
Unlimited
Entries per collection
1,000
10,000
Unlimited
API calls per month
5,000
100,000
Unlimited
Webhooks
1
10
Unlimited
Log retention
3 days
30 days
365 days
Media file size
10 MB
25 MB
50 MB
Live events (SSE) and webhook test
No
Yes
Yes
Sites per license
n/a
1
Unlimited
See the [pricing page](/pottr#pricing) for current prices.
## Activating a License
Choose a plan on the [pricing page](/pottr#pricing) and complete checkout. A license key is emailed to you.
In WordPress, open **Pottr › License**, paste the key and click **Activate**.
The new limits apply immediately. Pottr re-checks your license once a day in the background; it never contacts the license service when you load an admin page. To move a license to another site, deactivate it on the License screen first.
## API-Call Metering
Plans with a monthly API-call quota move through three stages:
**Normal:** requests are within the quota.
**Grace:** the quota is used up. Writes return `429 api_limit_exceeded`; reads keep working for up to 500 more calls.
**Paused:** all requests are blocked until the quota resets on the first day of the next month.
Authentication routes are not metered, so users can always sign in. Usage is shown on the dashboard.
## Cancelling or Expiring
If a subscription is cancelled or expires, the site returns to Free limits. Nothing is deleted: your collections, entries, schemas and webhooks stay, and only new additions beyond the Free limits are blocked. A failed payment gives a 5-day grace period with paid access before that happens.
## Development License
For local and staging sites, define `POTTR_SUPER_KEY` in `wp-config.php` to run with Business limits without contacting the license service. See [Configuration](/pottr/docs/configuration).
--------------------------------------------------------------------------------
## POTTR DOCS - CHAPTER 6: SYSTEM CONFIGURATION & ENVIRONMENT
--------------------------------------------------------------------------------
# System Configuration & Environment
> wp-config.php constants for CORS origins, local development, email URLs, and trusted reverse proxies.
- **Category:** Build & Integrate
- **Canonical Guide:** https://pottr.tangble.com/docs/configuration
---
>
`wp-config.php` constants for CORS origins, local development, email URLs, and trusted reverse proxies.
## Available `wp-config.php` Constants
Constant
Type
Description
`POTTR_ALLOWED_ORIGIN`
String
Single production domain allowed for cross-origin browser requests.
`POTTR_ALLOWED_ORIGINS`
String
Comma-separated list of multiple allowed frontend origins.
`POTTR_DEV_MODE`
Boolean
When `true`, automatically permits any `localhost` or `127.0.0.1` port. (Never enable in production).
`POTTR_APP_URL`
String
Frontend application base URL for password reset links in transactional emails.
`POTTR_TRUSTED_PROXIES`
String
Comma-separated proxy/load balancer IPs to trust for accurate client IP resolution.
## Configuration Example
**File: `wp-config.php`**
```php
// 1. Allow production frontend origins
define( 'POTTR_ALLOWED_ORIGINS', 'https://app.example.com,https://staging.example.com' );
// 2. Frontend URL for password reset email links
define( 'POTTR_APP_URL', 'https://app.example.com' );
// 3. Trust reverse proxy (e.g. Cloudflare / Nginx) for accurate IP rate limiting
define( 'POTTR_TRUSTED_PROXIES', '10.0.0.1,10.0.0.2' );
```
--------------------------------------------------------------------------------
## POTTR DOCS - CHAPTER 7: COLLECTIONS & FIELDS
--------------------------------------------------------------------------------
# Collections & Fields
> How Pottr models structured application entities using 9 field types, strict validation, and normalized schemas.
- **Category:** Core Concepts
- **Canonical Guide:** https://pottr.tangble.com/docs/collections-and-fields
---
>
How Pottr models structured application entities using 9 field types, strict validation, and normalized schemas.
## What is a Collection?
In Pottr, a **Collection** represents a structured data entity — such as `projects`, `tickets`, `invoices`, or `bookings`. Unlike WordPress posts, collections do not use `wp_posts` or `wp_postmeta`, keeping your application data separated from editorial content.
Collection slugs must use lowercase alphanumeric characters with hyphens or underscores (matching `^[a-z][a-z0-9_-]*$`).
## The 9 Supported Field Types
Type
Data Representation
Description & Sanitization
`text`
String
Single-line text. Sanitized via WordPress `sanitize_text_field()`.
`textarea`
String
Multi-line plain text. Sanitized via `sanitize_textarea_field()`.
`rich_text`
String (HTML)
Formatted HTML text. Sanitized via `wp_kses_post()`.
`number`
Number (int / float)
Stored and indexed as numeric values.
`boolean`
Boolean (`true` / `false`)
Boolean flag. Normalized to standard boolean on output.
`date`
String (ISO-8601)
Date/datetime string (e.g. `2026-05-10` or `2026-05-10T14:30:00Z`).
`relation`
Integer (Entry ID)
Foreign key ID referencing an entry in another collection.
`media`
Integer (Attachment ID)
WordPress media attachment ID.
`json`
Object / Array
Arbitrary structured JSON data payload.
## The Primary Title Field
Every collection in Pottr includes a primary `title` field (type `text`, required). If you declare a collection via Blueprints without a `title` field, Pottr automatically prepends it to the schema.
## What Is Validated
On every `POST`, `PUT` and `PATCH`, Pottr checks the body against the collection's schema:
Keys that are not fields of the collection are rejected (`unknown_field`).
Required fields must be present and non-empty (`missing_required`).
Each value is coerced and sanitized for its field type; values that cannot be coerced are rejected (`invalid_field`).
`relation` and `media` values must be positive integer IDs.
## User-Owned Collections
Add a `relation` or `number` field with the key `user_id` and the collection becomes user-owned: Pottr fills in the signed-in user on create and limits reads and writes to their entries. See [User-Owned Data](/pottr/docs/user-owned-data).
## Plan Limits
The number of collections and entries per collection depends on your plan. Hitting a limit returns `403 collection_limit_reached` or `403 entry_limit_reached`. See [Plans, Limits & Licensing](/pottr/docs/plans-and-limits).
--------------------------------------------------------------------------------
## POTTR DOCS - CHAPTER 8: RELATIONSHIPS & EXPANSION
--------------------------------------------------------------------------------
# Relationships & Expansion
> Connecting entities across collections and resolving linked records with single-level relation expansion.
- **Category:** Core Concepts
- **Canonical Guide:** https://pottr.tangble.com/docs/relationships
---
>
Connecting entities across collections and resolving linked records with single-level relation expansion.
## Declaring a Relation Field
To link one collection to another, declare a field with `type: "relation"` and specify the `target_collection` slug. By convention, relation field keys should use the `_id` suffix (e.g. `project_id`, `author_id`).
**File: `schema-definition.json`**
```json
{
"key": "project_id",
"name": "Project",
"type": "relation",
"target_collection": "project",
"required": true
}
```
## Relation Expansion (`?expand`)
By default, querying a collection returns the numeric ID stored in the relation field. When your frontend needs the related data, append `?expand=field_key` to inline the full related entry in a single HTTP request:
**File: `GET /wp-json/pottr/v1/collections/tasks?expand=project_id`**
```json
{
"data": [
{
"id": 42,
"title": "Write integration tests",
"project_id": {
"id": 7,
"collection": "project",
"data": {
"title": "Q3 Mobile App Launch",
"status": "in_progress"
},
"created_at": "2026-05-01 10:00:00",
"updated_at": "2026-05-03 14:22:00"
}
}
],
"meta": { "total": 1, "limit": 20, "offset": 0, "has_more": false }
}
```
Single-Level Expansion
Relation expansion is single-level. Pottr does not perform recursive nested expansions to ensure predictable performance and prevent circular dependency loops.
--------------------------------------------------------------------------------
## POTTR DOCS - CHAPTER 9: USER-OWNED DATA & ROW-LEVEL SECURITY
--------------------------------------------------------------------------------
# User-Owned Data & Row-Level Security
> Automatic data isolation and row-level privacy for multi-tenant portals, user dashboards, and private application stores.
- **Category:** Core Concepts
- **Canonical Guide:** https://pottr.tangble.com/docs/user-owned-data
---
>
Automatic data isolation and row-level privacy for multi-tenant portals, user dashboards, and private application stores.
## How User-Ownership Works
Any collection containing a field named `user_id` (type `relation` or `number`) is automatically designated as **user-owned**. Pottr enforces strict row-level security without requiring custom permissions code:
**Read Scoping:** `GET /collections/{slug}` queries automatically filter to only return entries owned by the authenticated app user (identified by their JWT). Requests without a valid user token receive `401 unauthorized`.
**Server-Side ID Injection:** When an authenticated user creates an entry (`POST /collections/{slug}`), Pottr extracts the user's ID from their verified JWT and attaches it server-side. Clients should omit `user_id` from the request body.
**Modification & Deletion Protection:** When updating (`PUT`/`PATCH`) or deleting (`DELETE`), Pottr verifies that the target entry's `user_id` matches the authenticated user. Attempts to read or alter another user's single entry return `403 forbidden`.
**Administrative Access:** Requests authenticated with the **Secret Key** (`sk_live_...`) or an active WordPress Administrator session bypass ownership checks, allowing backends and administrators to manage entries across all users.
## Example: Creating a User-Owned Entry
**File: `create-private-note.js`**
```javascript
// Notice: 'user_id' is NOT included in the body — it is injected server-side from the JWT
const res = await fetch('https://example.com/wp-json/pottr/v1/collections/notes', {
method: 'POST',
headers: {
'Authorization': `Bearer ${process.env.NEXT_PUBLIC_POTTR_PUBLIC_KEY}`,
'X-Pottr-User-Token': userAccessToken,
'Content-Type': 'application/json'
},
body: JSON.stringify({
title: 'My Private Financial Goal',
content: 'Confidential user data'
})
});
```
--------------------------------------------------------------------------------
## POTTR DOCS - CHAPTER 10: API OVERVIEW & CONVENTIONS
--------------------------------------------------------------------------------
# API Overview & Conventions
> Base URLs, authentication headers, payload conventions, response structures, and standard error handling.
- **Category:** REST API
- **Canonical Guide:** https://pottr.tangble.com/docs/api-overview
---
>
Base URLs, authentication headers, payload conventions, response structures, and standard error handling.
## Base Endpoint
All Pottr REST routes are anchored under the following base URL:
https://your-domain.com/wp-json/pottr/v1
## Authentication Header Model
Pottr supports three primary authentication patterns depending on your client environment:
Single-Page Apps, mobile apps, and Jamstack clients. Authenticates the site gateway and the end-user identity simultaneously.
**Secret Key**
`Authorization: Bearer sk_live_...`
Server-to-server microservices, Node/Python backends, CI/CD scripts. Full administrative bypass.
**User JWT Only**
`Authorization: Bearer `
Direct user authentication endpoints and user-scoped data calls.
## Standard Error Response Format
When an error occurs, Pottr returns a normalized JSON error payload accompanied by the relevant HTTP status code:
**File: `401 Unauthorized Response`**
```text
{
"error": true,
"code": "invalid_api_key",
"message": "The provided API key is invalid or revoked."
}
```
## Common Error Codes
Your monthly API-call quota is used up (writes pause first), or a rate limit was hit. Check the `Retry-After` header when present.
## Response Formats
By default, list endpoints return flattened entries (`id` as a string, `created_at` and your fields), and create, get and update return the stored entry. To get one uniform shape everywhere, opt in to the standard envelope with `?format=standard` or the header `Accept: application/vnd.pottr.v1+json`:
**File: `Standard format`**
```json
{
"data": {
"id": "87",
"collection": "tasks",
"attributes": { "title": "Ship documentation", "completed": false },
"created_at": "2026-11-18 10:00:00",
"updated_at": "2026-11-18 10:05:00"
}
}
```
## Other Headers
`X-Pottr-App`: names the app when one site hosts several, so app-user tokens and tables resolve to the right app.
Live event streams (`/events`) accept the key and token as query parameters because browsers cannot set headers on `EventSource`. Secret keys are never accepted in a query string.
--------------------------------------------------------------------------------
## POTTR DOCS - CHAPTER 11: WORKING WITH DATA (CRUD)
--------------------------------------------------------------------------------
# Working with Data (CRUD)
> Full reference for creating, reading, updating, partially patching, and soft-deleting entries.
- **Category:** REST API
- **Canonical Guide:** https://pottr.tangble.com/docs/working-with-data
---
>
Full reference for creating, reading, updating, partially patching, and soft-deleting entries.
## 1. List Entries
GET
/collections/{slug}
Public or Secret Key
Returns a paginated array of entries matching the collection schema. Entry IDs in lists are strings. See [Querying Data](/pottr/docs/querying-data) for filters and sorting.
**File: `Response (200 OK)`**
```text
{
"data": [
{
"id": "1",
"title": "First Task",
"priority": "high",
"completed": false,
"created_at": "2026-05-01 12:00:00",
"updated_at": "2026-05-01 12:00:00"
}
],
"meta": {
"total": 1,
"limit": 20,
"offset": 0,
"has_more": false
}
}
```
## 2. Create Entry
POST
/collections/{slug}
Public or Secret Key
Creates a new entry. Validates submitted fields against schema rules. Returns `201 Created` with the stored entry (`id`, `collection`, `data`, `created_at`, `updated_at`).
**File: `Request Body`**
```text
{
"title": "Deploy staging build",
"priority": "urgent",
"completed": false
}
```
## 3. Get Single Entry
GET
/collections/{slug}/{id}
Public or Secret Key
Retrieves a single entry by its ID. The response is the stored entry, the same shape as a create response.
## 4. Replace Entry (PUT)
PUT
/collections/{slug}/{id}
Public or Secret Key
Replaces the full entry record. All required schema fields must be present and will be re-validated. Omitted optional fields are reset to their default empty values.
**Optimistic concurrency:** include the `updated_at_ts` you received when you loaded the entry. If someone else saved a newer version since, Pottr returns `409 concurrency_conflict` instead of overwriting their work. Send `"force": true` (or omit `updated_at_ts`) to overwrite anyway.
## 5. Partial Update (PATCH)
PATCH
/collections/{slug}/{id}
Public or Secret Key
Partially updates an entry. Only the submitted fields are validated and updated; omitted fields retain their existing values.
**File: `PATCH Request`**
```text
// Mark a task as completed without sending other fields:
await fetch('https://example.com/wp-json/pottr/v1/collections/tasks/42', {
method: 'PATCH',
headers: {
'Authorization': `Bearer ${API_KEY}`,
'Content-Type': 'application/json'
},
body: JSON.stringify({ completed: true })
});
```
## 6. Delete Entry (Soft-Delete)
DELETE
/collections/{slug}/{id}
Public or Secret Key
Soft-deletes the entry. The entry immediately becomes invisible to all REST API queries. The row stays in the database, and removing it permanently is only possible from the WordPress admin.
**File: `Response (200 OK)`**
```text
{
"success": true,
"id": 42
}
```
## Standard Response Envelope
Add `?format=standard` (or the header `Accept: application/vnd.pottr.v1+json`) to any collection endpoint to get the same shape for lists and single entries: `data` with string `id`, `collection`, `attributes`, `created_at` and `updated_at`, plus `meta` on lists. See [API Overview](/pottr/docs/api-overview).
--------------------------------------------------------------------------------
## POTTR DOCS - CHAPTER 12: QUERYING DATA (FILTERING & SORTING)
--------------------------------------------------------------------------------
# Querying Data (Filtering & Sorting)
> Pagination parameters, sorting directives, field equality filters, and batch ID retrieval.
- **Category:** REST API
- **Canonical Guide:** https://pottr.tangble.com/docs/querying-data
---
>
Pagination parameters, sorting directives, field equality filters, and batch ID retrieval.
## Query Parameters Reference
Parameter
Type
Default
Description
`limit`
Integer
`20`
Number of entries to return. Maximum value is `100`.
`offset`
Integer
`0`
Number of entries to skip for pagination.
`order_by`
String
`created_at`
Sort field: `created_at`, `updated_at`, or any custom schema field key.
`order`
String
`DESC`
Sort direction: `ASC` (ascending) or `DESC` (descending).
`filter[key]`
String
—
Equality filter on any schema field (e.g. `filter[status]=active`). The long form `filter[status][value]=active` is equivalent. Unknown field keys are ignored.
`where[key]`
String
—
Alias for `filter[key]`.
`format`
String
—
`standard` returns the uniform response envelope. See [API Overview](/pottr/docs/api-overview).
`ids`
String
—
Comma-separated list of entry IDs to fetch directly (e.g. `?ids=1,2,5`).
`expand`
String
—
Relation field key. The related entry is inlined one level deep; deeper relations are not followed.
## Filtering Examples
Multiple filters combine automatically with boolean `AND`. A bare field query such as `?status=active` also works as a filter, as long as the name is not a reserved parameter (`limit`, `offset`, `order_by`, `order`, `expand`, `ids`, `filter`, `where`, `format`):
**File: `cURL Query Example`**
```bash
# Filter active projects, sorted by updated date, page 2:
curl -H "Authorization: Bearer pk_live_..." \
"https://example.com/wp-json/pottr/v1/collections/project?filter\[status\]=active&filter\[category\]=design&order_by=updated_at&order=DESC&limit=10&offset=10"
```
## Batch ID Lookups
To fetch specific entries without manual iterative loops, pass `?ids=101,102,105`. Batch queries maintain full row-level security for user-owned collections.
--------------------------------------------------------------------------------
## POTTR DOCS - CHAPTER 13: MEDIA UPLOADS
--------------------------------------------------------------------------------
# Media Uploads
> Upload images and PDFs through the REST API into the WordPress media library and attach them to entries.
- **Category:** REST API
- **Canonical Guide:** https://pottr.tangble.com/docs/media-uploads
---
>
Upload images and PDFs through the REST API into the WordPress media library and attach them to entries.
## Upload a File
POST
/media
Public or Secret Key
Send the file as `multipart/form-data` (field name `file`) or as JSON with a base64 data URL. Identify your app with the `X-Pottr-App` header or an `app` parameter. Add `X-Pottr-User-Token` to record the signed-in user as the owner.
**File: `upload.js`**
```javascript
const form = new FormData();
form.append('file', fileInput.files[0]);
const res = await fetch('https://example.com/wp-json/pottr/v1/media', {
method: 'POST',
headers: {
'Authorization': `Bearer ${PUBLIC_KEY}`,
'X-Pottr-App': 'task-manager',
'X-Pottr-User-Token': userAccessToken
},
body: form
});
const media = await res.json(); // use media.id in a `media` field
```
## Attach It to an Entry
Add a field of type `media` to your collection and store the attachment ID in it. The field also accepts the object returned by the upload or a media URL.
## What Is Accepted
**Types:** JPEG, PNG, WebP, GIF, SVG and PDF.
**Size:** 10 MB on Free, 25 MB on Pro, 50 MB on Business. Larger files return `413`.
**Executable extensions** (such as `.php`, `.exe`, `.sh`, `.js`) and multi-extension names are rejected with `400`.
**SVG files** are parsed and rejected if they contain scripts, event handlers, external references, entities or `foreignObject`, or exceed 2 MB (`invalid_file_type`).
Files are stored under `wp-content/uploads/pottr/{app}/{year}/{month}/` with unguessable names and are registered in the WordPress media library.
## Delete a File
DELETE
/media/{id}
Owner or Secret Key
Only the user who uploaded the file, or a secret key, can delete it.
--------------------------------------------------------------------------------
## POTTR DOCS - CHAPTER 14: LIVE EVENTS (SSE)
--------------------------------------------------------------------------------
# Live Events (SSE)
> Stream collection changes to browsers with Server-Sent Events. Available on Pro and Business.
- **Category:** REST API
- **Canonical Guide:** https://pottr.tangble.com/docs/realtime-events
---
>
Stream collection changes to browsers with Server-Sent Events. Available on Pro and Business.
## Connect to the Stream
GET
/events
Public Key, Pro or Business
Browsers cannot set headers on `EventSource`, so this is the one route that accepts the public key and user token in the query string. Secret keys are never accepted in a URL.
**File: `events.js`**
```javascript
const url = new URL('https://example.com/wp-json/pottr/v1/events');
url.searchParams.set('api_key', PUBLIC_KEY);
url.searchParams.set('user_token', userAccessToken);
url.searchParams.set('app', 'task-manager');
url.searchParams.set('collection', 'tasks'); // optional
const source = new EventSource(url);
source.addEventListener('entry.updated', (e) => {
const change = JSON.parse(e.data);
// refetch change.id from /collections/tasks/{id}
});
```
## Event Format
**File: `Stream`**
```text
id: 1042
event: entry.updated
data: {"collection":"tasks","id":87,"user_id":8,"updated_at_ts":1727170001000}
```
Events tell you what changed, not the full entry. Fetch the entry when you need its fields.
## Who Sees What
With a user token, a client receives events for entries that user owns plus public entries.
With only a public key, a client receives events for public entries only.
A secret key (server side, header only) receives all events for the app.
## Reconnecting
Pottr sends a `:keepalive` comment every 15 seconds. When the connection drops, `EventSource` reconnects with `Last-Event-ID` and Pottr replays what you missed. Events are buffered for 2 hours.
Plan and hosting
Live events need a Pro or Business license. Each open stream holds a PHP worker, so size your hosting accordingly for many concurrent viewers.
--------------------------------------------------------------------------------
## POTTR DOCS - CHAPTER 15: API KEYS & CONNECT TOKENS
--------------------------------------------------------------------------------
# API Keys & Connect Tokens
> Understanding the Public Key vs Secret Key security model and endpoint permission gates.
- **Category:** Authentication
- **Canonical Guide:** https://pottr.tangble.com/docs/api-keys
---
>
Understanding the Public Key vs Secret Key security model and endpoint permission gates.
## Key Types & Prefixes
Key Type
Prefix
Environment
Permitted Scope
**Public Key**
`pk_live_...`
Frontend Web, Mobile, Jamstack
• App bootstrapping (`POST /auth/bootstrap`)
• User authentication (Signup, Login, Refresh, Password Reset)
• Public collection reads
• User-owned collection writes (paired with User JWT)
**Secret Key**
`sk_live_...`
Backend Servers, CI/CD Pipelines
• Full administrative access across all endpoints
• Blueprint provisioning (`POST /blueprint`)
• Schema discovery (`GET /schema`)
• Webhooks management (`/webhooks`)
• Bypasses row-level user ownership restrictions
Security Rule: Never Expose Secret Keys
Never embed your `sk_live_...` secret key in frontend JavaScript bundles, mobile app binaries, or public Git repositories. Secret keys have administrative privileges to manage webhooks, blueprints, and view un-scoped data.
## How Keys Are Sent
Send keys in the `Authorization: Bearer` header. Secret keys are accepted in the header only, never in a query string, so they cannot leak into logs or browser history. Public keys may appear in a query string only on live event streams, where browsers cannot set headers.
Requests made from the WordPress admin by a logged-in administrator (with the WordPress REST nonce) are treated as trusted, so the admin screens work without a key.
## Secret-Only Routes
A public key receives `403 insufficient_key_scope` on these routes:
`POST /blueprint` (provision from a server or pipeline)
Use `POST /auth/bootstrap` with a public key when a frontend needs to declare collections at boot; it is additive and rejects secret keys by design.
## Key Regeneration
If a secret key is compromised, navigate to **Pottr › API Keys** in WordPress Admin and click **Regenerate**. Regenerating a key immediately invalidates the previous key across all active API requests, so update your environment variables and redeploy straight away. The API Keys screen also shows a ready-made `.env` snippet.
--------------------------------------------------------------------------------
## POTTR DOCS - CHAPTER 16: APP USERS & JWT AUTHENTICATION
--------------------------------------------------------------------------------
# App Users & JWT Authentication
> Decoupled end-user authentication, JWT lifecycles, profile management, and password reset flows.
- **Category:** Authentication
- **Canonical Guide:** https://pottr.tangble.com/docs/app-users
---
>
Decoupled end-user authentication, JWT lifecycles, profile management, and password reset flows.
## How are App Users Different from WordPress Admins?
Pottr provides an independent authentication layer designed specifically for end-users of your custom application:
**No WordPress Admin Access:** App users cannot log into `/wp-admin` and have no core WordPress capabilities.
**No `wp_users` Bloat:** App users are stored in dedicated application authentication tables, keeping WordPress administration clean.
**Custom Profile Fields:** Blueprints allow declaring custom fields on user accounts (e.g. `full_name`, `company`, `avatar_url`).
**Stateless JWT Tokens:** Authenticated via 15-minute HS256 JWT access tokens and 30-day hashed refresh tokens.
## App Header Requirement (`X-Pottr-App`)
Every authentication endpoint requires an application identifier passed in the `X-Pottr-App: ` request header (or an `app` string in the JSON body).
## Authentication Endpoints
### 1. User Signup
POST
/auth/signup
Public Key Required
Registers a new app user. Password must be at least 8 characters. Returns `201 Created` with tokens.
**File: `signup.js`**
```javascript
const res = await fetch('https://example.com/wp-json/pottr/v1/auth/signup', {
method: 'POST',
headers: {
'Authorization': `Bearer ${PUBLIC_KEY}`,
'X-Pottr-App': 'task-manager',
'Content-Type': 'application/json'
},
body: JSON.stringify({
email: 'alex@example.com',
password: 'securePassword123',
full_name: 'Alex Smith'
})
});
```
### 2. User Login
POST
/auth/login
Public Key Required
Authenticates user credentials. Signup and login return the same shape:
**File: `Token Response`**
```json
{
"user": { "id": 12, "email": "alex@example.com", "full_name": "Alex Smith" },
"access_token": "eyJ...",
"refresh_token": "64_character_hex_refresh_token",
"token_type": "Bearer",
"expires_in": 900
}
```
Send the access token in the `X-Pottr-User-Token` header (alongside your public key). Passwords are never returned.
### 3. Current User Profile
GET
/auth/me
User JWT Required
### 4. Token Refresh
POST
/auth/refresh
Public Key Required
Refresh tokens are **single-use**. Each refresh returns a new access token *and* a new refresh token; store the new one and discard the old. Presenting an already-used refresh token is treated as theft: Pottr revokes that whole session and returns `401 token_breach_detected`.
**File: `Request Body`**
```text
{
"refresh_token": "64_character_hex_refresh_token"
}
```
### 5. Logout
POST
/auth/logout
User JWT Required
Revokes the current device session. Pass `?all=true` (or `{ "all": true }`) to sign the user out everywhere. Outstanding access tokens are invalidated immediately.
### 6. Sessions
GET
/auth/sessions
User JWT Required
Lists the user's active device sessions with IP, browser and an `is_current` flag. End one with:
DELETE
/auth/sessions/{family_id}
User JWT Required
## Rate Limits
Signup, login and password-reset routes are rate limited per IP. Exceeding the limit returns `429 rate_limited`.
## Password Reset Flow
**Request Reset Email (`POST /auth/forgot-password`):**
Client submits `{ "email": "user@example.com" }`. Pottr generates a secure 1-hour single-use transient token and sends a reset email via WordPress `wp_mail()`. Always returns `200 { success: true }` to prevent email enumeration.
**Complete Password Reset (`POST /auth/reset-password`):**
Client submits `{ "email": "...", "token": "...", "password": "newPassword" }`. Pottr validates the token, updates the password hash, immediately destroys the token, and revokes active sessions.
--------------------------------------------------------------------------------
## POTTR DOCS - CHAPTER 17: BLUEPRINTS & SCHEMA MIGRATIONS
--------------------------------------------------------------------------------
# Blueprints & Schema Migrations
> Declarative schema definitions for automated, non-destructive application provisioning on boot or deploy.
- **Category:** Build & Integrate
- **Canonical Guide:** https://pottr.tangble.com/docs/blueprints
---
>
Declarative schema definitions for automated, non-destructive application provisioning on boot or deploy.
## What are Blueprints?
A **Blueprint** is a JSON document declaring your application's required collections, fields, and user authentication profile schema. When submitted to Pottr, the engine provisions missing collections and adds new fields automatically.
## Additive, Non-Destructive Provisioning
Pottr provisioning is strictly **additive**:
Existing collections and entries are never dropped or deleted.
Existing fields retain their data.
Any field defined in the blueprint that does not yet exist is safely added to the schema.
The required primary `title` text field is automatically prepended if omitted.
## Public vs Secret Provisioning Endpoints
Endpoint
Required Credential
Typical Usage
`POST /auth/bootstrap`
**Public Key** (`pk_live_...`)
Client-side web or mobile applications on initial boot. Rejects secret keys.
Collection slugs match `^[a-z][a-z0-9_-]*$`; field keys match `^[a-z][a-z0-9_]*$`.
Auth fields can use the collection field types plus `select`, `email`, `url` and `password`. They describe the per-app user profile.
Provisioning is additive, so it is safe to run on every deploy or app boot.
If your plan's collection limit is reached part-way, provisioning succeeds partially. Check each item in the response.
## Provisioning Response
**File: `Response`**
```json
{
"app": "task-manager",
"version": "1.0.0",
"version_status": "new",
"auth": { "slug": "users", "status": "created" },
"results": [
{ "slug": "project", "status": "created" },
{ "slug": "task", "status": "existing" },
{ "slug": "report", "status": "failed", "code": "plan_limit_exceeded" }
]
}
```
Each result is `created`, `existing` or `failed`. `version_status` tells you whether this app version is new, unchanged or older than the one Pottr already recorded.
`GET /blueprint/{app}` returns the recorded version, the auth snapshot, timestamps and the live schema of the collections that app manages.
--------------------------------------------------------------------------------
## POTTR DOCS - CHAPTER 18: CONNECTING APPS
--------------------------------------------------------------------------------
# Connecting Apps
> Let an external app request a connection and get API keys after one click of admin approval, with no manual setup.
- **Category:** Build & Integrate
- **Canonical Guide:** https://pottr.tangble.com/docs/connecting-apps
---
>
Let an external app request a connection and get API keys after one click of admin approval, with no manual setup.
## The Handshake
The app calls `POST /connect/request` with its `app` slug, a display `name` and the `collections` it needs. No API key is required. The response is `202` with a `request_id` and a single-use `polling_token`.
WordPress shows a notice to administrators. Opening the Pottr dashboard shows the app and the collections it wants, and the admin clicks **Approve** or **Reject**.
The app polls `GET /connect/status?request_id=...` with the header `X-Pottr-Connect-Token`. While waiting it receives `{ "status": "pending" }`. After approval it receives `approved`, the public key and the created collections.
Requests expire after 15 minutes and are limited to 5 per 10 minutes per IP address.
**File: `connect.js`**
```javascript
const base = 'https://example.com/wp-json/pottr/v1';
const req = await fetch(`${base}/connect/request`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
app: 'task-manager',
name: 'Task Manager',
collections: [
{ slug: 'tasks', name: 'Tasks', fields: [{ key: 'title', type: 'text', required: true }] }
]
})
}).then(r => r.json());
// Poll until the admin approves
const status = await fetch(`${base}/connect/status?request_id=${req.request_id}`, {
headers: { 'X-Pottr-Connect-Token': req.polling_token }
}).then(r => r.json());
// { status: 'approved', public_key: 'pk_live_...', collections: {...} }
```
## From Another WordPress Plugin
Code running on the same site can skip HTTP. See [PHP Helpers](/pottr/docs/php-helpers) for `pottr_connect_app()`.
## Keyless First Writes
Pottr can also catch a first `POST` to a collection that does not exist yet. The admin sees the inferred fields and can create the collection with one click, which suits quick prototypes and webhook sources.
--------------------------------------------------------------------------------
## POTTR DOCS - CHAPTER 19: WEBHOOKS & EVENT DISPATCHING
--------------------------------------------------------------------------------
# Webhooks & Event Dispatching
> Subscribing to collection data changes with HMAC-SHA256 signature verification.
- **Category:** Build & Integrate
- **Canonical Guide:** https://pottr.tangble.com/docs/webhooks
---
>
Subscribing to collection data changes with HMAC-SHA256 signature verification.
## Supported Events
`entry.created`: Triggered when a new entry is created via `POST`.
`entry.updated`: Triggered when an entry is updated via `PUT` or `PATCH`.
`entry.deleted`: Triggered when an entry is soft-deleted via `DELETE`.
`*`: Wildcard event triggering on all three operations.
## Managing Webhooks
Webhooks are managed via REST routes requiring the **Secret Key** (`sk_live_...`):
Method
Endpoint
Description
GET
`/webhooks`
List all registered webhooks.
POST
`/webhooks`
Register a new webhook (`url`, `event`, optional `collection`). Returns signing secret.
DELETE
`/webhooks/{id}`
Delete a webhook subscription by ID.
GET
`/webhooks/{id}`
Fetch one webhook.
PUT
`/webhooks/{id}`
Update the `url`, `event`, `collection` or `active` flag.
POST
`/webhooks/{id}/regenerate-secret`
Issue a new signing secret. The old one stops working immediately.
POST
`/webhooks/{id}/test`
Send a test ping and return latency and status. Pro and Business only.
## Webhook Payload Structure
**File: `Webhook JSON Payload`**
```json
{
"event": "entry.created",
"timestamp": 1714999999,
"payload": {
"collection": "tasks",
"entry": {
"id": "42",
"title": "Deploy update",
"created_at": "2026-05-06 12:00:00"
}
}
}
```
## Signature Verification (HMAC-SHA256)
Every delivery includes an `X-Pottr-Signature` header containing `sha256=`. Compute the HMAC using the raw request body and your webhook secret:
**File: `verify-webhook.js (Node.js)`**
```javascript
const crypto = require('crypto');
function verifyPottrWebhook(rawBodyBuffer, signatureHeader, secret) {
const expectedSignature = 'sha256=' + crypto
.createHmac('sha256', secret)
.update(rawBodyBuffer)
.digest('hex');
return crypto.timingSafeEqual(
Buffer.from(signatureHeader),
Buffer.from(expectedSignature)
);
}
```
## Security & Delivery Rules
**HTTPS Destination Required:** Webhook URLs must use `https://`.
**SSRF Protections:** Localhost, loopback IPs (`127.0.0.1`), private subnets (`10.0.0.0/8`, `192.168.0.0/16`), and raw IP addresses are rejected.
**Background Delivery:** Deliveries are sent by WP-Cron after the API response, so they never slow down your requests. Each attempt has a 5-second timeout, so acknowledge with `2xx` immediately and do the work afterwards. (Sites that disable WP-Cron deliver inline.)
**Delivery Log:** Every attempt is logged with its response. Any non-2xx response is recorded as `failed`. Pottr does not retry failed deliveries, so make your endpoint idempotent and use the log to investigate.
**Retention:** Delivery history is kept for your plan's log retention period.
**Plan Limits:** Free allows 1 webhook, Pro 10, Business unlimited.
--------------------------------------------------------------------------------
## POTTR DOCS - CHAPTER 20: PHP HELPERS
--------------------------------------------------------------------------------
# PHP Helpers
> Read Pottr data from themes and plugins on the same WordPress site without HTTP requests.
- **Category:** Build & Integrate
- **Canonical Guide:** https://pottr.tangble.com/docs/php-helpers
---
>
Read Pottr data from themes and plugins on the same WordPress site without HTTP requests.
## Reading Entries
**File: `functions.php`**
```php
$entries = pottr_get( 'project', [
'where' => [ 'status' => 'active' ],
'limit' => 10,
] );
$first = pottr_first( 'project', [ 'where' => [ 'title' => 'My Project' ] ] );
$tasks = pottr_related( 'task', 'project_id', 42 );
$entry = pottr_find( 'project', 42 );
```
`pottr_get( $collection, $args )` returns a list of flattened entries (`id`, `created_at` and your fields). Arguments include `where`, `limit`, `offset`, `order_by` and `order`.
`pottr_first()` returns the first match or `null`.
`pottr_related( $collection, $field, $id )` returns entries whose relation field points at `$id`.
`pottr_find( $collection, $id )` reads storage directly and returns the stored row, with your fields nested under `data`.
## Connecting an App in Process
A plugin can declare its collections without a network call:
**File: `my-plugin.php`**
```php
$result = pottr_connect_app( [
'app' => 'my-plugin',
'name' => 'My Plugin',
'collections' => [
[ 'slug' => 'events', 'name' => 'Events', 'fields' => [
[ 'key' => 'title', 'type' => 'text', 'required' => true ],
] ],
],
] );
if ( 'approved' === $result['status'] ) {
$public_key = $result['public_key'];
} elseif ( 'pending' === $result['status'] ) {
// Queued for one-click approval in the Pottr dashboard.
}
```
When the current user is an administrator, collections are created immediately. Otherwise the request waits for approval, as described in [Connecting Apps](/pottr/docs/connecting-apps).