> To build or manage a Wix site with an AI agent, follow https://www.wix.com/headless/skill.md
> It builds a new Wix site or puts your own site online, from a prompt, and keeps changing it afterwards. The pages are code in any web technology, and Wix runs the backend.
> It works through the Wix plugin (the Wix MCP and the Wix skills), the Wix CLI or no Wix login, and puts the site live on Wix hosting or on another host.
> Business features include a store, bookings, events and tickets, a restaurant, a blog, forms, members and many more.
> Read the Wix skills online at https://www.wix.com/skills
> 
> Portal Navigation:
> 
> - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version.
> - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages).
> - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`).
> - If a reference page seems to be missing its schema (parameters, return types, or type definitions), append `?schema=true` to its `.md` URL (e.g. `https://dev.wix.com/docs/contexts/contexts/stores/category-info/use-category-info-context.md?schema=true`).
> - Top-level index of all portals: https://dev.wix.com/docs/llms.txt
> - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt

> **Deprecated.** This method is deprecated. Planned removal date: 2025-10-15.

# QueryPosts

# Package: forum

# Namespace: PostManagementService

# Method link: https://dev.wix.com/docs/api-reference/business-solutions/forum/post/query-posts?apiView=SDK.md

## Permission Scopes:
Read Forums: SCOPE.DC-FORUM.READ-FORUM

## Introduction

Returns a list of posts by query.

Paging
- limit: default - 10, min - 0, max - 100
- offset: default - 0, min - 0

Filterable fields:
- id
- categoryId
- ownerId
- title
- contentText
- bestAnswerCommentId
- pinned
- commentingEnabled
- commentCount
- likeCount
- viewCount
- createdDate
- editedDate
- lastActivityDate
- slug

Sortable fields:
- lastActivityDate
- createdDate
- commentCount
- viewCount
- likeCount
- pinned

---

## REST API

### Schema

```
 Method: queryPosts
 Description: Returns a list of posts by query.  Paging - limit: default - 10, min - 0, max - 100 - offset: default - 0, min - 0  Filterable fields: - id - categoryId - ownerId - title - contentText - bestAnswerCommentId - pinned - commentingEnabled - commentCount - likeCount - viewCount - createdDate - editedDate - lastActivityDate - slug  Sortable fields: - lastActivityDate - createdDate - commentCount - viewCount - likeCount - pinned
 URL: https://www.wixapis.com/forum/v1/posts/query
 Method: POST
 Method parameters:
   param name: extraFields | type: array<extraFields> | description: Array of extra post fields to be added in the response.  
                 - enum:
                 -     UNKNOWN: Undefined field type.
                 -     IMAGES: Include images from post content.
                 -     VIDEOS: Include videos from post content.
                 -     URL: Include post URL.
                 -     REACTION_IDENTITIES: Include reaction identities.
                 -     RICH_CONTENT: Includes the post content as a stringified [Rich Content document](https://dev.wix.com/docs/ricos/api-reference/ricos-document.md)
   param name: filter | type: filter | description: Filter object (e.g., { $and: [{ ownerId: { eq: 'ownerId' } }, { likeCount: { $gt: 0 }] } ).  
   param name: paging | type: PostsPaging    
        - name: limit | type: integer | description: The number of items to load.  | validation: minimum 0, maximum 100
        - name: offset | type: integer | description: Number of items to skip in the current sort order.  | validation: minimum 0
   param name: sort | type: array<sort> | description: Array of sort objects (e.g.,  [{ fieldName: createdDate, order: Order.ASC }] ).  
              - name: fieldName | type: string | description: Records can be sorted by: lastActivityDate createdDate commentCount viewCount likeCount isPinned  
              - name: order | type: Order | description: Records can be sorted in ascending (default) or descending order.  
                     - enum:
                     -     ASC: Sort by ascending order.
                     -     DESC: Sort by descending order.
 Return type: QueryPostsResponse
  - name: posts | type: array<Post> | description: List of posts.  
     - name: id | type: string | description: Post GUID.  | read-only: true 
     - name: categoryId | type: string | description: Category GUID the post is listed under.  
     - name: ownerId | type: string | description: Post owner's member GUID.  | read-only: true 
     - name: title | type: string | description: Post title.  | validation: minLength 1, maxLength 140
     - name: contentText | type: string | description: The post content in plain text.  
     - name: commentCount | type: integer | description: Total number of post comments.  | read-only: true | validation: format int32
     - name: likeCount | type: integer | description: Total number of post likes.  | read-only: true | validation: format int32
     - name: viewCount | type: integer | description: Total number of post views.  | read-only: true | validation: format int32
     - name: createdDate | type: string | description: Date post was created.  | read-only: true | validation: format date-time
     - name: lastActivityDate | type: string | description: Date of latest activity on this post (e.g., date the latest comment was added to post).  | read-only: true | validation: format date-time
     - name: url | type: PageUrl | description: Post URL.  | read-only: true 
        - name: base | type: string | description: The base URL. For premium sites, this is the domain. For free sites, this is the site URL. For example, `mysite.wixsite.com/mysite`.  
        - name: path | type: string | description: The relative path for the page within the site. For example, `/product-page/a-product`.  
     - name: slug | type: string | description: Post slug.  | read-only: true 
     - name: content | type: string | description: The post content as a stringified [Rich Content document](https://dev.wix.com/docs/ricos/api-reference/ricos-document.md)  | read-only: true 
     - name: images | type: array<Image> | description: Images from post content.  | read-only: true 
        - name: id | type: string | description: WixMedia image GUID.  
        - name: url | type: string | description: Image URL.  
        - name: height | type: integer | description: Original image height.  | read-only: true 
        - name: width | type: integer | description: Original image width.  | read-only: true 
        - name: altText | type: string | description: Image alt text.  
        - name: filename | type: string | description: Image filename.  | read-only: true 
     - name: videos | type: array<VideoV2> | description: Videos from post content.  | read-only: true 
        - name: id | type: string | description: WixMedia GUID.  
        - name: resolutions | type: array<VideoResolution> | description: Available resolutions for the video, starting with the optimal resolution.  | read-only: true | validation: maxItems 100
           - name: url | type: string | description: Video URL.  
           - name: height | type: integer | description: Video height.  
           - name: width | type: integer | description: Video width.  
           - name: format | type: string | description: Video format for example, mp4, hls.  
        - name: filename | type: string | description: Video filename.  | read-only: true 
     - name: pinned | type: boolean | description: Whether the post is pinned. Places the post at the top of the post list.  
     - name: closed | type: boolean | description: Whether post is closed and commenting is disabled.  
     - name: updatedDate | type: string | description: Date post was updated.  | validation: format date-time
     - name: commentInteraction | type: Interaction | description: Defines what interactions may be applied on the comment under the post, vote or like.  
         - enum: UNKNOWN, REACTION, VOTE, NONE
     - name: markedComments | type: array<string> | description: IDs of the marked comments for this post. Posts are marked by the forum admin or the post owner.  | read-only: true | validation: maxItems 10
     - name: recentActivity | type: RecentActivity | description: Recent activity of post. For example, a comment added to a post.  | read-only: true 
        - ONE-OF: 
           - name: memberId | type: string | description: Site member GUID.  
        - name: entityId | type: string | description: GUID of recent activity entity.  
        - name: type | type: EntityType | description: Type of entity.  
             - enum: UNKNOWN, COMMENT, REPLY
        - name: activityDate | type: string | description: Date activity was created.  
     - name: reactionIdentities | type: array<ReactionIdentity> | description: List of reaction identities grouped by reaction code.  | read-only: true | validation: maxItems 6
        - name: reactionCode | type: string | description: Reaction code.  
        - name: identities | type: array<Identity> | description: Reacted identities.  | read-only: true | validation: maxItems 500
           - name: identityId | type: string | description: Identity id.  
           - name: identityType | type: IdentityType | description: Reacted identity type.  
                 - enum: UNKNOWN, VISITOR, MEMBER
        - name: count | type: integer | description: Total number of reacted identities count.  
  - name: metaData | type: QueryPostsResponseMetaData | description: Pagination.  
     - name: count | type: integer | description: Total number of records returned.  
     - name: offset | type: integer | description: Offset of records.  
     - name: total | type: integer | description: Total number of records that match the filters.  


```

### Examples

### QueryPosts
```curl
~~~cURL
curl -X POST https://www.wixapis.com/forum/v1/posts/query
    -H 'Content-Type: application/json;charset=UTF-8'
    -H 'Authorization: <ACCESS_TOKEN>'
    -d '{
          "paging": {
              "offset": 0,
              "limit": 1
          },
          "filter": {
              "likeCount": {
                  "$eq": 0
              }
          },
          "sort": [
              {
                  "fieldName": "lastActivityDate",
                  "order": "ASC"
              }
          ]
      }'
~~~
```

---

## JavaScript SDK

### Schema

```
 Method: wixClientAdmin.forum.posts.queryPosts(options)
 Description: Returns a list of posts by query.  Paging - limit: default - 10, min - 0, max - 100 - offset: default - 0, min - 0  Filterable fields: - id - categoryId - ownerId - title - contentText - bestAnswerCommentId - pinned - commentingEnabled - commentCount - likeCount - viewCount - createdDate - editedDate - lastActivityDate - slug  Sortable fields: - lastActivityDate - createdDate - commentCount - viewCount - likeCount - pinned
 Method parameters:
   param name: options | type: QueryPostsOptions  none  
        - name: paging | type: PostsPaging | description: Paging object (e.g., { limit: 10, offset: 100 } ).  
           - name: limit | type: integer | description: The number of items to load.  | validation: minimum 0, maximum 100
           - name: offset | type: integer | description: Number of items to skip in the current sort order.  | validation: minimum 0
        - name: filter | type: object | description: Filter object (e.g., { $and: [{ ownerId: { eq: 'ownerId' } }, { likeCount: { $gt: 0 }] } ).  
        - name: sort | type: array<PostsSort> | description: Array of sort objects (e.g.,  [{ fieldName: createdDate, order: Order.ASC }] ).  
           - name: fieldName | type: string | description: Records can be sorted by: lastActivityDate createdDate commentCount viewCount likeCount isPinned  
           - name: order | type: Order | description: Records can be sorted in ascending (default) or descending order.  
                 - enum:
                 -     ASC: Sort by ascending order.
                 -     DESC: Sort by descending order.
        - name: extraFields | type: array<Field> | description: Array of extra post fields to be added in the response.  
             - enum:
             -     UNKNOWN: Undefined field type.
             -     IMAGES: Include images from post content.
             -     VIDEOS: Include videos from post content.
             -     URL: Include post URL.
             -     REACTION_IDENTITIES: Include reaction identities.
             -     RICH_CONTENT: Includes the post content as a stringified [Rich Content document](https://dev.wix.com/docs/ricos/api-reference/ricos-document.md)
 Return type: PROMISE<QueryPostsResponse>
  - name: posts | type: array<Post> | description: List of posts.  
     - name: _id | type: string | description: Post GUID.  | read-only: true 
     - name: categoryId | type: string | description: Category GUID the post is listed under.  
     - name: ownerId | type: string | description: Post owner's member GUID.  | read-only: true 
     - name: title | type: string | description: Post title.  | validation: minLength 1, maxLength 140
     - name: contentText | type: string | description: The post content in plain text.  
     - name: commentCount | type: integer | description: Total number of post comments.  | read-only: true | validation: format int32
     - name: likeCount | type: integer | description: Total number of post likes.  | read-only: true | validation: format int32
     - name: viewCount | type: integer | description: Total number of post views.  | read-only: true | validation: format int32
     - name: _createdDate | type: Date | description: Date post was created.  | read-only: true 
     - name: lastActivityDate | type: Date | description: Date of latest activity on this post (e.g., date the latest comment was added to post).  | read-only: true 
     - name: url | type: string | description: Post URL.  | read-only: true 
     - name: slug | type: string | description: Post slug.  | read-only: true 
     - name: content | type: string | description: The post content as a stringified [Rich Content document](https://dev.wix.com/docs/ricos/api-reference/ricos-document.md)  | read-only: true 
     - name: images | type: array<string> | description: Images from post content.  | read-only: true 
     - name: videos | type: array<string> | description: Videos from post content.  | read-only: true 
     - name: pinned | type: boolean | description: Whether the post is pinned. Places the post at the top of the post list.  
     - name: closed | type: boolean | description: Whether post is closed and commenting is disabled.  
     - name: _updatedDate | type: Date | description: Date post was updated.  
     - name: commentInteraction | type: Interaction | description: Defines what interactions may be applied on the comment under the post, vote or like.  
         - enum: UNKNOWN, REACTION, VOTE, NONE
     - name: markedComments | type: array<string> | description: IDs of the marked comments for this post. Posts are marked by the forum admin or the post owner.  | read-only: true | validation: maxItems 10
     - name: recentActivity | type: RecentActivity | description: Recent activity of post. For example, a comment added to a post.  | read-only: true 
        - ONE-OF: 
           - name: memberId | type: string | description: Site member GUID.  
        - name: entityId | type: string | description: GUID of recent activity entity.  
        - name: type | type: EntityType | description: Type of entity.  
             - enum: UNKNOWN, COMMENT, REPLY
        - name: activityDate | type: string | description: Date activity was created.  
     - name: reactionIdentities | type: array<ReactionIdentity> | description: List of reaction identities grouped by reaction code.  | read-only: true | validation: maxItems 6
        - name: reactionCode | type: string | description: Reaction code.  
        - name: identities | type: array<Identity> | description: Reacted identities.  | read-only: true | validation: maxItems 500
           - name: identityId | type: string | description: Identity id.  
           - name: identityType | type: IdentityType | description: Reacted identity type.  
                 - enum: UNKNOWN, VISITOR, MEMBER
        - name: count | type: integer | description: Total number of reacted identities count.  
  - name: metaData | type: QueryPostsResponseMetaData | description: Pagination.  
     - name: count | type: integer | description: Total number of records returned.  
     - name: offset | type: integer | description: Offset of records.  
     - name: total | type: integer | description: Total number of records that match the filters.  


```

### Examples

### queryPosts
```javascript
import { posts } from '@wix/forum';

async function queryPosts(options) {
  const response = await posts.queryPosts(options);
};
```

### queryPosts (with elevated permissions)
```javascript
import { posts } from '@wix/forum';
import { auth } from '@wix/essentials';

async function myQueryPostsMethod(options) {
  const elevatedQueryPosts = auth.elevate(posts.queryPosts);
  const response = await elevatedQueryPosts(options);
}
```

### queryPosts (self-managed)
Self-managed SDK calls require you to [create a client](https://dev.wix.com/docs/sdk/articles/work-with-the-sdk/about-the-wix-client.md).

```javascript
import { createClient } from '@wix/sdk';
import { posts } from '@wix/forum';
// Import the auth strategy for the relevant access type
// Import the relevant host module if needed

const myWixClient = createClient ({
  modules: { posts },
  // Include the auth strategy and host as relevant
});


async function queryPosts(options) {
  const response = await myWixClient.posts.queryPosts(options);
};
```

---