> 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`).
> - Top-level index of all portals: https://dev.wix.com/docs/llms.txt
> - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt

# queryAvailableTickets

# Package: @wix/events

# Namespace: orders

# Method link: https://dev.wix.com/docs/api-reference/business-solutions/events/registration/ticketing/orders/query-available-tickets.md

## Permission Scopes:
Events Checkout: SCOPE.EVENTS.EVENTS-CHECKOUT

## Introduction

Retrieves tickets available to reserve.

---

## JavaScript SDK

### Schema

```
 Method: wixClientAdmin.events.orders.queryAvailableTickets(options)
 Description: Retrieves tickets available to reserve.
 Method parameters:
   param name: options | type: QueryAvailableTicketsOptions  none  
        - name: offset | type: integer | description: Offset.  | validation: minimum 0
        - name: limit | type: integer | description: Limit.  **Default:** `0`. If you don't pass this field in the request, only `metadata` is returned.  | validation: minimum 0, maximum 1000
        - name: filter | type: object | description: Ticket definition.  
        - name: fieldset | type: array<TicketDefinitionFieldset> | description: Which fields to return.  | validation: maxItems 20
             - enum:
             -     POLICY: Include `policy` in the response.
             -     DASHBOARD: Include `dashboard` in the response.
        - name: sort | type: string | description: Sort order.  Default: `"created:asc"`.  | validation: maxLength 100
 Return type: PROMISE<QueryAvailableTicketsResponse>
  - name: metaData | type: ResponseMetaData | description: Ticket definitions meta data.  
     - name: count | type: integer | description: Number of items in the response.  
     - name: offset | type: integer | description: Offset of items.  | validation: minimum 0
     - name: total | type: integer | description: Total number of matching items.  
  - name: definitions | type: array<TicketDefinition> | description: Ticket definitions.  
     - name: _id | type: string | description: Ticket definition GUID.  | validation: format GUID
     - name: price | type: Money | description: Ticket price.  
        - name: currency | type: string | description: 3-letter currency code in [ISO-4217 alphabetic](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) format. For example, `USD`.  | validation: format CURRENCY
        - name: value | type: string | description: Monetary amount. Decimal string with a period as a decimal separator (e.g., 3.99). Optionally, starts with a single (-), to indicate that the amount is negative.  | validation: format DECIMAL_VALUE
     - name: free | type: boolean | description: Whether the ticket is free (read only).  
     - name: name | type: string | description: Ticket name.  
     - name: description | type: string | description: Ticket description.  
     - name: limitPerCheckout | type: integer | description: Limit of tickets that can be purchased per checkout. Set to 20 for unlimited ticket definition.  | validation: minimum 0, maximum 20
     - name: orderIndex | type: integer | description: Custom sort index.  
     - name: policy | type: string | description: Policy information plain text block, as printed on the ticket.  
     - name: dashboard | type: Dashboard | description: Sensitive dashboard data.  
        - name: hidden | type: boolean | description: Whether ticket is hidden and cannot be sold.  
        - name: limited | type: boolean | description: Whether the ticket has limited quantity.  
        - name: quantity | type: integer | description: Ticket limit. `NULL` for unlimited ticket definitions.  | validation: format int32
        - name: unsold | type: integer | description: Number of unsold tickets. `NULL` for unlimited ticket definitions.  | validation: format int32
        - name: ticketsSold | type: integer | description: Number of tickets sold.  
        - name: ticketsReserved | type: integer | description: Number of tickets reserved.  
     - name: eventId | type: string | description: Event GUID associated with the ticket.  | validation: format GUID
     - name: wixFeeConfig | type: WixFeeConfig | description: Configuration of the fixed-rate Wix service fee that is applied at checkout to each ticket sold.  | read-only: true 
        - name: type | type: FeeType | description: Fee calculation method.  
             - enum:
             -     FEE_ADDED: Fee is added to the ticket price at checkout.
             -     FEE_INCLUDED: Seller absorbs the fee. It's deducted from the ticket price.
             -     FEE_ADDED_AT_CHECKOUT: Fee is added to the ticket price at checkout.
     - name: salePeriod | type: TicketSalePeriod | description: Ticket sale period.  
        - name: startDate | type: Date | description: Ticket sale start timestamp.  
        - name: endDate | type: Date | description: Ticket sale end timestamp.  
        - name: hideNotOnSale | type: boolean | description: Whether to hide this ticket if it isn't on sale.  
     - name: saleStatus | type: TicketSaleStatus | description: Ticket sale status.  | read-only: true 
         - enum:
         -     SALE_SCHEDULED: Ticket sale is scheduled to start.
         -     SALE_STARTED: Ticket sale has started.
         -     SALE_ENDED: Ticket sale has ended.
     - name: state | type: array<State> | description: Ticket state.  
         - enum: INCLUDE_HIDDEN_NOT_ON_SALE
     - name: pricing | type: TicketPricing | description: Ticket pricing.  
        - ONE-OF: 
           - name: fixedPrice | type: Money | description: Ticket price which is read only.  
           - name: minPrice | type: Money | description: Min price per ticket, customizable.  
           - name: pricingOptions | type: PricingOptions | description: Ticket pricing options.  
              - name: options | type: array<PricingOption> | description: Multiple ticket pricing options.  
                 - name: _id | type: string | description: Ticket pricing option GUID.  | validation: format GUID
                 - name: name | type: string | description: Ticket pricing option name.  | validation: minLength 1, maxLength 200
                 - name: price | type: Money | description: Ticket pricing option price.  
        - name: pricingType | type: Type | description: Ticket pricing type.  | read-only: true 
             - enum: STANDARD, DONATION


```

### Examples

### queryAvailableTickets
```javascript
import { orders } from '@wix/events';

async function queryAvailableTickets(options) {
  const response = await orders.queryAvailableTickets(options);
};
```

### queryAvailableTickets (with elevated permissions)
```javascript
import { orders } from '@wix/events';
import { auth } from '@wix/essentials';

async function myQueryAvailableTicketsMethod(options) {
  const elevatedQueryAvailableTickets = auth.elevate(orders.queryAvailableTickets);
  const response = await elevatedQueryAvailableTickets(options);
}
```

### queryAvailableTickets (self-hosted)
Self-hosted 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 { orders } from '@wix/events';
// Import the auth strategy for the relevant access type
// Import the relevant host module if needed

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


async function queryAvailableTickets(options) {
  const response = await myWixClient.orders.queryAvailableTickets(options);
};
```

---