Moshtix Developer Documentation

Moshtix Developer Documentation

  • Docs
  • API Playground
  • Terms Of Use
  • Need Help?

›Getting Started

Getting Started

  • Our API
  • Authentication
  • Queries
  • Mutations
  • Dates
  • Currency
  • Images
  • Errors
  • Webhooks
  • Widgets

Queries

Queries

What's great about our API is that you request only the data you want, which means fewer requests, and smaller response payloads compared to a traditional API. We define a schema that we make available, and from this you can choose which objects and attributes you want in each request.

For example, the getEvents query method has many attributes, and arguments available so you can write a complex query like this:

query {
  viewer {
    getEvents(pageIndex: 0, pageSize: 15, sortBy: STARTDATE, sortByDirection: ASC) {
      totalCount
      pageInfo {
        hasPreviousPage
        hasNextPage
        pageIndex
        pageSize
      }
      items {
        name
        teaser
        startDate
        venue {
          name
          address {
            locality
          }
        }
        genre {
          name
        }
        ticketTypes(pageIndex: 0, pageSize: 10) {
          items {
            name
            ticketPrice
          }
        }
      }
    }
  }
}

But, if you only require the event name and start date you can use a query that only retrieves those fields e.g.

query {
  viewer {
    getEvents {
      items {
        name
        startDate
      }
    }
  }
}

Lists / Arrays / Pagination

All lists/arrays of objects in our API are represented as 'connection' objects, which means they always have an 'items' attribute that includes the list of objects, but they also have pagination data available, and are also paginated.

Each connection has a default page size, and a max page size limit, which can be determined using the API Explorer in GraphiQL by inspecting the definition for the pageSize argument for an API method.

The following query as an example doesn't have pagination arguments specified, so will return the default page size of 10 events, and 10 ticket types.

query {
  viewer {
    getEvents {
      items {
        id
        name
        ticketTypes {
          items {
            id
            name
          }
        }
      }
    }
  }
}

You could just increase the page size, but this will only get you so far because of max limits. The next query demonstrates how to query the first page of tickets for the third page of events as an example to help you get started accessing all of the data from a client account or all of the ticket types for an event i.e. multiple requests to fetch all of the pages of data, where the page index is incremented until the end of each data set is reached.

query {
  viewer {
    getEvents(pageSize: 10, pageIndex: 3, sortBy: STARTDATE, sortByDirection: DESC) {
      totalCount
      pageInfo {
        hasPreviousPage
        hasNextPage
        pageIndex
        pageSize
      }
      items {
        id
        name
        ticketTypes(pageSize: 10, pageIndex: 1, sortBy: TICKET_ORDINAL, sortByDirection: ASC) {
          totalCount
          pageInfo {
            hasPreviousPage
            hasNextPage
            pageIndex
            pageSize
          }
          items {
            id
            name
          }
        }
      }
    }
  }
}

The following is an example of the response so that you can see an example of the page info for the connections. Note that none of these events have more than 10 tickets so the

{
  "data": {
    "viewer": {
      "getEvents": {
        "totalCount": 1472,
        "pageInfo": {
          "hasPreviousPage": true,
          "hasNextPage": true,
          "pageIndex": 3,
          "pageSize": 10
        },
        "items": [
          {
            "id": 127763,
            "name": "The Screaming Jets - All For One 30th Anniversary Tour",
            "ticketTypes": {
              "totalCount": 3,
              "pageInfo": {
                "hasPreviousPage": true,
                "hasNextPage": false,
                "pageIndex": 1,
                "pageSize": 10
              },
              "items": [
                {
                  "id": 331370,
                  "name": "Show Ticket Only"
                },
                {
                  "id": 331372,
                  "name": "CD + Show Ticket"
                },
                {
                  "id": 331371,
                  "name": "Vinyl + Show Ticket"
                }
              ]
            }
          },
          {
            "id": 130807,
            "name": "NGAIIRE & WALLACE ",
            "ticketTypes": {
              "totalCount": 1,
              "pageInfo": {
                "hasPreviousPage": true,
                "hasNextPage": false,
                "pageIndex": 1,
                "pageSize": 10
              },
              "items": [
                {
                  "id": 350438,
                  "name": "General Admission"
                }
              ]
            }
          },
          {
            "id": 130842,
            "name": "NGAIIRE & Wallace With Special Guests",
            "ticketTypes": {
              "totalCount": 1,
              "pageInfo": {
                "hasPreviousPage": true,
                "hasNextPage": false,
                "pageIndex": 1,
                "pageSize": 10
              },
              "items": [
                {
                  "id": 350974,
                  "name": "General Admission"
                }
              ]
            }
          },
          {
            "id": 127759,
            "name": "The Screaming Jets - All For One 30th Anniversary Tour",
            "ticketTypes": {
              "totalCount": 3,
              "pageInfo": {
                "hasPreviousPage": true,
                "hasNextPage": false,
                "pageIndex": 1,
                "pageSize": 10
              },
              "items": [
                {
                  "id": 331363,
                  "name": "Show Ticket Only"
                },
                {
                  "id": 331365,
                  "name": "CD + Show Ticket"
                },
                {
                  "id": 331364,
                  "name": "Vinyl + Show Ticket"
                }
              ]
            }
          },
          {
            "id": 129890,
            "name": "On Repeat: Olivia Rodrigo Night - ADL | POSTPONED, NEW DATE TBC",
            "ticketTypes": {
              "totalCount": 1,
              "pageInfo": {
                "hasPreviousPage": true,
                "hasNextPage": false,
                "pageIndex": 1,
                "pageSize": 10
              },
              "items": [
                {
                  "id": 344541,
                  "name": "General Admission"
                }
              ]
            }
          },
          {
            "id": 130908,
            "name": "BABY ANIMALS - 30TH ANNIVERSARY TOUR | CONCERT",
            "ticketTypes": {
              "totalCount": 10,
              "pageInfo": {
                "hasPreviousPage": true,
                "hasNextPage": false,
                "pageIndex": 1,
                "pageSize": 10
              },
              "items": [
                {
                  "id": 351614,
                  "name": "Wishlist Donation $2"
                },
                {
                  "id": 351617,
                  "name": "General Admission Standing (18+)"
                },
                {
                  "id": 351618,
                  "name": "NightQuarter Stubby Cooler"
                },
                {
                  "id": 351622,
                  "name": " The Gallery + Hospitality Package (18+)"
                },
                {
                  "id": 351626,
                  "name": "General Admission Standing (U18)"
                },
                {
                  "id": 351620,
                  "name": "NightQuarter T Shirt"
                },
                {
                  "id": 351613,
                  "name": "Wishlist Donation $5"
                },
                {
                  "id": 351612,
                  "name": "Wishlist Donation $10"
                },
                {
                  "id": 351619,
                  "name": "NightQuarter Cap"
                },
                {
                  "id": 351615,
                  "name": "Wishlist Donation $20"
                }
              ]
            }
          },
          {
            "id": 130462,
            "name": "POSTPONED - One Direction 11 Year Anniversary Party - Canberra",
            "ticketTypes": {
              "totalCount": 3,
              "pageInfo": {
                "hasPreviousPage": true,
                "hasNextPage": false,
                "pageIndex": 1,
                "pageSize": 10
              },
              "items": [
                {
                  "id": 347743,
                  "name": "First Release"
                },
                {
                  "id": 347745,
                  "name": "Second Release"
                },
                {
                  "id": 347744,
                  "name": "Final Release"
                }
              ]
            }
          },
          {
            "id": 130317,
            "name": "Taking Back Saturday: Emo & Pop Punk Night - ADL | CANCELLED",
            "ticketTypes": {
              "totalCount": 0,
              "pageInfo": {
                "hasPreviousPage": true,
                "hasNextPage": false,
                "pageIndex": 1,
                "pageSize": 10
              },
              "items": []
            }
          },
          {
            "id": 129254,
            "name": "On Repeat: Hamilton Party - ADL ",
            "ticketTypes": {
              "totalCount": 3,
              "pageInfo": {
                "hasPreviousPage": true,
                "hasNextPage": false,
                "pageIndex": 1,
                "pageSize": 10
              },
              "items": [
                {
                  "id": 338403,
                  "name": "1ST RELEASE"
                },
                {
                  "id": 338404,
                  "name": "2ND RELEASE"
                },
                {
                  "id": 338405,
                  "name": "FINAL RELEASE"
                }
              ]
            }
          },
          {
            "id": 124223,
            "name": "Baby Animals – 30th Anniversary Tour",
            "ticketTypes": {
              "totalCount": 1,
              "pageInfo": {
                "hasPreviousPage": true,
                "hasNextPage": false,
                "pageIndex": 1,
                "pageSize": 10
              },
              "items": [
                {
                  "id": 312531,
                  "name": "General Admission"
                }
              ]
            }
          }
        ]
      }
    }
  }
}

Past/Historic Events

By default our API only returns future events, because generally this is what people want to promote, but also because early versions of our API only returned future events, and so we still need to support that behaviour ;)

To return past events the 'includePastEvents' argument needs to be included in the query.

query {
  viewer {
    getEvents(includePastEvents: true) {
      items {
        id
      }
    }
  }
}

Event Marketing/Purchase Links

Links to events aren't provided by our API, they need to be constructed.

Event links are structured like so:

https://[domain]/v2/event/[event-name-slug]/[eventid]?[any-other-query-string-params]

Domain

If you're operating in a single market (e.g. Australia), then this is straight forward, you can just hardcode to 'moshtix.com.au', but if you're working with events across markets, you will need to obtain the domain from our API as shown below.

query {
  viewer {
    getEvents {
      items {
        id
        client {
          operatingCountry {
            domain
            currency
            country {
              name
            }
          }
        }
      }
    }
  }
}

Note that the client.operatingCountry object will be available in our API anywhere you find a client e.g. order.event.client.operatingCountry.domain is also available.

Event Name Slug

query {
  viewer {
    getEvents {
      items {
        name
      }
    }
  }
}

Once you have an event name you can run it through this function to obtain the event slug.

const getEventNameSlug = ({ name }) => {
  if (!name) {
    return '';
  }
  return name
    .trim()
    .toLowerCase()
    .replace(/([^0-9a-zA-Z-\u4e00-\u9eff])+/g, '-') // replace all non text characters, and non international characters with just a dash
    .replace(/-+/g, '-'); // replace all multiple adjacent dashes with a single dash
};

Event Id

query {
  viewer {
    getEvents {
      items {
        id
      }
    }
  }
}

any-other-query-string-params

You can then append any other query string params like embedded offer codes or previewId, which are common requirements.

query {
  viewer {
    getEvents {
      items {
        previewId
        offerCodes {
          items {
            codes {
              items {
                name
              }
            }
          }
        }
      }
    }
  }
}

e.g. [baseEventUrl]?previewId=[previewId]&offercode=[offercode]

← AuthenticationMutations →
  • Queries
  • Lists / Arrays / Pagination
  • Past/Historic Events
  • Event Marketing/Purchase Links
    • Domain
    • Event Name Slug
    • Event Id
    • any-other-query-string-params
Copyright © 2025 Moshtix Pty Ltd