-
Notifications
You must be signed in to change notification settings - Fork 0
REST API Reference
Jetonomy exposes a comprehensive REST API under the jetonomy/v1 namespace with 61+ endpoints across 15 controllers. All endpoints are prefixed with /wp-json/jetonomy/v1.
Jetonomy supports two authentication methods:
| Method | Use Case | Header |
|---|---|---|
| WP REST Nonce | Browser-based requests from logged-in users | X-WP-Nonce: {nonce} |
| Application Passwords | External integrations, mobile apps, CI/CD | Authorization: Basic base64(username:app_password) |
Nonces are generated via wp_create_nonce( 'wp_rest' ) and passed either as the X-WP-Nonce header or as a _wpnonce query parameter. Application Passwords are managed under Users > Application Passwords in wp-admin.
Endpoints marked Auth required return 401 Unauthorized without valid credentials. Endpoints marked Public can be accessed without authentication.
Jetonomy supports two pagination strategies:
| Parameter | Type | Description |
|---|---|---|
limit |
int | Number of items to return (default 20, max 100) |
offset |
int | Number of items to skip |
Response headers include:
-
X-JT-Total— total number of items -
X-JT-TotalPages— total number of pages
| Parameter | Type | Description |
|---|---|---|
after |
string | Cursor token from previous response for forward pagination |
Use cursor-based pagination for large datasets (10,000+ items) where offset performance degrades.
Rate limits are based on the user's trust level:
| Trust Level | Requests/Minute |
|---|---|
| Anonymous | 30 |
| New Member | 60 |
| Member | 120 |
| Regular | 180 |
| Leader / Moderator | 300 |
| Admin | Unlimited |
Rate limit headers are included in every response:
-
X-RateLimit-Limit— max requests per window -
X-RateLimit-Remaining— remaining requests -
X-RateLimit-Reset— seconds until window resets
All errors follow a consistent JSON format:
{
"code": "jetonomy_not_found",
"message": "Post not found.",
"data": {
"status": 404
}
}Common error codes:
| HTTP Status | Code | Description |
|---|---|---|
| 400 | jetonomy_invalid_param |
Missing or invalid parameter |
| 401 | jetonomy_not_logged_in |
Authentication required |
| 403 | jetonomy_forbidden |
Insufficient permissions |
| 404 | jetonomy_not_found |
Resource not found |
| 429 | jetonomy_rate_limited |
Rate limit exceeded |
10 endpoints for creating, reading, updating, and managing posts within spaces.
GET /spaces/{space_id}/posts
Returns a paginated list of posts in the specified space.
| Parameter | Type | Required | Description |
|---|---|---|---|
limit |
int | No | Number of posts to return (default 20) |
offset |
int | No | Number of posts to skip |
sort |
string | No | Sort order: recent, popular, unanswered
|
after |
string | No | Cursor for cursor-based pagination |
Auth: Public
POST /spaces/{space_id}/posts
Creates a new post in the specified space.
| Parameter | Type | Required | Description |
|---|---|---|---|
title |
string | Yes | Post title |
content |
string | Yes | Post body (HTML) |
tags[] |
array | No | Array of tag slugs or IDs |
status |
string | No |
publish or draft (default publish) |
published_at |
string | No | Schedule publication (ISO 8601 datetime) |
captcha_token |
string | Conditional | Required if captcha is enabled in settings |
Auth: Required
GET /posts/drafts
Returns all draft posts belonging to the authenticated user.
Auth: Required
GET /posts/{id}
Returns a single post by ID, including vote counts, reply count, tags, and author info.
Auth: Public
PATCH /posts/{id}
Updates an existing post. Only the post author or a moderator can update.
| Parameter | Type | Required | Description |
|---|---|---|---|
title |
string | No | Updated title |
content |
string | No | Updated body |
tags[] |
array | No | Replace tags |
status |
string | No |
publish or draft
|
Auth: Required (author or moderator)
DELETE /posts/{id}
Deletes a post. Only the post author or a moderator can delete.
Auth: Required (author or moderator)
POST /posts/{id}/close
Closes a post in Q&A-type spaces, preventing new replies.
Auth: Required (author or moderator)
POST /posts/{id}/pin
Toggles the pinned state of a post. Pinned posts appear at the top of the space.
Auth: Moderator+
POST /posts/{id}/move
Moves a post from its current space to a different space.
| Parameter | Type | Required | Description |
|---|---|---|---|
target_space_id |
int | Yes | Destination space ID |
Auth: Moderator+
POST /posts/{id}/merge
Merges the current post into a target post. Replies from the source post are moved to the target.
| Parameter | Type | Required | Description |
|---|---|---|---|
target_post_id |
int | Yes | Post ID to merge into |
Auth: Moderator+
GET /link-preview?url={url}
Fetches Open Graph metadata (title, description, image) for the given URL. Used by the post composer for rich link embeds.
| Parameter | Type | Required | Description |
|---|---|---|---|
url |
string | Yes | URL to fetch OG metadata for |
Auth: Required
6 endpoints for managing replies on posts.
GET /posts/{post_id}/replies
Returns a paginated list of replies for the specified post.
| Parameter | Type | Required | Description |
|---|---|---|---|
limit |
int | No | Number of replies to return (default 20) |
offset |
int | No | Number of replies to skip |
sort |
string | No | Sort order (e.g., oldest, newest, votes) |
Auth: Public
POST /posts/{post_id}/replies
Creates a new reply on the specified post.
| Parameter | Type | Required | Description |
|---|---|---|---|
content |
string | Yes | Reply body (HTML) |
parent_id |
int | No | Parent reply ID for nested/threaded replies |
captcha_token |
string | Conditional | Required if captcha is enabled |
Auth: Required
PATCH /replies/{id}
Updates the content of an existing reply.
Auth: Required (author or moderator)
DELETE /replies/{id}
Deletes a reply.
Auth: Required (author or moderator)
POST /replies/{id}/accept
Marks a reply as the accepted answer in Q&A-type spaces. Only the original post author can accept.
Auth: Required (post author)
POST /replies/{id}/split
Splits a reply out of its current post and creates a new standalone post from it.
Auth: Moderator+
11 endpoints for managing community spaces.
GET /spaces
Returns a paginated list of spaces.
| Parameter | Type | Required | Description |
|---|---|---|---|
limit |
int | No | Number of spaces to return |
offset |
int | No | Number to skip |
sort |
string | No | Sort order |
visibility |
string | No | Filter by visibility (public, private, hidden) |
Auth: Public (private/hidden spaces only visible to members)
POST /spaces
Creates a new space.
| Parameter | Type | Required | Description |
|---|---|---|---|
name |
string | Yes | Space name |
description |
string | No | Space description |
type |
string | No | Space type (e.g., discussion, qa) |
visibility |
string | No |
public, private, or hidden
|
join_policy |
string | No |
open, approval, or invite
|
icon |
string | No | Icon identifier or URL |
Auth: Admin
GET /spaces/{id}
Returns a single space by ID, including settings, member count, and post count.
Auth: Public (private/hidden require membership)
PATCH /spaces/{id}
Updates space properties. Settings are merged via array_merge() — you only need to send the keys you want to change.
Auth: Space admin
DELETE /spaces/{id}
Permanently deletes a space and all its posts.
Auth: Admin
GET /spaces/{id}/members
Returns a paginated list of space members with their roles.
Auth: Public
POST /spaces/{id}/members
Adds the authenticated user as a member. Respects the space's join_policy:
- open — user is added immediately
- approval — a join request is created for space admins to review
- invite — returns 403 unless the user has a valid invite token
Auth: Required
DELETE /spaces/{id}/members/{user_id}
Removes a member from the space. Users can remove themselves (leave). Space admins can remove other members.
Auth: Required
PATCH /spaces/{id}/members/{user_id}
Changes a member's role within the space (e.g., member, moderator, admin).
Auth: Space admin
POST /spaces/{id}/invite
Generates a unique invite token/link for the space.
Auth: Space admin
GET /invite/{token}
Redeems an invite token and adds the user to the space (or redirects to registration if not logged in).
Auth: Public
5 endpoints for user profiles and lookups.
GET /users/me
Returns the authenticated user's full profile including settings and preferences.
Auth: Required
PATCH /users/me
Updates the current user's profile or settings. Settings use a MERGE pattern — only the keys you send are updated; existing keys are preserved.
Auth: Required
GET /users/{id}
Returns a user's public profile by ID.
Auth: Public
GET /users/by-login/{login}
Returns a user's public profile by their username/login.
Auth: Public
GET /users/{id}/posts
Returns a paginated list of posts authored by the specified user.
Auth: Public
4 endpoints for voting on posts and replies.
POST /posts/{id}/vote
Casts a vote on a post.
| Parameter | Type | Required | Description |
|---|---|---|---|
value |
int | Yes |
1 (upvote) or -1 (downvote) |
Re-casting the same vote value toggles it off (removes the vote).
Auth: Required
DELETE /posts/{id}/vote
Removes the authenticated user's vote from a post.
Auth: Required
POST /replies/{id}/vote
Casts a vote on a reply. Same toggle behavior as post votes.
| Parameter | Type | Required | Description |
|---|---|---|---|
value |
int | Yes |
1 (upvote) or -1 (downvote) |
Auth: Required
DELETE /replies/{id}/vote
Removes the authenticated user's vote from a reply.
Auth: Required
2 endpoints for retrieving tags.
GET /tags
Returns all tags used across the community.
Auth: Public
GET /space-tags
Returns tags scoped to spaces (space-specific tag taxonomy).
Auth: Public
4 endpoints for managing user notifications.
GET /notifications
Returns the authenticated user's notifications (paginated).
Auth: Required
GET /notifications/unread-count
Returns the count of unread notifications.
Auth: Required
PATCH /notifications/{id}
Marks a single notification as read or unread.
Auth: Required
POST /notifications/mark-all-read
Marks all of the authenticated user's notifications as read.
Auth: Required
9 endpoints for content moderation. All require the jetonomy_moderate capability.
GET /moderation/queue
Returns posts and replies pending moderation review.
Auth: Moderator (jetonomy_moderate)
POST /moderation/approve/{type}/{id}
Approves a moderated item. {type} is post or reply.
Auth: Moderator (jetonomy_moderate)
POST /moderation/spam/{type}/{id}
Marks an item as spam. {type} is post or reply.
Auth: Moderator (jetonomy_moderate)
POST /moderation/trash/{type}/{id}
Moves an item to trash. {type} is post or reply.
Auth: Moderator (jetonomy_moderate)
POST /flags
Flags a post or reply for moderator review.
Auth: Moderator (jetonomy_moderate)
GET /moderation/flags
Returns all open flags.
Auth: Moderator (jetonomy_moderate)
POST /moderation/flags/{id}/resolve
Resolves/dismisses a flag.
Auth: Moderator (jetonomy_moderate)
POST /moderation/ban
Bans a user from the community.
Auth: Moderator (jetonomy_moderate)
DELETE /moderation/ban/{id}
Removes a ban from a user.
Auth: Moderator (jetonomy_moderate)
1 endpoint for full-text search across the community.
GET /search
| Parameter | Type | Required | Description |
|---|---|---|---|
q |
string | Yes | Search query |
mode |
string | No |
posts, replies, spaces, tags, or all (default all) |
space_id |
int | No | Limit to a specific space |
author_id |
int | No | Limit to a specific author |
tag_id |
int | No | Limit to posts with a specific tag |
from_date |
string | No | ISO 8601 start date |
to_date |
string | No | ISO 8601 end date |
sort |
string | No | Sort order (e.g., relevance, recent) |
limit |
int | No | Number of results to return |
offset |
int | No | Number of results to skip |
Auth: Public
3 endpoints for following/subscribing to posts and spaces.
GET /subscriptions
Returns the authenticated user's active subscriptions.
Auth: Required
POST /subscriptions
Subscribes the authenticated user to a post or space.
Auth: Required
DELETE /subscriptions
Removes a subscription.
Auth: Required
5 endpoints for managing top-level categories that organize spaces.
GET /categories
Returns all categories.
Auth: Public
POST /categories
Creates a new category.
Auth: Admin
GET /categories/{id}
Returns a single category by ID.
Auth: Public
PATCH /categories/{id}
Updates a category.
Auth: Admin
DELETE /categories/{id}
Deletes a category.
Auth: Admin
1 endpoint for community reputation rankings.
GET /leaderboards
Returns a ranked list of users by reputation score.
| Parameter | Type | Required | Description |
|---|---|---|---|
limit |
int | No | Number of users to return (default 20) |
offset |
int | No | Number to skip |
period |
string | No | Time period: all, month, or week (default all) |
Auth: Public
3 endpoints for bookmarking posts.
GET /bookmarks
Returns the authenticated user's bookmarked posts.
Auth: Required
POST /bookmarks
Bookmarks a post for the authenticated user.
Auth: Required
DELETE /bookmarks
Removes a bookmark.
Auth: Required
1 endpoint for polling recent activity.
GET /updates
Returns recent activity updates since a given timestamp. Used for live-update polling.
| Parameter | Type | Required | Description |
|---|---|---|---|
since |
string | Yes | ISO 8601 datetime — return updates after this time |
scope |
string | No |
global, space, or post
|
id |
int | Conditional | Required when scope is space or post — the space or post ID |
Auth: Required