> 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: ticketing
# Namespace: CheckoutService
# 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.
---
## REST API
### Schema
```
Method: queryAvailableTickets
Description: Retrieves tickets available to reserve.
URL: https://www.wixapis.com/events/v1/checkout/available-tickets/query
Method: POST
Method parameters:
param name: fieldset | type: array
| description: Which fields to return.
- enum:
- POLICY: Include `policy` in the response.
- DASHBOARD: Include `dashboard` in the response.
param name: filter | type: filter | description: Ticket definition.
param name: limit | type: limit | description: Limit. **Default:** `0`. If you don't pass this field in the request, only `metadata` is returned.
param name: offset | type: offset | description: Offset.
param name: sort | type: sort | description: Sort order. Default: `"created:asc"`.
Return type: 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.
- name: total | type: integer | description: Total number of matching items.
- name: definitions | type: array | description: Ticket definitions.
- name: id | type: string | description: Ticket definition 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`.
- 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.
- 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.
- 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.
- name: unsold | type: integer | description: Number of unsold tickets. `NULL` for unlimited ticket definitions.
- 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.
- name: wixFeeConfig | type: WixFeeConfig | description: Configuration of the fixed-rate Wix service fee that is applied at checkout to each ticket sold.
- 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: string | description: Ticket sale start timestamp.
- name: endDate | type: string | 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.
- 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 | 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 | description: Multiple ticket pricing options.
- name: id | type: string | description: Ticket pricing option GUID.
- name: name | type: string | description: Ticket pricing option name.
- name: price | type: Money | description: Ticket pricing option price.
- name: pricingType | type: Type | description: Ticket pricing type.
- enum: STANDARD, DONATION
```
### Examples
### QueryAvailableTickets
```curl
~~~cURL
curl -X POST 'https://www.wixapis.com/events/v1/tickets/available/query' \
-H 'Content-Type: application/json' \
-H 'Authorization: ' \
--data-binary '{
"offset": 0,
"limit": 100,
"order": "orderIndex:asc",
"filter": {
"name": {
"$contains": "ticket"
}
}
}'
~~~
```
---
## JavaScript SDK
### Schema
```
Method: wixClientAdmin.ticketing.CheckoutService.queryAvailableTickets(options)
Description: Retrieves tickets available to reserve.
Method parameters:
param name: options | type: QueryAvailableTicketsOptions none
- name: offset | type: integer | description: Offset.
- name: limit | type: integer | description: Limit. **Default:** `0`. If you don't pass this field in the request, only `metadata` is returned.
- name: filter | type: object | description: Ticket definition.
- name: fieldset | type: array | description: Which fields to return.
- enum:
- POLICY: Include `policy` in the response.
- DASHBOARD: Include `dashboard` in the response.
- name: sort | type: string | description: Sort order. Default: `"created:asc"`.
Return type: PROMISE
- 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.
- name: total | type: integer | description: Total number of matching items.
- name: definitions | type: array | description: Ticket definitions.
- name: _id | type: string | description: Ticket definition 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`.
- 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.
- 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.
- 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.
- name: unsold | type: integer | description: Number of unsold tickets. `NULL` for unlimited ticket definitions.
- 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.
- name: wixFeeConfig | type: WixFeeConfig | description: Configuration of the fixed-rate Wix service fee that is applied at checkout to each ticket sold.
- 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.
- 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 | 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 | description: Multiple ticket pricing options.
- name: _id | type: string | description: Ticket pricing option GUID.
- name: name | type: string | description: Ticket pricing option name.
- name: price | type: Money | description: Ticket pricing option price.
- name: pricingType | type: Type | description: Ticket pricing type.
- 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);
};
```
---