> 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

# queryProjects

# Package: @wix/portfolio

# Namespace: projects

# Method link: https://dev.wix.com/docs/api-reference/business-solutions/portfolio/projects/query-projects.md

## Permission Scopes:
Manage Portfolio: SCOPE.PORTFOLIO.MANAGE-PORTFOLIO

## Introduction

Retrieves a list of projects, given the provided paging, filtering, and sorting. Up to 100 projects can be returned per request.

The default `sort` is `id` in `ASC`.

To retrieve projects in the site-wide display order, as shown on the All Projects page, sort by `sortOrder` in `ASC`, then by `createdDate` in `DESC`, then by `id` in `ASC`.
Projects without a `sortOrder` come first in that sort, newest first. Projects created before the field existed have no value until a one-time migration assigns one, so don't use this sort for a site until that migration has completed.

To learn how to query projects, see [API Query Language](https://dev.wix.com/docs/rest/articles/getting-started/api-query-language.md).

---

## JavaScript SDK

### Schema

```
 Method: wixClientAdmin.portfolio.projects.queryProjects(query, options)
 Description: Retrieves a list of projects, given the provided paging, filtering, and sorting. Up to 100 projects can be returned per request.  The default `sort` is `id` in `ASC`.  To retrieve projects in the site-wide display order, as shown on the All Projects page, sort by `sortOrder` in `ASC`, then by `createdDate` in `DESC`, then by `id` in `ASC`. Projects without a `sortOrder` come first in that sort, newest first. Projects created before the field existed have no value until a one-time migration assigns one, so don't use this sort for a site until that migration has completed.  To learn how to query projects, see [API Query Language](https://dev.wix.com/docs/rest/articles/getting-started/api-query-language.md).
 # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present.
 Required parameters:  query
 Method parameters: 
   param name: query | type: ProjectQuery   | required: true 
     - name: cursorPaging | type: CursorPaging | description: Cursor token pointing to a page of results. Not used in the first request. Following requests use the cursor token and not `filter` or `sort`.  
        - name: limit | type: integer | description: Maximum number of items to return in the results.  | validation: minimum 0, maximum 100, format int32
        - name: cursor | type: string | description: Pointer to the next or previous page in the list of results.  Pass the relevant cursor token from the `pagingMetadata` object in the previous call's response. Not relevant for the first request.  | validation: maxLength 16000
        - name: filter | type: object | description: Filter object.  Learn more about [filtering](https://dev.wix.com/docs/rest/articles/getting-started/api-query-language.md#filters).  
        - name: sort | type: array<Sorting> | description: Sort object.  Learn more about [sorting](https://dev.wix.com/docs/rest/articles/getting-started/api-query-language.md#sorting).  
           - name: fieldName | type: string | description: Name of the field to sort by.  | validation: maxLength 512
           - name: order | type: SortOrder | description: Sort order.  
                 - enum: ASC, DESC
           - name: origin | type: AddressLocation | description: Origin point for geo-distance sorting on a GEO field results are ordered by distance from this point (ASC = nearest first, DESC = farthest first).  
              - name: latitude | type: number | description: Address latitude.  
              - name: longitude | type: number | description: Address longitude.  
   param name: options | type: QueryProjectsOptions  none  
        - name: includePageUrl | type: boolean | description: Whether to include the project's relative path and full URL in the response. Default: `false`  
 Query fields:
   - field: _id | operators: $eq, $ne, $in, $exists, $gt, $gte, $lt, $lte, $startsWith | sort: ASC, DESC | aggregatable: undefined | searchable: undefined
   - field: title | operators: $eq, $ne, $in, $exists, $gt, $gte, $lt, $lte, $startsWith | sort: ASC, DESC | aggregatable: undefined | searchable: undefined
   - field: description | operators: $eq, $ne, $in, $exists, $gt, $gte, $lt, $lte, $startsWith | sort: ASC, DESC | aggregatable: undefined | searchable: undefined
   - field: slug | operators: $eq, $ne, $in, $exists, $gt, $gte, $lt, $lte, $startsWith | sort: ASC, DESC | aggregatable: undefined | searchable: undefined
   - field: collectionIds | operators: $hasSome, $hasAll, $exists, $isEmpty | sort: none | aggregatable: undefined | searchable: undefined
   - field: hidden | operators: $eq, $ne, $in, $exists | sort: none | aggregatable: undefined | searchable: undefined
   - field: _createdDate | operators: $eq, $ne, $in, $exists, $gt, $gte, $lt, $lte | sort: ASC, DESC | aggregatable: undefined | searchable: undefined
   - field: _updatedDate | operators: $eq, $ne, $in, $exists, $gt, $gte, $lt, $lte | sort: ASC, DESC | aggregatable: undefined | searchable: undefined
 Return type: PROMISE<QueryProjectsResponse>
  - name: projects | type: array<Project> | description: List of projects.  
     - ONE-OF: 
        - name: coverImage | type: Image | description: Project cover image.  
           - name: imageInfo | type: string | description: Information about the Wix Media image.  
           - name: focalPoint | type: Point | description: Focal point of the image.  
              - name: x | type: number | description: X-coordinate of the focal point.  
              - name: y | type: number | description: Y-coordinate of the focal point.  
           - name: altText | type: string | description: Alt text of the image, for screen readers and SEO. On read, the same value as `image_info.alt_text`. On write, both fields set the same stored value; when the update mask names this field, it wins. Use this field from the SDK, where `image_info` is a `wix:image` string that cannot carry alt text.  | validation: maxLength 5000
        - name: coverVideo | type: Video | description: Project cover video.  
           - name: videoInfo | type: string | description: Information about the Wix Media video.  
           - name: durationInMillis | type: integer | description: Manually defined Video duration in milliseconds.  | validation: format int32
     - name: _id | type: string | description: Project GUID.  | read-only: true | validation: format GUID
     - name: revision | type: string | description: Revision number, which increments by 1 each time the project is updated. To prevent conflicting changes, the existing revision must be passed when updating the project object.  | read-only: true | validation: format uint64
     - name: title | type: string | description: Project title.  | validation: maxLength 100
     - name: description | type: string | description: Project description.  
     - name: hidden | type: boolean | description: Whether the project is hidden from the portfolio. Default: `false`  
     - name: collectionIds | type: array<string> | description: IDs of the collections that include the project.  | validation: maxItems 1000, format GUID
     - name: details | type: array<ProjectDetail> | description: Project details.  
        - ONE-OF: 
           - name: text | type: string | description: Project label in plain text format.  
           - name: link | type: DetailsLink | description: Project label in link format.  
              - name: text | type: string | description: Display text of the link.  
              - name: url | type: string | description: Target URL of the link.  | validation: format WEB_URL
              - name: target | type: string | description: Whether the link opens in a new tab or window. One of: * `'_blank'`: The link opens in a new tab or window. * `'_self'`: The link opens in the same tab or window.  
        - name: label | type: string | description: Project label.  
     - name: slug | type: string | description: Project slug.  
     - name: _createdDate | type: Date | description: Date and time the project was created.  | read-only: true 
     - name: _updatedDate | type: Date | description: Date and time the project was updated.  | read-only: true 
     - name: url | type: string | description: Project page URL and relative path. Returned when `includePageUrl` is `true` in the request.  | read-only: true 
     - name: seoData | type: SeoSchema | description: Project SEO data.  
        - name: tags | type: array<Tag> | description: The tags rendered into <head>, in no particular order. Render order is decided by the renderer, not by position in this list.  No maxSize: this list is already populated by data written years ago, and a bound added now could reject a page that is already stored.  
           - name: type | type: string | description: Legacy. Was a free-form string: "title" | "meta" | "script" | "link". The typed replacement is the `kind` oneof on `SeoSchemaV2.Tag`, which makes the invalid combinations unrepresentable rather than merely discouraged.  Which of these an API actually accepts depends on where the tag is being set: this list is not a blanket guarantee across every API that reuses this message. Site SEO Tags in particular accepts only `meta` (see `SiteSeoTags.tags`) and rejects `title`/`script`/`link` with a validation error even though they appear here — check the field description of the specific `tags`-typed field you are writing to.  Limitation: `title` and `script` (e.g. a `script` tag with `props.type` "application/ld+json" carrying structured data) are supported only when `custom` is unset or `false`. Setting `custom: true` on a `title` or `script` tag is rejected with `TAG_TYPE_NOT_ALLOWED`, because `custom: true` routes the write through the site's Advanced/Custom Tags list. To write structured data, omit `custom` (or set it to `false`).  No length limit: this field holds data written years ago by writers we are not migrating. A constraint here could reject a record that is already stored, which is exactly the promise this design makes.  
           - name: props | type: object | description: Legacy. Was an untyped bag of HTML attributes. Typed replacement: `SeoSchemaV2.TitleTag` / `MetaTag` / `LinkTag`.  
           - name: meta | type: object | description: Legacy. Was an untyped bag of 16 mixed-purpose keys. In `SeoSchemaV2` its contents are split by purpose: per-page structured-data state moves to StructuredDataTag, authorship to `written_by`, and render-time preset logic (variants, enabledByExperiment, removeSchemaIf*) moved out of the stored document entirely — it belongs to the preset definition, not to the page. See the design log for the full key-by-key mapping.  
           - name: children | type: string | description: Legacy. Was the tag's inner content, doubling as the JSON-LD payload for script tags. Typed replacement: `SeoSchemaV2.TitleTag.text` and `StructuredDataTag.json_ld`. No length limit, for the same reason as `type` above.  
           - name: custom | type: boolean | description: Whether the tag is a [custom tag](https://support.wix.com/en/article/adding-additional-meta-tags-to-your-sites-pages) — i.e. an entry from the site's Advanced/Custom Tags list.  Setting this to `true` on a write restricts which `type` values are accepted — the same restriction the Advanced/Custom Tags UI enforces. `title` and `script` tags (including JSON-LD structured data) must be sent with `custom` omitted or `false`; sending them with `custom: true` is rejected with `TAG_TYPE_NOT_ALLOWED`.  Note this is a separate restriction from Site SEO Tags' own type restriction on `SiteSeoTags.tags`: even with `custom` unset, Site SEO Tags rejects `script` (e.g. for site-wide structured data) unconditionally. There is currently no way to set site-wide, every-page structured data through any of these APIs — write a per-page `script` tag through the Item SEO Tags API instead.  This flag is scoped to that feature only. It is NOT an indicator of whether a standard tag (`title`, `description`, Open Graph, etc.) reflects a manually configured value versus a computed default/pattern — standard tags always resolve with `custom: false`, even when their content comes from a page's manually saved SEO title/description override. Don't use this field to verify whether a live page reflects a manual per-page SEO edit.  Limitation: when `ResolveStaticPageSeoTags` is called without `seoData`, the per-page SEO data is read only from the Vibe/Wix-managed-headless override store. That store holds nothing for classic Wix Editor or Wix Studio pages, so even genuine Advanced/Custom Tags saved on those pages are missing from the response entirely — there, `false` means this API could not tell, not that no custom tag exists. Pass `seoData` explicitly to resolve against a known set of tags.  `SeoSchemaV2.Tag` expresses this as `written_by = USER_CUSTOM`.  
           - name: disabled | type: boolean | description: Whether the tag is excluded from the rendered <head>.  A disabled tag is still stored, so the user can re-enable it and so a pattern-provided tag stays suppressed on this page. Default false.  
        - name: settings | type: Settings | description: Page-level SEO settings that are not themselves tags.  
           - name: preventAutoRedirect | type: boolean | description: Whether to suppress the automatic redirect from this page's previous URL to its current one after a slug change.  Default false, meaning the redirect IS created. The field is named for the exception rather than the rule, which reads backwards; kept as-is because renaming a stored boolean is not worth the migration.  
           - name: keywords | type: array<Keyword> | description: Keyword terms the user is targeting for this page. Used by the SEO assistant and checklist; never rendered into <head>.  20 is a sanity bound, not the product limit. v1 declared 5 — the number the panel happens to allow today — which is exactly the mistake we are fixing for structured data. A product decision to allow 8 should not need a proto release, so the panel owns that number and the proto only stops something absurd.  | validation: maxItems 20
              - name: term | type: string | description: The term itself, e.g. "trail running shoes".  No maxLength, for the same reason as the legacy tag fields: keywords are already stored, and a bound added now could reject a record written before the bound existed. The flynt `missing-string-validations` warning on this field is accepted deliberately.  
              - name: isMain | type: boolean | description: Whether this is the page's primary focus keyword. At most one per page.  
              - name: origin | type: string | description: Which surface added the term, e.g. a panel or a suggestion flow. Used for attribution in BI. Opaque to the renderer.  | validation: maxLength 1000
     - name: watermark | type: Watermark | description: Optional watermark that can be applied to all project's images.  
        - name: position | type: Position | description: Position of the watermark on the image.  
             - enum: NORTH_WEST, NORTH, NORTH_EAST, WEST, CENTER, EAST, SOUTH_WEST, SOUTH, SOUTH_EAST
        - name: size | type: integer | description: Size of the watermark, from 0 to 100.  | validation: minimum 0, maximum 100
        - name: opacity | type: integer | description: Opacity of the watermark.  | validation: minimum 1, maximum 100
        - name: imageUrl | type: string | description: Image GUID of the Watermark as saved in Media Platform.  | validation: maxLength 300
        - name: enabled | type: boolean | description: Whether the watermark is to be displayed on Items & Cover Photos.  
  - name: metadata | type: PagingMetadataV2 | description: Paging metadata.  
     - name: count | type: integer | description: Number of items returned in the response.  | validation: format int32
     - name: offset | type: integer | description: Offset that was requested.  | validation: format int32
     - name: total | type: integer | description: Total number of items that match the query. Returned if offset paging is used and the `tooManyToCount` flag is not set.  | validation: format int32
     - name: tooManyToCount | type: boolean | description: Flag that indicates the server failed to calculate the `total` field.  
     - name: cursors | type: Cursors | description: Cursors to navigate through the result pages using `next` and `prev`. Returned if cursor paging is used.  
        - name: next | type: string | description: Cursor string pointing to the next page in the list of results.  | validation: maxLength 16000
        - name: prev | type: string | description: Cursor pointing to the previous page in the list of results.  | validation: maxLength 16000


```

### Examples

### queryProjects
```javascript
import { projects } from '@wix/portfolio';

async function queryProjects(query,options) {
  const response = await projects.queryProjects(query,options);
};
```

### queryProjects (with elevated permissions)
```javascript
import { projects } from '@wix/portfolio';
import { auth } from '@wix/essentials';

async function myQueryProjectsMethod(query,options) {
  const elevatedQueryProjects = auth.elevate(projects.queryProjects);
  const response = await elevatedQueryProjects(query,options);
}
```

### queryProjects (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 { projects } from '@wix/portfolio';
// Import the auth strategy for the relevant access type
// Import the relevant host module if needed

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


async function queryProjects(query,options) {
  const response = await myWixClient.projects.queryProjects(query,options);
};
```

---