> 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

# QueryLatestActions

# Package: actions

# Namespace: ActionCatalogService

# Method link: https://dev.wix.com/docs/api-reference/business-management/automations/actions/action-catalog/query-latest-actions.md

## Permission Scopes:
Set Up Automations: SCOPE.CRM.SETUP-AUTOMATIONS

## Introduction

Retrieves a list of the latest version of each action, based on the provided paging, filtering, and sorting.

To retrieve all stored versions of each action, call [Query Actions](https://dev.wix.com/docs/api-reference/business-management/automations/actions/action-catalog/query-actions.md).


Query Latest Actions runs with these defaults, which you can override:

- `createdDate` is sorted in `DESC` order.
- `paging.limit` is `50`.
- `paging.offset` is `0`.

To learn about working with query methods, see:
- [API Query Language](https://dev.wix.com/docs/api-reference/articles/getting-started/api-query-language.md)
- [Sorting and Paging](https://dev.wix.com/docs/api-reference/articles/work-with-wix-apis/data-retrieval/about-sorting-and-paging.md)
- [Field projection](https://dev.wix.com/docs/api-reference/articles/work-with-wix-apis/data-retrieval/about-field-projection.md)

---

## REST API

### Schema

```
 Method: queryLatestActions
 Description: Retrieves a list of the latest version of each action, based on the provided paging, filtering, and sorting.  To retrieve all stored versions of each action, call [Query Actions](https://dev.wix.com/docs/api-reference/business-management/automations/actions/action-catalog/query-actions.md).   Query Latest Actions runs with these defaults, which you can override:  - `createdDate` is sorted in `DESC` order. - `paging.limit` is `50`. - `paging.offset` is `0`.  To learn about working with query methods, see: - [API Query Language](https://dev.wix.com/docs/api-reference/articles/getting-started/api-query-language.md) - [Sorting and Paging](https://dev.wix.com/docs/api-reference/articles/work-with-wix-apis/data-retrieval/about-sorting-and-paging.md) - [Field projection](https://dev.wix.com/docs/api-reference/articles/work-with-wix-apis/data-retrieval/about-field-projection.md)
 URL: https://www.wixapis.com/v1/actions/query-latest
 Method: POST
 # 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: QueryV2   | 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 500, 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 64000
        - name: filter | type: object | description: Filter object in the following format: `"filter" : { "fieldName1": "value1", "fieldName2":{"$operator":"value2"} }` Example of operators: `$eq`, `$ne`, `$lt`, `$lte`, `$gt`, `$gte`, `$in`, `$hasSome`, `$hasAll`, `$startsWith`, `$contains`  
        - name: sort | type: array<Sorting> | description: Sort object in the following format: `[{"fieldName":"sortField1","order":"ASC"},{"fieldName":"sortField2","order":"DESC"}]`  | validation: maxItems 4
           - 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: fields | type: array<string> | description: Array of projected fields. A list of specific field names to return. If `fieldsets` are also specified, the union of `fieldsets` and `fields` is returned.  | validation: maxItems 20, maxLength 200
        - name: fieldsets | type: array<string> | description: Array of named, predefined sets of projected fields. A array of predefined named sets of fields to be returned. Specifying multiple `fieldsets` will return the union of fields from all sets. If `fields` are also specified, the union of `fieldsets` and `fields` is returned.  | validation: maxItems 20, maxLength 200
 Return type: QueryLatestActionsResponse
  - name: results | type: array<Action> | description: Retrieved actions. Contains only the latest version of each action.  
     - name: id | type: string | description: Action GUID. (per component version)  | read-only: true | validation: format GUID
     - name: appId | type: string | description: GUID of the [app that created the action](https://dev.wix.com/docs/api-reference/business-management/automations/actions/add-an-action-to-your-app.md).  | read-only: true | validation: format GUID
     - name: actionKey | type: string | description: Action key.  Learn about [adding an action to your app](https://dev.wix.com/docs/api-reference/business-management/automations/actions/add-an-action-to-your-app.md).  | read-only: true | validation: minLength 5, maxLength 50
     - name: inputSchema | type: object | description: Action [input schema](https://dev.wix.com/docs/api-reference/business-management/automations/actions/about-actions.md#the-input-schema).  | read-only: true 
     - name: outputSchema | type: object | description: Action [output schema](https://dev.wix.com/docs/api-reference/business-management/automations/actions/about-actions.md#the-output-schema).  | read-only: true 
     - name: displayName | type: string | description: Action display name. Users see this name when they [choose an action for an automation](https://support.wix.com/en/article/wix-automations-creating-an-automation-with-the-new-builder#step-4-choose-an-action). For example, "Send SMS" or "Create Coupon".  | read-only: true | validation: minLength 1, maxLength 80
     - name: description | type: string | description: Action description displayed in the site dashboard to Wix users.  | read-only: true 
     - name: implementedMethods | type: ImplementedMethods | description: Additional [service plugin methods](https://dev.wix.com/docs/api-reference/business-management/automations/actions/action-provider-service-plugin/introduction.md#implement-the-service-plugin-methods) implemented for this action.  
        - name: validateConfiguration | type: boolean | description: Whether [Validate Configuration](https://dev.wix.com/docs/api-reference/business-management/automations/actions/action-provider-service-plugin/validate-configuration.md) is implemented.  Default: `false`.  
        - name: getQuotaInfo | type: boolean | description: Whether [Get Quota Info](https://dev.wix.com/docs/api-reference/business-management/automations/actions/action-provider-service-plugin/get-quota-info.md) is implemented.  Default: `false`.  
     - name: interfaceConfiguration | type: InterfaceConfiguration | description: Selected user interface for the action. The UI is displayed to the Wix user in the site dashboard when they configure the action.  
        - ONE-OF: 
           - name: genericOptions | type: GenericOptions | description: Details for the generic UI.  
              - name: uiSchema | type: object | description: UI schema.  
        - name: type | type: Type | description: Type of action configuration UI.  
             - enum:
             -     UNKNOWN_TYPE: Unknown action configuration UI.
             -     GENERIC: The generic action configuration UI. This requires you to provide a [UI schema](https://dev.wix.com/docs/api-reference/business-management/automations/actions/about-actions.md#the-ui-schema).
     - name: icon | type: Image | description: Action icon displayed in the [site dashboard](https://support.wix.com/en/article/about-your-wix-dashboard) to Wix users.  
        - 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: createdDate | type: string | description: Date and time the action was created.  | read-only: true | validation: format date-time
     - name: updatedDate | type: string | description: Date and time the action was last updated.  | read-only: true | validation: format date-time
     - name: baseUri | type: string | description: Action base URI. Wix calls your action at this base address.  Learn more about the [Action Provider service plugin](https://dev.wix.com/docs/api-reference/business-management/automations/actions/action-provider-service-plugin/introduction.md).  | validation: maxLength 256
  - name: paging | type: PagingMetadataV2 | description: Paging metadata of the response.  
     - 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 64000
        - name: prev | type: string | description: Cursor pointing to the previous page in the list of results.  | validation: maxLength 64000


```

### Examples

### Query latest actions
```curl
curl -X POST 'https://www.wixapis.com/v1/actions/query-latest' \
    -H 'Authorization: <AUTH>' \
    -H 'Content-Type: application/json' \
    -d '{
      "query": {
        "filter": {
          "appId": "e4c3e640-0b63-4bd9-8574-53f8c14e0236"
        },
        "paging": {
          "limit": 10,
          "offset": 0
        }
      }
    }'
```

---

## JavaScript SDK

### Schema

```
 Method: wixClientAdmin.automations.actionCatalog.queryLatestActions(query)
 Description: Retrieves a list of the latest version of each action, based on the provided paging, filtering, and sorting.  To retrieve all stored versions of each action, call [Query Actions](https://dev.wix.com/docs/api-reference/business-management/automations/actions/action-catalog/query-actions.md).   Query Latest Actions runs with these defaults, which you can override:  - `createdDate` is sorted in `DESC` order. - `paging.limit` is `50`. - `paging.offset` is `0`.  To learn about working with query methods, see: - [API Query Language](https://dev.wix.com/docs/api-reference/articles/getting-started/api-query-language.md) - [Sorting and Paging](https://dev.wix.com/docs/api-reference/articles/work-with-wix-apis/data-retrieval/about-sorting-and-paging.md) - [Field projection](https://dev.wix.com/docs/api-reference/articles/work-with-wix-apis/data-retrieval/about-field-projection.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: QueryV2   | required: true 
    - ONE-OF: - required: true
     - name: paging | type: Paging | description: Paging options to limit and skip the number of items.  
        - name: limit | type: integer | description: Number of items to load.  | validation: minimum 0, format int32
        - name: offset | type: integer | description: Number of items to skip in the current sort order.  | validation: minimum 0, format int32
     - 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 500, 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 64000
        - name: filter | type: object | description: Filter object in the following format: `"filter" : { "fieldName1": "value1", "fieldName2":{"$operator":"value2"} }` Example of operators: `$eq`, `$ne`, `$lt`, `$lte`, `$gt`, `$gte`, `$in`, `$hasSome`, `$hasAll`, `$startsWith`, `$contains`  
        - name: sort | type: array<Sorting> | description: Sort object in the following format: `[{"fieldName":"sortField1","order":"ASC"},{"fieldName":"sortField2","order":"DESC"}]`  | validation: maxItems 4
           - 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: fields | type: array<string> | description: Array of projected fields. A list of specific field names to return. If `fieldsets` are also specified, the union of `fieldsets` and `fields` is returned.  | validation: maxItems 20, maxLength 200
        - name: fieldsets | type: array<string> | description: Array of named, predefined sets of projected fields. A array of predefined named sets of fields to be returned. Specifying multiple `fieldsets` will return the union of fields from all sets. If `fields` are also specified, the union of `fieldsets` and `fields` is returned.  | validation: maxItems 20, maxLength 200
 Return type: PROMISE<QueryLatestActionsResponse>
  - name: results | type: array<Action> | description: Retrieved actions. Contains only the latest version of each action.  
     - name: _id | type: string | description: Action GUID. (per component version)  | read-only: true | validation: format GUID
     - name: appId | type: string | description: GUID of the [app that created the action](https://dev.wix.com/docs/api-reference/business-management/automations/actions/add-an-action-to-your-app.md).  | read-only: true | validation: format GUID
     - name: actionKey | type: string | description: Action key.  Learn about [adding an action to your app](https://dev.wix.com/docs/api-reference/business-management/automations/actions/add-an-action-to-your-app.md).  | read-only: true | validation: minLength 5, maxLength 50
     - name: inputSchema | type: object | description: Action [input schema](https://dev.wix.com/docs/api-reference/business-management/automations/actions/about-actions.md#the-input-schema).  | read-only: true 
     - name: outputSchema | type: object | description: Action [output schema](https://dev.wix.com/docs/api-reference/business-management/automations/actions/about-actions.md#the-output-schema).  | read-only: true 
     - name: displayName | type: string | description: Action display name. Users see this name when they [choose an action for an automation](https://support.wix.com/en/article/wix-automations-creating-an-automation-with-the-new-builder#step-4-choose-an-action). For example, "Send SMS" or "Create Coupon".  | read-only: true | validation: minLength 1, maxLength 80
     - name: description | type: string | description: Action description displayed in the site dashboard to Wix users.  | read-only: true 
     - name: implementedMethods | type: ImplementedMethods | description: Additional [service plugin methods](https://dev.wix.com/docs/api-reference/business-management/automations/actions/action-provider-service-plugin/introduction.md#implement-the-service-plugin-methods) implemented for this action.  
        - name: validateConfiguration | type: boolean | description: Whether [Validate Configuration](https://dev.wix.com/docs/api-reference/business-management/automations/actions/action-provider-service-plugin/validate-configuration.md) is implemented.  Default: `false`.  
        - name: getQuotaInfo | type: boolean | description: Whether [Get Quota Info](https://dev.wix.com/docs/api-reference/business-management/automations/actions/action-provider-service-plugin/get-quota-info.md) is implemented.  Default: `false`.  
     - name: interfaceConfiguration | type: InterfaceConfiguration | description: Selected user interface for the action. The UI is displayed to the Wix user in the site dashboard when they configure the action.  
        - ONE-OF: 
           - name: genericOptions | type: GenericOptions | description: Details for the generic UI.  
              - name: uiSchema | type: object | description: UI schema.  
        - name: type | type: Type | description: Type of action configuration UI.  
             - enum:
             -     UNKNOWN_TYPE: Unknown action configuration UI.
             -     GENERIC: The generic action configuration UI. This requires you to provide a [UI schema](https://dev.wix.com/docs/api-reference/business-management/automations/actions/about-actions.md#the-ui-schema).
     - name: icon | type: string | description: Action icon displayed in the [site dashboard](https://support.wix.com/en/article/about-your-wix-dashboard) to Wix users.  
     - name: _createdDate | type: Date | description: Date and time the action was created.  | read-only: true 
     - name: _updatedDate | type: Date | description: Date and time the action was last updated.  | read-only: true 
     - name: baseUri | type: string | description: Action base URI. Wix calls your action at this base address.  Learn more about the [Action Provider service plugin](https://dev.wix.com/docs/api-reference/business-management/automations/actions/action-provider-service-plugin/introduction.md).  | validation: maxLength 256
  - name: paging | type: PagingMetadataV2 | description: Paging metadata of the response.  
     - 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 64000
        - name: prev | type: string | description: Cursor pointing to the previous page in the list of results.  | validation: maxLength 64000


```

### Examples

### Query latest actions
Queries the latest version of each action, filtered by app ID.

```javascript
import { actionCatalog } from "@wix/automations";

async function queryLatestActions() {
  const response = await actionCatalog.queryLatestActions({
    filter: {
      appId: "e4c3e640-0b63-4bd9-8574-53f8c14e0236",
    },
    paging: { limit: 10, offset: 0 },
  });
  return response;
}

/* Promise resolves to:
 * {
 *   "results": [
 *     {
 *       "_id": "a3d2f8e1-7c4b-4a9e-b6d5-1e8f3c2a9b7d",
 *       "appId": "e4c3e640-0b63-4bd9-8574-53f8c14e0236",
 *       "actionKey": "send-gift-card",
 *       "inputSchema": { ... },
 *       "displayName": "Send a gift card",
 *       "description": "Send a gift card to a contact via email.",
 *       "implementedMethods": { "validateConfiguration": false, "getQuotaInfo": false },
 *       "interfaceConfiguration": { "type": "GENERIC" },
 *       "_createdDate": "2024-11-15T10:30:00.000Z",
 *       "_updatedDate": "2024-11-20T14:45:00.000Z"
 *     }
 *   ],
 *   "paging": { "total": 1, "limit": 10, "offset": 0 }
 * }
 */

```

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

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


async function queryLatestActions(query) {
  const response = await myWixClient.actionCatalog.queryLatestActions(query);
};
```

---