API reference

discount

Throws an error if the discount doesn't exist, requires an authenticated user or is invalid (expired, consumed etc)

graphql
discount(
  restaurantId: ID!
  code: String!
): Discount

Arguments

Name Type Description
restaurantId ID!
code String!

Returns

Discount

Example

graphql
query Discount($restaurantId: ID!, $code: String!) {
  discount(restaurantId: $restaurantId, code: $code) {
    id
    isDisabled
    code
    title
    description
    validFrom
  }
}
bash
curl https://api.thelocoapp.com/graphql \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $LOCO_API_KEY" \
  -d '{"query": "query { discount(...) { __typename } }"}'