{"openapi":"3.0.0","info":{"title":"Platform API","version":"1.0.0","contact":{"name":"PepperHQ","url":"https://www.pepperhq.com","email":"info@pepperhq.com"}},"description":"\n# Introduction\n\nThe Platform API provides a REST-based interface to resources to manage\n* users management\n* location management\n* messaging and notifications\n* user segments\n* perks (rewards) management\n* user awards\n* payment methods and payments\n* secondary user credentials\n\nThe following are covered in separate API references - please refer to the Pepper Developer Portal.\n* location and menu POS integration management\n* ordering (v1 and v2)\n* app content management\n* user v2 management\n","servers":[{"url":"https://beta-api.pepperhq.com"},{"url":"https://api.pepperhq.com"}],"security":[{"auth-token":[]},{"bearer-auth-token":[]},{"x-service-auth-token":[]}],"tags":[{"name":"Actions","description":"Use the actions endpoints to post and retrieve actions\n"},{"name":"Addresses","description":"Address-related operations\n"},{"name":"Awards","description":"An 'award' records whether or not a user has accrued loyalty points for a particular\n'perk'.  A perk is the definition of an award type and defines how the award is earnt\nand redeemed.\n\nWhen a user has sufficient points in the award `points.available` field, the award can be redeemed\nin exchange for something of value, such as a discount on an order.\n\nIn the past, Pepper had two loyalty schemas: Perks and 'PointPerk'.  All perks are now stored as 'PointPerks', and we are now\nin the process of refactoring the endpoints to remove the distinctions between the two schemes.\n"},{"name":"Checkins","description":"A 'checkin' records when a user has arrived at a particular location.\n\nIt is used by the platform to\n* provide custom content to the user tailored for that location\n* allow the location's POS to see who is in the location so that the sales assistant can easily select a customer\n  to add to an open basket.\n"},{"name":"Credentials","description":"Credentials gives access to users' login details as well as secondary email and phone details.\n"},{"name":"Guests","description":"Guests endpoint provides temporary user accounts, credentials and sessions for guest actions like ordering.\n\nGuest users, credentials and sessions are automatically removed after 1 hour, unless they have been converted\ninto a full USER acount\n"},{"name":"Locations","description":"Locations gives access to a merchant's locations for defining location specific details such as:\n* opening hours\n* available services\n* promotional material and branding for display in the App\n"},{"name":"Loyalty","description":"Loyalty gives access to a user's loyalty account balance\n"},{"name":"Notifications","description":"Use the Notifications endpoints to send App notification messages to App users.\n"},{"name":"Operations","description":"Bulk operations on users, segments, etc\n"},{"name":"Payment Cards","description":"Manage details of users' payment cards in tokenized form\n"},{"name":"Perks","description":"Use the Perk endpoints to create, retrieve and edit perks.\n\nPerks and awards, while closely related, are not one and the same thing. A perk describes the parameters\nof the overall Rewards Programme (e.g. ‘Stamp Card Loyalty’), whereas an award is a user’s instance\nof a perk (e.g. ‘Andrew’s Stamp Cards’). An award is derived from a perk and captures a single\nuser’s relationship with that perk.\n\nAn award is created for a user by ‘granting’ a perk to them. A perk can be granted in any one of the\nfollowing three ways:\n\n* manually via an appropriate call to the Pepper API,\n* automatically as the result of a set of rules being matched,\n* automatically if the `isGlobal` property is `true`.\n\nIf a user already has an award when a perk is granted to them, the appropriate properties of the\naward are updated accordingly (eg by updating `points.available`).\n\nThere are several types of perk:\n\nSTAMP_CARD perks reward a user with a free item when they have earned enough ‘stamps’ via\nqualifying purchases.\n\nPSEUDO_CURRENCY perks are a points based perk.  They can be redeemed for money off an order using a fixed point to money\nratio: for example: 1 penny off per point redeemed.\n\nAD_HOC perks are rewards that can be granted to users on an ad hoc basis for promotional purposes - for example, \na free Gin and Tonic on the user’s birthday. \n\nCLUB and LEVEL perks reward a User whilst they are members of a specific Audience.\nThe act of being added to, or removed from, an Audience will grant or revoke the Perk as appropriate.\nExamples of Membership based Perks include:\n* Club membership\n* Corporate Discount\n* VIP Customers (i.e. non-level based activity driven rewards)\n\nAdditionally, a ‘Level Based Loyalty’ programme (e.g. Bronze, Silver, Gold) can be modelled using the Membership scheme.\nIf the `isTier` property of a Perk is set to true, then it will be assumed to be a tier in a Level Based\nLoyalty programme (in conjunction with other Perks with the value set). The `priority` of the Perk determines\nwhich should be presented if the User is in multiple tiers. e.g. if the User has each of the Bronze, Silver and\nGold Perks then the Gold Perk will be the only one viable (assuming of course it has the highest priority).\n"},{"name":"Perk Templates","description":"Use the Perk Template endpoints to create and manage reusable perk configurations.\n\nA Perk Template defines the parameters of a perk that can be applied across tenants.\n"},{"name":"Prompts","description":"Use the prompts endpoints to get relevants prompts for the user, and update prompt statuses.\n\nPrompts represent the details and state behind the pop-up shown to users post-order in order to capture a review."},{"name":"Referrals","description":"A user sends a referral to a introduce a new user to the App.  When the new user\nsigns up, they can claim the code and both they and the referrer will receive a configurable\naward\n"},{"name":"Reviews","description":"Use the Reviews endpoints to create and manage customer reviews for locations.\n\nReviews can include ratings (1-5), text feedback, and are linked to orders. Reviews can originate from different sources such as prompts or web UI confirmations.\n"},{"name":"Rules","description":"A rule describes\n* an effect to be triggered\n* when a new event (eg ORDER_COMPLETED) event matches the rule's conditions\n\nRules are used for example to add users to segments (audiences) or automatically grant awards\n"},{"name":"Scheduled Tasks","description":"Scheduled tasks are used to execute some action at a specific time in the future.\n"},{"name":"Segments","description":"A segment is a group of users that can be used to drive different activities around marketing campaigns.  A segment is also known as an audience.\n\nThe merchant can define rules for adding and removing users to a segment, send notifications to a segment, define different content\nto display to a segment, and give different loyalty awards to a segment.\n\nSegment members are managed via explicit requests to add and remove users, or automatically via rules.\n\nUsers are also automatically removed (expired) according to the segment `type` and the `expiryHorizon`:\n* SCHEDULED = Drop a user when the `expiryHorizon` time has elapsed since they were added.\n* ROLLING = Drop a user when the `expiryHorizon` time has elapsed since they were added; if any action fires during the period that would add the user to the segment, then reset the expiry time.\n* PERSISTENT = Never expire membership\n\nExpiry checks run once a day, so using expiry values less than 1 day will only be executed the day after.\n"},{"name":"Stamps","description":"Use the stamps endpoints to create, retrieve and edit Pepper Solo stamps details.\n"},{"name":"Users","description":"Use the users endpoints to create, retrieve and edit a merchant's user details.\n"},{"name":"Award Enrichments","description":"Use the Award Enrichment endpoints to create, updated, delete and get Award Enrichments.\n\nAward Enrichments are used to enrich PointAwards, and external Loyalty Awards with data such as visualisations.\nAward Enrichments are loyalty provider agnostic.\n"},{"name":"Subscription Schemes","description":"Use the Subscription Scheme endpoints to create, retrieve and edit Subscription Schemes.\n\nA Subscription Scheme defines the parameters of a subscription plan that users can subscribe to.\n"},{"name":"Subscriptions","description":"Use the Subscription endpoints to create, retrieve and manage Subscriptions.\n\nA Subscription represents an user's subscription to a Subscription Scheme.\n"}],"paths":{"/awards":{"get":{"tags":["Awards"],"summary":"Get Awards","description":"Gets all Awards for the merchant or user.\n\nThe response is paged.  Use `limit` and `startKey` to control the page returned.\n\nWhen called by a normal User, this returns all the user's awards.\nWhen called by authenticated Admin user, this returns all the merchant's awards.  An admin user can specify a `userId` query parameter to\nreturn that user's awards only.\n\nNote: when the merchant is connected to an external loyalty system rather than the `PEPPER` loyalty system,\ngetting all merchant's awards **is not supported**.\n\nA caller can select specific fields to be returned by setting the `fields` query parameter.\n\nThis path is versioned via the `x-api-version` header, which should be '9' or higher.\nWhen x-api-version header is not present, the legacy resource is returned.\n","operationId":"getAwards","parameters":[{"name":"x-api-version","required":false,"in":"header","description":"The behaviour of this path is versioned via the `x-api-version` header.  The version should be an integer number as a string, eg `'2'`.\nFor this endpoint, the supported values are:\n- '1' ... '7': deprecated behaviour (default)\n- '8' or higher: current behaviour as described here\n","schema":{"type":"number"}},{"$ref":"#/paths/~1users/get/parameters/8"},{"$ref":"#/paths/~1users/get/parameters/9"},{"name":"userId","in":"query","description":"Retrieve awards for this user.  Admin only.","required":false,"schema":{"type":"string"}},{"name":"includeUnvisualisedAwards","in":"query","description":"if true, it will include awards that have not been visualised in the response.","required":false,"schema":{"type":"string"}},{"name":"includeDisabled","in":"query","description":"if true, it will include awards linked to disabled perks in the response.","required":false,"schema":{"type":"string"}},{"name":"locationId","in":"query","description":"if supported by merchant's setup, it will only return the list of awards valid for the location ID provided.","required":false,"schema":{"type":"string"}},{"name":"fields","in":"query","description":"Limit the response to specific fields.  Valid fields are:\n `_id`, `tenantId`, `userId`, `loyaltyProvider`, `perkId`, `points`, and `updatedAt`\n","required":false,"schema":{"type":"string"}},{"name":"updatedAt[.gt | .lte | .eq | .neq]","in":"query","description":"Filter the response using award `updatedAt` in comparison to this RFC 3339 date value.  Valid values of comparison are \n'gt' (for greater than), 'lte', 'eq', 'neq'.  The comparison defaults to 'eq' when not provided.\n\nFiltering using `updateAt` when the merchant is connected to an external loyalty system rather than the `PEPPER` loyalty system.\n","required":false,"schema":{"type":"string","format":"date-time"}}],"responses":{"200":{"description":"The request succeeded","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"$ref":"#/paths/~1pointperks~1%3AperkId~1awards/post/responses/200/content/application~1json/schema"}},"page":{"$ref":"#/paths/~1perks/get/responses/200/content/application~1json/schema/properties/page"}}}}}},"401":{"$ref":"#/paths/~1users/get/responses/401"},"404":{"$ref":"#/paths/~1users/get/responses/404"},"422":{"$ref":"#/paths/~1users/get/responses/422"},"500":{"$ref":"#/paths/~1users/get/responses/500"}}}},"/awards/imports":{"post":{"tags":["Awards"],"summary":"Start Bulk Grant Awards Import","description":"Upload and process file to grant awards perks and award points to users.\nThe response is an operation resource.\n\nUse the response's operation `_id` to poll `GET /operations/:operationId` in order to monitor progress.    \nWhen complete, the operation will contain a `result.href` field providing a link to download a file\nof results.\n\nUse the `dryRun=true` to test processing your file and validating userIds before running the award granting for real.\n\nUse the `dryRun=false` to process the file and grant awards.  \n*Warning:* If you repeat the import, extra award points will be granted.  The import is NOT idempotent.\n\n\nThe import file format should be a plain text file with comma separated values, and the first row as column headings.\nThe possible column formats are:\n\nWith `perk_id` column:\n```\nuser_id, perk_id\n60f7e53e944a60af2caa9977, 60f7e54b3438386d4b09719a\n60f7e55550f30ab39776b834, 60f7e55d04d203c77d7f54d9    \n```\n\nWith `perk_id` and `points` column:\n```\nuser_id, perk_id, points\n60f7e53e944a60af2caa9977, 60f7e54b3438386d4b09719a, 5\n60f7e55550f30ab39776b834, 60f7e55d04d203c77d7f54d9, 3    \n```\n\nWith one or more `perk_XXXXX` and columns, where XXXX is the perk id to award, and the\ncolumn contains the points to award\n```\nuser_id, perk_60f7e54b3438386d4b09719a, perk_60f7e55d04d203c77d7f54d9\n60f7e53e944a60af2caa9977, 5, 0\n60f7e55550f30ab39776b834, 3, 1\n```\n","operationId":"createPointAwardImportOperation","parameters":[{"$ref":"#/paths/~1segments~1%3AsegmentId~1awards/parameters/0"},{"name":"dryRun","in":"query","description":"Set `dryRun` to `false` in order to perform the import.  Otherwise, the import file will be processed\nto check for errors, but no awards will be granted.\n","required":false,"default":true,"schema":{"type":"string"}},{"name":"suppressEvents","in":"query","description":"Set `suppressEvents` to `false` to cause all events to be emitted on award granting.\n","required":false,"default":"true,","schema":{"type":"string"}},{"in":"formData","name":"file","type":"file","description":"The csv file of awards to grant"}],"requestBody":{"content":{"multipart/form-data":{"schema":{"type":"object","properties":{"file":{"type":"string","format":"binary"}}}}}},"responses":{"202":{"description":"The bulk award operation was created","content":{"application/json":{"schema":{"$ref":"#/paths/~1users~1imports/post/responses/202/content/application~1json/schema"}}}},"401":{"$ref":"#/paths/~1users/get/responses/401"},"404":{"$ref":"#/paths/~1users/get/responses/404"},"422":{"$ref":"#/paths/~1users/get/responses/422"},"500":{"$ref":"#/paths/~1users/get/responses/500"}}}},"/awards/imports/:fileId":{"get":{"tags":["Awards"],"summary":"Get Bulk Grant Awards Import Result","description":"Download a file of award grant import results.\n\nThe full path including `fileId` is retrieved from the import operation's `href`.\n\nExample Result File:\n\n```\nuser_id,perk_id,points,result,perk_awarded_1,award_awarded_1,points_available_1,error\n5bc074a3bd07b10d8684773e,60f02ff1cbe10f0ecca644a9,1,ok,60f02ff1cbe10f0ecca644a9,63a099fe6f0b6d0eca2fbcaa,1,\n5bd09db25fe1810d99862192,60f02ff1cbe10f0ecca644a9,1,fail,,,,user not found\n```\n","operationId":"getPointAwardImportOperationResults","parameters":[{"name":"fileId","in":"path","description":"The ID of the file to download.","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"A csv file of results","content":{"text/plain":{"schema":{"type":"string","format":"binary"}}}},"401":{"$ref":"#/paths/~1users/get/responses/401"},"404":{"$ref":"#/paths/~1users/get/responses/404"},"422":{"$ref":"#/paths/~1users/get/responses/422"},"500":{"$ref":"#/paths/~1users/get/responses/500"}}}},"/pointawards/:awardId":{"put":{"tags":["Awards"],"summary":"Update Award (PointAward)","description":"Update an award for a user.\n\nUse this method to change the `points` fields associated with an\naward.\n\nUnlike grant, redeem or refund award, no actions are emitted on this call.\n","operationId":"updateAward","parameters":[{"name":"awardId","in":"path","description":"The Id of the award to update.","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"$schema":"http://json-schema.org/draft-07/schema#","title":"Update Award","description":"Update Award","type":"object","allOf":[{"$ref":"#/paths/~1pointperks~1%3AperkId~1awards/post/responses/200/content/application~1json/schema/definitions/pointaward-fields-editable"}]}}}},"responses":{"200":{"description":"The request succeeded"},"401":{"$ref":"#/paths/~1users/get/responses/401"},"404":{"$ref":"#/paths/~1users/get/responses/404"},"422":{"$ref":"#/paths/~1users/get/responses/422"},"500":{"$ref":"#/paths/~1users/get/responses/500"}}}},"/awardenrichments":{"post":{"tags":["Award Enrichments"],"summary":"Create an Award Enrichment","description":"Creates an Award Enrichment for a Loyalty Award or Reward.\n","operationId":"createAwardEnrichment","requestBody":{"content":{"application/json":{"schema":{"$schema":"http://json-schema.org/draft-07/schema#","title":"Create Award Enrichment","description":"Create Award Enrichment request","type":"object","allOf":[{"$ref":"#/paths/~1awardenrichments/post/responses/201/content/application~1json/schema/definitions/create"}]}}}},"responses":{"201":{"description":"The request succeeded","content":{"application/json":{"schema":{"$schema":"http://json-schema.org/draft-07/schema#","title":"Award Enrichment","description":"An Enrichment representing additional data for Awards","type":"object","allOf":[{"$ref":"#/paths/~1awardenrichments/post/responses/201/content/application~1json/schema/definitions/read"},{"$ref":"#/paths/~1awardenrichments/post/responses/201/content/application~1json/schema/definitions/update"},{"$ref":"#/paths/~1awardenrichments/post/responses/201/content/application~1json/schema/definitions/create"}],"definitions":{"points":{"type":"object","properties":{"initial":{"$ref":"#/paths/~1awardenrichments/post/responses/201/content/application~1json/schema/definitions/points/properties/min"},"min":{"type":"integer","minimum":0},"max":{"$ref":"#/paths/~1awardenrichments/post/responses/201/content/application~1json/schema/definitions/points/properties/min"},"step":{"$ref":"#/paths/~1awardenrichments/post/responses/201/content/application~1json/schema/definitions/points/properties/min"},"redemption":{"$ref":"#/paths/~1awardenrichments/post/responses/201/content/application~1json/schema/definitions/points/properties/min"},"maxTotalRedemptions":{"$ref":"#/paths/~1awardenrichments/post/responses/201/content/application~1json/schema/definitions/points/properties/min"}},"additionalProperties":false},"create":{"type":"object","allOf":[{"$ref":"#/paths/~1awardenrichments/post/responses/201/content/application~1json/schema/definitions/update"},{"type":"object","required":["loyaltyRewardId","loyaltyProvider"]}]},"update":{"properties":{"loyaltyRewardId":{"type":"string","description":"A Reward ID representing Pepper PerkID or External Loyalty Reward ID"},"loyaltyProvider":{"type":"string","enum":["PEPPER","SQUARE","POWERCARD","ATREEMO","REVEL","PAYTRONIX"],"description":"The provider of the Loyalty Reward this Enrichment is for"},"title":{"oneOf":[{"type":"string","minLength":1,"maxLength":255},{"type":"null"}]},"token":{"oneOf":[{"type":"string","minLength":1,"maxLength":255},{"type":"null"}]},"template":{"oneOf":[{"type":"string","enum":["PSEUDO_CURRENCY","AD_HOC","STAMP_CARD","LEVEL","CLUB"]},{"type":"null"}]},"basketQualification":{"oneOf":[{"type":"object","properties":{"matchCode":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}]},"maxCount":{"type":"number"},"minimumItems":{"type":"number"},"minimumValue":{"type":"number"},"scope":{"type":"string","enum":["ITEM","CATEGORY","BASKET","ITEM_OR_CATEGORY","CHILD_ITEM","ITEM_AND_CHILD_ITEM"],"description":"The scope to use for selecting qualifying items or cost. ITEM: any item with menu perks field or product id that matches the scopeMatchCode. CATEGORY: any item in category with perks field or category id that matches the scopeMatchCode. ITEM_OR_CATEGORY: Both item and categories are matched against scopeMatchCode.  BASKET: Perk will discount any item in the basket. CHILD_ITEM: any condiment item with menu perks field or product id that matches the scopeMatchCode. ITEM_AND_CHILD_ITEM: any item or condiment item with menu perks field or product id that matches the scopeMatchCode."}}},{"type":"null"}]},"dateTimeRestriction":{"oneOf":[{"type":"object","properties":{"startTime":{"type":"number"},"endTime":{"type":"number"},"daysOfWeek":{"type":"number"},"startDate":{"type":"string"},"endDate":{"type":"string"}}},{"type":"null"}]},"points":{"oneOf":[{"$ref":"#/paths/~1awardenrichments/post/responses/201/content/application~1json/schema/definitions/points"},{"type":"null"}]},"discount":{"oneOf":[{"type":"object","properties":{"value":{"type":"number"},"type":{"type":"string"},"maxValue":{"type":"number"},"maxCount":{"type":"number","minimum":1,"maximum":20},"scope":{"type":"string","enum":["ITEM","CATEGORY","BASKET","ITEM_OR_CATEGORY","CHILD_ITEM","ITEM_AND_CHILD_ITEM"],"description":"Which items in the basket will the perk's discount apply: ITEM: any item with menu perks field that matches the scopeMatchCode. CATEGORY: any item in category that matches the scopeMatchCode. ITEM_OR_CATEGORY: Both item and categories are matched against scopeMatchCode.  BASKET: Perk will discount any item in the basket"},"scopeMatchCode":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}},{"type":"array","items":{"type":"array","items":{"type":"string"}}}]},"rule":{"type":"string","enum":["CHEAPEST","COSTLIEST","ALL","ALL_ALLOCATE","CHEAPEST_ALLOCATE","COSTLIEST_ALLOCATE","CHEAPEST_FIRST","COSTLIEST_FIRST"]},"childItemRule":{"type":"string","enum":["INCLUDE","INCLUDE_MATCHED","EXCLUDE"]},"combinationRule":{"oneOf":[{"type":"string","enum":["MULTI","OWN_QUALIFIER","SINGLE"]},{"type":"null"}]},"discountCharges":{"oneOf":[{"type":"number","description":"Bitwise flags controlling if charge types are discounted.  1: service charges; 2: delivery charges.  The default is 1"},{"type":"null"}]}},"additionalProperties":false},{"type":"null"}]},"visualisation":{"oneOf":[{"type":"object","properties":{"stampImageUrl":{"type":"string"},"stampImageUrlPerStamp":{"type":"object","additionalProperties":{"type":"string"}},"textColour":{"$ref":"#/paths/~1perks/post/responses/201/content/application~1json/schema/definitions/visualisation/properties/textColour"},"stampColour":{"$ref":"#/paths/~1perks/post/responses/201/content/application~1json/schema/definitions/visualisation/properties/textColour"},"stampColourPerStamp":{"type":"object","additionalProperties":{"type":"string"}},"stampBackgroundUrl":{"type":"string"},"stampBackgroundUrlPerStamp":{"type":"object","additionalProperties":{"type":"string"}},"randomiseStampPositions":{"type":"boolean"},"randomiseStampPositionsPerStamp":{"type":"object","additionalProperties":{"type":"boolean"}},"backgroundOverlayColour":{"$ref":"#/paths/~1perks/post/responses/201/content/application~1json/schema/definitions/visualisation/properties/textColour"},"backgroundOverlayOpacity":{"type":"number","minimum":0,"maximum":1},"titleText":{"type":"string"},"subtitleText":{"type":"string"},"description":{"type":"string"},"availableCardCopy":{"type":"string"},"nextCardProgressCopy":{"type":"string"},"textAlignment":{"type":"string","enum":["LEFT","RIGHT","CENTER","JUSTIFY"]},"subtitleTwoText":{"type":"string"},"verticalAlignment":{"type":"string","enum":["TOP","CENTER","BOTTOM"]},"backgroundImageUrl":{"type":"string"},"backgroundImageUrlNoAvailableRedemptions":{"type":"string"},"backgroundImageUrlAvailableRedemptions":{"type":"string"},"showExpiry":{"type":"boolean"},"expiryLabelAnchorStyle":{"type":"string","enum":["BOTTOM_LEFT_CHIP","BOTTOM_RIGHT_CHIP","BOTTOM_MIDDLE_CHIP","BOTTOM_FULL_WIDTH_BAR","TOP_LEFT_CHIP","TOP_RIGHT_CHIP","TOP_MIDDLE_CHIP","TOP_FULL_WIDTH_BAR"]},"expiryLabelDetailStyle":{"type":"string","enum":["BOTTOM_MIDDLE_CHIP","BOTTOM_FULL_WIDTH_BAR","TOP_MIDDLE_CHIP","TOP_FULL_WIDTH_BAR"]},"awardsScreenShape":{"type":"string","enum":["DOUBLE_RECTANGLE","SINGLE_RECTANGLE","LARGE_SQUARE","SMALL_SQUARE"]},"expiryLabelTextStyle":{"type":"string","enum":["NONE","FULL","NARROW"]},"stampsHidden":{"type":"boolean"},"fullCardsIndicatorHidden":{"type":"boolean"},"terms":{"type":"string"},"priority":{"type":"number"}},"additionalProperties":false},{"type":"null"}]},"visualisationOnCurrentStamp":{"oneOf":[{"type":"object","additionalProperties":{"type":"object","properties":{"textColour":{"$ref":"#/paths/~1perks/post/responses/201/content/application~1json/schema/definitions/visualisation/properties/textColour"},"stampImageUrl":{"type":"string"},"stampImageUrlPerStamp":{"type":"object","additionalProperties":{"type":"string"}},"stampColour":{"$ref":"#/paths/~1perks/post/responses/201/content/application~1json/schema/definitions/visualisation/properties/textColour"},"stampColourPerStamp":{"type":"object","additionalProperties":{"type":"string"}},"stampBackgroundUrl":{"type":"string"},"stampBackgroundUrlPerStamp":{"type":"object","additionalProperties":{"type":"string"}},"randomiseStampPositions":{"type":"boolean"},"randomiseStampPositionsPerStamp":{"type":"object","additionalProperties":{"type":"boolean"}},"backgroundOverlayColour":{"$ref":"#/paths/~1perks/post/responses/201/content/application~1json/schema/definitions/visualisation/properties/textColour"},"backgroundOverlayOpacity":{"type":"number","minimum":0,"maximum":1},"titleText":{"type":"string"},"subtitleText":{"type":"string"},"availableCardCopy":{"type":"string"},"nextCardProgressCopy":{"type":"string"},"textAlignment":{"type":"string","enum":["LEFT","RIGHT","CENTER","JUSTIFY"]},"verticalAlignment":{"type":"string","enum":["TOP","CENTER","BOTTOM"]},"backgroundImageUrl":{"type":"string"},"backgroundImageUrlNoAvailableRedemptions":{"type":"string"},"backgroundImageUrlAvailableRedemptions":{"type":"string"},"showExpiry":{"type":"boolean"},"expiryLabelAnchorStyle":{"type":"string","enum":["BOTTOM_LEFT_CHIP","BOTTOM_RIGHT_CHIP","BOTTOM_MIDDLE_CHIP","BOTTOM_FULL_WIDTH_BAR","TOP_LEFT_CHIP","TOP_RIGHT_CHIP","TOP_MIDDLE_CHIP","TOP_FULL_WIDTH_BAR"]},"expiryLabelDetailStyle":{"type":"string","enum":["BOTTOM_MIDDLE_CHIP","BOTTOM_FULL_WIDTH_BAR","TOP_MIDDLE_CHIP","TOP_FULL_WIDTH_BAR"]},"expiryLabelTextStyle":{"type":"string","enum":["NONE","FULL","NARROW"]},"awardsScreenShape":{"type":"string","enum":["DOUBLE_RECTANGLE","SINGLE_RECTANGLE","LARGE_SQUARE","SMALL_SQUARE"]},"stampsHidden":{"type":"boolean"},"fullCardsIndicatorHidden":{"type":"boolean"}},"additionalProperties":false}},{"type":"null"}]},"excludeDiscountIds":{"oneOf":[{"type":"array","items":{"type":"string"}},{"type":"null"}]}}},"read":{"type":"object","allOf":[{"$ref":"#/paths/~1awardenrichments/post/responses/201/content/application~1json/schema/definitions/create"},{"properties":{"_id":{"type":"string","description":"Award Enrichment Id"},"created":{"type":"string","description":"Time created in ISO 8601"},"updated":{"type":"string","description":"Time last updated in ISO 8601"}}}]}}}}}},"401":{"$ref":"#/paths/~1users/get/responses/401"},"404":{"$ref":"#/paths/~1users/get/responses/404"},"422":{"$ref":"#/paths/~1users/get/responses/422"},"500":{"$ref":"#/paths/~1users/get/responses/500"}}},"get":{"tags":["Award Enrichments"],"summary":"Get all Award Enrichments","description":"Retrieves all the Award Enrichments for a Tenant.\n","operationId":"getAllAwardEnrichments","parameters":[{"$ref":"#/paths/~1users/get/parameters/8"},{"$ref":"#/paths/~1users/get/parameters/9"}],"requestBody":null,"responses":{"200":{"description":"The request succeeded","content":{"application/json":{"schema":{"$schema":"http://json-schema.org/draft-07/schema#","title":"Award Enrichments List","description":"A paged list of Award Enrichments","type":"object","properties":{"items":{"type":"array","title":"Award Enrichments","items":{"$ref":"#/paths/~1awardenrichments/post/responses/201/content/application~1json/schema"}},"page":{"$ref":"#/paths/~1perks/get/responses/200/content/application~1json/schema/properties/page"}}}}}},"401":{"$ref":"#/paths/~1users/get/responses/401"},"404":{"$ref":"#/paths/~1users/get/responses/404"},"422":{"$ref":"#/paths/~1users/get/responses/422"},"500":{"$ref":"#/paths/~1users/get/responses/500"}}}},"/awardenrichments/:enrichmentId":{"get":{"tags":["Award Enrichments"],"summary":"Get an Award Enrichment","description":"Retrieves a specific Award Enrichment for a Tenant","operationId":"getAwardEnrichmentById","parameters":[{"name":"enrichmentId","in":"path","description":"The ID of the Award Enrichment to retrieve.","required":true,"schema":{"type":"string"}}],"requestBody":null,"responses":{"200":{"description":"The request succeeded","content":{"application/json":{"schema":{"$ref":"#/paths/~1awardenrichments/post/responses/201/content/application~1json/schema"}}}},"401":{"$ref":"#/paths/~1users/get/responses/401"},"404":{"$ref":"#/paths/~1users/get/responses/404"},"422":{"$ref":"#/paths/~1users/get/responses/422"},"500":{"$ref":"#/paths/~1users/get/responses/500"}}},"delete":{"tags":["Award Enrichments"],"summary":"Delete an Award Enrichment","description":"Delete a specific Award Enrichment for a Tenant.","operationId":"deleteAwardEnrichment","parameters":[{"name":"enrichmentId","in":"path","description":"The unique ID of the Award Enrichment to Delete","required":true,"schema":{"type":"string"}}],"requestBody":null,"responses":{"204":{"description":"The request succeeded"},"401":{"$ref":"#/paths/~1users/get/responses/401"},"404":{"$ref":"#/paths/~1users/get/responses/404"},"422":{"$ref":"#/paths/~1users/get/responses/422"},"500":{"$ref":"#/paths/~1users/get/responses/500"}}},"put":{"tags":["Award Enrichments"],"summary":"Update a Award Enrichment","description":"Update an existing Award Enrichment for a Tenant.","operationId":"updateAwardEnrichment","parameters":[{"name":"enrichmentId","in":"path","description":"The ID of the Award Enrichment to update.","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"$schema":"http://json-schema.org/draft-07/schema#","title":"Update Award Enrichment","description":"Update Award Enrichment request","type":"object","allOf":[{"$ref":"#/paths/~1awardenrichments/post/responses/201/content/application~1json/schema/definitions/update"}]}}}},"responses":{"200":{"description":"The request succeeded","content":{"application/json":{"schema":{"$ref":"#/paths/~1awardenrichments/post/responses/201/content/application~1json/schema"}}}},"401":{"$ref":"#/paths/~1users/get/responses/401"},"404":{"$ref":"#/paths/~1users/get/responses/404"},"422":{"$ref":"#/paths/~1users/get/responses/422"},"500":{"$ref":"#/paths/~1users/get/responses/500"}}}},"/guests":{"post":{"tags":["Guests"],"summary":"Create a Guest Session","description":"\nCreate a guest user, credential and session for allowing guest actions like ordering.\n","operationId":"createGuest","parameters":[{"$ref":"#/paths/~1users/post/headers/0"}],"requestBody":{"content":{"application/json":{"schema":{"$schema":"http://json-schema.org/draft-07/schema#","title":"Guest Session Create","description":"Create a Guest User and Session","type":"object","properties":{"firstName":{"type":"string"},"lastName":{"type":"string"},"fullName":{"type":"string"},"credentials":{"type":"array","items":{"$ref":"#/paths/~1credentials/get/responses/200/content/application~1json/schema/definitions/credentialCreate"}},"hasAgreedToShareData":{"type":"boolean","description":"The user has accepted sharing his/her data for the purposes of using the Tenant's application (GDPR)."},"hasAgreedToReceiveMarketing":{"type":"boolean","description":"The user has accepted receiving marketing messages from or on behalf of the Tenant (GDPR)."},"birthdate":{"type":"string","description":"Birthdate in ISO format - eg 1997-12-25"},"gender":{"type":"string","enum":["FEMALE","MALE"]}}}}}},"responses":{"201":{"description":"The guest session was created.","content":{"application/json":{"schema":{"$schema":"http://json-schema.org/draft-07/schema#","title":"Session with User","description":"A session for a User, together with the User record","allOf":[{"$schema":"http://json-schema.org/draft-07/schema#","title":"Session","description":"A session for a User","type":"object","properties":{"_id":{"type":"string","description":"Id of the session.  This is used as the token value in the auth-token security scheme."},"userId":{"type":"string","description":"Id of the user"},"tenantId":{"type":"string"},"tenantTitle":{"type":"string"},"permanent":{"type":"boolean","description":"Whether or not the session will expire, and thus require a new login request"},"lastName":{"type":"string"},"fullName":{"type":"string"},"state":{"type":"string","enum":["ACTIVE","PENDING"]},"isGuest":{"type":"boolean"},"isPrimary":{"type":"boolean"},"roles":{"type":"array","description":"List of user's roles","items":{"type":"string","enum":["USER","ADMIN"]}}}},{"type":"object","properties":{"user":{"allOf":[{"$ref":"#/paths/~1users/post/responses/201/content/application~1json/schema"},{"type":"object","properties":{"credentials":{"type":"array","items":{"$ref":"#/paths/~1credentials/get/responses/200/content/application~1json/schema/definitions/credentialRead"}}}}]}}}]}}}},"401":{"$ref":"#/paths/~1users/get/responses/401"},"404":{"$ref":"#/paths/~1users/get/responses/404"},"422":{"$ref":"#/paths/~1users/get/responses/422"},"500":{"$ref":"#/paths/~1users/get/responses/500"}}}},"/users/lookup":{"post":{"tags":["Users"],"summary":"Lookup Users","description":"Gets the users specified in the request body.  Useful for retrieving a large batch of users.\n\nThe response is paged.  Use `limit` and `startKey` to control the page returned.\n\n\nOptional User fields `favouriteLocations`, `favouriteProducts`, `extended`, `points`\nare omitted from the response by default.  Specify them in the `include` parameter to have them included.\n\nExtra fields `segmentIds`, `credentials` and `checkin` are also optional.   Specify them in `include` to have them included.\n","operationId":"postUsersLookup","parameters":[{"name":"sort","in":"query","description":"The names of the fields to sort the results by, in decreasing order of precendence.  Allowed values are `updatedAt`, `created`.  Separate each field by a comma.  Prepend the field name with `-` sign to sort that field in descending order.","required":false,"schema":{"type":"string"}},{"name":"include","in":"query","description":"Specify which optional fields to return in the response.  Optional fields are:\n`favouriteLocations`, `favouriteProducts`, `extended`, `points`,\n`credentials`, `checkin` and `segmentIds`\n","required":false,"schema":{"type":"string"}},{"$ref":"#/paths/~1users/get/parameters/8"},{"$ref":"#/paths/~1users/get/parameters/9"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"userIds":{"description":"The ids of the users to retrieve","type":"array","items":{"type":"string"}}},"required":["userIds"]}}}},"responses":{"200":{"description":"The request succeeded","content":{"application/json":{"schema":{"$ref":"#/paths/~1users/get/responses/200/content/application~1json/schema"}}}},"401":{"$ref":"#/paths/~1users/get/responses/401"},"404":{"$ref":"#/paths/~1users/get/responses/404"},"422":{"$ref":"#/paths/~1users/get/responses/422"},"500":{"$ref":"#/paths/~1users/get/responses/500"}}}},"/users":{"get":{"tags":["Users"],"summary":"Get Users","description":"Gets all the users in the system for a Tenant.\n\nThe response is paged.  Use `limit` and `startKey` to control the page returned.\n\nSearch terms supported are `name` and `updatedAfter`.\n\nOptional User fields `favouriteLocations`, `favouriteProducts`, `extended`, `points`\nare omitted from the response by default.  Specify them in the `include` parameter to have them included.\n\nExtra fields `segmentIds`, `credentials` and `checkin` are also optional.   Specify them in `include` to have them included.\n\nThis path is versioned via the `x-api-version` header, which should be '9' or higher.\nWhen x-api-version header is not present, the legacy resource is returned.\n","operationId":"getUsers","parameters":[{"name":"x-api-version","required":false,"in":"header","description":"The behaviour of this path is versioned via the `x-api-version` header.  The version should be an integer number as a string, eg `'2'`.\nFor this endpoint, the supported values are:\n- '1', '2', '3': deprecated behaviour (default)\n- '4' or higher: current behaviour as described here\n","schema":{"type":"number"}},{"name":"name","in":"query","description":"Filter the request by user full names matching this value (minimum 3 characters, case insensitive).","required":false,"schema":{"type":"string"}},{"name":"updatedAfter","in":"query","description":"Filter the request by for users changed or added after this value.  Use ISO date format.","required":false,"schema":{"type":"string"}},{"name":"createdAfter","in":"query","description":"Filter the request by for users created after this value. Use ISO date format.","required":false,"schema":{"type":"string"}},{"name":"credentialId","in":"query","description":"Filter the request by a user's credential i.e email address or phone number","required":false,"schema":{"type":"string"}},{"name":"role","in":"query","description":"Filter the request by for users with the specified role. Valid values are 'GUEST' and 'USER'.","required":false,"schema":{"type":"string"}},{"name":"sort","in":"query","description":"The names of the fields to sort the results by, in decreasing order of precendence.  Allowed values are `updatedAt`, `created`.  Separate each field by a comma.  Prepend the field name with `-` sign to sort that field in descending order.","required":false,"schema":{"type":"string"}},{"name":"include","in":"query","description":"Specify which optional fields to return in the response.  Optional fields are:\n`favouriteLocations`, `favouriteProducts`, `extended`, `points`,\n`credentials`, `checkin` and `segmentIds`\n","required":false,"schema":{"type":"string"}},{"name":"limit","in":"query","description":"Set the response to be paged, and limit by this number of results.  If not provided, a default limit (usually 100) will be used","required":false,"schema":{"type":"number"}},{"name":"startKey","in":"query","description":"Request results to start at the record represented by this key.  You can page through a dataset by making requests, setting `startKey` to the `nextKey` value provided in the last response.","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"The request succeeded","content":{"application/json":{"schema":{"$schema":"http://json-schema.org/draft-07/schema#","title":"User List","description":"A paged list of Users","type":"object","properties":{"items":{"type":"array","description":"A list of Users","items":{"$ref":"#/paths/~1users~1%3AuserId/get/responses/200/content/application~1json/schema"}},"page":{"$ref":"#/paths/~1perks/get/responses/200/content/application~1json/schema/properties/page"}}}}}},"401":{"description":"Access denied","content":{"application/json":{"schema":{"$ref":"#/components/responses/BadRequestError/content/application~1json/schema"}}}},"404":{"description":"Resource not found","content":{"application/json":{"schema":{"$ref":"#/components/responses/BadRequestError/content/application~1json/schema"}}}},"422":{"description":"Unprocessable request.  The request cannot be processed","content":{"application/json":{"schema":{"$ref":"#/components/responses/BadRequestError/content/application~1json/schema"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/responses/BadRequestError/content/application~1json/schema"}}}}}},"post":{"tags":["Users"],"summary":"Create a User","description":"\nCreates an end User for a Tenant.\n\nThe User’s roles property will be populated automatically on the platform based on the context of the\nrequest.  If the request is anonymous, a User with a role of USER will be created. If the request is authenticated\nas an admin User, a User with a role of ADMIN can be created if specified.\n\nIf a credentials.provider value of FACEBOOK is specified, the passed id and token will be validated against\nthe Facebook API and a failure will result in 422 being returned.\n\nWhen a User account is created, the initial value of loyaltyPoints will be determined by the Merchant settings.\n\nIf the User being created has a role of USER and is being created using a MOBILE credential type,\ntheir account state will be set to PENDING. This means they will not be able to login until their account has been activated.\n\nIf the User being created has a role of USER and is being created using a FACEBOOK credential type,\ntheir account state will immediately be set to ACTIVE on successful validation with Facebook.\n\nIf a User is created using credentials that already exist in either the ACTIVE or PENDING state, a 422 will be returned.\n\nIf a non-Admin User is created with a MOBILE credential type, a 4 digit activation code will be sent\nvia SMS to the supplied number. This activation code should be used to activate the account.\n\n### Single Accounts per Device\n\nThe platform will enforce single user accounts for a mobile device (by a tenant) if this is enabled in the tenant settings.\nThe `x-client-platform` header must be sent to identify the platform type.\n","operationId":"createUser","headers":[{"name":"x-client-platform","required":false,"in":"header","description":"Identifies the platform type of the caller.\n","schema":{"type":"string","enum":["ANDROID","IOS"]}}],"parameters":[{"name":"autoActivate","in":"query","description":"Set `autoActivate` to true to skip the user activation process.  Note, to use this, an admin session token must be provided.\n","required":false,"schema":{"type":"string"}},{"name":"awaitExternalAccountSync","in":"query","description":"Set `awaitExternalAccountSync` to true to wait for the external account sync to complete before returning user details.\nNote, this only applies if `autoActivate` is set to `true`.\n","required":false,"schema":{"type":"string"}},{"name":"uniqueDeviceIdAndroid","in":"query","description":"Supports Single Accounts per device. The token that identifies an Android device.\n","required":false,"schema":{"type":"string"}},{"name":"uniqueDeviceIdIOS","in":"query","description":"Supports Single Accounts per device. The token that identifies an iOS device.\n","required":false,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"$schema":"http://json-schema.org/draft-07/schema#","title":"User Create","description":"Fields for creating a User","type":"object","properties":{"firstName":{"type":"string"},"lastName":{"type":"string"},"fullName":{"type":"string"},"credentials":{"type":"array","items":{"$ref":"#/paths/~1credentials/get/responses/200/content/application~1json/schema/definitions/credentialCreate"},"minItems":1},"hasAgreedToShareData":{"type":"boolean","description":"The user has accepted sharing his/her data for the purposes of using the Tenant's application (GDPR)."},"hasAgreedToReceiveMarketing":{"type":"boolean","description":"The user has accepted receiving marketing messages from or on behalf of the Tenant (GDPR)."},"birthdate":{"type":"string"},"gender":{"type":"string","enum":["FEMALE","MALE"]}},"required":["firstName","lastName","credentials"]}}}},"responses":{"201":{"description":"The user was created.","content":{"application/json":{"schema":{"$schema":"http://json-schema.org/draft-07/schema#","title":"User","description":"An end user of a Tenant","type":"object","properties":{"id":{"type":"string","description":"Id of the user"},"tenantId":{"type":"string"},"firstName":{"type":"string"},"lastName":{"type":"string"},"fullName":{"type":"string"},"state":{"type":"string","enum":["ACTIVE","PENDING"]},"isGuest":{"type":"boolean"},"roles":{"type":"array","description":"List of user's roles","items":{"type":"string","enum":["USER","ADMIN"]}},"subscribed":{"type":"boolean","description":"TODO"},"birthdate":{"type":"string"},"tokens":{"type":"object","description":"User validation tokens","properties":{"activation":{"type":"string","description":"Token sent via SMS or email to validate a user"},"reset":{"type":"string","description":"Token sent via SMS or email to validate a user's password reset"}}},"defaultTip":{"type":"object","description":"The defaults for tipping","properties":{"scheme":{"type":"string","enum":["ABSOLUTE","PERCENTAGE"]},"amount":{"type":"number","description":"The percentage (example 15), or an absolute amount."}}},"favouriteLocations":{"type":"array","description":"List of the user's favourite location ids","items":{"type":"string"}},"primaryPlatform":{"type":"string","enum":["UNKNOWN","IOS","ANDROID"]},"contacts":{"type":"object","description":"TODO"},"additionalInformation":{"type":"array","description":"List of extra user information in a display friendly format","items":{"type":"object","properties":{"name":{"type":"string","enum":["birthdate","favouriteProducts","defaultTip"]},"value":{"type":"string","description":"The formatted extra information."}}}},"extended":{"type":"object","description":"Tenant specific extensions.  For example, login data for extra services such as Secret DJ"},"card":{"$ref":"#/paths/~1cards~1%3AcardId/get/responses/200/content/application~1json/schema/definitions/getCard"},"hasPaymentCard":{"type":"boolean"},"hasProfilePhoto":{"type":"boolean"},"isRegisteredForPushNotifications":{"type":"boolean","description":"The user is subscribed to application push notifications."},"hasAgreedToShareData":{"type":"boolean","description":"The user has accepted sharing his/her data for the purposes of using the Tenant's application (GDPR)."},"hasAgreedToReceiveMarketing":{"type":"boolean","description":"The user has accepted receiving marketing messages from or on behalf of the Tenant (GDPR)."},"externalPosId":{"type":"string","description":"The unique id of the user provided by a Point of Sale CRM"},"externalLoyaltyId":{"type":"string","description":"The unique id for the user provided by an external loyalty program"},"updatedAt":{"type":"string","description":"UTC iso formatted date of when the record was last updated (or created)"},"created":{"type":"string","description":"UTC iso formatted date of when the record was created"},"deleted":{"type":"boolean","description":"The user has been deleted, and all his/her data has been redacted."}}}}}},"401":{"$ref":"#/paths/~1users/get/responses/401"},"404":{"$ref":"#/paths/~1users/get/responses/404"},"422":{"$ref":"#/paths/~1users/get/responses/422"},"500":{"$ref":"#/paths/~1users/get/responses/500"}}}},"/users/:ssoProvider/sso":{"post":{"tags":["Users"],"summary":"Login/Create a user via SSO","description":"\nLogs a User into the system via a 3rd party SSO provider and retrieves a session for use in subsequent calls to the API.\n\nIf the user does not exist in the system, a new user will be created from the details supplied in the request body.\n`firstName` and `lastName` are both required to create a new user if one does not exist already.\n\nWhen a User account is created, the initial value of loyaltyPoints will be determined by the Merchant settings.\n\n### Single Accounts per Device\n\nThe platform will enforce single user accounts for a mobile device (by a tenant) if this is enabled in the tenant settings.\nThe `x-client-platform` header must be sent to identify the platform type.\n","operationId":"loginCreateUserViaSSO","headers":[{"$ref":"#/paths/~1users/post/headers/0"}],"parameters":[{"name":"ssoProvider","in":"path","description":"The SSO provider to verify the incoming JWT with\n","required":true,"schema":{"type":"string","enum":["google","apple"]}}],"requestBody":{"content":{"application/json":{"schema":{"$schema":"http://json-schema.org/draft-07/schema#","title":"User SSO","description":"Fields for logging in/signing up a User via SSO","type":"object","properties":{"idToken":{"type":"string","description":"The JWT obtained from the 3rd party SSO provider to authenticate and identify the user"},"firstName":{"type":"string"},"lastName":{"type":"string"},"fullName":{"type":"string"},"hasAgreedToShareData":{"type":"boolean","description":"The user has accepted sharing his/her data for the purposes of using the Tenant's application (GDPR)."},"hasAgreedToReceiveMarketing":{"type":"boolean","description":"The user has accepted receiving marketing messages from or on behalf of the Tenant (GDPR)."},"birthdate":{"type":"string"},"gender":{"type":"string","enum":["FEMALE","MALE"]}},"required":["idToken"]}}}},"responses":{"200":{"description":"The user was logged in and a new Session is returned.","content":{"application/json":{"schema":{"$ref":"#/paths/~1guests/post/responses/201/content/application~1json/schema"}}}},"201":{"description":"A new user was created.","content":{"application/json":{"schema":{"$ref":"#/paths/~1guests/post/responses/201/content/application~1json/schema"}}}},"401":{"$ref":"#/paths/~1users/get/responses/401"},"404":{"$ref":"#/paths/~1users/get/responses/404"},"422":{"$ref":"#/paths/~1users/get/responses/422"},"500":{"$ref":"#/paths/~1users/get/responses/500"}}}},"/users/activate":{"post":{"tags":["Users"],"summary":"Activate a User","description":"Activates a specific User.\n\nThe response is a compound of a `Session` resource, with the User included under `user`.\n\nIf an attempt is made to activate a User that is already active, a 422 will be returned.\n\nIf token is omitted from the POST body, the Platform assumes that the User is re-attempting activation\nand the SMS will be delivered again.\n\nIf an invalid token is provided, the Platform will return a 422.\n\nOn successful activation, the User’s state property will be changed to `ACTIVE`.\n","operationId":"activateUser","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","description":"User's credential id, such as an email or mobile number."},"token":{"type":"string","description":"The activation token.  If this omitted, this request is treated as a request to resend the SMS."}},"required":["id"]}}}},"responses":{"200":{"description":"The user was activated.","content":{"application/json":{"schema":{"$ref":"#/paths/~1guests/post/responses/201/content/application~1json/schema"}}}},"401":{"$ref":"#/paths/~1users/get/responses/401"},"404":{"$ref":"#/paths/~1users/get/responses/404"},"422":{"$ref":"#/paths/~1users/get/responses/422"},"500":{"$ref":"#/paths/~1users/get/responses/500"}}}},"/users/login":{"get":{"tags":["Users"],"summary":"Login a User","description":"\nLogs a User into the system and retrieves a session for use in subsequent calls to the API.\n\nThe request should use Basic authentication.\n\nIf an AuthProvider header of FACEBOOK is used, then the 'Basic' auth token is comprised of the Facebook user\nid as the username, and the session token as the password.\n\nIf the User has a state of `PENDING`, the login will always fail, even if the correct credentials were provided.\n","operationId":"loginUser","security":[{"basic":[]}],"parameters":[{"name":"AuthProvider","in":"header","description":"Which authentication provider should fulfil the request","required":false,"schema":{"type":"string","default":"MOBILE"}}],"requestBody":null,"responses":{"200":{"description":"The user was logged in and a new Session is returned.","content":{"application/json":{"schema":{"$ref":"#/paths/~1guests/post/responses/201/content/application~1json/schema"}}}},"401":{"$ref":"#/paths/~1users/get/responses/401"},"404":{"$ref":"#/paths/~1users/get/responses/404"},"422":{"$ref":"#/paths/~1users/get/responses/422"},"500":{"$ref":"#/paths/~1users/get/responses/500"}}}},"/users/logout":{"get":{"tags":["Users"],"summary":"Logout a User","description":"Logs out a User by Id.","operationId":"logoutUserById","parameters":[{"name":"userId","in":"query","description":"The Id of the User to logout of the system.","required":true,"schema":{"type":"string"}}],"requestBody":null,"responses":{"200":{"description":"The user was logged out."},"401":{"$ref":"#/paths/~1users/get/responses/401"},"404":{"$ref":"#/paths/~1users/get/responses/404"},"422":{"$ref":"#/paths/~1users/get/responses/422"},"500":{"$ref":"#/paths/~1users/get/responses/500"}}}},"/sessions/:userId":{"delete":{"tags":["Sessions"],"summary":"Delete sessions","description":"Removes all the sessions against a userId from the database","operationId":"deleteSessionsById","parameters":[{"name":"userId","in":"path","description":"The unique Id of the user","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"The request was successful"},"401":{"$ref":"#/paths/~1users/get/responses/401"},"404":{"$ref":"#/paths/~1users/get/responses/404"},"422":{"$ref":"#/paths/~1users/get/responses/422"},"500":{"$ref":"#/paths/~1users/get/responses/500"}}},"post":{"tags":["Sessions"],"summary":"Create an admin session","description":"Creates a new admin session","responses":{"201":{"content":{"application/json":{"schema":{"$schema":"http://json-schema.org/draft-07/schema#","title":"Session","description":"A session for an admin user","type":"object","properties":{"_id":{"type":"string","description":"Id of the session.  This is used as the token value in the auth-token security scheme."},"userId":{"type":"string","description":"Id of the admin user"},"tenantId":{"type":"string"},"tenantTitle":{"type":"string"},"permanent":{"type":"boolean","description":"Whether or not the session will expire, and thus require a new login request"},"roles":{"type":"array","items":{"type":"string","enum":["ADMIN"]}}}}}}},"401":{"$ref":"#/paths/~1users/get/responses/401"},"422":{"$ref":"#/paths/~1users/get/responses/422"},"500":{"$ref":"#/paths/~1users/get/responses/500"}}}},"/users/reset":{"post":{"tags":["Users"],"summary":"Reset User Password","description":"\nTo reset a user password, two requests need to be made:\n1. A reset token request to initiate the request and request a token be sent via SMS or email\n  ```js\n  POST /users/reset\n  {\n    \"id\": \"07811555123\"\n  }\n  ```\n2. The new password request, including the reset token request to validate the call\n  ```js\n  POST /users/reset\n  {\n    \"token\": \"3375\",\n    \"username\": \"07811555123\",\n    \"password\": \"password\"\n  }\n   ```\n\nA User who is in the PENDING state cannot request a reset and a 422 will be returned if they attempt to do so.\n","operationId":"resetUser","parameters":[],"requestBody":{"content":{"application/json":{"schema":{"oneOf":[{"type":"object","title":"Password reset token request","properties":{"id":{"type":"string","description":"User's credential id, such as an email or mobile number."}},"required":["id"]},{"type":"object","title":"Password reset","properties":{"username":{"type":"string","description":"User's credential id."},"token":{"type":"string","description":"The token received from the reset token request"},"password":{"type":"string","description":"New password in plaintext"}},"required":["username","password","token"]}]}}}},"responses":{"200":{"description":"The user password reset token was sent"},"401":{"$ref":"#/paths/~1users/get/responses/401"},"404":{"$ref":"#/paths/~1users/get/responses/404"},"422":{"$ref":"#/paths/~1users/get/responses/422"},"500":{"$ref":"#/paths/~1users/get/responses/500"}}}},"/users/:userId":{"get":{"tags":["Users"],"summary":"Get User by Id","description":"Retrieves a User given a user Id\n\nOptional User fields `favouriteLocations`, `favouriteProducts`, `extended`, `points`\nare omitted from the response by default.  Specify them in the `include` parameter to have them included.\n\nExtra fields `segmentids`, `segments`, `credentials` and `checkin` are also optional.   Specify them in `include` to have them included.\n\nThis path is versioned via the `x-api-version` header, which should be '9' or higher.\nWhen x-api-version header is not present, the legacy resource is returned.\n","operationId":"getUserById","parameters":[{"$ref":"#/paths/~1users/get/parameters/0"},{"name":"userId","in":"path","description":"The specific ID of the User to retrieve.","required":true,"schema":{"type":"string"}},{"name":"include","in":"query","description":"Specify which optional fields to return in the response.  Optional fields are:\n`favouriteLocations`, `favouriteProducts`, `extended`, `points`,\n`credentials`, `checkin`, `segmentids`, `segments`\n","required":false,"schema":{"type":"string"}}],"requestBody":null,"responses":{"200":{"description":"The request was successful","content":{"application/json":{"schema":{"$schema":"http://json-schema.org/draft-07/schema#","title":"User","description":"An end user of a Tenant","type":"object","allOf":[{"$ref":"#/paths/~1users/post/responses/201/content/application~1json/schema"},{"$ref":"#/paths/~1users~1%3AuserId/get/responses/200/content/application~1json/schema/definitions/userExtra"}],"definitions":{"userExtra":{"properties":{"credentials":{"type":"array","items":{"$ref":"#/paths/~1credentials/get/responses/200/content/application~1json/schema/definitions/credentialRead"}},"checkin":{"type":"object","$ref":"#/paths/~1users~1%3AuserId/get/responses/200/content/application~1json/schema/definitions/checkin"},"segments":{"type":"array","items":{"$ref":"#/paths/~1users~1%3AuserId/get/responses/200/content/application~1json/schema/definitions/segmentSummary"}},"segmentIds":{"type":"array","description":"Segment Ids that the user belongs to","items":{"type":"string"}}}},"segmentSummary":{"type":"object","description":"Segment Id and title, and included flag set true if the user is in the segment","properties":{"_id":{"type":"string","description":"Id of Segment"},"title":{"type":"string","description":"Segment title"},"included":{"type":"boolean","description":"True if the user is in the segment"}}},"checkin":{"description":"User checkin location details","properties":{"_id":{"type":"string","description":"Checkin Id"},"tenantId":{"type":"string"},"userId":{"type":"string","description":"Id of the user who checked in"},"locationTitle":{"type":"string","description":"Name of location where the user checked in"},"userFullName":{"type":"string","description":"Name of the user who checked in"},"type":{"type":"string","enum":["AUTO","MANUAL","CFD","OFFLINE","UNKNOWN"]},"updated":{"type":"string","description":"UTC iso formatted date of when the record was updated"},"created":{"type":"string","description":"UTC iso formatted date of when the record was created"}}}}}}}},"401":{"$ref":"#/paths/~1users/get/responses/401"},"404":{"$ref":"#/paths/~1users/get/responses/404"},"422":{"$ref":"#/paths/~1users/get/responses/422"},"500":{"$ref":"#/paths/~1users/get/responses/500"}}},"put":{"tags":["Users"],"summary":"Update a User","description":"Updates a specific User with new information.  One or more of the User record's fields can be updated in one call.\n\nThe User’s loyalty `points` cannot be updated via the API. A 422 will result.\n\nA PUT call that includes a property of `apnDeviceToken` or `gcmDeviceToken` will cause a new Apple Push Notification\nor Google Cloud Messaging end-point respectively to be registered for the user on the Amazon Web Services SNS service\nand will allow Users to receive push notifications.\n","operationId":"updateUser","parameters":[{"name":"userId","in":"path","description":"The unique ID of the User to update.","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"$schema":"http://json-schema.org/draft-07/schema#","title":"User Update","description":"Update on a User","type":"object","properties":{"firstName":{"type":"string"},"lastName":{"type":"string"},"fullName":{"type":"string"},"credentials":{"type":"array","items":{"$ref":"#/paths/~1credentials/get/responses/200/content/application~1json/schema/definitions/credentialCreate"}},"birthdate":{"type":"string"},"gender":{"type":"string","enum":["FEMALE","MALE"]},"defaultTip":{"type":"object","description":"The defaults for tipping","properties":{"scheme":{"type":"string","enum":["ABSOLUTE","PERCENTAGE"]},"amount":{"type":"number","description":"The percentage (example 15), or an absolute amount."}}},"favouriteLocations":{"type":"array","description":"List of the user's favourite location ids","items":{"type":"string"}},"primaryPlatform":{"type":"string","enum":["UNKNOWN","IOS","ANDROID"]},"contacts":{"type":"object","description":"TODO"},"extended":{"type":"object","description":"Tenant specific extensions.  For example, login data for extra services such as Secret DJ"},"hasAgreedToShareData":{"type":"boolean","description":"The user has accepted sharing his/her data for the purposes of using the Tenant's application (GDPR)."},"hasAgreedToReceiveMarketing":{"type":"boolean","description":"The user has accepted receiving marketing messages from or on behalf of the Tenant (GDPR)."},"apnDeviceToken":{"type":"string","description":"Cause a new Apple Push Notification end-point to be registered for the user"},"gcmDeviceToken":{"type":"string","description":"Cause a new Google Cloud Messaging end-point to be registered for the user"},"photo":{"type":"string","description":"User image, base 64 encoded"}}},"examples":[{"summary":"Update a property","value":{"firstName":"Wilbert"}},{"summary":"Update a photo","value":{"photo":"data:image/png;base64,iVBORw0KGgoAAAANSUhEU..."}},{"summary":"Remove a photo","value":{"photo":null}},{"summary":"Register for Apple Push Notification","value":{"apnDeviceToken":"1111111d7057049af03af61edf09f7b31dfe684990779284b3f01a076e5e44c4"}}]}}},"responses":{"200":{"description":"The user was updated.","content":{"application/json":{"schema":{"$ref":"#/paths/~1users/post/responses/201/content/application~1json/schema"}}}},"401":{"$ref":"#/paths/~1users/get/responses/401"},"404":{"$ref":"#/paths/~1users/get/responses/404"},"422":{"$ref":"#/paths/~1users/get/responses/422"},"500":{"$ref":"#/paths/~1users/get/responses/500"}}},"delete":{"tags":["Users"],"summary":"Delete a User","description":"\nRemove a User and all their associated records from the system.  Note - internally, the user is marked as `deleted`, and all user information is redacted so that is no longer identifiable.\n\n> Requires `ADMIN` role to delete arbitrary user. `USER` role may delete their own accounts using this endpoint.\n","operationId":"deleteUser","parameters":[{"name":"userId","in":"path","description":"The unique ID of the User to remove.","required":true,"schema":{"type":"string"}},{"name":"deleteLoyaltyAccount","in":"query","description":"\"Defaults to true. If true, the request will attempt to delete the user from the merchant's external loyalty service, if supported and configured.\"\n","required":false},{"name":"deletePosAccount","in":"query","description":"\"Defaults to true. If true, the request will attempt to delete the user from the merchant's pos account, if supported and configured.\"\n","required":false}],"responses":{"200":{"description":"The user was removed from the system"},"401":{"$ref":"#/paths/~1users/get/responses/401"},"404":{"$ref":"#/paths/~1users/get/responses/404"},"422":{"$ref":"#/paths/~1users/get/responses/422"},"500":{"$ref":"#/paths/~1users/get/responses/500"}}}},"/users/:userId/checkins":{"post":{"tags":["Users","Checkins"],"summary":"Create a Checkin for a User","description":"If a Checkin is created for a User that does not already have a profile photo associated with their account,\na status of 422 will be returned and the Checkin will not be created.\n\nIf the User for which a Checkin is being created is already checked in at another Location,\nthe other Checkins will be deleted automatically for them. A User may only be checked in at a single Location at a time.\n\nIf the User is already checked in at the Location, an HTTP status code of 409 (Conflict) will be returned by the API.\n\nCheckins will be automatically deleted after 30 minutes.\n\nIf the POS associated with the Merchant supports it, a notification will be delivered to\nthe Location’s POS when a new Checkin is created.\n","operationId":"createCheckinByUserId","parameters":[{"name":"userId","in":"path","description":"The Id of the User to create the Checkin for.","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"$schema":"http://json-schema.org/draft-07/schema#","title":"Checkin Create","description":"Checkin create request","type":"object","allOf":[{"$ref":"#/paths/~1users~1%3AuserId~1checkins/post/responses/201/content/application~1json/schema/definitions/create"}]}}}},"responses":{"201":{"description":"The user was checked in","content":{"application/json":{"schema":{"$schema":"http://json-schema.org/draft-07/schema#","title":"Checkin","description":"A user checkin record at a location","type":"object","allOf":[{"$ref":"#/paths/~1users~1%3AuserId~1checkins/post/responses/201/content/application~1json/schema/definitions/read"},{"$ref":"#/paths/~1users~1%3AuserId~1checkins/post/responses/201/content/application~1json/schema/definitions/create"}],"definitions":{"create":{"properties":{"locationId":{"type":"string","description":"Location where the user checked in"},"type":{"type":"string","enum":["AUTO","MANUAL","CFD","OFFLINE","UNKNOWN"]},"trigger":{"type":"string","description":"What triggered the checkin to occur","enum":["GEO","BEACON","CODE","POS","UNKNOWN"]}}},"read":{"properties":{"_id":{"type":"string","description":"Checkin Id"},"tenantId":{"type":"string"},"userId":{"type":"string","description":"Id of the user who checked in"},"locationTitle":{"type":"string","description":"Name of location where the user checked in"},"userFullName":{"type":"string","description":"Name of the user who checked in"},"type":{"type":"string","enum":["AUTO","MANUAL","CFD","OFFLINE","UNKNOWN"]},"updated":{"type":"string","description":"UTC iso formatted date of when the record was updated"},"created":{"type":"string","description":"UTC iso formatted date of when the record was created"}}}}}}}},"401":{"$ref":"#/paths/~1users/get/responses/401"},"404":{"$ref":"#/paths/~1users/get/responses/404"},"422":{"$ref":"#/paths/~1users/get/responses/422"},"500":{"$ref":"#/paths/~1users/get/responses/500"}}},"get":{"tags":["Users","Checkins"],"summary":"Get Checkins for a User","description":"Retrieves the Checkins for a specific User.","operationId":"usersuseridcheckins","parameters":[{"name":"userId","in":"path","description":"The unique ID of the User to retrieve the Checkins for.","required":true,"schema":{"type":"string"}},{"name":"per_page","in":"query","description":"Set the response to be paged by this number of results per page.","required":false,"schema":{"type":"string","default":20}},{"name":"page","in":"query","description":"Request a specific page of results in the response.  The first page is page 1","required":false,"schema":{"type":"string","default":1}}],"responses":{"200":{"description":"The list of checkins","content":{"application/json":{"schema":{"$schema":"http://json-schema.org/draft-07/schema#","title":"Checkin List","description":"A paged list of User Checkins","type":"object","properties":{"checkins":{"type":"array","description":"A list of Checkins","items":{"$ref":"#/paths/~1users~1%3AuserId~1checkins/post/responses/201/content/application~1json/schema"}},"summary":{"type":"object","title":"Paging information","description":"Details of the current page and the overall results","properties":{"total":{"type":"number","description":"Total number of records"},"count":{"type":"number","description":"Total number of records in current page"},"pages":{"type":"number","description":"Total number of pages"},"page":{"type":"number","description":"Current page number"}}}}}}}},"401":{"$ref":"#/paths/~1users/get/responses/401"},"404":{"$ref":"#/paths/~1users/get/responses/404"},"422":{"$ref":"#/paths/~1users/get/responses/422"},"500":{"$ref":"#/paths/~1users/get/responses/500"}}}},"/users/:userId/credits":{"post":{"tags":["Users","Credits"],"summary":"Create a Credit for a User","description":"Creates a Credit for a specific User","operationId":"usersuseridcredits-1","parameters":[{"name":"userId","in":"path","description":"The unique ID of the User to create the Credit for.","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"oneOf":[{"$schema":"http://json-schema.org/draft-07/schema#","title":"Using Award","description":"Creates a Credit for a specific User","type":"object","properties":{"scheme":{"type":"string"},"number":{"type":"number"},"description":{"type":"string"},"awardId":{"type":"string","description":"The ID of the Award to be credited"}},"required":["scheme","description","awardId"]},{"$schema":"http://json-schema.org/draft-07/schema#","title":"Using Perk","description":"Creates a Credit for a specific User","type":"object","properties":{"scheme":{"type":"string"},"number":{"type":"number"},"description":{"type":"string"},"perkId":{"type":"string","description":"The ID of the Perk to be credited"},"disableDefaultMessagePrefix":{"type":"boolean","description":"Set true to disable prepending the description with the standard balance update statement"}},"required":["scheme","description","perkId"]}]}}}},"deprecated":false},"get":{"tags":["Users","Credits"],"summary":"Get Credits for a User","description":"Retrieves the Credits for a specific User","operationId":"usersuseridcredits","parameters":[{"name":"userId","in":"path","description":"The unique ID of the User to retrieve the Credits for.","required":true,"schema":{"type":"string"}}],"requestBody":null,"deprecated":false}},"/users/:userId/actions":{"get":{"tags":["Users","Actions"],"summary":"Get Actions for User","description":"Retrieve the Actions for a specific User.\n\nThis path is versioned via the `x-api-version` header, which should be '9' or higher.\n","operationId":"getUsersActions","parameters":[{"name":"userId","in":"path","description":"The unique ID of the User to retrieve the Actions for.","required":true,"schema":{"type":"string"}},{"$ref":"#/paths/~1awards/get/parameters/0"},{"$ref":"#/paths/~1users/get/parameters/8"},{"$ref":"#/paths/~1users/get/parameters/9"},{"name":"when.timestamp[.gt | .lte | .eq | .neq]","in":"query","description":"Filter the response using action `when.timestamp` in comparison to this iso date value.  Valid values of comparison are \n'gt' (for greater than), 'lte', 'eq', 'neq'.  The comparison defaults to 'eq' when not provided\n","required":false,"schema":{"type":"string","format":"date-time"}},{"name":"type[.in | .nin]","in":"query","description":"Filter the response using action 'type' in comparison this list of comma separated types.  Valid values of comparison are \n'in' (for matching any), 'nin' (for not matching any).  The comparison defaults to 'in' when not provided\n","required":false,"schema":{"type":"string"}},{"name":"paymentType[.in | .nin]","in":"query","description":"Filter transactions by payment type. Accepts comma-separated list of OrderPaymentType enum values.\nValid values: CASH_AT_POS, CARD_AT_POS, GIFT_CARD_AT_POS, OTHER_AT_POS, APPLEPAY, GOOGLEPAY, CARD_ON_FILE, CARD_TENDERED, GIFT_CARD, CARDHOLDER_PRESENT, CASH, CARD, OTHER, APP, PAY_BY_BANK.\nUse 'in' (for matching any), 'nin' (for not matching any). The comparison defaults to 'in' when not provided.\n","required":false,"schema":{"type":"string"},"example":"CARDHOLDER_PRESENT,APPLEPAY"}],"responses":{"200":{"description":"The request succeeded","content":{"application/json":{"example":{"actions":[{"type":"XXX_XXX","tenantId":"111111111111111111111111","when":{"timestamp":"YYYY-MM-DDTHH:mm:ss.SSSZ","monthofyear":1,"weekofyear":1,"dayofmonth":1,"dayofweek":1,"daypart":"XXX"},"metadata":{"/* ... */":null},"context":{"tenant":{"_id":"111111111111111111111111","title":"Hooli"},"user":{"_id":"111111111111111111111111","name":"Gavin Belson","primaryPlatform":"IOS"},"location":{"_id":"111111111111111111111111","title":"Hooli Restaurant","geo":[0,0],"regions":[],"tags":[]},"tags":[]},"environment":"PRODUCTION"}]}}}},"401":{"$ref":"#/paths/~1users/get/responses/401"},"404":{"$ref":"#/paths/~1users/get/responses/404"},"422":{"$ref":"#/paths/~1users/get/responses/422"},"500":{"$ref":"#/paths/~1users/get/responses/500"}}}},"/users/:userId/addresses":{"post":{"tags":["Users","Addresses"],"summary":"Create Addresses for User","description":"Create one address for a specific user.","operationId":"createAddressesByUserId","parameters":[{"name":"userId","in":"path","description":"The unique ID of the user to create the address for.","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"$schema":"http://json-schema.org/draft-07/schema#","title":"Address","description":"Fields for creating and updating an Address","type":"object","properties":{"name":{"type":"string"},"address":{"type":"object","properties":{"line1":{"type":"string"},"line2":{"type":"string"},"city":{"type":"string"},"region":{"type":"string"},"postalCode":{"type":"string"},"country":{"type":"string"}},"required":["line1","city","postalCode","country"]},"coordinates":{"$ref":"#/paths/~1addresses~1geocode/post/responses/200/content/application~1json/schema/properties/position"},"note":{"type":"string"}},"required":["address","coordinates"]}}}},"responses":{"201":{"description":"The request succeeded","content":{"application/json":{"example":[{"name":"testName","address":{"line1":"testLine1","line2":"testLine2","city":"testCity","region":"testRegions","postalCode":"AB1 1AB","country":"GB"},"coordinates":[1,1],"note":"testNote","_id":"XXXXXXXXXXXXXXXXXXXXXXXX"}]}}},"400":{"$ref":"#/paths/~1users/get/responses/422"},"401":{"$ref":"#/paths/~1users/get/responses/401"},"500":{"$ref":"#/paths/~1users/get/responses/500"}}}},"/users/:userId/addresses/:addressId":{"put":{"tags":["Users","Addresses"],"summary":"Update Addresses for User","description":"Update one address for a specific user.","operationId":"updateAddressesByUserId","parameters":[{"name":"userId","in":"path","description":"The unique ID of the user to create the address for.","required":true,"schema":{"type":"string"}},{"name":"addressId","in":"path","description":"The unique ID of the address to update.","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/paths/~1users~1%3AuserId~1addresses/post/requestBody/content/application~1json/schema"}}}},"responses":{"200":{"description":"The request succeeded","content":{"application/json":{"example":[{"name":"testName","address":{"line1":"testLine1","line2":"testLine2","city":"testCity","region":"testRegions","postalCode":"AB1 1AB","country":"GB"},"coordinates":[1,1],"note":"testNote","_id":"XXXXXXXXXXXXXXXXXXXXXXXX"}]}}},"400":{"$ref":"#/paths/~1users/get/responses/422"},"401":{"$ref":"#/paths/~1users/get/responses/401"},"404":{"$ref":"#/paths/~1users/get/responses/404"},"500":{"$ref":"#/paths/~1users/get/responses/500"}}},"delete":{"tags":["Users","Addresses"],"summary":"Delete Addresses from User","description":"Delete one address for a specific user.","operationId":"deleteAddressesByUserId","parameters":[{"name":"userId","in":"path","description":"The unique ID of the user to delete the address from.","required":true,"schema":{"type":"string"}},{"name":"addressId","in":"path","description":"The unique ID of the address to delete.","required":true,"schema":{"type":"string"}}],"requestBody":null,"responses":{"200":{"description":"The request succeeded; returns updated address array","content":{"application/json":{"example":[{"name":"remainingAddressName","address":{"line1":"remainingTestLine1","line2":"remainingTestLine2","city":"remainingTestCity","region":"remainingTestRegions","postalCode":"AB1 1AB","country":"GB"},"coordinates":[1,1],"note":"remainingTestNote","_id":"XXXXXXXXXXXXXXXXXXXXXXXX"}]}}},"401":{"$ref":"#/paths/~1users/get/responses/401"},"404":{"$ref":"#/paths/~1users/get/responses/404"},"500":{"$ref":"#/paths/~1users/get/responses/500"}}}},"/users/:userId/credentials":{"get":{"tags":["Users","Credentials"],"summary":"Get user credentials","description":"Retrieves the Credentials for a specific User.","operationId":"usersuseridcredentials","parameters":[{"name":"userId","in":"path","description":"The unique ID of the User to retrieve the Credentials for.","required":true,"schema":{"type":"string"}}],"requestBody":null,"deprecated":false}},"/users/imports":{"post":{"tags":["Users"],"summary":"Start Bulk User Import","description":"Upload a file of users to create, along with and perks and points to award and segments to join.\n\nThe response is an operation resource that can be polled in order to monitor progress.\nWhen complete, the operation will contain a `result.href` field providing a link to download a file\nof results.\n\nRequired columns:\n* user_first_name\n* user_last_name\n* opt_in_marketing in format TRUE | FALSE\n\nCredential columns: 1 or both of these must be provided\n* email\n* mobile in E.164 format\n\nOptional columns:\n* dob - in format YYYY-MM-DD\n* perk - one or more columns containing perk Ids to award to the imported user\n* audience - one or more columns containing audience Ids to add the imported user to\n* points_perk_XXXX - one or more columns.  The perk award Id is parsed from the column suffix XXXX, and the column contains the points to award to the imported user\n* phoneNumberLastUsedToOrder - in E.164 format\n* Address fields - **Note:** line1, city, postalCode, country are all required column values if an address is being provided\n\n    * line1 - Street address, e.g., \"123 Main St.\"\n    * line2 - apartment, suite, building etc. (optional) \n    * city - City name\n    * region - State, province or region (optional)\n    * postalCode - Postal or ZIP code\n    * country - Country code (e.g., 'US', 'GB')\n\n* any other columns - these are echoed to the output results.  eg external user ids, etc\n\n\n\nExample file:\n```\nuser_first_name,user_last_name,dob,email,mobile,opt_in_marketing,points_perk_601689c37e7ef80ebefe4121,perk,perk,audience,audience\nFred,Pitt,1997-01-15,fred@gmail.com,447498886666,FALSE,1,605efeade9965c0ecc921311,603938b47a7e830f22cd524a,605c9d6466a2ac0ea3bc6a85,60393894ab83830f3eaae79b\nJane,Arnold,1999-01-01,jane@gmail.com,447398886666,TRUE,4,605efeade9965c0ecc921311,603938b47a7e830f22cd524a,605c9d6466a2ac0ea3bc6a85,60393894ab83830f3eaae79b\n```\n","operationId":"createUserImportOperation","parameters":[{"$ref":"#/paths/~1segments~1%3AsegmentId~1awards/parameters/0"},{"name":"dryRun","in":"query","description":"Set `dryRun` to `false` in order to perform the import.  Otherwise, the import file will be processed\nto check for errors, but no awards will be granted.\n","required":false,"default":true,"schema":{"type":"string"}},{"name":"suppressEvents","in":"query","description":"Set `suppressEvents` to `false` to cause all events to be emitted during processing.\n","required":false,"default":"true,","schema":{"type":"string"}},{"in":"formData","name":"file","type":"file","description":"The csv file of awards to grant"}],"requestBody":{"content":{"multipart/form-data":{"schema":{"type":"object","properties":{"file":{"type":"string","format":"binary"}}}}}},"responses":{"202":{"description":"The bulk import operation was created","content":{"application/json":{"schema":{"$schema":"http://json-schema.org/draft-07/schema#","title":"File Import Operation","type":"object","allOf":[{"$ref":"#/paths/~1users~1imports/post/responses/202/content/application~1json/schema/definitions/read"},{"$ref":"#/paths/~1users~1imports/post/responses/202/content/application~1json/schema/definitions/create"}],"definitions":{"status":{"enum":["DONE","ERROR","PENDING","TIMEOUT"],"type":"string"},"create":{"properties":{}},"read":{"properties":{"_id":{"type":"string","description":"Operation id"},"tenantId":{"type":"string"},"namespace":{"type":"string","description":"A name identifying the section of the platform the operation is associated with e.g awards, segments"},"entityId":{"type":"string","description":"A reference to a specific entity or function within the area defined by namespace e.g imports, segment ID"},"nonce":{"type":"string","description":"A unique key that prevents non-idempotent operations from occurring twice."},"name":{"type":"string","description":"The name of the operation"},"status":{"$ref":"#/paths/~1users~1imports/post/responses/202/content/application~1json/schema/definitions/status"},"result":{"type":"object","description":"The result of the operation.","properties":{"message":{"type":"string","description":"A progress message"},"etaMs":{"type":"number","description":"The estimated remaining duration in millisecs"},"total":{"type":"number","description":"The total number of records to process"},"skipped":{"type":"number","description":"The total number of records skipped.  For instance, users that are already within a segnment during segment user import"},"imported":{"type":"number","description":"The total number of records successfulyt imported"},"errors":{"type":"number","description":"The total number of users that failed.  The reasons by record will be stored in the results file"},"href":{"type":"string","description":"Path to use in a URL to download the results file"}}},"error":{"$ref":"#/components/responses/BadRequestError/content/application~1json/schema"},"createdAt":{"type":"string","description":"UTC iso formatted date of when the operation was created"},"updatedAt":{"type":"string","description":"UTC iso formatted date of when the operation was updated"},"endedAt":{"type":"string","description":"UTC iso formatted date of when the operation was ended"}}}}}}}},"401":{"$ref":"#/paths/~1users/get/responses/401"},"404":{"$ref":"#/paths/~1users/get/responses/404"},"422":{"$ref":"#/paths/~1users/get/responses/422"},"500":{"$ref":"#/paths/~1users/get/responses/500"}}}},"/users/imports/:fileId":{"get":{"tags":["Users"],"summary":"Get Bulk User Import Result","description":"Download a file of user import results.\n\nThe full path including `fileId` is retrieved from the import operation's `href`.\n\nExample Result File:\n\n```\nuser_first_name,user_last_name,dob,email,mobile,opt_in_marketing,perk,audience,points_perk_601689c37e7ef80ebefe4121,pepper_id,mobile_e164,award_ids,audiences_added,error\nFred,Pitt,1997-01-15,fred@gmail.com,447498886666,FALSE,605efeade9965c0ecc921311; 603938b47a7e830f22cd524a,605c9d6466a2ac0ea3bc6a85; 60393894ab83830f3eaae79b,1,6064b01ff0c1267d8984cc46,+447498886666,601689c37e7ef80ebefe4121.6064b01ff0c1267d8984cc49=1; 605efeade9965c0ecc921311.6064b01ff0c1267d8984cc4a=1; 603938b47a7e830f22cd524a.6064b01ff0c1267d8984cc4b=1,2,\nJane,Arnold,1999-01-01,jane@gmail.com,447398886666,TRUE,605efeade9965c0ecc921311; 603938b47a7e830f22cd524a,605c9d6466a2ac0ea3bc6a85; 60393894ab83830f3eaae79b,4,6064b01ff0c1267d8984cc4e,+447398886666,601689c37e7ef80ebefe4121.6064b020f0c1267d8984cc51=4; 605efeade9965c0ecc921311.6064b020f0c1267d8984cc52=1; 603938b47a7e830f22cd524a.6064b020f0c1267d8984cc53=1,2,\n```\n\nColumn description:\n* user_first_name,user_last_name,dob,email,mobile,opt_in_marketing columns echoed from the import file, along with any other extra columns\n* perk: colon separated list of the parsed perks to grant\n* audience: colon separated list of the parsed audiences to add\n* pepper_id: the pepper user id for the imported user\n* mobile_e164: the parsed mobile, if it was provided\n* award_ids: colon separated list of award information in the format <perkId>.<awardId>=<points available>\n* audiences_added: the count of audiences the user was added to\n* error: colon separated list of errors, if any\n","operationId":"getUserImportOperationResults","parameters":[{"name":"fileId","in":"path","description":"The ID of the file to download.","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"A csv file of results","content":{"text/plain":{"schema":{"type":"string","format":"binary"}}}},"401":{"$ref":"#/paths/~1users/get/responses/401"},"404":{"$ref":"#/paths/~1users/get/responses/404"},"422":{"$ref":"#/paths/~1users/get/responses/422"},"500":{"$ref":"#/paths/~1users/get/responses/500"}}}},"/users/exports":{"post":{"tags":["Users"],"summary":"Create a user export","description":"Generate a CSV export of users with their credentials (emails and phone numbers).\n\n**Requires ADMIN role.**\n\nThe response is an operation resource that can be polled to monitor progress.\nWhen complete, the operation will contain a `result.href` field providing a link to download the zip file.\n\n**File Splitting:** Large exports are automatically split into multiple CSV files within the zip archive.\nFiles are split based on row count (primary mechanism) and file size (safeguard).\n\nThe exported CSV includes the following columns:\n* user_id\n* first_name\n* last_name\n* primary_email\n* secondary_emails (comma-separated)\n* primary_phone\n* secondary_phones (comma-separated)\n* role (primary role only)\n* state\n* has_agreed_to_receive_marketing\n* has_agreed_to_share_data\n* subscribed\n* created_at\n* updated_at\n","operationId":"postUsersExport","parameters":[{"name":"x-pepper-req-nonce","required":true,"in":"header","description":"A unique nonce (e.g. UUID) to prevent duplicate processing. Each new request should have a new nonce.","schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"filters":{"description":"Optional filters to apply to the export","type":"object","properties":{"hasAgreedToReceiveMarketing":{"description":"Filter by marketing opt-in status","type":"boolean"},"role":{"description":"Filter by user role","type":"string","enum":["USER","GUEST"]},"createdAfter":{"description":"Filter users created after this ISO 8601 date","type":"string"},"updatedAfter":{"description":"Filter users updated after this ISO 8601 date","type":"string"}}},"maxFileSizeMB":{"description":"Maximum size of each CSV file in the zip archive (default 220, maximum 220)","type":"number"},"maxRowsPerFile":{"description":"Maximum number of rows per CSV file in the zip archive (default 1000000, maximum 1000000). Files are split by row count first, then by file size as a safeguard.","type":"number"}}}}}},"responses":{"202":{"description":"The bulk export operation was created","content":{"application/json":{"schema":{"$schema":"http://json-schema.org/draft-07/schema#","title":"Operation","description":"An asynchronous operation","type":"object","allOf":[{"$ref":"#/paths/~1users~1exports/post/responses/202/content/application~1json/schema/definitions/read"},{"$ref":"#/paths/~1users~1exports/post/responses/202/content/application~1json/schema/definitions/create"}],"definitions":{"status":{"enum":["DONE","ERROR","PENDING","TIMEOUT"],"type":"string"},"create":{"properties":{}},"read":{"properties":{"_id":{"type":"string","description":"Operation id"},"tenantId":{"type":"string"},"namespace":{"type":"string","description":"A name identifying the area of the platform the operation is associated with e.g segments"},"entityId":{"type":"string","description":"A reference to a specific entity within the area defined by namespace e.g segment ID"},"nonce":{"type":"string","description":"A unique key that prevents non-idempotent operations from occurring twice."},"name":{"type":"string","description":"The name of the operation"},"status":{"$ref":"#/paths/~1users~1exports/post/responses/202/content/application~1json/schema/definitions/status"},"metadata":{"description":"Specific data/parameters associated with the operation. The exact schema of the metadata depends on the specific operation."},"result":{"description":"The result of the operation. The exact schema of the result depends on the specific operation."},"error":{"description":"The error that has occurred if the operation has failed. The exact schema of the error depends on the specific operation."},"isRetryable":{"type":"boolean","description":"Whether or not the operation can be retried."},"createdAt":{"type":"string","description":"UTC iso formatted date of when the operation was created"},"updatedAt":{"type":"string","description":"UTC iso formatted date of when the operation was updated"},"endedAt":{"type":"string","description":"UTC iso formatted date of when the operation was ended"}}}}}}}},"401":{"$ref":"#/paths/~1users/get/responses/401"},"422":{"$ref":"#/paths/~1users/get/responses/422"},"500":{"$ref":"#/paths/~1users/get/responses/500"}}}},"/users/exports/:fileId":{"get":{"tags":["Users"],"summary":"Download a user export","description":"Download a zip file containing CSV export(s) of users.\n\n**Requires ADMIN role.**\n\nThe full path including `fileId` is retrieved from the export operation's `result.href` field.\nThe operation must be in DONE status before the file can be downloaded.\n","operationId":"getUsersExport","responses":{"200":{"description":"A zip file containing CSV export(s) of users","content":{"application/zip":{"schema":{"type":"string","format":"binary"}}}},"401":{"$ref":"#/paths/~1users/get/responses/401"},"404":{"$ref":"#/paths/~1users/get/responses/404"},"500":{"$ref":"#/paths/~1users/get/responses/500"}}}},"/credentials":{"get":{"tags":["Credentials"],"summary":"Get credentials","description":"Get credentials, filtering by matching arguments such as id","operationId":"getCredentials","parameters":[{"name":"id","in":"query","description":"Find credentials matching a specified email or mobile number.\n","required":false,"schema":{"type":"string"}},{"name":"provider","in":"query","description":"Find credentials matching the provider (email, mobile)\n","required":false,"schema":{"type":"string"}},{"name":"sort","in":"query","description":"The names of the fields to sort the results by, in decreasing order of precendence.  Allowed values are `_id`, `id`, `provider`.  Separate each field by a comma.  Prepend the field name with `-` sign to sort that field in descending order.","required":false,"schema":{"type":"string"}},{"$ref":"#/paths/~1users/get/parameters/8"},{"$ref":"#/paths/~1users/get/parameters/9"}],"responses":{"200":{"content":{"application/json":{"schema":{"title":"Credential","description":"A credential that a user has added to their account","type":"object","properties":{"_id":{"type":"string","description":"Id of the new credential record"},"id":{"type":"string","description":"username of the new credential"},"provider":{"type":"string","description":"type of credential","enum":["EMAIL","MOBILE"]},"isVerified":{"type":"string","description":"Indicates whether or not the credential has been verified"},"isPrimary":{"type":"string","description":"Indicates whether this is the credential the user used to register and logs in with"}},"additionalProperties":false,"definitions":{"credentialCreate":{"type":"object","properties":{"provider":{"type":"string","enum":["MOBILE","EMAIL","FACEBOOK"],"description":"The type of the id being sent."},"id":{"type":"string","description":"The id of the user.  This must be unique for a Tenant.  Mobile numbers should be in local format, or full international numbers","examples":["+447770444999","gavin@hotmail.com"]},"token":{"type":"string","description":"For login credential, provide a password in plaintext"}},"required":["provider","id"]},"credentialRead":{"type":"object","description":"User credentials such as email or phone number","properties":{"provider":{"type":"string","enum":["MOBILE","EMAIL","FACEBOOK"],"description":"The type of the id being sent."},"id":{"type":"string","description":"The credential id of the user.  This must be unique for a Tenant.  Mobile numbers should be in local format, or full international numbers","examples":["+447770444999","gavin@hotmail.com"]},"isVerified":{"type":"boolean","description":"Whether or not this credential has been verified"},"isPrimary":{"type":"boolean","description":"The user has this credential as their account logon"}}}}}}}},"401":{"$ref":"#/paths/~1users/get/responses/401"},"404":{"$ref":"#/paths/~1users/get/responses/404"},"422":{"$ref":"#/paths/~1users/get/responses/422"},"500":{"$ref":"#/paths/~1users/get/responses/500"}},"deprecated":false},"post":{"tags":["Credentials"],"summary":"Create a secondary credential for a user","description":"Create a secondary unverified passwordless (user will not be able to log in with) credential for a user. Triggers a verification code to be sent to the user.","operationId":"createCredential","parameters":[],"requestBody":{"content":{"application/json":{"schema":{"title":"Credential Creation Schema","type":"object","properties":{"id":{"type":"string","description":"username of the new credential"},"provider":{"type":"string","description":"type of credential","enum":["EMAIL","MOBILE"]},"skipVerification":{"type":"boolean","description":"Indicates whether verification should be skipped for this credential"}},"additionalProperties":false,"required":["id","provider"]},"example":{"id":"user@pepperhq.com","provider":"EMAIL"}}}},"responses":{"201":{"description":"The credential has been created and verification code has been sent.","content":{"application/json":{"schema":{"$ref":"#/paths/~1credentials/get/responses/200/content/application~1json/schema"},"example":{"_id":"5d3098a0ee2cb3561b704de3","id":"user@pepperhq.com","provider":"EMAIL","isVerified":false,"isPrimary":false}}}},"401":{"$ref":"#/paths/~1users/get/responses/401"},"404":{"$ref":"#/paths/~1users/get/responses/404"},"422":{"$ref":"#/paths/~1users/get/responses/422"},"500":{"$ref":"#/paths/~1users/get/responses/500"}},"deprecated":false}},"/credentials/:credentialId/verification":{"post":{"tags":["Credentials"],"summary":"Verifies a secondary credential for a user","operationId":"verifyCredential","parameters":[{"name":"credentialId","in":"path","description":"The unique ID of the Credential to verify.","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"title":"Credential Verification Schema","type":"object","properties":{"verificationCode":{"type":"string","description":"verification code associated with the credential"}},"additionalProperties":false,"required":["verificationCode"]},"example":{"verificationCode":"1234"}}}},"responses":{"200":{"description":"The credential has been verified","content":{"application/json":{"schema":{"$ref":"#/paths/~1credentials/get/responses/200/content/application~1json/schema"},"example":{"_id":"5d3098a0ee2cb3561b704de3","id":"user@pepperhq.com","provider":"EMAIL","isVerified":true,"isPrimary":false}}}},"422":{"$ref":"#/paths/~1users/get/responses/422"},"500":{"$ref":"#/paths/~1users/get/responses/500"}},"deprecated":false}},"/locations":{"get":{"tags":["Locations"],"summary":"Get Locations","description":"Gets locations for a Tenant filtering based on query parameters\n\nThis path is versioned via the `x-api-version` header.  The current version is '9' or higher.\n","operationId":"getLocations","parameters":[{"name":"state","in":"query","description":"A comma separated list of location states to filter by.  Possible states are 'PENDING', 'ACTIVE', 'RETIRED'","required":false,"default":"ACTIVE","schema":{"type":"string"}},{"name":"lat","in":"query","description":"The latitude of the search centre","required":false,"schema":{"type":"number","format":"double"}},{"name":"long","in":"query","description":"The longitude of the search centre","required":false,"schema":{"type":"number","format":"double"}},{"name":"search","in":"query","description":"Filter to those locations whose title includes the search term, in a comma separated list. The match may be a substring.","required":false,"schema":{"type":"string"}},{"name":"title","in":"query","description":"Title of the location to search for","required":false,"schema":{"type":"string"}},{"name":"favourites","in":"query","description":"Filter to the user's favourite locations","required":false,"schema":{"type":"boolean"}},{"name":"tags","in":"query","description":"Filter locations by tags, in a comma separated list.","required":false,"schema":{"type":"string"}},{"name":"services","in":"query","description":"Filter to the locations which have all the listed services, in a comma separated list.","required":false,"schema":{"type":"boolean"}},{"name":"include","in":"query","description":"Specify which optional fields to return in the response.\n","schema":{"type":"array","items":{"type":"string","enum":["created","updated","state","mainImageUrl","alternativeOpeningHoursText","buttons","links","description","ordering","VATnumber","regions","address","tags","zones"]}},"required":false},{"$ref":"#/paths/~1users/get/parameters/8"},{"$ref":"#/paths/~1users/get/parameters/9"}],"deprecated":false,"responses":{"200":{"description":"The request succeeded","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"$ref":"#/paths/~1locations/post/responses/201/content/application~1json/schema"}},"page":{"$ref":"#/paths/~1perks/get/responses/200/content/application~1json/schema/properties/page"}}}}}},"401":{"$ref":"#/paths/~1users/get/responses/401"},"404":{"$ref":"#/paths/~1users/get/responses/404"},"422":{"$ref":"#/paths/~1users/get/responses/422"},"500":{"$ref":"#/paths/~1users/get/responses/500"}}},"post":{"tags":["Locations"],"summary":"Create a Location","description":"Create a Location\n\nThis path is versioned via the `x-api-version` header.  The current version is '9' or higher.\n","operationId":"addLocation","parameters":[{"name":"x-api-version","required":false,"in":"header","description":"The behaviour of this path is versioned via the `x-api-version` header.  The version should be an integer number as a string, eg `'2'`.\nFor this endpoint, the supported values are:\n- '1' ... '5': deprecated behaviour (default)\n- '6' or higher: current behaviour as described here\n","schema":{"type":"number"}}],"requestBody":{"content":{"application/json":{"schema":{"$schema":"http://json-schema.org/draft-07/schema#","title":"Location Create","description":"Fields for creating a Location","type":"object","allOf":[{"$ref":"#/paths/~1locations/post/responses/201/content/application~1json/schema/definitions/update"},{"required":["title","geo"]}]}}}},"responses":{"201":{"description":"The location was created.","content":{"application/json":{"schema":{"$schema":"http://json-schema.org/draft-07/schema#","title":"Location","description":"A Location is a physical restaurant or shop where orders can be placed","type":"object","allOf":[{"$ref":"#/paths/~1locations/post/responses/201/content/application~1json/schema/definitions/read"},{"$ref":"#/paths/~1locations/post/responses/201/content/application~1json/schema/definitions/update"}],"definitions":{"update":{"properties":{"title":{"type":"string","description":"Name of the location"},"description":{"type":"string","description":"Description of the location"},"state":{"enum":["PENDING","ACTIVE","RETIRED"]},"mainImageUrl":{"type":"string","description":"URL to an image resource"},"listingImageUrl":{"type":"string","description":"URL to an image resource"},"openingHours":{"$ref":"#/paths/~1locations/post/responses/201/content/application~1json/schema/definitions/openingHours"},"alternativeOpeningHoursText":{"type":"string","description":"An HTML snippet that overrides how opening hours are displayed in the app. However, the standard opening hours will still be used to determine when the location is open for ordering. This will replace your standard defined opening hours."},"facilities":{"type":"array","items":{"type":"string"}},"services":{"$ref":"#/paths/~1locations/post/responses/201/content/application~1json/schema/definitions/services"},"buttons":{"type":"array","items":{"$ref":"#/paths/~1locations/post/responses/201/content/application~1json/schema/definitions/button"}},"links":{"$ref":"#/paths/~1locations/post/responses/201/content/application~1json/schema/definitions/links"},"VATnumber":{"type":"string","description":"VAT / sales tax number"},"address":{"$ref":"#/paths/~1locations/post/responses/201/content/application~1json/schema/definitions/address"},"contacts":{"description":"Contact details for the location","properties":{"email":{"type":"string"},"phone":{"type":"string"}}},"beacons":{"type":"array","items":{"type":"object","properties":{"enabled":{"type":"string"},"minor":{"type":"string"},"major":{"type":"string"},"uuid":{"type":"string"}}}},"ordering":{"type":"object","properties":{"extendedFields":{"type":"object","properties":{"PREORDER":{"$ref":"#/paths/~1locations/post/responses/201/content/application~1json/schema/definitions/orderingFields"},"ORDER_TO_TABLE":{"$ref":"#/paths/~1locations/post/responses/201/content/application~1json/schema/definitions/orderingFields"}}}}},"geo":{"type":"array","description":"An array of 2 numbers for longitude, latitude","items":{"type":"number"},"maxItems":2,"minItems":2},"regions":{"type":"array","items":{"type":"string"}},"tags":{"type":"array","items":{"type":"string"}},"mapPinImageUrl":{"type":"string","description":"Optional image url of pin to display to users on map"},"timezone":{"type":"string","description":"Timezone of the location eg Europe/London"},"zones":{"type":"object","description":"List of zones (keyed by the zone name) in the location that describes a set of tables e.g Garden, Indoors.","patternProperties":{"^.*$":{"type":"array","description":"A range of table numbers that this zone covers","items":{"type":"array","items":{"type":"number","description":"A tuple representing the start and end of a range of tables e.g [1, 49] would be tables 1 to 49"}}}},"additionalProperties":false}}},"read":{"properties":{"_id":{"type":"string","description":"Location Id"},"tenantId":{"type":"string","description":"Id of the tenant"},"created":{"type":"string","description":"Time created in ISO 8601"},"updated":{"type":"string","description":"Time last updated in ISO 8601"}}},"openingHours":{"properties":{"monday":{"type":"string","description":"Start to end time in the format HH:mm[am|pm] - HH:mm[am|pm].  Example 11:30am - 09:00pm"},"tuesday":{"type":"string","description":"Start to end time in the format HH:mm[am|pm] - HH:mm[am|pm].  Example 11:30am - 09:00pm"},"wednesday":{"type":"string","description":"Start to end time in the format HH:mm[am|pm] - HH:mm[am|pm].  Example 11:30am - 09:00pm"},"thursday":{"type":"string","description":"Start to end time in the format HH:mm[am|pm] - HH:mm[am|pm].  Example 11:30am - 09:00pm"},"friday":{"type":"string","description":"Start to end time in the format HH:mm[am|pm] - HH:mm[am|pm].  Example 11:30am - 09:00pm"},"saturday":{"type":"string","description":"Start to end time in the format HH:mm[am|pm] - HH:mm[am|pm].  Example 11:30am - 09:00pm"},"sunday":{"type":"string","description":"Start to end time in the format HH:mm[am|pm] - HH:mm[am|pm].  Example 11:30am - 09:00pm"}},"required":["monday","tuesday","wednesday","thursday","friday","saturday","sunday"]},"services":{"description":"Enable or disable different ordering services for the location","properties":{"checkins":{"type":"boolean"},"offline_checkin":{"type":"boolean"},"pre_order":{"type":"boolean"},"book_table":{"type":"boolean"},"book_room":{"type":"boolean"},"tab":{"type":"boolean"},"order_to_table":{"type":"boolean"},"pay_at_table":{"type":"boolean"},"pay_at_table_nfc":{"type":"boolean"},"delivery":{"type":"boolean"},"dine_in":{"type":"boolean"}}},"button":{"description":"Enable or disable different ordering services for the location","properties":{"title":{"type":"string"},"style":{"enum":["PRIMARY","SECONDARY"]},"action":{"enum":["PREORDER","CHECKIN","BROWSER","OPENING_TIMES","OPEN_TAB","TABLE_ORDER","EVENTS"]},"properties":{"properties":{"url":{"type":"string"}}}}},"links":{"description":"Enable or disable different social media and third party services for the location","properties":{"facebook":{"$ref":"#/paths/~1locations/post/responses/201/content/application~1json/schema/definitions/exernalService"},"twitter":{"$ref":"#/paths/~1locations/post/responses/201/content/application~1json/schema/definitions/exernalService"},"foursquare":{"$ref":"#/paths/~1locations/post/responses/201/content/application~1json/schema/definitions/exernalService"},"instagram":{"$ref":"#/paths/~1locations/post/responses/201/content/application~1json/schema/definitions/exernalService"},"uber":{"$ref":"#/paths/~1locations/post/responses/201/content/application~1json/schema/definitions/exernalService"},"hailo":{"$ref":"#/paths/~1locations/post/responses/201/content/application~1json/schema/definitions/exernalService"},"citymapper":{"$ref":"#/paths/~1locations/post/responses/201/content/application~1json/schema/definitions/exernalService"}}},"exernalService":{"properties":{"title":{"type":"string"},"parameters":{"type":"string","description":"the account to use for the social media or third party service"},"enabled":{"type":"boolean"}}},"orderingFields":{"type":"object","properties":{"note":{"type":"array","items":{"type":"object","properties":{"title":{"type":"string"},"description":{"type":"string"}}}}}},"address":{"properties":{"address":{"type":"string","description":"First line of street address"},"address2":{"type":"string","description":"Second line of street address"},"town":{"type":"string"},"country":{"type":"string"},"postcode":{"type":"string"},"summary":{"type":"string","description":"Brief address for display"},"fullAddress":{"type":"string","description":"Full address, comma separated"},"googleMapsShortUrl":{"type":"string","description":"URL of location in google maps "}}}}}}}},"400":{"description":"Invalid request.  The request cannot be processed","content":{"application/json":{"schema":{"$ref":"#/components/responses/BadRequestError/content/application~1json/schema"}}}},"401":{"$ref":"#/paths/~1users/get/responses/401"},"404":{"$ref":"#/paths/~1users/get/responses/404"},"422":{"$ref":"#/paths/~1users/get/responses/422"},"500":{"$ref":"#/paths/~1users/get/responses/500"}}}},"/locations/imports":{"post":{"tags":["Locations"],"summary":"Start Bulk Location Import","description":"Upload a CSV file of locations to create or update.\n\nThe response is an operation resource that can be polled to monitor progress.\nWhen complete, the operation will contain a `result.href` field providing a link to download a file\nof results.\n\n**Required columns:**\n* `title`, `geo_longitude` (-180 to 180), `geo_latitude` (-90 to 90)\n\n**Optional columns:**\n* `_id` - MongoDB ObjectId for updates\n* `state`, `description`, `timezone`, `VATnumber`, `mainImageUrl`, `listingImageUrl`, `mapPinImageUrl`, `alternativeOpeningHoursText`\n* `facilities`, `regions`, `tags` - Pipe-delimited lists (e.g., \"wifi|parking\")\n\n**Nested fields using dot notation:**\n* `address.*` - line1, line2, city, region, postalCode, country\n* `contacts.*` - phone, email\n* `services.*` - checkins, pre_order, book_table, book_room, delivery, dine_in, tab, order_to_table, pay_at_table (boolean)\n* `openingHours.*` - monday, tuesday, etc. (e.g., \"9am-5pm\")\n* `zones.N.*` - Indexed array notation: zones.0.name, zones.0.tables, zones.1.name, etc.\n* `links.PROVIDER.*` - facebook, twitter, instagram, etc.: enabled (boolean), parameters (e.g., \"@handle\")\n\n**Advanced fields (JSON strings for rare use):**\n* `ordering_json`, `buttons_json`, `extended_json`, `beacons_json`, `deliveryBoundaries_json`\n\n**Upsert behavior:** Matches by `_id` → `title` (deterministic) → creates new location\n\n**Example CSV:**\n```\ntitle,geo_longitude,geo_latitude,address.line1,address.city,openingHours.monday,zones.0.name,zones.0.tables\nTest Cafe,-0.1276,51.5074,123 Main St,London,9am-5pm,Ground Floor,[[1,10]]\n```\n","operationId":"createLocationImportOperation","parameters":[{"$ref":"#/paths/~1segments~1%3AsegmentId~1awards/parameters/0"},{"name":"dryRun","in":"query","description":"Set `dryRun` to `false` in order to perform the import.  Otherwise, the import file will be processed\nto check for errors, but no locations will be created or updated.\n","required":false,"default":true,"schema":{"type":"string"}},{"name":"suppressEvents","in":"query","description":"Set `suppressEvents` to `false` to cause all events to be emitted during processing.\n","required":false,"default":true,"schema":{"type":"string"}},{"in":"formData","name":"file","type":"file","description":"The CSV file of locations to import"}],"requestBody":{"content":{"multipart/form-data":{"schema":{"type":"object","properties":{"file":{"type":"string","format":"binary"}}}}}},"responses":{"202":{"description":"The bulk import operation was created","content":{"application/json":{"schema":{"$ref":"#/paths/~1users~1imports/post/responses/202/content/application~1json/schema"}}}},"401":{"$ref":"#/paths/~1users/get/responses/401"},"404":{"$ref":"#/paths/~1users/get/responses/404"},"422":{"$ref":"#/paths/~1users/get/responses/422"},"500":{"$ref":"#/paths/~1users/get/responses/500"}}}},"/locations/imports/:fileId":{"get":{"tags":["Locations"],"summary":"Get Bulk Location Import Result","description":"Download a CSV file of location import results.\nThe full path including `fileId` is retrieved from the operation's `result.href` field.\n\nResult file contains all input columns plus: `locationId` (MongoDB ObjectId), `action` (created|updated), `error` (pipe-delimited messages if any).\n\nExample:\n```\ntitle,geo_longitude,geo_latitude,locationId,action,error\nTest Cafe,-0.1276,51.5074,507f1f77bcf86cd799439011,created,\nBad Location,invalid,-100,,,geo_longitude invalid or missing | geo_latitude must be between -90 and 90\n```\n","operationId":"getLocationImportOperationResults","parameters":[{"name":"fileId","in":"path","description":"The ID of the file to download (from operation result.href)","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"A csv file of results","content":{"text/plain":{"schema":{"type":"string","format":"binary"}}}},"401":{"$ref":"#/paths/~1users/get/responses/401"},"404":{"$ref":"#/paths/~1users/get/responses/404"},"422":{"$ref":"#/paths/~1users/get/responses/422"},"500":{"$ref":"#/paths/~1users/get/responses/500"}}}},"/locations/exports":{"post":{"tags":["Locations"],"summary":"Create a locations export","description":"Generate a CSV export of locations in the same format as the import endpoint.\n\nThe response is an operation resource that can be polled to monitor progress.\nWhen complete, the operation will contain a `result.href` field providing a link to download the CSV file.\n\nThe exported CSV uses dot notation for nested fields (address.city, services.checkins, etc.) and indexed\narray notation for zones (zones.0.name, zones.1.name), ensuring compatibility with the import endpoint.\n","operationId":"postLocationsExport","parameters":[{"$ref":"#/paths/~1segments~1%3AsegmentId~1awards/parameters/0"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"limit":{"description":"Maximum number of locations to export","type":"number"},"filters":{"description":"Optional filters to apply","type":"object","properties":{"state":{"description":"Filter by location state (ACTIVE, PENDING, RETIRED)","type":"string"},"tags":{"description":"Filter by tags (locations matching any tag)","type":"array","items":{"type":"string"}},"regions":{"description":"Filter by regions (locations in any region)","type":"array","items":{"type":"string"}}}}}}}}},"responses":{"202":{"description":"The bulk export operation was created","content":{"application/json":{"schema":{"$ref":"#/paths/~1users~1exports/post/responses/202/content/application~1json/schema"}}}},"401":{"$ref":"#/paths/~1users/get/responses/401"},"404":{"$ref":"#/paths/~1users/get/responses/404"},"422":{"$ref":"#/paths/~1users/get/responses/422"},"500":{"$ref":"#/paths/~1users/get/responses/500"}}}},"/locations/exports/:fileId":{"get":{"tags":["Locations"],"summary":"Download a locations export","description":"Download a CSV export of locations.\n\nThe full path including `fileId` is retrieved from the export operation's `result.href` field.\n","operationId":"getLocationsExport","parameters":[{"name":"fileId","in":"path","description":"The ID of the file to download (from operation result.href)","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"A csv file of locations","content":{"text/plain":{"schema":{"type":"string","format":"binary"}}}},"401":{"$ref":"#/paths/~1users/get/responses/401"},"404":{"$ref":"#/paths/~1users/get/responses/404"},"422":{"$ref":"#/paths/~1users/get/responses/422"},"500":{"$ref":"#/paths/~1users/get/responses/500"}}}},"/locations/:locationId":{"get":{"tags":["Locations"],"summary":"Get Location by Id","description":"Retrieve a specific Location by Id\n","operationId":"getLocationById","parameters":[{"name":"locationId","in":"path","description":"The unique ID of the Location to retrieve.","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"The request was successful","content":{"application/json":{"schema":{"$ref":"#/paths/~1locations/post/responses/201/content/application~1json/schema"}}}},"401":{"$ref":"#/paths/~1users/get/responses/401"},"404":{"$ref":"#/paths/~1users/get/responses/404"},"422":{"$ref":"#/paths/~1users/get/responses/422"},"500":{"$ref":"#/paths/~1users/get/responses/500"}}},"put":{"tags":["Locations"],"summary":"Update a Location","description":"Updates a specific Location with new values.\n\nAny unspecified fields will be left unchanged.\n\nWhen updating an array or map field, the whole field should be replaced even if just updating one part of it.\n","operationId":"updateLocation","parameters":[{"name":"locationId","in":"path","description":"The unique ID of the Location to update.","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"$schema":"http://json-schema.org/draft-07/schema#","title":"Location Update","description":"Fields for updating a Location","type":"object","allOf":[{"$ref":"#/paths/~1locations/post/responses/201/content/application~1json/schema/definitions/update"}]}}}},"responses":{"200":{"description":"The request was successful","content":{"application/json":{"schema":{"$ref":"#/paths/~1locations/post/responses/201/content/application~1json/schema"}}}},"401":{"$ref":"#/paths/~1users/get/responses/401"},"404":{"$ref":"#/paths/~1users/get/responses/404"},"422":{"$ref":"#/paths/~1users/get/responses/422"},"500":{"$ref":"#/paths/~1users/get/responses/500"}}},"delete":{"tags":["Locations"],"summary":"Delete a Location","description":"Deletes a specific Location","operationId":"deleteLocation","parameters":[{"name":"locationId","in":"path","description":"The unique ID of the Location to delete.","required":true,"schema":{"type":"string"}}],"responses":{"204":{"description":"The location was deleted"},"401":{"$ref":"#/paths/~1users/get/responses/401"},"404":{"$ref":"#/paths/~1users/get/responses/404"},"422":{"$ref":"#/paths/~1users/get/responses/422"},"500":{"$ref":"#/paths/~1users/get/responses/500"}}}},"/locations/:locationId/registers":{"post":{"tags":["Locations"],"summary":"Create a Register","description":"Create a Register for a Location","operationId":"locationslocationidregisters-1","parameters":[],"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["title"],"properties":{"title":{"type":"string","description":"The title to create the register with"}}}}}},"deprecated":false},"get":{"tags":["Locations"],"summary":"Get Registers for a Location","description":"Retrieve the Registers for a specific Location","operationId":"locationslocationidregisters","parameters":[{"name":"locationId","in":"path","description":"The unique ID of the Location to retrieve Registers for.","required":true,"schema":{"type":"string"}}],"requestBody":null,"deprecated":false}},"/locations/:locationId/checkins":{"get":{"tags":["Locations"],"summary":"Get Checkins for a Location","description":"Retrieve the Checkins for a specific Location","operationId":"locationslocationidcheckins","parameters":[{"name":"locationId","in":"path","description":"The unique ID of the Location to retrieve the Checkins for.","required":true,"schema":{"type":"string"}},{"name":"per_page","in":"query","description":"How many results to return.","required":false,"schema":{"type":"string","default":"20"}},{"name":"page","in":"query","description":"Which page of results to return.","required":false,"schema":{"type":"string","default":"1"}}],"requestBody":null,"deprecated":false}},"/locations/:locationId/actions":{"get":{"tags":["Locations","Actions"],"summary":"Get Actions for Location","description":"Retrieves the Actions for a specific Location\n\nThis path is versioned via the `x-api-version` header, which should be '9' or higher.\n","operationId":"locationslocationidactions","parameters":[{"name":"locationId","in":"path","description":"The unique ID of the Location to retrieve the Actions for.","required":true,"schema":{"type":"string"}},{"$ref":"#/paths/~1segments/post/parameters/0"},{"$ref":"#/paths/~1users/get/parameters/8"},{"$ref":"#/paths/~1users/get/parameters/9"},{"name":"when.timestamp[.gt | .lte | .eq | .neq]","in":"query","description":"Filter the response using action `when.timestamp` in comparison to this iso date value.  Valid values of comparison are \n'gt' (for greater than), 'lte', 'eq', 'neq'.  The comparison defaults to 'eq' when not provided\n","required":false,"schema":{"type":"string","format":"date-time"}},{"name":"type[.in | .nin]","in":"query","description":"Filter the response using action 'type' in comparison this list of comma separated types.  Valid values of comparison are \n'in' (for matching any), 'nin' (for not matching any).  The comparison defaults to 'in' when not provided\n","required":false,"schema":{"type":"string"}},{"name":"paymentType[.in | .nin]","in":"query","description":"Filter transactions by payment type. Accepts comma-separated list of OrderPaymentType enum values.\nValid values: CASH_AT_POS, CARD_AT_POS, GIFT_CARD_AT_POS, OTHER_AT_POS, APPLEPAY, GOOGLEPAY, CARD_ON_FILE, CARD_TENDERED, GIFT_CARD, CARDHOLDER_PRESENT, CASH, CARD, OTHER, APP, PAY_BY_BANK.\nUse 'in' (for matching any), 'nin' (for not matching any). The comparison defaults to 'in' when not provided.\n","required":false,"schema":{"type":"string"},"example":"CARDHOLDER_PRESENT,APPLEPAY"}],"responses":{"200":{"description":"The request succeeded","content":{"application/json":{"example":{"actions":[{"type":"XXX_XXX","tenantId":"111111111111111111111111","when":{"timestamp":"YYYY-MM-DDTHH:mm:ss.SSSZ","monthofyear":1,"weekofyear":1,"dayofmonth":1,"dayofweek":1,"daypart":"XXX"},"metadata":{"/* ... */":null},"context":{"tenant":{"_id":"111111111111111111111111","title":"Hooli"},"user":{"_id":"111111111111111111111111","name":"Gavin Belson","primaryPlatform":"IOS"},"location":{"_id":"111111111111111111111111","title":"Hooli Restaurant","geo":[0,0],"regions":[],"tags":[]},"tags":[]},"environment":"PRODUCTION"}]}}}},"401":{"$ref":"#/paths/~1users/get/responses/401"},"404":{"$ref":"#/paths/~1users/get/responses/404"},"422":{"$ref":"#/paths/~1users/get/responses/422"},"500":{"$ref":"#/paths/~1users/get/responses/500"}}}},"/locations/:locationId/registers/:registerId":{"delete":{"tags":["Locations"],"summary":"Delete a Register","description":"Delete a specific Register at a Location","operationId":"locationslocationidregistersregisterid-2","parameters":[{"name":"locationId","in":"path","description":"The unique ID of the Location.","required":true,"schema":{"type":"string"}},{"name":"registerId","in":"path","description":"The unique ID of the Register","required":true,"schema":{"type":"string"}}],"requestBody":null,"deprecated":false},"get":{"tags":["Locations"],"summary":"Get a Register","description":"Retrieves a specific Register at a Location","operationId":"locationslocationidregistersregisterid","parameters":[{"name":"locationId","in":"path","description":"The unique ID of the Location.","required":true,"schema":{"type":"string"}},{"name":"registerId","in":"path","description":"The unique ID of the Register at the Location.","required":true,"schema":{"type":"string"}}],"requestBody":null,"deprecated":false},"put":{"tags":["Locations"],"summary":"Update a Register","description":"Update a specific Register at a Location","operationId":"locationslocationidregistersregisterid-1","parameters":[{"name":"locationId","in":"path","description":"The unique ID of the Location.","required":true,"schema":{"type":"string"}},{"name":"registerId","in":"path","description":"The unique ID of the Register.","required":true,"schema":{"type":"string"}}],"requestBody":null,"deprecated":false}},"/locations/taggroups":{"get":{"tags":["Locations"],"summary":"Get Location Tag Groups","description":"Get location tag groups\n","operationId":"getLocationTagGroups","responses":{"200":{"description":"A list of tag groups.","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"$ref":"#/paths/~1locations~1taggroups/put/requestBody/content/application~1json/schema"}}}}}}},"400":{"$ref":"#/paths/~1locations/post/responses/400"},"401":{"$ref":"#/paths/~1users/get/responses/401"},"422":{"$ref":"#/paths/~1users/get/responses/422"},"500":{"$ref":"#/paths/~1users/get/responses/500"}}},"put":{"tags":["Locations"],"summary":"Upsert a Location Tag Group","description":"Upsert a location tag group\n","operationId":"upsertLocationTagGroup","requestBody":{"content":{"application/json":{"schema":{"$schema":"http://json-schema.org/draft-07/schema#","title":"Location Tag Group","description":"Location tag group properties","type":"object","properties":{"id":{"type":"string","description":"The unique id of the tag group"},"title":{"type":"string","description":"The title of the tag group to be displayed to users"},"sort":{"type":"number"},"matchAll":{"type":"boolean","description":"Set to true if filtering locations by multiple tags in this group should require all relevant tags to be present on the location. As opposed to requiring at least one tag to be present on the location"},"tags":{"type":"object","additionalProperties":{"type":"object","properties":{"id":{"type":"string","description":"The unique id of the tag (within the tag group)"},"title":{"type":"string","description":"The title of the tag displayed to users"},"sort":{"type":"number"}},"required":["id","title"]}}},"required":["id","title","matchAll","tags"]}}}},"responses":{"200":{"description":"The tag group was upserted.","content":{"application/json":{"schema":{"$ref":"#/paths/~1locations~1taggroups/put/requestBody/content/application~1json/schema"}}}},"400":{"$ref":"#/paths/~1locations/post/responses/400"},"401":{"$ref":"#/paths/~1users/get/responses/401"},"422":{"$ref":"#/paths/~1users/get/responses/422"},"500":{"$ref":"#/paths/~1users/get/responses/500"}}}},"/locations/taggroups/:locationTagGroupId":{"delete":{"tags":["Locations"],"summary":"Delete a Tag Group","description":"Remove a location tag group\n","operationId":"deleteLocationTagGroup","parameters":[{"name":"locationTagGroupId","in":"path","description":"The unique ID of the location tag group to remove.","required":true,"schema":{"type":"string"}}],"responses":{"204":{"description":"The location tag group was removed from the system"},"401":{"$ref":"#/paths/~1users/get/responses/401"},"404":{"$ref":"#/paths/~1users/get/responses/404"},"422":{"$ref":"#/paths/~1users/get/responses/422"},"500":{"$ref":"#/paths/~1users/get/responses/500"}}}},"/locations/:locationId/deliveryboundaries":{"post":{"tags":["Locations","Delivery Boundaries"],"summary":"Create Delivery Boundaries for Location","description":"Create one delivery boundary for a specific location.","operationId":"createDeliveryBoundaryByLocationId","parameters":[{"name":"locationId","in":"path","description":"The unique ID of the location to create the delivery boundary for.","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"deliveryBoundary":{"$schema":"http://json-schema.org/draft-07/schema#","title":"Delivery Boundary","description":"Fields for creating and updating a Delivery Boundary","type":"object","definitions":{"boundaryPolygon":{"title":"Polygon Boundary","type":"object","properties":{"shape":{"type":"string","enum":["polygon"]},"vertices":{"type":"array","items":{"type":"array","items":{"type":"number"}},"description":"Array of coordinates for the vertices of the polygon.  The first and last coordinates must be the same."},"allowOverlap":{"type":"boolean","description":"Determines if other delivery boundaries can overlap. Only used if delivery boundary type is 'include'."}},"required":["shape","vertices"]},"boundaryCircle":{"title":"Circle Boundary","type":"object","properties":{"shape":{"type":"string","enum":["circle"]},"center":{"$ref":"#/paths/~1addresses~1geocode/post/responses/200/content/application~1json/schema/properties/position","description":"Coordinates of the center of the circle."},"radius":{"type":"number","description":"Radius of the circle in kilometers."},"allowOverlap":{"type":"boolean","description":"Determines if other delivery boundaries can overlap. Only used if delivery boundary type is 'include'."}},"required":["shape","center","radius"]}},"anyOf":[{"$ref":"#/paths/~1locations~1%3AlocationId~1deliveryboundaries/post/requestBody/content/application~1json/schema/properties/deliveryBoundary/definitions/boundaryPolygon"},{"$ref":"#/paths/~1locations~1%3AlocationId~1deliveryboundaries/post/requestBody/content/application~1json/schema/properties/deliveryBoundary/definitions/boundaryCircle"}]},"filter":{"type":"string","enum":["include","exclude"],"description":"Location will only be available if delivery coordinates are within an include boundary AND outside of any exclude boundaries."}},"required":["deliveryBoundary","filter"]}}}},"responses":{"201":{"description":"The request succeeded","content":{"application/json":{"example":{"include":[{"id":"XXXXXXXXXXXXXXXXXX","shape":"circle","center":[37.785834,-122.406417],"radius":10,"allowOverlap":false}],"exlude":[{"id":"XXXXXXXXXXXXXXXXXX","shape":"polygon","coordinates":[[37,-122],[38,-122],[38,-123],[37,-123],[37,-122]]}]}}}},"400":{"$ref":"#/paths/~1locations/post/responses/400"},"401":{"$ref":"#/paths/~1users/get/responses/401"},"422":{"$ref":"#/paths/~1users/get/responses/422"},"500":{"$ref":"#/paths/~1users/get/responses/500"}}}},"/locations/:locationId/deliveryboundaries/:deliveryBoundaryId":{"put":{"tags":["Locations","Delivery Boundaries"],"summary":"Update Delivery Boundaries for Location","description":"Update one delivery boundary for a specific location.","operationId":"updateDeliveryBoundaryByLocationId","parameters":[{"name":"locationId","in":"path","description":"The unique ID of the location to update the delivery boundary  for.","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"deliveryBoundary":{"$ref":"#/paths/~1locations~1%3AlocationId~1deliveryboundaries/post/requestBody/content/application~1json/schema/properties/deliveryBoundary"},"filter":{"type":"string","enum":["include","exclude"],"description":"Location will only be available if delivery coordinates are within an include boundary AND outside of any exclude boundaries."}},"required":["deliveryBoundary","filter"]}}}},"responses":{"200":{"description":"The request succeeded","content":{"application/json":{"example":{"include":[{"id":"XXXXXXXXXXXXXXXXXX","shape":"circle","center":[37.785834,-122.406417],"radius":10,"allowOverlap":false}],"exlude":[{"id":"XXXXXXXXXXXXXXXXXX","shape":"polygon","coordinates":[[37,-122],[38,-122],[38,-123],[37,-123],[37,-122]]}]}}}},"400":{"$ref":"#/paths/~1locations/post/responses/400"},"401":{"$ref":"#/paths/~1users/get/responses/401"},"422":{"$ref":"#/paths/~1users/get/responses/422"},"500":{"$ref":"#/paths/~1users/get/responses/500"}}},"delete":{"tags":["Locations","Delivery Boundaries"],"summary":"Delete Delivery Boundaries from Location","description":"Delete one delivery boundary for a specific location.","operationId":"deleteDeliveryBoundaryByLocationId","parameters":[{"name":"locationId","in":"path","description":"The unique ID of the location to delete the delivery boundary from.","required":true,"schema":{"type":"string"}},{"name":"deliveryBoundaryId","in":"path","description":"The unique ID of the deliveryBoundary to delete.","required":true,"schema":{"type":"string"}}],"requestBody":null,"responses":{"200":{"description":"The request succeeded; returns updated deliveryBoundaries object","content":{"application/json":{"example":{"include":[{"id":"XXXXXXXXXXXXXXXXXX","shape":"circle","center":[37.785834,-122.406417],"radius":10,"allowOverlap":false}],"exlude":[]}}}},"401":{"$ref":"#/paths/~1users/get/responses/401"},"404":{"$ref":"#/paths/~1users/get/responses/404"},"500":{"$ref":"#/paths/~1users/get/responses/500"}}}},"/locations/delivery":{"get":{"tags":["Locations","Delivery"],"summary":"Get Locations for Delivery","description":"Retrieve the locations that are available for delivery for a given pair of co-ordinates.","operationId":"getLocationsForDelivery","parameters":[{"name":"lat","in":"query","description":"Latitude of the delivery location.","required":true,"schema":{"type":"number"}},{"name":"long","in":"query","description":"Longitude of the delivery location.","required":true,"schema":{"type":"number"}},{"name":"include","in":"query","description":"Specify which optional fields to return in the response.\n","schema":{"type":"array","items":{"type":"string","enum":["created","updated","state","mainImageUrl","alternativeOpeningHoursText","buttons","links","description","ordering","VATnumber","regions","address","tags","zones"]}},"required":false}],"requestBody":null,"responses":{"200":{"description":"The request succeeded","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"$ref":"#/paths/~1locations/post/responses/201/content/application~1json/schema"}}}}}}},"400":{"$ref":"#/paths/~1locations/post/responses/400"},"401":{"$ref":"#/paths/~1users/get/responses/401"},"500":{"$ref":"#/paths/~1users/get/responses/500"}}}},"/loyalty/balance":{"get":{"tags":["Loyalty"],"summary":"Get Loyalty Balance","description":"Gets the loyalty balance of the user\n\nThe loyalty provider used is the loyalty provider from the merchant settings, if a provider does not exist,\nor the user does not have a loyalty account Id, then this endpoint will throw an error.\n","operationId":"getLoyaltyBalance","parameters":[{"name":"balanceId","in":"query","description":"A specific balance to get, if the loyalty provider supports multiple balances at once, this is not required if the provider only supports a single balance\n","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"The request succeeded","content":{"application/json":{"schema":{"type":"object","properties":{"balance":{"type":"number"},"type":{"type":"string","enum":["POINTS","MU","FMU"]}}}}}},"401":{"$ref":"#/paths/~1users/get/responses/401"},"404":{"$ref":"#/paths/~1users/get/responses/404"},"422":{"$ref":"#/paths/~1users/get/responses/422"},"500":{"$ref":"#/paths/~1users/get/responses/500"}}}},"/scheduledtasks":{"post":{"tags":["Scheduled Tasks"],"summary":"Create a Scheduled Task","description":"Create a scheduled task for a tenant.\n","operationId":"createScheduledTask","parameters":[],"requestBody":{"content":{"application/json":{"schema":{"$schema":"http://json-schema.org/draft-07/schema#","title":"Create Scheduled Task","description":"Create Scheduled Task Request","type":"object","allOf":[{"$ref":"#/paths/~1scheduledtasks/post/responses/201/content/application~1json/schema/definitions/fields-editable"}]}}}},"responses":{"201":{"description":"The request succeeded","content":{"application/json":{"schema":{"$schema":"http://json-schema.org/draft-07/schema#","title":"Scheduled Task","type":"object","allOf":[{"$ref":"#/paths/~1scheduledtasks/post/responses/201/content/application~1json/schema/definitions/fields-editable"},{"$ref":"#/paths/~1scheduledtasks/post/responses/201/content/application~1json/schema/definitions/fields-readonly"}],"definitions":{"source":{"oneOf":[{"title":"API","properties":{"source":{"type":"string","enum":["API"]}}},{"title":"RULE","properties":{"source":{"type":"string","enum":["RULE"]},"ruleId":{"type":"string","description":"Rule Id"}}}]},"fields-readonly":{"type":"object","properties":{"_id":{"type":"string","description":"Scheduled task Id"},"tenantId":{"type":"string","description":"Id of the tenant"},"locationId":{"type":"string","description":"Id of the location"},"status":{"type":"string","enum":["DRAFT","SCHEDULED","QUEUED","PROCESSING","PROCESSED","ERROR"]},"createdAt":{"type":"string","description":"creation time stamp"},"updatedAt":{"type":"string","description":"last updated time stamp"},"attempts":{"type":"number","description":"number of times the task has been executed"},"queuedAt":{"type":"string","description":"when the task was queued"},"idempotencyKey":{"type":"string","description":"unique key for the task"},"error":{"type":"string"},"source":{"$ref":"#/paths/~1scheduledtasks/post/responses/201/content/application~1json/schema/definitions/source"}},"required":["_id","tenantId","createdAt","updatedAt"]},"base-fields-editable":{"status":{"type":"string","enum":["DRAFT","SCHEDULED"]},"triggerAt":{"type":"string","description":"when the task should be executed"}},"fields-editable":{"anyOf":[{"title":"CREATE_PUSH_NOTIFICATION","allOf":[{"$ref":"#/paths/~1scheduledtasks/post/responses/201/content/application~1json/schema/definitions/base-fields-editable"},{"type":"object","properties":{"type":{"type":"string","enum":["CREATE_PUSH_NOTIFICATION"]},"parameters":{"$ref":"#/paths/~1notifications/post/responses/201/content/application~1json/schema/definitions/messageCreate"}}}]},{"title":"RESET_AWARD_POINTS","type":"object","allOf":[{"$ref":"#/paths/~1scheduledtasks/post/responses/201/content/application~1json/schema/definitions/base-fields-editable"},{"type":"object","properties":{"type":{"type":"string","enum":["RESET_AWARD_POINTS"]},"parameters":{"type":"object","properties":{"userId":{"type":"string"},"awardId":{"type":"string"}},"required":["userId","awardId"]}}}]}]}}}}}},"401":{"$ref":"#/paths/~1users/get/responses/401"},"404":{"$ref":"#/paths/~1users/get/responses/404"},"422":{"$ref":"#/paths/~1users/get/responses/422"},"500":{"$ref":"#/paths/~1users/get/responses/500"}}},"get":{"tags":["Scheduled Tasks"],"summary":"Get All Scheduled Tasks","description":"Retrieve all the scheduled tasks for a tenant\n","operationId":"getAllScheduledTasks","parameters":[],"responses":{"200":{"description":"ScheduledTasks","content":{"application/json":{"schema":{"title":"An array of ScheduledTasks","type":"array","items":{"$ref":"#/paths/~1scheduledtasks/post/responses/201/content/application~1json/schema"}}}}},"401":{"$ref":"#/paths/~1users/get/responses/401"},"404":{"$ref":"#/paths/~1users/get/responses/404"},"422":{"$ref":"#/paths/~1users/get/responses/422"},"500":{"$ref":"#/paths/~1users/get/responses/500"}}}},"/scheduledtasks/:taskId":{"get":{"tags":["Scheduled Tasks"],"summary":"Get a Scheduled Task","description":"Retrieves a specific scheduled task for a tenant\n","operationId":"getScheduledTask","parameters":[{"name":"taskId","in":"path","description":"The ID of the Scheduled Task to retrieve.","required":true,"schema":{"type":"string"}}],"requestBody":null,"responses":{"200":{"description":"The request succeeded","content":{"application/json":{"schema":{"$ref":"#/paths/~1scheduledtasks/post/responses/201/content/application~1json/schema"}}}},"401":{"$ref":"#/paths/~1users/get/responses/401"},"404":{"$ref":"#/paths/~1users/get/responses/404"},"422":{"$ref":"#/paths/~1users/get/responses/422"},"500":{"$ref":"#/paths/~1users/get/responses/500"}}},"delete":{"tags":["Scheduled Tasks"],"summary":"Delete a Scheduled Task","description":"Delete a specific Scheduled Task for a Tenant.","operationId":"deleteScheduledTask","parameters":[{"name":"taskId","in":"path","description":"The unique ID of the Scheduled Task to delete","required":true,"schema":{"type":"string"}}],"requestBody":null,"responses":{"204":{"description":"The request succeeded"},"401":{"$ref":"#/paths/~1users/get/responses/401"},"404":{"$ref":"#/paths/~1users/get/responses/404"},"422":{"$ref":"#/paths/~1users/get/responses/422"},"500":{"$ref":"#/paths/~1users/get/responses/500"}}},"put":{"tags":["Scheduled Tasks"],"summary":"Update a Scheduled Task","description":"Update an existing Scheduled Task for a Tenant.","operationId":"updateScheduledTask","parameters":[{"name":"taskId","in":"path","description":"The ID of the Scheduled Task to update.","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"$schema":"http://json-schema.org/draft-07/schema#","title":"Update Scheduled Task","description":"Update Scheduled Task Request","type":"object","allOf":[{"$ref":"#/paths/~1scheduledtasks/post/responses/201/content/application~1json/schema/definitions/fields-editable"}]}}}},"responses":{"200":{"description":"The request succeeded","content":{"application/json":{"schema":{"$ref":"#/paths/~1scheduledtasks/post/responses/201/content/application~1json/schema"}}}},"401":{"$ref":"#/paths/~1users/get/responses/401"},"404":{"$ref":"#/paths/~1users/get/responses/404"},"422":{"$ref":"#/paths/~1users/get/responses/422"},"500":{"$ref":"#/paths/~1users/get/responses/500"}}}},"/scheduledtasks/:taskId/queue":{"put":{"tags":["Scheduled Tasks"],"summary":"Forcibly queue a Scheduled Task","description":"Forcibly queues a specific Scheduled Task for a Tenant. This will cause the task to execute as soon as possible, regardless of its triggerAt time.\n","operationId":"queueScheduledTask","parameters":[{"name":"taskId","in":"path","description":"The ID of the Scheduled Task to queue.","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"The request succeeded","content":{"application/json":{"schema":{"$ref":"#/paths/~1scheduledtasks/post/responses/201/content/application~1json/schema"}}}},"401":{"$ref":"#/paths/~1users/get/responses/401"},"404":{"$ref":"#/paths/~1users/get/responses/404"},"422":{"$ref":"#/paths/~1users/get/responses/422"},"500":{"$ref":"#/paths/~1users/get/responses/500"}}}},"/segments":{"post":{"tags":["Segments"],"summary":"Create a Segment","description":"Creates a Segment for a Tenant.\n\nThis path is versioned via the `x-api-version` header, which should be '9' or higher.\n","operationId":"createSegment","parameters":[{"name":"x-api-version","required":false,"in":"header","description":"The behaviour of this path is versioned via the `x-api-version` header.  The version should be an integer number as a string, eg `'2'`.\nFor this endpoint, the supported values are:\n- '1' ... '8': deprecated behaviour (default)\n- '9' or higher: current behaviour as described here\n","schema":{"type":"number"}}],"requestBody":{"content":{"application/json":{"schema":{"$schema":"http://json-schema.org/draft-07/schema#","title":"Create Segment","description":"Create Segment request","type":"object","allOf":[{"$ref":"#/paths/~1segments/post/responses/201/content/application~1json/schema/definitions/create"}]}}}},"responses":{"201":{"description":"The request succeeded","content":{"application/json":{"schema":{"$schema":"http://json-schema.org/draft-07/schema#","title":"Segment","description":"A Segment representing a group of users","type":"object","allOf":[{"$ref":"#/paths/~1segments/post/responses/201/content/application~1json/schema/definitions/read"},{"$ref":"#/paths/~1segments/post/responses/201/content/application~1json/schema/definitions/update"}],"definitions":{"create":{"properties":{"title":{"type":"string","description":"Name of the segment"},"description":{"type":"string","description":"Segment description"},"type":{"enum":["PERSISTENT","ROLLING","SCHEDULED"],"description":"Scheme for managing expiring user segment membership"},"expiryHorizon":{"type":"number","description":"Depends on type value - sets the duration in seconds that users should remain as a segment member"}},"required":["title","type"]},"update":{"properties":{"title":{"type":"string","description":"Name of the segment"},"description":{"type":"string","description":"Segment description"},"type":{"enum":["PERSISTENT","ROLLING","SCHEDULED"],"description":"Scheme for managing expiring user segment membership"},"expiryHorizon":{"type":"number","description":"Depends on type value - sets the duration in seconds that users should remain as a segment member"}}},"read":{"properties":{"_id":{"type":"string","description":"Segment Id"},"tenantId":{"type":"string","description":"Id of the tenant"},"created":{"type":"string","description":"Time created in ISO 8601"},"updated":{"type":"string","description":"Time last updated in ISO 8601"}}}}}}}},"401":{"$ref":"#/paths/~1users/get/responses/401"},"404":{"$ref":"#/paths/~1users/get/responses/404"},"422":{"$ref":"#/paths/~1users/get/responses/422"},"500":{"$ref":"#/paths/~1users/get/responses/500"}}},"get":{"tags":["Segments"],"summary":"Get all Segments","description":"Retrieves all the Segments for a Tenant.  Extra fields can be specified by using the `include` parameter.\nThis path is versioned via the `x-api-version` header, which should be '12' or higher.\n","operationId":"getAllSegments","parameters":[{"name":"x-api-version","required":false,"in":"header","description":"The behaviour of this path is versioned via the `x-api-version` header.  The version should be an integer number as a string, eg `'2'`.\nFor this endpoint, the supported values are:\n- '1' ... '11': deprecated behaviour (default)\n- '12' or higher: current behaviour as described here\n","schema":{"type":"number"}},{"$ref":"#/paths/~1users/get/parameters/8"},{"$ref":"#/paths/~1users/get/parameters/9"},{"name":"include","in":"query","description":"A comma separated list of extra fields to return.  Possible fields are: `count` (current user count),\n`metrics` (list of calculated metric values)\n","schema":{"type":"string"}}],"requestBody":null,"responses":{"200":{"description":"The request succeeded","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","title":"Segments","items":{"allOf":[{"$ref":"#/paths/~1segments/post/responses/201/content/application~1json/schema"},{"properties":{"count":{"type":"number","title":"Count of users in segment"},"metrics":{"type":"array","title":"Calculated metric values","items":{"type":"object","properties":{"definitionId":{"type":"string"},"metricId":{"type":"string"},"value":{"type":"number"},"updatedAt":{"type":"string"}}}}}}]}},"page":{"$ref":"#/paths/~1perks/get/responses/200/content/application~1json/schema/properties/page"}}}}}},"401":{"$ref":"#/paths/~1users/get/responses/401"},"404":{"$ref":"#/paths/~1users/get/responses/404"},"422":{"$ref":"#/paths/~1users/get/responses/422"},"500":{"$ref":"#/paths/~1users/get/responses/500"}}}},"/segments/:segmentId":{"parameters":[{"name":"x-api-version","required":false,"in":"header","description":"The behaviour of this path is versioned via the `x-api-version` header.  The version should be an integer number as a string, eg `'2'`.\nFor this endpoint, the supported values are:\n- '1', '2': deprecated behaviour (default)\n- '3' or higher: current behaviour as described here\n","schema":{"type":"number"}}],"get":{"tags":["Segments"],"summary":"Get a Segment","description":"Retrieves a specific Segment for a Tenant","operationId":"getSegmentById","parameters":[{"name":"segmentId","in":"path","description":"The ID of the Segment to retrieve.","required":true,"schema":{"type":"string"}}],"requestBody":null,"responses":{"200":{"description":"The request succeeded","content":{"application/json":{"schema":{"$ref":"#/paths/~1segments/post/responses/201/content/application~1json/schema"}}}},"401":{"$ref":"#/paths/~1users/get/responses/401"},"404":{"$ref":"#/paths/~1users/get/responses/404"},"422":{"$ref":"#/paths/~1users/get/responses/422"},"500":{"$ref":"#/paths/~1users/get/responses/500"}}},"delete":{"tags":["Segments"],"summary":"Delete a Segment","description":"Delete a specific Segment for a Tenant.","operationId":"deleteSegment","parameters":[{"name":"segmentId","in":"path","description":"The unique ID of the Segment to Delete","required":true,"schema":{"type":"string"}}],"requestBody":null,"responses":{"204":{"description":"The request succeeded"},"401":{"$ref":"#/paths/~1users/get/responses/401"},"404":{"$ref":"#/paths/~1users/get/responses/404"},"422":{"$ref":"#/paths/~1users/get/responses/422"},"500":{"$ref":"#/paths/~1users/get/responses/500"}}},"put":{"tags":["Segments"],"summary":"Update a Segment","description":"Update an existing Segment for a Tenant.","operationId":"updateSegment","parameters":[{"name":"segmentId","in":"path","description":"The ID of the Segment to update.","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"$schema":"http://json-schema.org/draft-07/schema#","title":"Update Segment","description":"Update Segment request","type":"object","allOf":[{"$ref":"#/paths/~1segments/post/responses/201/content/application~1json/schema/definitions/update"}]}}}},"responses":{"200":{"description":"The request succeeded","content":{"application/json":{"schema":{"$ref":"#/paths/~1segments/post/responses/201/content/application~1json/schema"}}}},"401":{"$ref":"#/paths/~1users/get/responses/401"},"404":{"$ref":"#/paths/~1users/get/responses/404"},"422":{"$ref":"#/paths/~1users/get/responses/422"},"500":{"$ref":"#/paths/~1users/get/responses/500"}}}},"/segments/:segmentId/users":{"parameters":[{"$ref":"#/paths/~1segments~1%3AsegmentId/parameters/0"}],"post":{"tags":["Segments"],"summary":"Add Users to a Segment","description":"Add a list of user Ids to the Segment.\n\nThe maximum users you can add at a time is 100.\n\nIt is safe to add users who are already a member, but note it will reset their expiry time for ROLLING segments.\n","operationId":"addSegmentUsers","parameters":[{"name":"segmentId","in":"path","description":"The ID of the Segment to add users to","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"title":"User ID array","description":"An array of User Ids.","type":"array","items":{"type":"string","description":"user Id"}}}}},"responses":{"201":{"description":"The request succeeded","content":{"application/json":{"schema":{"title":"Users added count","type":"object","properties":{"added":{"type":"number","description":"How many users were successfully added"}}}}}},"401":{"$ref":"#/paths/~1users/get/responses/401"},"404":{"$ref":"#/paths/~1users/get/responses/404"},"422":{"$ref":"#/paths/~1users/get/responses/422"},"500":{"$ref":"#/paths/~1users/get/responses/500"}}},"get":{"tags":["Segments"],"summary":"Get Segment Users","description":"Fetch a paged list of users in the segment.  The request can be optionaly expanded with extra user fields.\n","operationId":"getAllSegmentUsers","parameters":[{"name":"segmentId","in":"path","description":"The Id of the Segment","required":true,"schema":{"type":"string"}},{"name":"expand","in":"query","style":"form","description":"Optional list of extra user fields to be returned in addition to the User Id.  Eg `expand=fullName,state`","required":false,"schema":{"type":"string"}},{"$ref":"#/paths/~1users/get/parameters/8"},{"$ref":"#/paths/~1users/get/parameters/9"}],"requestBody":null,"responses":{"200":{"description":"The request succeeded.  If the request contained an `expand` parameter, then the response will also contain the requested fields.","content":{"application/json":{"schema":{"$schema":"http://json-schema.org/draft-07/schema#","title":"Segment Users List","description":"A paged list of the user members of the segment","type":"object","properties":{"items":{"type":"array","title":"Segment Users","items":{"$schema":"http://json-schema.org/draft-07/schema#","title":"Segment","description":"A Segment representing a group of users","type":"object","properties":{"userId":{"type":"string","description":"Id of the user"},"expires":{"type":"string","description":"Time the user will be expired from the segment, if the segment is ROLLING or SCHEDULED.  The format is ISO 8601"}}}},"page":{"$ref":"#/paths/~1perks/get/responses/200/content/application~1json/schema/properties/page"}}}}}},"401":{"$ref":"#/paths/~1users/get/responses/401"},"404":{"$ref":"#/paths/~1users/get/responses/404"},"422":{"$ref":"#/paths/~1users/get/responses/422"},"500":{"$ref":"#/paths/~1users/get/responses/500"}}},"delete":{"tags":["Segments"],"summary":"Remove Users from a Segment","description":"Remove a list of user Ids from the Segment.\n\nThe maximum users you can remove at a time is 100.\n\nIt is safe to try and remove users who are not in the segment.\n","operationId":"deleteSegmentUsers","parameters":[{"name":"segmentId","in":"path","description":"The ID of the Segment to add users to","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"title":"User ID array","description":"An array of User Ids","type":"array","items":{"type":"string","description":"user Id"}}}}},"responses":{"200":{"description":"The request succeeded","content":{"application/json":{"schema":{"title":"Users removed count","type":"object","properties":{"removed":{"type":"number","description":"How many users were successfully removed"}}}}}},"401":{"$ref":"#/paths/~1users/get/responses/401"},"404":{"$ref":"#/paths/~1users/get/responses/404"},"422":{"$ref":"#/paths/~1users/get/responses/422"},"500":{"$ref":"#/paths/~1users/get/responses/500"}}}},"/segments/:segmentId/users/imports":{"post":{"tags":["Segments"],"summary":"Start Bulk Segment User Import","description":"Upload a file of users and add them to a segment if not already in the segment.\nIf they are already in the segment, then reset their expiry according to the segment\ntype and `expiryDate` parameter.\n\nThe response is an operation resource that can be polled in order to monitor progress.\nWhen complete, the operation will contain a `result.href` field providing a link to download a file\nof results.\n\nNote: no events are emitted as part of this bulk import action.\n\nSupported import file formats:\n\n```\nuser_id\n60f7e53e944a60af2caa9977\n60f7e55550f30ab39776b834\n```\n","operationId":"createSegmentUserImportOperation","parameters":[{"$ref":"#/paths/~1segments~1%3AsegmentId~1awards/parameters/0"},{"name":"segmentId","in":"path","description":"The ID of the segment to add the users to.","required":true,"schema":{"type":"string"}},{"name":"expiryDate","in":"query","description":"An ISO 8061 date string.  Added users will have this expiryDate set for SCHEDULED or ROLLING segment types.\nExisting users will have their expiryDate reset (ROLLING segment only).\n","required":false,"default":"Now plus the segment's `expiryHorizon`","schema":{"type":"string"}},{"name":"dryRun","in":"query","description":"Set `dryRun` to `false` in order to perform the import.  Otherwise, the import file will be processed\nto check for errors, but no users will be added.\n","required":false,"default":true,"schema":{"type":"string"}},{"in":"formData","name":"file","type":"file","description":"The csv file of awards to grant"}],"requestBody":{"content":{"multipart/form-data":{"schema":{"type":"object","properties":{"file":{"type":"string","format":"binary"}}}}}},"responses":{"202":{"description":"The bulk segment user import operation was created","content":{"application/json":{"schema":{"$ref":"#/paths/~1users~1imports/post/responses/202/content/application~1json/schema"}}}},"401":{"$ref":"#/paths/~1users/get/responses/401"},"404":{"$ref":"#/paths/~1users/get/responses/404"},"422":{"$ref":"#/paths/~1users/get/responses/422"},"500":{"$ref":"#/paths/~1users/get/responses/500"}}}},"/segments/:segmentId/users/imports/:fileId":{"get":{"tags":["Segments"],"summary":"Get Bulk Segment User Import Result","description":"Download a file of segment user import results.\n\nThe full path including `fileId` is retrieved from the import operation's `href`.\n\nExample Result File:\n\n```\nuser_id,result,error\n60f7e53e944a60af2caa9977,ok,\n60f7e55550f30ab39776b834,exists,\n60f7ef021a12d8ddf3ed8a24,fail,user not found\n```\n","operationId":"getSegmentUserImportOperationResults","parameters":[{"name":"fileId","in":"path","description":"The ID of the file to download.","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"A csv file of results","content":{"text/plain":{"schema":{"type":"string","format":"binary"}}}},"401":{"$ref":"#/paths/~1users/get/responses/401"},"404":{"$ref":"#/paths/~1users/get/responses/404"},"422":{"$ref":"#/paths/~1users/get/responses/422"},"500":{"$ref":"#/paths/~1users/get/responses/500"}}}},"/segments/:segmentId/awards":{"parameters":[{"name":"x-pepper-req-nonce","required":false,"in":"header","description":"This call requires a nonce in this header to prevent duplicate processing of calls.  The nonce value represents an individual call.\nIt should be set to a guid.  Each new call should have a new guid.  In the rare occasion you want to repeat a call, use the original guid value.\n","schema":{"type":"string"}}],"post":{"tags":["Segments"],"summary":"Grant Perk to Segment Users","description":"Grants a perk to all users in a segment who don't already have it.\n","operationId":"grantPerkToSegmentUsers","parameters":[{"name":"segmentId","in":"path","description":"The ID of the Segment used to grant the perk","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"$schema":"http://json-schema.org/draft-07/schema#","title":"Create Segment Award Operation","type":"object","properties":{"perkId":{"type":"string","description":"Id of the perk to award"},"points":{"type":"string","description":"Amount of points to award"}}}}}},"responses":{"202":{"description":"The request was accepted","content":{"application/json":{"schema":{"$schema":"http://json-schema.org/draft-07/schema#","title":"Segment Award Operation","type":"object","allOf":[{"$ref":"#/paths/~1segments~1%3AsegmentId~1awards/post/responses/202/content/application~1json/schema/definitions/read"},{"$ref":"#/paths/~1segments~1%3AsegmentId~1awards/post/responses/202/content/application~1json/schema/definitions/create"}],"definitions":{"status":{"enum":["DONE","ERROR","PENDING","TIMEOUT"],"type":"string"},"create":{"properties":{}},"read":{"properties":{"_id":{"type":"string","description":"Operation id"},"tenantId":{"type":"string"},"namespace":{"type":"string","description":"A name identifying the area of the platform the operation is associated with e.g segments"},"entityId":{"type":"string","description":"A reference to a specific entity within the area defined by namespace e.g segment ID"},"nonce":{"type":"string","description":"A unique key that prevents non-idempotent operations from occurring twice."},"name":{"type":"string","description":"The name of the operation"},"status":{"$ref":"#/paths/~1segments~1%3AsegmentId~1awards/post/responses/202/content/application~1json/schema/definitions/status"},"result":{"type":"object","description":"The result of the operation.","properties":{"total":{"type":"string","description":"The total number of users in the segment that the perk will be awarded to"},"skipped":{"type":"string","description":"The total number of users in the segment that have been skipped. This could be because the user has already received the award."},"successes":{"type":"string","description":"The total number of users in the segment that the perk has successfully been awarded to"},"errors":{"type":"string","description":"The total number of users in the segment that the perk has failed to been awarded to"}}},"error":{"$ref":"#/components/responses/BadRequestError/content/application~1json/schema"},"createdAt":{"type":"string","description":"UTC iso formatted date of when the operation was created"},"updatedAt":{"type":"string","description":"UTC iso formatted date of when the operation was updated"},"endedAt":{"type":"string","description":"UTC iso formatted date of when the operation was ended"}}}}}}}},"401":{"$ref":"#/paths/~1users/get/responses/401"},"404":{"$ref":"#/paths/~1users/get/responses/404"},"422":{"$ref":"#/paths/~1users/get/responses/422"},"500":{"$ref":"#/paths/~1users/get/responses/500"}}}},"/users/:userId/segments":{"get":{"tags":["Users","Segments"],"summary":"Get a User's Segments","description":"This endpoint is deprecated.  Use `GET /users/:userId?include=segmentIds` or `GET /users/:userId?include=segments`instead\n\nRetrieve the Segments that the user is in.\n","operationId":"getUserSegments","parameters":[{"name":"userId","in":"path","description":"The Id of the User","required":true,"schema":{"type":"string"}}],"requestBody":null,"responses":{"200":{"description":"The request succeeded.","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/paths/~1users~1%3AuserId/get/responses/200/content/application~1json/schema/definitions/segmentSummary"}}}}},"401":{"$ref":"#/paths/~1users/get/responses/401"},"404":{"$ref":"#/paths/~1users/get/responses/404"},"422":{"$ref":"#/paths/~1users/get/responses/422"},"500":{"$ref":"#/paths/~1users/get/responses/500"}}}},"/stamps":{"get":{"tags":["Stamps"],"summary":"Gets the list of all the stamps for the tenant","operationId":"getAllStamps","responses":{"200":{"description":"Shows all stamps","content":{"application/json":{"schema":{"$schema":"http://json-schema.org/draft-07/schema#","title":"Stamps List","description":"A paged list of Stamps","type":"object","properties":{"items":{"type":"array","title":"Stamps","items":{"$ref":"#/paths/~1stamps~1%3Aid/get/responses/200/content/application~1json/schema"}},"page":{"$ref":"#/paths/~1perks/get/responses/200/content/application~1json/schema/properties/page"}}}}}}}},"post":{"tags":["Stamps"],"summary":"Creates stamps for the tenant","operationId":"createStamps","requestBody":{"content":{"application/json":{"schema":{"$schema":"http://json-schema.org/draft-07/schema#","title":"Create Stamp","description":"Create Stamp request","type":"array","items":{"$ref":"#/paths/~1stamps~1%3Aid/get/responses/200/content/application~1json/schema/definitions/create"}}}}},"responses":{"201":{"description":"Stamp Created"},"422":{"description":"Invalid data provided","content":{"application/json":{"schema":{"$ref":"#/paths/~1users/get/responses/422"}}}},"500":{"description":"Failed to process request","content":{"application/json":{"schema":{"$ref":"#/paths/~1users/get/responses/500"}}}}}}},"/stamps/:id":{"get":{"tags":["Stamps"],"summary":"Gets a specific stamp for the tenant","operationId":"getStamp","parameters":[{"in":"path","name":"id","schema":{"type":"string"},"required":true,"description":"Pepper id of the stamp to retrieve"}],"responses":{"200":{"description":"Shows the stamp","content":{"application/json":{"schema":{"$schema":"http://json-schema.org/draft-07/schema#","title":"Stamp","description":"A snowshoe stamp and related metadata","type":"object","allOf":[{"$ref":"#/paths/~1stamps~1%3Aid/get/responses/200/content/application~1json/schema/definitions/read"},{"$ref":"#/paths/~1stamps~1%3Aid/get/responses/200/content/application~1json/schema/definitions/update"}],"definitions":{"create":{"properties":{"locationId":{"type":"string","pattern":"^[0-9a-fA-F]{24}$","description":"The id of the Location that the stamp belongs to"},"stampId":{"type":"string","description":"The Snowshoe ID of the stamp"},"effects":{"type":"object","description":"The effects enabled for this stamp","properties":{"REWARD":{"type":"boolean"},"REDEEM":{"type":"boolean"}}},"imprints":{"type":"array","description":"Array of imprints for this stamp","items":{"$ref":"#/paths/~1stamps~1%3Aid/get/responses/200/content/application~1json/schema/definitions/imprint"}},"successEffect":{"type":"string","enum":["ANIMATED","BASIC"],"default":"ANIMATED","description":"Effect to show when a stamp is granted to user"}},"required":["locationId","stampId","effects"]},"update":{"properties":{"locationId":{"type":"string","pattern":"^[0-9a-fA-F]{24}$","description":"The id of the Location that the stamp belongs to"},"stampId":{"type":"string","description":"The Snowshoe ID of the stamp"},"effects":{"type":"object","description":"The effects enabled for this stamp","properties":{"REWARD":{"type":"boolean"},"REDEEM":{"type":"boolean"}}},"successEffect":{"type":"string","enum":["ANIMATED","BASIC"],"default":"ANIMATED","description":"Effect to show when a stamp is granted to user"}}},"updateImprints":{"properties":{"imprints":{"type":"array","description":"Array of imprints for this stamp","items":{"$ref":"#/paths/~1stamps~1%3Aid/get/responses/200/content/application~1json/schema/definitions/imprint"}}}},"read":{"properties":{"_id":{"type":"string","description":"Stamp Id"},"tenantId":{"type":"string","pattern":"^[0-9a-fA-F]{24}$","description":"The id of the Tenant that the stamp belongs to"},"locationId":{"type":"string","pattern":"^[0-9a-fA-F]{24}$","description":"The id of the Location that the stamp belongs to"},"stampId":{"type":"string","description":"The Snowshoe ID of the stamp"},"effects":{"type":"object","description":"The effects enabled for this stamp","properties":{"REWARD":{"type":"boolean"},"REDEEM":{"type":"boolean"}}},"successEffect":{"type":"string","enum":["ANIMATED","BASIC"],"description":"Effect to show when a stamp is granted to user"}}},"imprint":{"type":"array","description":"An imprint defined by arrays of coordinate pairs","items":{"type":"array","description":"A coordinate pair [x, y]","minItems":2,"maxItems":2,"items":{"type":"number","description":"Coordinate value"}}}}}}}},"404":{"description":"Stamp not found","content":{"application/json":{"schema":{"$ref":"#/paths/~1users/get/responses/404"}}}}}},"put":{"tags":["Stamps"],"summary":"Update a single stamp for a tenant","operationId":"updateStamp","parameters":[{"in":"path","name":"id","schema":{"type":"string"},"required":true,"description":"Pepper id of the stamp to update"}],"responses":{"200":{"description":"Shows updated stamp","content":{"application/json":{"schema":{"$ref":"#/paths/~1stamps~1%3Aid/get/responses/200/content/application~1json/schema"}}}},"404":{"description":"Stamp not found","content":{"application/json":{"schema":{"$ref":"#/paths/~1users/get/responses/404"}}}}}},"delete":{"tags":["Stamps"],"summary":"Delete a single stamp for a tenant","operationId":"deleteStamp","parameters":[{"in":"path","name":"id","schema":{"type":"string"},"required":true,"description":"Pepper id of the stamp to delete"}],"responses":{"200":{"description":"Shows deleted stamp","content":{"application/json":{"schema":{"$ref":"#/paths/~1stamps~1%3Aid/get/responses/200/content/application~1json/schema"}}}},"404":{"description":"Stamp not found","content":{"application/json":{"schema":{"$ref":"#/paths/~1users/get/responses/404"}}}}}}},"/stamps/nonces":{"post":{"tags":["Stamps"],"summary":"Create a Stamp Nonce","description":"Creates a new nonce that expires after 120 seconds as well as the public key to encrypt a stamp impression and the nonce with.","operationId":"createStampNonce","parameters":[],"requestBody":[],"responses":{"201":{"description":"The request succeeded","content":{"application/json":{"schema":{"$schema":"http://json-schema.org/draft-07/schema#","title":"StampNonce","description":"Returns the necessary fields required to encrypt and validate a stamp impression","type":"object","properties":{"nonce":{"type":"string","description":"A one time use nonce that expires after 120 seconds"},"key":{"type":"string","description":"The public key used to encrypt the stamp impression and nonce together"}}}}}},"401":{"$ref":"#/paths/~1users/get/responses/401"},"404":{"$ref":"#/paths/~1users/get/responses/404"},"422":{"$ref":"#/paths/~1users/get/responses/422"},"500":{"$ref":"#/paths/~1users/get/responses/500"}}}},"/stamps/imprints":{"post":{"tags":["Stamps"],"summary":"Validate and process a stamp impression","description":"Validates a stamp impression encrypted with the nonce and public key and processes the effect of the stamp","operationId":"validateStampImpression","parameters":[],"requestBody":{"content":{"application/json":{"schema":{"$schema":"http://json-schema.org/draft-07/schema#","title":"StampImprint","description":"Validates and processes a stamp impression","type":"object","properties":{"impression":{"type":"string","description":"Encrypted JSON string containing co-ordinates of the impression of the stamp on phone as well as the one time nonce retrieved by hitting the create nonce endpoint"},"effect":{"type":"object","description":"The intended effect of imprinting the stamp","oneOf":[{"properties":{"type":{"type":"string","enum":["REWARD","REDEEM"],"description":"This represents an effect on a user's loyalty award, REWARD increments points on an award, REDEEM decrements points on an award"},"awardId":{"type":"string","description":"The award that should have it's points incremented or decremented"},"points":{"type":"number","description":"The amount of points to increment or decrement the award by"}},"required":["type","awardId","points"],"additionalProperties":false}]}}}}}},"responses":{"200":{"description":"The request succeeded","content":{"application/json":{"schema":{"$schema":"http://json-schema.org/draft-07/schema#","title":"StampImprint","description":"The result of a stamp impression, changes based on the effect of the stamp imprint","type":"object","oneOf":[{"properties":{"result":{"$ref":"#/paths/~1pointperks~1%3AperkId~1awards/post/responses/200/content/application~1json/schema"},"successEffect":{"type":"string","enum":["ANIMATED","BASIC"],"default":"ANIMATED","description":"Effect to show when a stamp is granted to user"}},"required":["result"],"additionalProperties":false}]}}}},"401":{"$ref":"#/paths/~1users/get/responses/401"},"404":{"$ref":"#/paths/~1users/get/responses/404"},"422":{"$ref":"#/paths/~1users/get/responses/422"},"500":{"$ref":"#/paths/~1users/get/responses/500"}}}},"/stamps/:id/imprints":{"put":{"tags":["Stamps"],"summary":"Update the imprint/fingerprint for a specific stamp","operationId":"updateStampImprint","parameters":[{"in":"path","name":"id","schema":{"type":"string"},"required":true,"description":"Pepper id of the stamp to update imprint for"}],"requestBody":{"content":{"application/json":{"schema":{"$schema":"http://json-schema.org/draft-07/schema#","title":"Update Stamp Fingerprint","description":"Update Stamp Fingerprint request","type":"object","allOf":[{"$ref":"#/paths/~1stamps~1%3Aid/get/responses/200/content/application~1json/schema/definitions/updateImprints"}]}}}},"responses":{"200":{"description":"Shows updated stamp with new fingerprint","content":{"application/json":{"schema":{"$ref":"#/paths/~1stamps~1%3Aid/get/responses/200/content/application~1json/schema"}}}},"404":{"description":"Stamp not found","content":{"application/json":{"schema":{"$ref":"#/paths/~1users/get/responses/404"}}}},"422":{"description":"Invalid data provided","content":{"application/json":{"schema":{"$ref":"#/paths/~1users/get/responses/422"}}}},"500":{"description":"Failed to process request","content":{"application/json":{"schema":{"$ref":"#/paths/~1users/get/responses/500"}}}}}}},"/perks":{"post":{"tags":["Perks"],"summary":"Create a Perk","description":"Creates a perk for a tenant.\n\nA Perk defines an award that can be granted to or earned by a user.\n","operationId":"createPerk","requestBody":{"content":{"application/json":{"schema":{"$schema":"http://json-schema.org/draft-07/schema#","title":"Create Perk","description":"Create Perk request","type":"object","allOf":[{"$ref":"#/paths/~1perks/post/responses/201/content/application~1json/schema/definitions/perk-fields-editable"},{"required":["title","template","points","auto","isGlobal","terms","priority","visualisation"]}]}}}},"responses":{"201":{"description":"The request succeeded","content":{"application/json":{"schema":{"$schema":"http://json-schema.org/draft-07/schema#","title":"Perk","description":"A perk defines awards that can be earnt by or granted to a user.","type":"object","allOf":[{"$ref":"#/paths/~1perks/post/responses/201/content/application~1json/schema/definitions/perk-fields-readonly"},{"$ref":"#/paths/~1perks/post/responses/201/content/application~1json/schema/definitions/perk-fields-editable"}],"definitions":{"perk-fields-readonly":{"properties":{"_id":{"type":"string","description":"Perk Id"},"tenantId":{"type":"string","description":"Id of the tenant"}}},"perk-fields-editable":{"properties":{"template":{"type":"string","enum":["STAMP_CARD","LEVEL","AD_HOC","PSEUDO_CURRENCY","CLUB"],"description":"The discount model used by the perk"},"title":{"type":"string","description":"The name of the perk"},"internalTitle":{"type":"string","description":"A more convenient, business-friendly title for easy reference in the console. Use this to distinguish between many perks with similar names."},"terms":{"type":"string","description":"The terms and conditions of an award of this perk type"},"priority":{"type":"number","description":"For LEVEL type perk awards, controls which award is active (the highest priority) and suppresses any others.  Also used to order the awards in the app awards carousel."},"redemptionMethod":{"string":"string","enum":["AUTO","CODE_PDF417","CODE_QR","VOUCHER"],"description":"How an award of this perk is communicated to the POS.\n- `AUTO` - Can be redeemed via integration with the POS and without the need for the User to show the Award in the app.\n- `CODE_PDF417` - Will be displayed in the App as a PDF 417 format of barcode.\n- `CODE_QR` - Will be displayed in the App as a QR code.\n- `VOUCHER` - Will be displayed in the App as a plain text string - e.g. '1234567890' ready for manual POS entry."},"auto":{"type":"boolean","description":"If true, the pos automatically redeems the awards of this perk for qualifying baskets"},"token":{"type":"string","description":"The code that the POS uses to match to a discount or adjustment known by the POS, and apply to a basket if appropriate.  This will be the value that is displayed according to `redemptionMethod` above."},"maximumPointCashValue":{"type":"number","description":"The maximum absolute discount that can be applied as the result of redeeming an award of this perk"},"locationIds":{"type":"array","items":{"type":"string"}},"points":{"allOf":[{"type":"object","description":"Defines how points are earned and redeemed against an award","properties":{"initial":{"description":"When an award is initially created for a user, and the number of points to grant has not been passed to the grantPerk method, the `points.initial` value will be used as the starting `points.available` property instead.","$ref":"#/paths/~1awardenrichments/post/responses/201/content/application~1json/schema/definitions/points/properties/min"},"min":{"$ref":"#/paths/~1awardenrichments/post/responses/201/content/application~1json/schema/definitions/points/properties/min","description":"The minimum value that the points.total property may have. Any attempt to reduce the number of available points below this value will result in the the value itself. For example, if min: 1, available: 2 and an attempt to redeem 2 points is made, the resulting balance will be 1 (i.e. the min value)."},"max":{"$ref":"#/paths/~1awardenrichments/post/responses/201/content/application~1json/schema/definitions/points/properties/min","description":"Specifies the ceiling value for the `points.available` property of an award."},"step":{"$ref":"#/paths/~1awardenrichments/post/responses/201/content/application~1json/schema/definitions/points/properties/min","description":"The increments that are deemed to be interesting. This is primarily for clients to determine how they behave. For example, a step value of 4 in a Perk with a template: `STAMP_CARD` would denote that there are 4 stamps on a card."},"redemption":{"$ref":"#/paths/~1awardenrichments/post/responses/201/content/application~1json/schema/definitions/points/properties/min","description":"The number of points that should be decremented from an award's `points.available` balance for each redemption. For example, if a user has an award `points.available` value of 10, a `points.redemption` value of 4 and redemption occurs with a value of 2, the resulting `points.available` will be 2 (i.e. 10 - (2*4))."},"maxTotalRedemptions":{"$ref":"#/paths/~1awardenrichments/post/responses/201/content/application~1json/schema/definitions/points/properties/min","description":"The number of redemptions that can be made against this perk globally, across all users"}},"additionalProperties":false},{"type":"object","required":["initial","min","max","step","redemption"]}]},"discount":{"$ref":"#/paths/~1perks/post/responses/201/content/application~1json/schema/definitions/discount"},"dateTimeRestriction":{"$ref":"#/paths/~1perks/post/responses/201/content/application~1json/schema/definitions/dateTimeRestriction"},"basketQualification":{"$ref":"#/paths/~1perks/post/responses/201/content/application~1json/schema/definitions/basketQualification"},"visualisation":{"$ref":"#/paths/~1perks/post/responses/201/content/application~1json/schema/definitions/visualisation"},"visualisationOnCurrentStamp":{"type":"object","description":"Per-stamp visualisation overrides, keyed by stamp number","additionalProperties":{"$ref":"#/paths/~1perks/post/responses/201/content/application~1json/schema/definitions/perStampVisualisation"}},"isDonatable":{"type":"boolean"},"isGlobal":{"type":"boolean","description":"If true, all users will be granted an award of this perk"},"isTier":{"type":"boolean"},"enabled":{"type":"boolean","description":"If true, the perk is active and can be earned and redeemed"},"physicalStampsEnabled":{"type":"boolean","description":"If true, this perk supports physical stamp functionality"}}},"discount":{"type":"object","description":"Used to describe rules around how a perk discount is calculated","properties":{"value":{"type":"number","description":"Depending on the discount type either the fixed value of discount or fractional discount on the discountable cost of the scoped items (item, items of category, basket). 50% = 0.5"},"type":{"type":"string","enum":["VALUE","PERCENTAGE","OVERRIDE"],"description":"Whether the type of discount in value should be a fixed VALUE or PERCENTAGE, or OVERRIDE the price with a new value"},"maxValue":{"type":"number","description":"The maximum value of the discount"},"maxCount":{"type":"number","minimum":1,"maximum":20,"description":"The number of times the discount can be matched and applied to a basket for each redemption"},"scope":{"type":"string","enum":["ITEM","CATEGORY","BASKET","ITEM_OR_CATEGORY","CHILD_ITEM","ITEM_AND_CHILD_ITEM"],"description":"Which items in the basket will the perk's discount apply: ITEM: any item with menu perks field or product id that matches the scopeMatchCode. CATEGORY: any item in category with perks field or category id that matches the scopeMatchCode. ITEM_OR_CATEGORY: Both item and categories are matched against scopeMatchCode.  BASKET: Perk will discount any item in the basket. CHILD_ITEM: any condiment item with menu perks field or product id that matches the scopeMatchCode. ITEM_AND_CHILD_ITEM: any item or condiment item with menu perks field or product id that matches the scopeMatchCode."},"scopeMatchCode":{"oneOf":[{"type":"string","description":"A value used to match against productId or categoryId, or values in the menu category or menu item perks field.  Note the portal sets menu perks field to the perkId, but it could be any string value"},{"type":"array","description":"An array of values used to match against productId or categoryId, or values in the menu category or menu item perks field.  Note the portal sets menu perks field to the perkId, but it could be any string value","items":{"type":"string"}},{"type":"array","items":{"type":"array","items":{"type":"string"}}}]},"rule":{"type":"string","enum":["CHEAPEST","COSTLIEST","ALL","CHEAPEST_FIRST","COSTLIEST_FIRST"],"description":"Rule to determine which item(s) to discount in a basket.\nCHEAPEST: The one cheapest item in the basket.\nCOSTLIEST: The most expensive one item in the basket.\nALL: Discount will apply in full to all items; VALUE type awards cannot be redeemed partially.\nALL_ALLOCATE: Discount will be allocated to matching items; VALUE type awards can be redeemed partially.\nCHEAPEST_FIRST: discount applied to cheapest items in asc order until no more can be wholly discounted.\nCOSTLIEST_FIRST: discount applied to costliest items in desc order until no more can be wholly discounted"},"childItemRule":{"type":"string","enum":["INCLUDE","INCLUDE_MATCHED","EXCLUDE"],"description":"Whether or not condiments should also be discounted.  The default is INCLUDE"},"combinationRule":{"type":"string","enum":["MULTI","OWN_QUALIFIER","SINGLE"]},"discountCharges":{"type":"number","description":"Bitwise flags controlling if charge types are discounted.  1: service charges; 2: delivery charges.  The default is 1"}},"required":["value","type","scope","rule"]},"dateTimeRestriction":{"type":"object","description":"Controls when a perk is redeemable based on the time and date","properties":{"startTime":{"type":"number","description":"active time by day, seconds from midnight. Must also have an endTime"},"endTime":{"type":"number","description":"active time by day, seconds from midnight. Must also have a startTime"},"daysOfWeek":{"type":"number","description":"active days of week expressed as the sum of bit flag where Monday=1, Tuesday=2, Wednesday=4, Thursday=8, Friday=16, Saturday=32, Sunday=64"},"startDate":{"type":"string","description":" inclusive start date AND TIME in ISO format"},"endDate":{"type":"string","description":"inclusive end date AND TIME in ISO format"}},"required":[]},"basketQualification":{"type":"object","description":"What conditions must be met in the basket for an award to be redeemable","properties":{"matchCode":{"oneOf":[{"type":"string","description":"A value used to match against productId or categoryId, or values in the menu category or menu item perks field.  Note the portal sets menu perks field to the perkId, but it could be any string value"},{"type":"array","description":"An array of values used to match against productId or categoryId, or values in the menu category or menu item perks field.  Note the portal sets menu perks field to the perkId, but it could be any string value","items":{"type":"string"}}]},"maxCount":{"type":"number","description":"The number of times the discount can be matched and applied to a basket for each successful qualification"},"minimumItems":{"type":"number","description":"the no. of items that need to be in the basket for the perk to be redeemable"},"minimumValue":{"type":"number","description":"the minimum cost of matching items that need to be in the basket for the perk to be redeemable"},"scope":{"type":"string","enum":["ITEM","CATEGORY","BASKET","ITEM_OR_CATEGORY","CHILD_ITEM","ITEM_AND_CHILD_ITEM"],"description":"The scope to use for selecting qualifying items or cost. ITEM: any item with menu perks field or product id that matches the scopeMatchCode. CATEGORY: any item in category with perks field or category id that matches the scopeMatchCode. ITEM_OR_CATEGORY: Both item and categories are matched against scopeMatchCode.  BASKET: Perk will discount any item in the basket. CHILD_ITEM: any condiment item with menu perks field or product id that matches the scopeMatchCode. ITEM_AND_CHILD_ITEM: any item or condiment item with menu perks field or product id that matches the scopeMatchCode."}},"required":["scope"]},"visualisation":{"type":"object","description":"Used by apps to display the award in an award carousel","properties":{"stampImageUrl":{"type":"string"},"stampImageUrlPerStamp":{"type":"object","additionalProperties":{"type":"string"}},"backgroundImageUrl":{"type":"string"},"backgroundImageUrlNoAvailableRedemptions":{"type":"string"},"backgroundImageUrlAvailableRedemptions":{"type":"string"},"showExpiry":{"type":"boolean"},"expiryLabelAnchorStyle":{"type":"string","enum":["BOTTOM_LEFT_CHIP","BOTTOM_RIGHT_CHIP","BOTTOM_MIDDLE_CHIP","BOTTOM_FULL_WIDTH_BAR","TOP_LEFT_CHIP","TOP_RIGHT_CHIP","TOP_MIDDLE_CHIP","TOP_FULL_WIDTH_BAR"]},"expiryLabelDetailStyle":{"type":"string","enum":["BOTTOM_MIDDLE_CHIP","BOTTOM_FULL_WIDTH_BAR","TOP_MIDDLE_CHIP","TOP_FULL_WIDTH_BAR"]},"awardsScreenShape":{"type":"string","enum":["DOUBLE_RECTANGLE","SINGLE_RECTANGLE","LARGE_SQUARE","SMALL_SQUARE"]},"expiryLabelTextStyle":{"type":"string","enum":["NONE","FULL","NARROW"]},"stampsHidden":{"type":"boolean"},"fullCardsIndicatorHidden":{"type":"boolean"},"textColour":{"type":"string","pattern":"^#[0-9a-fA-F]{3,6}$"},"stampColour":{"$ref":"#/paths/~1perks/post/responses/201/content/application~1json/schema/definitions/visualisation/properties/textColour"},"stampColourPerStamp":{"type":"object","additionalProperties":{"type":"string"}},"stampBackgroundUrl":{"type":"string"},"stampBackgroundUrlPerStamp":{"type":"object","additionalProperties":{"type":"string"}},"randomiseStampPositions":{"type":"boolean"},"randomiseStampPositionsPerStamp":{"type":"object","additionalProperties":{"type":"boolean"}},"backgroundOverlayColour":{"$ref":"#/paths/~1perks/post/responses/201/content/application~1json/schema/definitions/visualisation/properties/textColour"},"backgroundOverlayOpacity":{"type":"number","minimum":0,"maximum":1},"titleText":{"type":"string"},"subtitleText":{"type":"string"},"subtitleTwoText":{"type":"string"},"description":{"type":"string"},"availableCardCopy":{"type":"string"},"nextCardProgressCopy":{"type":"string"},"textAlignment":{"type":"string","enum":["LEFT","RIGHT","CENTER","JUSTIFY"]},"verticalAlignment":{"type":"string","enum":["TOP","CENTER","BOTTOM"]},"wallet":{"$ref":"#/paths/~1perks/post/responses/201/content/application~1json/schema/definitions/walletVisualisation"}}},"walletVisualisation":{"type":"object","description":"Controls how the perk is displayed in the wallet","properties":{"enabled":{"type":"boolean"},"title":{"type":"string"},"description":{"type":"string"},"terms":{"type":"string"},"link":{"type":"string"},"priority":{"type":"number"},"imageUrls":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":255},"value":{"type":"string","minLength":1,"maxLength":255}},"additionalProperties":false}},"displayPoints":{"type":"boolean"},"hidden":{"type":"boolean"}}},"excludeDiscountIds":{"type":"array","items":{"type":"string"}},"perStampVisualisation":{"type":"object","description":"Visualisation overrides for a specific stamp","properties":{"textColour":{"$ref":"#/paths/~1perks/post/responses/201/content/application~1json/schema/definitions/visualisation/properties/textColour"},"stampImageUrl":{"type":"string"},"stampImageUrlPerStamp":{"type":"object","additionalProperties":{"type":"string"}},"stampColour":{"$ref":"#/paths/~1perks/post/responses/201/content/application~1json/schema/definitions/visualisation/properties/textColour"},"stampColourPerStamp":{"type":"object","additionalProperties":{"type":"string"}},"stampBackgroundUrl":{"type":"string"},"stampBackgroundUrlPerStamp":{"type":"object","additionalProperties":{"type":"string"}},"randomiseStampPositions":{"type":"boolean"},"randomiseStampPositionsPerStamp":{"type":"object","additionalProperties":{"type":"boolean"}},"backgroundOverlayColour":{"$ref":"#/paths/~1perks/post/responses/201/content/application~1json/schema/definitions/visualisation/properties/textColour"},"backgroundOverlayOpacity":{"type":"number","minimum":0,"maximum":1},"titleText":{"type":"string"},"subtitleText":{"type":"string"},"availableCardCopy":{"type":"string"},"nextCardProgressCopy":{"type":"string"},"textAlignment":{"type":"string","enum":["LEFT","RIGHT","CENTER","JUSTIFY"]},"verticalAlignment":{"type":"string","enum":["TOP","CENTER","BOTTOM"]},"backgroundImageUrl":{"type":"string"},"backgroundImageUrlNoAvailableRedemptions":{"type":"string"},"backgroundImageUrlAvailableRedemptions":{"type":"string"},"showExpiry":{"type":"boolean"},"expiryLabelAnchorStyle":{"type":"string","enum":["BOTTOM_LEFT_CHIP","BOTTOM_RIGHT_CHIP","BOTTOM_MIDDLE_CHIP","BOTTOM_FULL_WIDTH_BAR","TOP_LEFT_CHIP","TOP_RIGHT_CHIP","TOP_MIDDLE_CHIP","TOP_FULL_WIDTH_BAR"]},"expiryLabelDetailStyle":{"type":"string","enum":["BOTTOM_MIDDLE_CHIP","BOTTOM_FULL_WIDTH_BAR","TOP_MIDDLE_CHIP","TOP_FULL_WIDTH_BAR"]},"expiryLabelTextStyle":{"type":"string","enum":["NONE","FULL","NARROW"]},"awardsScreenShape":{"type":"string","enum":["DOUBLE_RECTANGLE","SINGLE_RECTANGLE","LARGE_SQUARE","SMALL_SQUARE"]},"stampsHidden":{"type":"boolean"},"fullCardsIndicatorHidden":{"type":"boolean"}},"additionalProperties":false}}}}}},"401":{"$ref":"#/paths/~1users/get/responses/401"},"404":{"$ref":"#/paths/~1users/get/responses/404"},"422":{"$ref":"#/paths/~1users/get/responses/422"},"500":{"$ref":"#/paths/~1users/get/responses/500"}}},"get":{"tags":["Perks"],"summary":"Get all Perks","description":"Retrieves all the perks for a tenant.\n\nA Perk defines an award that can be granted to or earned by a User.\n","operationId":"getAllPerks","parameters":[{"name":"x-api-version","required":false,"in":"header","description":"The behaviour of this path is versioned via the `x-api-version` header.  The version should be an integer number as a string, eg `'2'`.\nFor this endpoint, the supported values are:\n- '1' ... '4': deprecated behaviour (default)\n- '5' or higher: current behaviour as described here\n","schema":{"type":"number"}},{"$ref":"#/paths/~1users/get/parameters/8"},{"$ref":"#/paths/~1users/get/parameters/9"}],"deprecated":false,"responses":{"200":{"description":"A paged list of perks","content":{"application/json":{"schema":{"title":"Perks List","description":"A paged list of perks","type":"object","properties":{"items":{"type":"array","title":"A list of perks","items":{"$ref":"#/paths/~1perks/post/responses/201/content/application~1json/schema"}},"page":{"type":"object","title":"Response Page","description":"Details of the page of the records in the response.","properties":{"limit":{"type":"number","description":"The limit used in the request"},"count":{"type":"number","description":"Total number of records in the current page"},"startKey":{"type":"string","description":"A value representing the record at the start of the page.  Do not use this value for any purpose other than paging."},"nextKey":{"type":"string","description":"A value representing the record at the start of the next page.  Use this as the `startKey` in another request.  Do not use this value for any purpose other than paging."}}}}}}}},"401":{"$ref":"#/paths/~1users/get/responses/401"},"404":{"$ref":"#/paths/~1users/get/responses/404"},"422":{"$ref":"#/paths/~1users/get/responses/422"},"500":{"$ref":"#/paths/~1users/get/responses/500"}}}},"/perks/:perkId":{"get":{"tags":["Perks"],"summary":"Get a Perk","description":"Retrieves a perk for a tenant by Id","operationId":"getPerkById","parameters":[{"name":"perkId","in":"path","description":"The Id of the perk to retrieve.","required":true,"schema":{"type":"string"}},{"name":"include","in":"query","description":"Specify which additional optional fields to return in the response.  Optional fields are: `awardCount`\n","required":false,"schema":{"type":"string"}}],"requestBody":null,"responses":{"200":{"description":"The request succeeded","content":{"application/json":{"schema":{"$ref":"#/paths/~1perks/post/responses/201/content/application~1json/schema"}}}},"401":{"$ref":"#/paths/~1users/get/responses/401"},"404":{"$ref":"#/paths/~1users/get/responses/404"},"422":{"$ref":"#/paths/~1users/get/responses/422"},"500":{"$ref":"#/paths/~1users/get/responses/500"}}},"delete":{"tags":["Perks"],"summary":"Delete a Perk","description":"Removes a specific perk for a tenant\n\nNote: this endpoint affects the old Perks schema and will be changed in a future version.\nUse the endpoint `DELETE /pointperks/:perkId` in the meantime\n","operationId":"deletePerk","deprecated":true,"parameters":[{"name":"perkId","in":"path","description":"The unique Id of the perk to remove.","required":true,"schema":{"type":"string"}}],"requestBody":null,"responses":{"200":{"description":"The request succeeded"},"401":{"$ref":"#/paths/~1users/get/responses/401"},"404":{"$ref":"#/paths/~1users/get/responses/404"},"422":{"$ref":"#/paths/~1users/get/responses/422"},"500":{"$ref":"#/paths/~1users/get/responses/500"}}},"put":{"tags":["Perks"],"summary":"Update a Perk","description":"Update a perk for a tenant.\n\nNote: this endpoint affects the old Perks schema and will be changed in a future version.\nUse the endpoint `PUT /pointperks/:perkId` in the meantime.\n","operationId":"updatePerk","deprecated":true,"parameters":[{"name":"perkId","in":"path","description":"The Id of the perk to update.","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"$schema":"http://json-schema.org/draft-07/schema#","title":"Update Perk","description":"Update perk request","type":"object","allOf":[{"$ref":"#/paths/~1perks/post/responses/201/content/application~1json/schema/definitions/perk-fields-editable"}]}}}},"responses":{"200":{"description":"The request succeeded"},"401":{"$ref":"#/paths/~1users/get/responses/401"},"404":{"$ref":"#/paths/~1users/get/responses/404"},"422":{"$ref":"#/paths/~1users/get/responses/422"},"500":{"$ref":"#/paths/~1users/get/responses/500"}}}},"/perktemplates":{"post":{"tags":["Perk Templates"],"summary":"Create a Perk Template","description":"Creates a perk template for a tenant.\n\nA perk template defines a reusable perk configuration that can be instantiated\nas a perk for a specific tenant.\n","operationId":"createPerkTemplate","requestBody":{"content":{"application/json":{"schema":{"$schema":"http://json-schema.org/draft-07/schema#","title":"Create Perk Template","description":"Create perk template request","type":"object","allOf":[{"$ref":"#/paths/~1perktemplates/post/responses/201/content/application~1json/schema/definitions/perktemplate-fields-editable"},{"required":["name","perk"]}]}}}},"responses":{"201":{"description":"The perk template was created successfully","content":{"application/json":{"schema":{"$schema":"http://json-schema.org/draft-07/schema#","title":"Perk Template","description":"A perk template defines a reusable perk configuration that can be applied across tenants.","type":"object","allOf":[{"$ref":"#/paths/~1perktemplates/post/responses/201/content/application~1json/schema/definitions/perktemplate-fields-readonly"},{"$ref":"#/paths/~1perktemplates/post/responses/201/content/application~1json/schema/definitions/perktemplate-fields-editable"}],"definitions":{"perktemplate-fields-readonly":{"properties":{"_id":{"type":"string","description":"Perk template Id"},"tenantId":{"type":"string","description":"Id of the tenant. Null indicates a global template available to all tenants.","nullable":true},"active":{"type":"boolean","description":"Whether the template is active. Defaults to true."},"disabledForTenantIds":{"type":"array","items":{"type":"string"},"description":"List of tenant IDs for which this template is disabled"},"createdAt":{"type":"string","format":"date-time","description":"Timestamp when the template was created"},"updatedAt":{"type":"string","format":"date-time","description":"Timestamp when the template was last updated"}}},"perktemplate-fields-editable":{"properties":{"name":{"type":"string","description":"Display name of the perk template"},"description":{"type":"string","description":"Optional description of the perk template"},"perk":{"type":"object","description":"The perk configuration","properties":{"title":{"type":"string","description":"The name of the perk"},"template":{"type":"string","enum":["AD_HOC","PSEUDO_CURRENCY","STAMP_CARD","CLUB","LEVEL"],"description":"The perk type"},"redemptionMethod":{"type":"string","enum":["AUTO","CODE_PDF417","CODE_QR","VOUCHER","PSEUDO_CURRENCY"],"description":"How the perk is redeemed"},"isGlobal":{"type":"boolean","description":"If true, the perk is automatically granted to all users"},"terms":{"type":"string","description":"Terms and conditions for this perk"},"priority":{"type":"number","description":"Controls ordering and tier precedence"},"points":{"type":"object","description":"Points configuration","properties":{"initial":{"type":"number","description":"Points awarded per qualifying transaction"},"min":{"type":"number","description":"Minimum points balance"},"max":{"type":"number","description":"Maximum points balance"},"step":{"type":"number","description":"Points increment per transaction"},"redemption":{"type":"number","description":"Points required for redemption"},"maxTotalRedemptions":{"type":"number","description":"Maximum number of times this perk can be redeemed in total"}}},"discount":{"type":"object","description":"Discount applied on redemption","properties":{"value":{"type":"number","description":"Discount value"},"type":{"type":"string","enum":["PERCENTAGE","VALUE","OVERRIDE"],"description":"Whether the discount is a percentage, fixed value reduction, or price override"},"scope":{"type":"string","enum":["ITEM","CATEGORY","BASKET","ITEM_OR_CATEGORY","CHILD_ITEM","ITEM_AND_CHILD_ITEM"],"description":"What the discount applies to"},"scopeMatchCode":{"description":"Codes identifying items or categories the discount applies to. Accepts a single string, an array of strings, or an array of string arrays (for grouped CHEAPEST/COSTLIEST selection).","oneOf":[{"type":"string"},{"type":"array","items":{"type":"string"}},{"type":"array","items":{"type":"array","items":{"type":"string"}}}]},"rule":{"type":"string","enum":["CHEAPEST","COSTLIEST","ALL","ALL_ALLOCATE","CHEAPEST_ALLOCATE","COSTLIEST_ALLOCATE","CHEAPEST_FIRST","COSTLIEST_FIRST"],"description":"Which qualifying item receives the discount"},"childItemRule":{"type":"string","enum":["INCLUDE","INCLUDE_MATCHED","EXCLUDE"],"description":"Whether child items (modifiers) are included in the discount"}}},"visualisation":{"type":"object","description":"Visual configuration for app display. This is a partial list of available properties — additional visualisation fields (background images, stamp configuration, wallet settings, etc.) are supported.","properties":{"textColour":{"type":"string","description":"Hex colour code for text (e.g. #000000)"},"titleText":{"type":"string","description":"Title text shown on the card"}}},"internalTitle":{"type":"string","description":"A more convenient, business-friendly title for easy reference in the console"},"auto":{"type":"boolean","description":"If true, the perk is automatically applied without user interaction"},"token":{"type":"string","description":"Unique token identifier for the perk"},"enabled":{"type":"boolean","description":"If true, the perk is active and can be earned and redeemed"},"locationIds":{"type":"array","items":{"type":"string"},"description":"Restricts the perk to specific location IDs"},"excludeDiscountIds":{"type":"array","items":{"type":"string"},"description":"Discount IDs excluded from this perk's qualification rules"},"physicalStampsEnabled":{"type":"boolean","description":"If true, physical stamp cards are supported for this perk"}}}}}}}}}},"401":{"$ref":"#/paths/~1users/get/responses/401"},"422":{"$ref":"#/paths/~1users/get/responses/422"},"500":{"$ref":"#/paths/~1users/get/responses/500"}}},"get":{"tags":["Perk Templates"],"summary":"Get Perk Templates","description":"Retrieves a paged list of perk templates.\n\nReturns templates belonging to the tenant as well as global templates (where tenantId is null).\nSoft-deleted templates are excluded.\n","operationId":"getPerkTemplates","parameters":[{"$ref":"#/paths/~1users/get/parameters/8"},{"$ref":"#/paths/~1users/get/parameters/9"},{"name":"active","in":"query","required":false,"description":"Filter templates by active status","schema":{"type":"string","enum":["true","false"]}},{"name":"sort","in":"query","required":false,"description":"Field to sort results by","schema":{"type":"string","enum":["createdAt","updatedAt","name"]}}],"responses":{"200":{"description":"A paged list of perk templates","content":{"application/json":{"schema":{"title":"Perk Templates List","description":"A paged list of perk templates","type":"object","properties":{"items":{"type":"array","title":"A list of perk templates","items":{"$ref":"#/paths/~1perktemplates/post/responses/201/content/application~1json/schema"}},"page":{"$ref":"#/paths/~1perks/get/responses/200/content/application~1json/schema/properties/page"}}}}}},"401":{"$ref":"#/paths/~1users/get/responses/401"},"422":{"$ref":"#/paths/~1users/get/responses/422"},"500":{"$ref":"#/paths/~1users/get/responses/500"}}}},"/perktemplates/:templateId":{"put":{"tags":["Perk Templates"],"summary":"Update a Perk Template","description":"Updates an existing perk template by Id.\n\nAll editable fields are replaced (full overwrite — no partial updates).\n","operationId":"updatePerkTemplate","parameters":[{"name":"templateId","in":"path","description":"The Id of the perk template to update","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"$schema":"http://json-schema.org/draft-07/schema#","title":"Update Perk Template","description":"Update perk template request","type":"object","allOf":[{"$ref":"#/paths/~1perktemplates/post/responses/201/content/application~1json/schema/definitions/perktemplate-fields-editable"},{"properties":{"active":{"type":"boolean","description":"Whether the template is active"}}},{"required":["name","active","perk"]}]}}}},"responses":{"200":{"description":"The request succeeded","content":{"application/json":{"schema":{"$ref":"#/paths/~1perktemplates/post/responses/201/content/application~1json/schema"}}}},"401":{"$ref":"#/paths/~1users/get/responses/401"},"404":{"$ref":"#/paths/~1users/get/responses/404"},"422":{"$ref":"#/paths/~1users/get/responses/422"},"500":{"$ref":"#/paths/~1users/get/responses/500"}}},"delete":{"tags":["Perk Templates"],"summary":"Delete a Perk Template","description":"Soft deletes a perk template by Id.\n\nThe template is not permanently removed — it is marked with a `deletedAt` timestamp\nand excluded from future GET responses.\n","operationId":"deletePerkTemplate","parameters":[{"name":"templateId","in":"path","description":"The Id of the perk template to delete","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"The request succeeded","content":{"application/json":{"schema":{"$ref":"#/paths/~1perktemplates/post/responses/201/content/application~1json/schema"}}}},"401":{"$ref":"#/paths/~1users/get/responses/401"},"404":{"$ref":"#/paths/~1users/get/responses/404"},"422":{"$ref":"#/paths/~1users/get/responses/422"},"500":{"$ref":"#/paths/~1users/get/responses/500"}}}},"/pointperks/:perkId":{"delete":{"tags":["Perks"],"summary":"Delete a Perk (PointPerk)","description":"Removes a specific perk for a tenant.\n\nThis endpoint will be deprecated in an upcoming release and be replaced by `DELETE /perks/:perkId`\n","operationId":"deletePointPerk","parameters":[{"name":"perkId","in":"path","description":"The unique Id of the perk to remove.","required":true,"schema":{"type":"string"}}],"requestBody":null,"responses":{"200":{"description":"The request succeeded"},"401":{"$ref":"#/paths/~1users/get/responses/401"},"404":{"$ref":"#/paths/~1users/get/responses/404"},"422":{"$ref":"#/paths/~1users/get/responses/422"},"500":{"$ref":"#/paths/~1users/get/responses/500"}}},"put":{"tags":["Perks"],"summary":"Update a Perk (PointPerk)","description":"Update an existing perk for a tenant.\n\nThis endpoint will be deprecated in an upcoming release and be replaced by `PUT /perks/:perkId`\n","operationId":"updatePointPerk","parameters":[{"name":"perkId","in":"path","description":"The Id of the perk to update.","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/paths/~1perks~1%3AperkId/put/requestBody/content/application~1json/schema"}}}},"responses":{"200":{"description":"The request succeeded","content":{"application/json":{"schema":{"$ref":"#/paths/~1perks/post/responses/201/content/application~1json/schema"}}}},"401":{"$ref":"#/paths/~1users/get/responses/401"},"404":{"$ref":"#/paths/~1users/get/responses/404"},"422":{"$ref":"#/paths/~1users/get/responses/422"},"500":{"$ref":"#/paths/~1users/get/responses/500"}}}},"/perks/:perkId/awards":{"post":{"tags":["Perks","Awards"],"summary":"Award a Perk","description":"Grant an award based on the specified perk to a user or segment.\n\nNote: this endpoint returns the old Perks schema and will be changed in a future version.\nUse the endpoint `POST /pointperks/:perkId/awards` in the meantime.\n","operationId":"grantPerkAward","deprecated":true,"parameters":[{"name":"perkId","in":"path","description":"The Id of the perk to award.","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"title":"User to grant the award to","type":"object","properties":{"userId":{"type":"string"}},"required":["userId"]}}}},"responses":{"200":{"description":"The request succeeded"},"401":{"$ref":"#/paths/~1users/get/responses/401"},"404":{"$ref":"#/paths/~1users/get/responses/404"},"422":{"$ref":"#/paths/~1users/get/responses/422"},"500":{"$ref":"#/paths/~1users/get/responses/500"}}}},"/pointperks/:perkId/awards":{"post":{"tags":["Perks","Awards"],"summary":"Award a Perk (PointPerk)","description":"Grant an award based on the specified perk to a user.\n\nNote: this endpoint will be deprecated in an upcoming release and be replaced by the endpoint `POST /perks/:perkId/awards`.\n","operationId":"grantPointPerkAward","parameters":[{"name":"perkId","in":"path","description":"The Id of the perk to award.","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"title":"User to grant the award to","type":"object","properties":{"userId":{"type":"string"},"points":{"type":"number","description":"The value to award the user. If not specified, the default value of the perk will be used."},"locationId":{"type":"string","description":"The id of the location associated with this grant, if any"}},"required":["userId"]}}}},"responses":{"200":{"description":"The request succeeded","content":{"application/json":{"schema":{"$schema":"http://json-schema.org/draft-07/schema#","title":"Award","description":"An Award that can be earnt by or granted to a User based on a perk","type":"object","allOf":[{"$ref":"#/paths/~1pointperks~1%3AperkId~1awards/post/responses/200/content/application~1json/schema/definitions/pointaward-fields-readonly"},{"$ref":"#/paths/~1pointperks~1%3AperkId~1awards/post/responses/200/content/application~1json/schema/definitions/pointaward-fields-editable"}],"required":["title","template","points","auto","isGlobal","terms","priority","visualisation"],"definitions":{"pointaward-fields-readonly":{"properties":{"_id":{"type":"string","description":"Award Id"},"tenantId":{"type":"string","description":"Id of the tenant"},"template":{"type":"string","enum":["STAMP_CARD","LEVEL","AD_HOC","PSEUDO_CURRENCY","CLUB"],"description":"The discount model used by the award"},"title":{"type":"string","description":"The name of the award"},"terms":{"type":"string","description":"The terms and conditions of this award"},"priority":{"type":"number","description":"For LEVEL type awards, controls which award is active (the highest priority) and suppresses any others.  Also used to order the awards in the app awards carousel."},"redemptionMethod":{"string":"string","enum":["AUTO","CODE_PDF417","CODE_QR","VOUCHER"],"description":"How an award is communicated to the POS.\n- `AUTO` - Can be redeemed via integration with the POS and without the need for the User to show the Award in the app.\n- `CODE_PDF417` - Will be displayed in the App as a PDF 417 format of barcode.\n- `CODE_QR` - Will be displayed in the App as a QR code.\n- `VOUCHER` - Will be displayed in the App as a plain text string - e.g. '1234567890' ready for manual POS entry."},"auto":{"type":"boolean","description":"If true, the pos automatically redeems the awards for qualifying baskets"},"token":{"type":"string","description":"The code that the POS uses to match to a discount or adjustment known by the POS, and apply to a basket if appropriate.  This will be the value that is displayed according to `redemptionMethod` above."},"maximumPointCashValue":{"type":"number","description":"The maximum absolute discount that can be applied as the result of redeeming an award"},"discount":{"type":"object","description":"Used to describe rules around how a perk discount is calculated","properties":{"value":{"type":"number","description":"Depending on the discount type either the fixed value of discount or fractional discount on the discountable cost of the scoped items (item, items of category, basket). 50% = 0.5"},"type":{"type":"string","enum":["VALUE","PERCENTAGE","OVERRIDE"],"description":"Whether the type of discount in value should be a fixed VALUE or PERCENTAGE, or OVERRIDE the price with a new value"},"maxValue":{"type":"number","description":"The maximum value of the discount"},"maxCount":{"type":"number","minimum":1,"maximum":20,"description":"The number of times the discount can be matched and applied to a basket for each redemption"},"scope":{"type":"string","enum":["ITEM","CATEGORY","BASKET","ITEM_OR_CATEGORY","CHILD_ITEM","ITEM_AND_CHILD_ITEM"],"description":"Which items in the basket will the perk's discount apply: ITEM: any item with menu perks field or product id that matches the scopeMatchCode. CATEGORY: any item in category with perks field or category id that matches the scopeMatchCode. ITEM_OR_CATEGORY: Both item and categories are matched against scopeMatchCode.  BASKET: Perk will discount any item in the basket. CHILD_ITEM: any condiment item with menu perks field or product id that matches the scopeMatchCode. ITEM_AND_CHILD_ITEM: any item or condiment item with menu perks field or product id that matches the scopeMatchCode."},"scopeMatchCode":{"oneOf":[{"type":"string","description":"A value used to match against productId or categoryId, or values in the menu category or menu item perks field.  Note the portal sets menu perks field to the perkId, but it could be any string value"},{"type":"array","description":"An array of values used to match against productId or categoryId, or values in the menu category or menu item perks field.  Note the portal sets menu perks field to the perkId, but it could be any string value","items":{"type":"string"}},{"type":"array","items":{"type":"array","items":{"type":"string"}}}]},"rule":{"type":"string","enum":["CHEAPEST","COSTLIEST","ALL","ALL_ALLOCATE","CHEAPEST_FIRST","COSTLIEST_FIRST"],"description":"Rule to determine which item(s) to discount in a basket.\nCHEAPEST: The one cheapest item in the basket.\nCOSTLIEST: The most expensive one item in the basket.\nALL: Discount will apply in full to all items; VALUE type awards cannot be redeemed partially.\nALL_ALLOCATE: Discount will be allocated to matching items; VALUE type awards can be redeemed partially.\nCHEAPEST_FIRST: discount applied to cheapest items in asc order until no more can be wholly discounted.\nCOSTLIEST_FIRST: discount applied to costliest items in desc order until no more can be wholly discounted"},"childItemRule":{"type":"string","enum":["INCLUDE","INCLUDE_MATCHED","EXCLUDE"],"description":"Whether or not condiments should also be discounted.  The default is INCLUDE"},"combinationRule":{"type":"string","enum":["MULTI","OWN_QUALIFIER","SINGLE"]},"discountCharges":{"type":"number","description":"Bitwise flags controlling if charge types are discounted.  1: service charges; 2: delivery charges.  The default is 1"}},"required":["value","type","scope","rule"]},"dateTimeRestriction":{"type":"object","description":"Controls when a perk is redeemable based on the time and date","properties":{"startTime":{"type":"number","description":"active time by day, seconds from midnight. Must also have an endTime"},"endTime":{"type":"number","description":"active time by day, seconds from midnight. Must also have a startTime"},"daysOfWeek":{"type":"number","description":"active days of week expressed as the sum of bit flag where Monday=1, Tuesday=2, Wednesday=4, Thursday=8, Friday=16, Saturday=32, Sunday=64"},"startDate":{"type":"string","description":" inclusive start date AND TIME in ISO format"},"endDate":{"type":"string","description":"inclusive end date AND TIME in ISO format"}},"required":[]},"basketQualification":{"type":"object","description":"What conditions must be met in the basket for an award to be redeemable","properties":{"matchCode":{"oneOf":[{"type":"string","description":"A value used to match against productId or categoryId, or values in the menu category or menu item perks field.  Note the portal sets menu perks field to the perkId, but it could be any string value"},{"type":"array","description":"An array of values used to match against productId or categoryId, or values in the menu category or menu item perks field.  Note the portal sets menu perks field to the perkId, but it could be any string value","items":{"type":"string"}}]},"maxCount":{"type":"number","description":"The number of times the discount can be matched and applied to a basket for each successful qualification"},"minimumItems":{"type":"number","description":"the no. of items that need to be in the basket for the perk to be redeemable"},"minimumValue":{"type":"number","description":"the minimum cost of matching items that need to be in the basket for the perk to be redeemable"},"scope":{"type":"string","enum":["ITEM","CATEGORY","BASKET","ITEM_OR_CATEGORY","CHILD_ITEM","ITEM_AND_CHILD_ITEM"],"description":"The scope to use for selecting qualifying items or cost. ITEM: any item with menu perks field or product id that matches the scopeMatchCode. CATEGORY: any item in category with perks field or category id that matches the scopeMatchCode. ITEM_OR_CATEGORY: Both item and categories are matched against scopeMatchCode.  BASKET: Perk will discount any item in the basket. CHILD_ITEM: any condiment item with menu perks field or product id that matches the scopeMatchCode. ITEM_AND_CHILD_ITEM: any item or condiment item with menu perks field or product id that matches the scopeMatchCode."}},"required":["scope"]},"visualisation":{"$ref":"#/paths/~1perks/post/responses/201/content/application~1json/schema/definitions/visualisation"},"isDonatable":{"type":"boolean"},"isGlobal":{"type":"boolean","description":"If true, all users will be granted an award"},"isTier":{"type":"boolean"},"updatedAt":{"type":"string","description":"Date in RFC 3339 format.  Note - records that haven't changed since API v8 was introduced will have a updateAt set to an arbitrary 1970 date"},"locationIds":{"type":"array","items":{"type":"string"}},"barcodeValue":{"type":"string","description":"The value to be encoded in the barcode","examples":["EX4MPL312345"]}}},"pointaward-fields-editable":{"properties":{"points":{"type":"object","properties":{"available":{"type":"number","description":"The user's current points balance on this award"}}}}}}}}}},"401":{"$ref":"#/paths/~1users/get/responses/401"},"404":{"$ref":"#/paths/~1users/get/responses/404"},"422":{"$ref":"#/paths/~1users/get/responses/422"},"500":{"$ref":"#/paths/~1users/get/responses/500"}}}},"/users/:userId/awards":{"get":{"tags":["Awards","Users"],"summary":"Get a User's Awards","description":"Get all Awards for a specific User\n\nNote: this endpoint returns the old Perks schema and will be changed in a future version.\nUse the endpoint `GET /users/:userId/pointawards` in the meantime.\n","operationId":"getUserAwards","parameters":[{"name":"userId","in":"path","description":"The unique ID of the User to retrieve the Awards for.","required":true,"schema":{"type":"string"}},{"name":"includeUnvisualisedAwards","in":"query","description":"if true, it will include awards that have not been visualised in the response.","required":false,"schema":{"type":"string"}},{"name":"includeDisabled","in":"query","description":"if true, it will include awards linked to disabled perks in the response.","required":false,"schema":{"type":"string"}},{"name":"locationId","in":"query","description":"if supported by merchant's setup, it will only return the list of awards valid for the location ID provided.","required":false,"schema":{"type":"string"}}],"requestBody":null,"deprecated":true,"responses":{"200":{"description":"A list of awards"},"401":{"$ref":"#/paths/~1users/get/responses/401"},"404":{"$ref":"#/paths/~1users/get/responses/404"},"422":{"$ref":"#/paths/~1users/get/responses/422"},"500":{"$ref":"#/paths/~1users/get/responses/500"}}}},"/users/:userId/pointawards":{"get":{"tags":["Awards","Users"],"summary":"Get a User's Awards (PointPerk)","description":"Get all awards for a specific user\n\nThis endpoint will be deprecated in an upcoming release and be replaced by `GET /user/:userId/awards`\n","operationId":"getUserPointAwards","parameters":[{"name":"userId","in":"path","description":"The unique ID of the User to retrieve the Awards for.","required":true,"schema":{"type":"string"}},{"name":"includeUnvisualisedAwards","in":"query","description":"if true, it will include awards that have not been visualised in the response.","required":false,"schema":{"type":"string"}},{"name":"includeDisabled","in":"query","description":"if true, it will include awards linked to disabled perks in the response.","required":false,"schema":{"type":"string"}},{"name":"locationId","in":"query","description":"if supported by merchant's setup, it will only return the list of awards valid for the location ID provided.","required":false,"schema":{"type":"string"}}],"requestBody":null,"responses":{"200":{"description":"A list of awards","content":{"application/json":{"schema":{"title":"Awards List","type":"object","properties":{"awards":{"type":"array","title":"A list of awards","items":{"$ref":"#/paths/~1pointperks~1%3AperkId~1awards/post/responses/200/content/application~1json/schema"}}}}}}},"401":{"$ref":"#/paths/~1users/get/responses/401"},"404":{"$ref":"#/paths/~1users/get/responses/404"},"422":{"$ref":"#/paths/~1users/get/responses/422"},"500":{"$ref":"#/paths/~1users/get/responses/500"}}}},"/users/:userId/awards/:awardId":{"put":{"tags":["Awards"],"summary":"Redeem an Award","description":"Redeem a specific award for a specific user.\n\nNote: this endpoint affects the old Perks schema and will be changed in a future version.\nUse the endpoint `GET /users/:userId/pointawards/:awardId` in the meantime.\n","operationId":"redeemAward","deprecated":true,"parameters":[{"name":"userId","in":"path","description":"The Id of the user","required":true,"schema":{"type":"string"}},{"name":"awardId","in":"path","description":"The Id of the award.","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"valueToRedeem":{"type":"number","description":"The number of points to deduct from award"}},"required":["valueToRedeem"]}}}},"responses":{"200":{"description":"The request succeeded"},"401":{"$ref":"#/paths/~1users/get/responses/401"},"404":{"$ref":"#/paths/~1users/get/responses/404"},"422":{"$ref":"#/paths/~1users/get/responses/422"},"500":{"$ref":"#/paths/~1users/get/responses/500"}}}},"/users/:userId/pointawards/:awardId":{"put":{"tags":["Awards"],"summary":"Redeem an Award (PointPerk)","description":"Redeem a specific award for a specific user.\n\nThis endpoint will be deprecated in an upcoming release and be replaced by `PUT users/:userId/awards/:awardId` (TBD)\n","operationId":"redeemPointAward","parameters":[{"name":"userId","in":"path","description":"The Id of the user","required":true,"schema":{"type":"string"}},{"name":"awardId","in":"path","description":"The Id of the award.","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"valueToRedeem":{"type":"number","description":"The number of points to deduct from award `points.available`"},"locationId":{"type":"string","description":"The id of the location where the award was redeemed"}},"required":["valueToRedeem"]}}}},"responses":{"200":{"description":"The request succeeded"},"401":{"$ref":"#/paths/~1users/get/responses/401"},"404":{"$ref":"#/paths/~1users/get/responses/404"},"422":{"$ref":"#/paths/~1users/get/responses/422"},"500":{"$ref":"#/paths/~1users/get/responses/500"}}}},"/users/:userId/pointawards/:awardId/refunds":{"put":{"tags":["Awards"],"summary":"Refund an Award Redemption (PointPerk)","description":"Refund a redeemption of a specific award for a specific user.\n\nThis endpoint will be deprecated in an upcoming release and be replaced by `PUT users/:userId/awards/:awardId` (TBD)\n","operationId":"refundPointAward","parameters":[{"name":"userId","in":"path","description":"The Id of the user","required":true,"schema":{"type":"string"}},{"name":"awardId","in":"path","description":"The Id of the award.","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"value":{"type":"number","description":"The number of points to refund to award `points.available`"}},"required":["value"]}}}},"responses":{"200":{"description":"The request succeeded"},"401":{"$ref":"#/paths/~1users/get/responses/401"},"404":{"$ref":"#/paths/~1users/get/responses/404"},"422":{"$ref":"#/paths/~1users/get/responses/422"},"500":{"$ref":"#/paths/~1users/get/responses/500"}}}},"/notifications":{"get":{"tags":["Notifications"],"summary":"Get Notifications","description":"Gets a paged list of push notification messages.\n","operationId":"getNotificationMessages","parameters":[{"$ref":"#/paths/~1users/get/parameters/8"},{"$ref":"#/paths/~1users/get/parameters/9"}],"requestBody":null,"responses":{"200":{"description":"The request succeeded","content":{"application/json":{"schema":{"$schema":"http://json-schema.org/draft-07/schema#","title":"Notification Message List","description":"A paged list of Notification Messages","type":"object","properties":{"items":{"type":"array","title":"Notification Messages","items":{"$ref":"#/paths/~1notifications/post/responses/201/content/application~1json/schema"}},"page":{"$ref":"#/paths/~1perks/get/responses/200/content/application~1json/schema/properties/page"}}}}}},"401":{"$ref":"#/paths/~1users/get/responses/401"},"404":{"$ref":"#/paths/~1users/get/responses/404"},"422":{"$ref":"#/paths/~1users/get/responses/422"},"500":{"$ref":"#/paths/~1users/get/responses/500"}}},"post":{"tags":["Notifications"],"summary":"Create a Notification","description":"\nCreates a push Notification Message, and schedules it for immediate delivery.\n\nThe destination can be specified as\n- a list of users, specified by their Ids\n- users that are members of segments, specified by a list of the segment Ids\n- users with locations set a favourites, specified by a list of the location Ids\n- all users of the app\n\nOnly one of the destination options can be set at a time; currently they cannot be combined.\n\nThe request will return immediately with a notification message `_id`.\nPoll the `GET /notifications/:notificationId` endpoint using the Id to track the result of the delivery.\n\nThis path is versioned via the `x-api-version` header, which should be '9' or higher.\n","operationId":"createNotificationMessage","parameters":[{"$ref":"#/paths/~1users~1%3AuserId~1receipts/parameters/0"}],"requestBody":{"content":{"application/json":{"schema":{"$schema":"http://json-schema.org/draft-07/schema#","title":"Notification Message Create","description":"Create request for a Push Notification Message","type":"object","allOf":[{"$ref":"#/paths/~1notifications/post/responses/201/content/application~1json/schema/definitions/messageCreate"},{"$ref":"#/paths/~1notifications/post/responses/201/content/application~1json/schema/definitions/messageDestination"}]}}}},"responses":{"201":{"description":"The message was created.","content":{"application/json":{"schema":{"$schema":"http://json-schema.org/draft-07/schema#","title":"Notification Message","description":"A Push Notification Message","type":"object","allOf":[{"properties":{"_id":{"type":"string","description":"Id of the message"},"tenantId":{"type":"string","description":"Id of the tenant"}}},{"$ref":"#/paths/~1notifications/post/responses/201/content/application~1json/schema/definitions/messageCreate"},{"$ref":"#/paths/~1notifications/post/responses/201/content/application~1json/schema/definitions/messageDestination"},{"properties":{"createdAt":{"type":"string","description":"Time the notification message was created."},"completedAt":{"type":"string","description":"Time the message delivery was completed."},"status":{"type":"string","description":"Status of the message delivery.  Poll the message to wait for completion.","enum":["PENDING","DONE","ERROR"]},"sent":{"type":"number","description":"The number of messages sent successfully to Apple or Google's push notification platforms.  See the receipts endpoint for details by user."},"failures":{"type":"number","description":"The number of messages failed to send to Apple or Google's push notification platforms.  See the receipts endpoint for details by user."},"skipped":{"type":"number","description":"The number of messages skipped and not sent due to opt outs or missing device tokens.  See the receipts endpoint for details by user."},"errorMessage":{"type":"string","description":"Error message if the whole delivery failed."}},"required":["_id","tenantId","createAt","status","sent","failures","skipped"]}],"definitions":{"messageCreate":{"properties":{"title":{"type":"string","description":"The title of the notification message"},"message":{"type":"string","description":"The text of the notification message"},"imageUrl":{"type":"string"},"deepLink":{"type":"object","properties":{"moduleId":{"type":"string"},"moduleItemId":{"type":"string"},"voucher":{"type":"string"}},"required":["moduleId","moduleItemId"]},"buttonText":{"type":"string","description":"The text of the button"},"type":{"type":"string","description":"Reserved for future use.","enum":["alert"]},"value":{"type":"string","description":"Reserved for future use."},"isProcessingMessage":{"type":"boolean","description":"Set this to false if the message is a marketing message, or true if it is a message that should be sent even if the user has opted out of receiving marketing.  Misusing this flag could cause penalties under the GDPR regulations."}},"required":["message","type","value","isProcessingMessage"]},"messageDestination":{"properties":{"userIds":{"type":"array","description":"List of Ids of users to send the message to.","items":{"type":"string"}},"locationIds":{"type":"array","description":"List of Ids of locations. All users with those locations as a favourite will be sent the message.","items":{"type":"string"}},"segmentIds":{"type":"array","description":"List of Ids of segments. All the segment user members will be sent the message.","items":{"type":"string"}},"global":{"type":"boolean","description":"Set this to true to send the message to every user of the App."}}}}}}}},"401":{"$ref":"#/paths/~1users/get/responses/401"},"404":{"$ref":"#/paths/~1users/get/responses/404"},"422":{"$ref":"#/paths/~1users/get/responses/422"},"500":{"$ref":"#/paths/~1users/get/responses/500"}}}},"/notifications/:notificationId":{"get":{"tags":["Notifications"],"summary":"Get a Notification","description":"Gets a push notification message by Id\n","operationId":"getNotificationMessageById","parameters":[{"name":"notificationMessageId","in":"path","description":"The specific ID of the Notification Message to retrieve.","required":true,"schema":{"type":"string"}}],"requestBody":null,"responses":{"200":{"description":"The request succeeded","content":{"application/json":{"schema":{"$ref":"#/paths/~1notifications/post/responses/201/content/application~1json/schema"}}}},"401":{"$ref":"#/paths/~1users/get/responses/401"},"404":{"$ref":"#/paths/~1users/get/responses/404"},"422":{"$ref":"#/paths/~1users/get/responses/422"},"500":{"$ref":"#/paths/~1users/get/responses/500"}}}},"/notifications/:notificationId/receipts":{"get":{"tags":["Notifications"],"summary":"Get Notification Message Receipts","description":"Gets a paged list of the user receipts for notifications.\n\n*User receipts are only retained for 45 days*\n","operationId":"getNotificationMessageByIdReceipts","parameters":[{"name":"notificationMessageId","in":"path","description":"The specific ID of the Notification Message to retrieve.","required":true,"schema":{"type":"string"}},{"$ref":"#/paths/~1users/get/parameters/8"},{"$ref":"#/paths/~1users/get/parameters/9"}],"requestBody":null,"responses":{"200":{"description":"The request succeeded","content":{"application/json":{"schema":{"$ref":"#/paths/~1users~1%3AuserId~1receipts/get/responses/200/content/application~1json/schema"}}}},"401":{"$ref":"#/paths/~1users/get/responses/401"},"404":{"$ref":"#/paths/~1users/get/responses/404"},"422":{"$ref":"#/paths/~1users/get/responses/422"},"500":{"$ref":"#/paths/~1users/get/responses/500"}}}},"/users/:userId/notifications":{"parameters":[{"$ref":"#/paths/~1users~1%3AuserId~1receipts/parameters/0"}],"post":{"tags":["Notifications"],"summary":"Create a Notification for a User","description":"Creates a push Notification Message for a specific user, and schedules it for immediate delivery.\n","operationId":"createUserIdNotificationMessage","parameters":[{"name":"userId","in":"path","description":"The unique ID of the User to create the Notifications for.","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/paths/~1notifications/post/responses/201/content/application~1json/schema/definitions/messageCreate"}}}},"responses":{"201":{"description":"The notification message was created.","content":{"application/json":{"schema":{"$ref":"#/paths/~1notifications/post/responses/201/content/application~1json/schema"}}}},"401":{"$ref":"#/paths/~1users/get/responses/401"},"404":{"$ref":"#/paths/~1users/get/responses/404"},"422":{"$ref":"#/paths/~1users/get/responses/422"},"500":{"$ref":"#/paths/~1users/get/responses/500"}}}},"/users/:userId/receipts":{"parameters":[{"name":"x-api-version","required":false,"in":"header","description":"The behaviour of this path is versioned via the `x-api-version` header.  The version should be an integer number as a string, eg `'2'`.\nFor this endpoint, the supported values are:\n- '1': not supported any longer\n- '2' or higher: current behaviour as described here\n\nIf missing, the default value is '1' which is no longer support by this endpoint.  You must set the header to '2' or higher.\n","schema":{"type":"number"}}],"get":{"tags":["Notifications"],"summary":"Get a User's Notification Message Receipts","description":"Gets a paged list of the receipts for Notification Message for a specific User.\n\n*User receipts are only retained for 45 days*\n","operationId":"getUserByIdNotificationMessagedReceipts","parameters":[{"name":"userId","in":"path","description":"The User ID to use for retrieving the Notification Message Receipts.","required":true,"schema":{"type":"string"}},{"$ref":"#/paths/~1users/get/parameters/8"},{"$ref":"#/paths/~1users/get/parameters/9"}],"requestBody":null,"responses":{"200":{"description":"The request succeeded","content":{"application/json":{"schema":{"$schema":"http://json-schema.org/draft-07/schema#","title":"Notification Message List","description":"A paged list of Notification Message Receipts","type":"object","properties":{"items":{"type":"array","title":"Notification Message Receipts","items":{"$schema":"http://json-schema.org/draft-07/schema#","title":"Notification Message Receipt","description":"A user receipt of a push Notification Message","type":"object","properties":{"_id":{"type":"string","description":"Id of the receipt"},"tenantId":{"type":"string","description":"Id of the tenant"},"notificationMessageId":{"type":"string","description":"Id of the message"},"userId":{"type":"string","description":"Id of the user"},"sentAt":{"type":"string","description":"Time the message delivery was attempted."},"method":{"type":"string","description":"Push notification method.","enum":["APNS","GCM","FCM"]},"pushMessageId":{"type":"string","description":"External message Id from the push notification platform."},"skipMessage":{"type":"string","description":"Reason sending the message toi this user was skipped."},"errorMessage":{"type":"string","description":"Error message while sending the message"},"createdAt":{"type":"number","description":"The number of messages skipped and not sent due to opt outs or missing device tokens.  See the receipts endpoint for details by user."}},"required":["_id","tenantId","createAt","status","sent","failures","skipped"]}},"page":{"$ref":"#/paths/~1perks/get/responses/200/content/application~1json/schema/properties/page"}}}}}},"401":{"$ref":"#/paths/~1users/get/responses/401"},"404":{"$ref":"#/paths/~1users/get/responses/404"},"422":{"$ref":"#/paths/~1users/get/responses/422"},"500":{"$ref":"#/paths/~1users/get/responses/500"}}}},"/locations/:segmentId/notifications":{"parameters":[{"$ref":"#/paths/~1users~1%3AuserId~1receipts/parameters/0"}],"post":{"tags":["Notifications"],"summary":"Create a Notification by Location","description":"Creates a push Notification Message for all the users with this Location set as a favourite\n","operationId":"createLocationIdNotificationMessage","parameters":[{"name":"userId","in":"path","description":"The unique ID of the Location to create the Notifications for.","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/paths/~1notifications/post/responses/201/content/application~1json/schema/definitions/messageCreate"}}}},"responses":{"201":{"description":"The notification message was created.","content":{"application/json":{"schema":{"$ref":"#/paths/~1notifications/post/responses/201/content/application~1json/schema"}}}},"401":{"$ref":"#/paths/~1users/get/responses/401"},"404":{"$ref":"#/paths/~1users/get/responses/404"},"422":{"$ref":"#/paths/~1users/get/responses/422"},"500":{"$ref":"#/paths/~1users/get/responses/500"}}}},"/segments/:segmentId/notifications":{"parameters":[{"$ref":"#/paths/~1users~1%3AuserId~1receipts/parameters/0"}],"post":{"tags":["Notifications"],"summary":"Create a Notification by Segment","description":"Creates a push Notification Message for all the users who are members of this segment.\n","operationId":"createSegmentIdNotificationMessage","parameters":[{"name":"userId","in":"path","description":"The unique ID of the Segment to create the Notifications for.","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/paths/~1notifications/post/responses/201/content/application~1json/schema/definitions/messageCreate"}}}},"responses":{"201":{"description":"The notification message was created.","content":{"application/json":{"schema":{"$ref":"#/paths/~1notifications/post/responses/201/content/application~1json/schema"}}}},"401":{"$ref":"#/paths/~1users/get/responses/401"},"404":{"$ref":"#/paths/~1users/get/responses/404"},"422":{"$ref":"#/paths/~1users/get/responses/422"},"500":{"$ref":"#/paths/~1users/get/responses/500"}}}},"/referrals":{"post":{"tags":["Referrals"],"summary":"Create a Referral","description":"Creates a Referral with a unique code for the authenticated User.\n","operationId":"createReferral","deprecated":false,"responses":{"201":{"description":"The referral was created.","content":{"application/json":{"schema":{"$schema":"http://json-schema.org/draft-07/schema#","title":"Referral","type":"object","properties":{"_id":{"type":"string","description":"Referral Id"},"tenantId":{"type":"string","description":"Id of the tenant"},"code":{"type":"number","description":"Unique referral code"},"refererId":{"type":"string","description":"Id of the referrer"},"refereeId":{"type":"string","description":"Id of the referee"},"expires":{"type":"string","description":"When the referral code expires"},"created":{"type":"string","description":"When the referral code what created"},"state":{"enum":["CREATED","CLAIMED"]}}}}}},"401":{"$ref":"#/paths/~1users/get/responses/401"},"404":{"$ref":"#/paths/~1users/get/responses/404"},"422":{"$ref":"#/paths/~1users/get/responses/422"},"500":{"$ref":"#/paths/~1users/get/responses/500"}}}},"/referrals/:code":{"put":{"tags":["Referrals"],"summary":"Claim a Referral","description":"Claims a Referral code for the authenticated User.\n","operationId":"claimReferral","parameters":[{"name":"code","in":"path","description":"The referral code to claim.","required":true,"schema":{"type":"string"}}],"requestBody":null,"responses":{"200":{"description":"The referral was claimed.","content":{"application/json":{"schema":{"$ref":"#/paths/~1referrals/post/responses/201/content/application~1json/schema"}}}},"401":{"$ref":"#/paths/~1users/get/responses/401"},"404":{"$ref":"#/paths/~1users/get/responses/404"},"422":{"$ref":"#/paths/~1users/get/responses/422"},"500":{"$ref":"#/paths/~1users/get/responses/500"}}}},"/actions":{"get":{"tags":["Actions"],"summary":"Get Actions","description":"Retrieve the Actions for the Tenant.\n\nGet all of the _Actions_ for the _Tenant_, sorted in reverse chronological order.\n\nFor an overview of the _Action_ construct, please see the [Overview of Actions](/#/guides/actions-overview) guide.\nThis includes a link to the JSON Schema the defines the structure of an _Action_ in detail.\n\nThis path is versioned via the `x-api-version` header, which should be '9' or higher.\n","operationId":"getActions","parameters":[{"$ref":"#/paths/~1awards/get/parameters/0"},{"$ref":"#/paths/~1users/get/parameters/8"},{"$ref":"#/paths/~1users/get/parameters/9"},{"name":"when.timestamp[.gt | .lte | .eq | .neq]","in":"query","description":"Filter the response using action `when.timestamp` in comparison to this iso date value.  Valid values of comparison are \n'gt' (for greater than), 'lte', 'eq', 'neq'.  The comparison defaults to 'eq' when not provided\n","required":false,"schema":{"type":"string","format":"date-time"}},{"name":"type[.in | .nin]","in":"query","description":"Filter the response using action 'type' in comparison this list of comma separated types.  Valid values of comparison are \n'in' (for matching any), 'nin' (for not matching any).  The comparison defaults to 'in' when not provided\n","required":false,"schema":{"type":"string"}},{"name":"locationId","in":"query","description":"Filter the response using action 'locationId'. This is a list of comma separated locationIds.\n","required":false,"schema":{"type":"string"}},{"name":"credentialId","in":"query","description":"Filter the response using a user's full credential (email or phone number)\n","required":false,"schema":{"type":"string"}},{"name":"paymentType[.in | .nin]","in":"query","description":"Filter transactions by payment type. Accepts comma-separated list of OrderPaymentType enum values.\nValid values: CASH_AT_POS, CARD_AT_POS, GIFT_CARD_AT_POS, OTHER_AT_POS, APPLEPAY, GOOGLEPAY, CARD_ON_FILE, CARD_TENDERED, GIFT_CARD, CARDHOLDER_PRESENT, CASH, CARD, OTHER, APP, PAY_BY_BANK.\nUse 'in' (for matching any), 'nin' (for not matching any). The comparison defaults to 'in' when not provided.\n","required":false,"schema":{"type":"string"},"example":"CARDHOLDER_PRESENT,APPLEPAY"}],"responses":{"200":{"description":"The request succeeded","content":{"application/json":{"example":{"actions":[{"type":"XXX_XXX","tenantId":"111111111111111111111111","when":{"timestamp":"YYYY-MM-DDTHH:mm:ss.SSSZ","monthofyear":1,"weekofyear":1,"dayofmonth":1,"dayofweek":1,"daypart":"XXX"},"metadata":{"/* ... */":null},"context":{"tenant":{"_id":"111111111111111111111111","title":"Hooli"},"user":{"_id":"111111111111111111111111","name":"Gavin Belson","primaryPlatform":"IOS"},"location":{"_id":"111111111111111111111111","title":"Hooli Restaurant","geo":[0,0],"regions":[],"tags":[]},"tags":[]},"environment":"PRODUCTION"}]}}}},"401":{"$ref":"#/paths/~1users/get/responses/401"},"404":{"$ref":"#/paths/~1users/get/responses/404"},"422":{"$ref":"#/paths/~1users/get/responses/422"},"500":{"$ref":"#/paths/~1users/get/responses/500"}}}},"/actions/:actionId":{"get":{"tags":["Actions"],"summary":"Get an Action","description":"Retrieve a specific Action","operationId":"actionsactionid","parameters":[{"name":"actionId","in":"path","description":"The ID of the Action to retrieve","required":true,"schema":{"type":"string"}}],"requestBody":null,"deprecated":false}},"/actions/exports":{"post":{"tags":["Actions"],"summary":"Create an actions export","description":"Generate a csv export of actions","operationId":"postActionsExport","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"limit":{"description":"The maximum number of actions to be exported","type":"number"},"from":{"description":"Only export actions from this date","type":"string"},"to":{"description":"Only export actions up to this date","type":"string"},"maxFileSizeMB":{"description":"Maximum size of a single csv file","type":"number"},"locationIds":{"description":"Only export actions at these locations","type":"array","items":{"type":"string"}},"types":{"description":"Only export actions matching these types","type":"array","items":{"type":"string"}}},"required":["from","to","types"]}}}},"responses":{"200":{"description":"The request was successful"},"401":{"$ref":"#/paths/~1users/get/responses/401"},"404":{"$ref":"#/paths/~1users/get/responses/404"},"422":{"$ref":"#/paths/~1users/get/responses/422"},"500":{"$ref":"#/paths/~1users/get/responses/500"}}}},"/actions/exports/:fileId":{"get":{"tags":["Actions"],"summary":"Download an actions export","description":"Download a csv export of actions.\n\nThe full path including `fileId` is retrieved from the import operation's `href`.\n","responses":{"200":{"description":"The request was successful"},"401":{"$ref":"#/paths/~1users/get/responses/401"},"404":{"$ref":"#/paths/~1users/get/responses/404"},"422":{"$ref":"#/paths/~1users/get/responses/422"},"500":{"$ref":"#/paths/~1users/get/responses/500"}}}},"/cards":{"get":{"tags":["Payment Cards"],"summary":"Get all Payment Cards","description":"If the user is an admin user, this call gets all the payment cards for the tenant.  **CAUTION** this call is not currently paged and so could give a huge result.\n\nIf the user is not an admin user, this call gets all the cards for the current user.\n","operationId":"getCards","parameters":[],"responses":{"200":{"description":"The request succeeded","content":{"application/json":{"schema":{"title":"Cards List","description":"A list of card details","type":"object","properties":{"cards":{"type":"array","title":"Cards","items":{"$ref":"#/paths/~1cards~1%3AcardId/get/responses/200/content/application~1json/schema"}}}}}}},"401":{"$ref":"#/paths/~1users/get/responses/401"},"404":{"$ref":"#/paths/~1users/get/responses/404"},"422":{"$ref":"#/paths/~1users/get/responses/422"},"500":{"$ref":"#/paths/~1users/get/responses/500"}}},"post":{"tags":["Payment Cards"],"summary":"Add a Payment Card","description":"Add a tokenized payment card for the authenticated user.\nOr, add a card via a one use token.\nOr, request a token to add a card for BRAINTREE.\n","operationId":"addCard","parameters":[],"requestBody":{"content":{"application/json":{"schema":{"oneOf":[{"$schema":"http://json-schema.org/draft-07/schema#","title":"Create Payment Method","description":"Create a payment method","allOf":[{"$ref":"#/paths/~1cards~1%3AcardId/get/responses/200/content/application~1json/schema/definitions/createCard"}]},{"type":"object","title":"BRAINTREE token request","properties":{"cardType":{"type":"string","enum":["BRAINTREE"]}}},{"type":"object","title":"Add card via one use token","properties":{"token":{"type":"string","description":"A token that can be used to register a card via the server.  Currently only supported by JUDOPAY"},"cardType":{"type":"string"}}}]}}}},"responses":{"201":{"description":"The payment card was created","content":{"application/json":{"schema":{"oneOf":[{"$ref":"#/paths/~1cards~1%3AcardId/get/responses/200/content/application~1json/schema"},{"type":"object","title":"BRAINTREE token","properties":{"clientToken":{"type":"string"}}}]}}}},"401":{"$ref":"#/paths/~1users/get/responses/401"},"404":{"$ref":"#/paths/~1users/get/responses/404"},"422":{"$ref":"#/paths/~1users/get/responses/422"},"500":{"$ref":"#/paths/~1users/get/responses/500"}}}},"/cards/setup":{"post":{"tags":["Payment Cards"],"summary":"Pre-Create a Payment Card","description":"Perform the precreation setup with the payment provider to support adding a new payment card to the user.\n\nThis is required for the following PaymentProviders:\n  Stripe:\n    To create a SetupIntent, returning the data required to Create a Card in Stripe.\n","operationId":"setupCard","parameters":[],"responses":{"201":{"description":"The request succeeded","content":{"application/json":{"schema":{"title":"Pre-Create Response","description":"A payment provider specific response with data required to authorise creation a Card","oneOf":[{"$schema":"http://json-schema.org/draft-07/schema#","title":"Stripe Setup Response","allOf":[{"$ref":"#/paths/~1cards~1setup/post/responses/201/content/application~1json/schema/oneOf/0/definitions/cardSetupResponseStripe"}],"definitions":{"cardSetupResponseStripe":{"description":"Stripe SetupIntent information for the Client","type":"object","properties":{"stripe":{"description":"Stripe SetupIntent data required for Stripe.confirmSetupCard","type":"object","properties":{"setupIntentCustomerId":{"type":"string","description":"Unique id of the SetupIntent's Customer in Stripe"},"setupIntentClientSecret":{"type":"string","description":"Unique secret of the SetupIntent in Stripe for Client Confirmation"}}}}}}}]}}}},"401":{"$ref":"#/paths/~1users/get/responses/401"},"404":{"$ref":"#/paths/~1users/get/responses/404"},"422":{"$ref":"#/paths/~1users/get/responses/422"},"500":{"$ref":"#/paths/~1users/get/responses/500"}}}},"/cards/:cardId":{"get":{"tags":["Payment Cards"],"summary":"Get a Payment Card","description":"Retrieve a specific card for the authenticated user","operationId":"getCardById","parameters":[{"name":"cardId","in":"path","description":"The unique Id of the payment card to retrieve","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"The request was successful","content":{"application/json":{"schema":{"$schema":"http://json-schema.org/draft-07/schema#","title":"Payment Card","allOf":[{"$ref":"#/paths/~1cards~1%3AcardId/get/responses/200/content/application~1json/schema/definitions/getCard"}],"definitions":{"createCard":{"description":"Details of a user's payment method such as a tokenised credit card","type":"object","properties":{"cardType":{"type":"string","description":"Payment gateway type","enum":["STRIPE","JUDOPAY","BRAINTREE","SQUARE"]},"methodType":{"type":"string","default":"CARD","enum":["CARD","PAYPAL"]},"consumerId":{"type":"string","description":"Consumer Id (for JUDOPAY)"},"consumerReference":{"type":"string","description":"consumerReference (for JUDOPAY)"},"gatewayId":{"type":"string","description":"The tokenized card id generated by the payment gateway.  If this is omitted, the call will attempt to retrieve a token and return it"},"last4":{"type":"string","description":"The last 4 digits of the payment card."},"expires":{"type":"string","description":"The month and year the card expires, format MMYY"},"token":{"type":"string","description":"An optional client-generated token encapsulating 3DS information."}},"required":[]},"getCard":{"description":"Details of a user's payment method such as a tokenised credit card","type":"object","properties":{"_id":{"type":"string","description":"Unique id of the card record"},"created":{"type":"string","description":"Time created in ISO 8601"},"updated":{"type":"string","description":"Time last updated in ISO 8601"},"userId":{"type":"string","description":"The user id the payment card is associated with"},"cardType":{"type":"string","description":"Payment gateway type","enum":["STRIPE","JUDOPAY","BRAINTREE","SQUARE"]},"gatewayId":{"type":"string","description":"The tokenized id of the card, or the consumerId (JUDOPAY)"},"cardId":{"type":"string","description":"The tokenized id of the card"},"methodType":{"type":"string","enum":["CARD","PAYPAL"]},"type":{"type":"string","description":"The payment card type - eg VISA_DEBIT"},"email":{"type":"string","description":"The email address associated with the card"},"last4":{"type":"string","description":"The last 4 digits of the payment card."},"expires":{"type":"string","description":"The month and year the card expires, format MMYY or MM/YYYY or M/YYYY"},"autoTopUp":{"$ref":"#/paths/~1cards~1%3AcardId/get/responses/200/content/application~1json/schema/definitions/autoTopUp"}}},"updateCard":{"description":"Details of a user's payment method such as a tokenised credit card","type":"object","properties":{"autoTopUp":{"$ref":"#/paths/~1cards~1%3AcardId/get/responses/200/content/application~1json/schema/definitions/autoTopUp"}}},"autoTopUp":{"type":"object","description":"User's auto balance topup settings.  These fields are deprecated","properties":{"enabled":{"type":"boolean"},"amount":{"type":"number","description":"The topup amount","default":10},"trigger":{"type":"number","description":"The balance amount below which a topup is triggered","default":10}}}}}}}},"401":{"$ref":"#/paths/~1users/get/responses/401"},"404":{"$ref":"#/paths/~1users/get/responses/404"},"422":{"$ref":"#/paths/~1users/get/responses/422"},"500":{"$ref":"#/paths/~1users/get/responses/500"}}},"put":{"tags":["Payment Cards"],"summary":"Update a Payment Card","description":"Updates an existing payment ../schemas/card.json\n\nOnly the deprecated auto topup fields can be changed.\n","operationId":"updateCardById","parameters":[{"name":"cardId","in":"path","description":"The unique Id of the payment card to update","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"$schema":"http://json-schema.org/draft-07/schema#","title":"Update Payment Card","description":"Update a payment card","allOf":[{"$ref":"#/paths/~1cards~1%3AcardId/get/responses/200/content/application~1json/schema/definitions/updateCard"}]}}}},"responses":{"200":{"description":"The request was successful","content":{"application/json":{"schema":{"$ref":"#/paths/~1cards~1%3AcardId/get/responses/200/content/application~1json/schema"}}}},"401":{"$ref":"#/paths/~1users/get/responses/401"},"404":{"$ref":"#/paths/~1users/get/responses/404"},"422":{"$ref":"#/paths/~1users/get/responses/422"},"500":{"$ref":"#/paths/~1users/get/responses/500"}}},"delete":{"tags":["Payment Cards"],"summary":"Delete a Payment Card","description":"Removes a payment card specifid by Id from the database and the payment gateway","operationId":"deleteCardById","parameters":[{"name":"cardId","in":"path","description":"The unique Id of the card to remove","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"The request was successful"},"401":{"$ref":"#/paths/~1users/get/responses/401"},"404":{"$ref":"#/paths/~1users/get/responses/404"},"422":{"$ref":"#/paths/~1users/get/responses/422"},"500":{"$ref":"#/paths/~1users/get/responses/500"}}}},"/users/:userId/cards":{"get":{"tags":["Users","Payment Cards"],"summary":"Get Payment Cards for a User","description":"Retrieves the payment cards for a specific user.  Only admin users can retrieve cards for other users.\n","operationId":"getCardsByUserId","parameters":[{"name":"userId","in":"path","description":"The unique ID of the User to retrieve the Cards for.","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"The request succeeded","content":{"application/json":{"schema":{"title":"Cards List","description":"A list of card details","type":"object","properties":{"cards":{"type":"array","title":"Cards","items":{"$ref":"#/paths/~1cards~1%3AcardId/get/responses/200/content/application~1json/schema"}}}}}}},"401":{"$ref":"#/paths/~1users/get/responses/401"},"404":{"$ref":"#/paths/~1users/get/responses/404"},"422":{"$ref":"#/paths/~1users/get/responses/422"},"500":{"$ref":"#/paths/~1users/get/responses/500"}}}},"/users/:userId/activeCard":{"get":{"tags":["Users","Payment Cards"],"summary":"Get the Active Payment Card for a User","description":"Retrieves the payment cards for a specific user.  Only admin users can retrieve cards for other users.\n","operationId":"getCardsByUserIdActive","parameters":[{"name":"userId","in":"path","description":"The unique ID of the User to retrieve the active payment card","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"The request succeeded","content":{"application/json":{"schema":{"$ref":"#/paths/~1cards~1%3AcardId/get/responses/200/content/application~1json/schema"}}}},"401":{"$ref":"#/paths/~1users/get/responses/401"},"404":{"$ref":"#/paths/~1users/get/responses/404"},"422":{"$ref":"#/paths/~1users/get/responses/422"},"500":{"$ref":"#/paths/~1users/get/responses/500"}}}},"/checkins":{"get":{"tags":["Checkins"],"summary":"Get all Checkins","description":"Retrieves the Checkins for the authenticated User.","operationId":"checkins","parameters":[{"name":"per_page","in":"query","description":"How many results to return.","required":false,"schema":{"type":"integer","format":"int32","default":"20"}},{"name":"page","in":"query","description":"Which page of results to return.","required":false,"schema":{"type":"integer","format":"int32","default":"1"}}],"requestBody":null,"deprecated":false},"post":{"tags":["Checkins"],"summary":"Create a Checkin","description":"Create a Checkin for the authenticated User","operationId":"checkins-1","parameters":[],"requestBody":null,"deprecated":false}},"/checkins/:checkinId":{"put":{"tags":["Checkins"],"summary":"Update a Checkin","description":"Updates a specific Checkin","operationId":"checkinscheckinid","parameters":[{"name":"checkinId","in":"path","description":"The unique ID of the Checkin to update.","required":true,"schema":{"type":"string"}}],"requestBody":null,"deprecated":false}},"/vouchers":{"post":{"tags":["Vouchers"],"summary":"Create a Voucher","description":"Creates a voucher for a tenant.\n\nA voucher is redeemable a specific number of times, either globally or per user.\nIn addition, validity dates can be set.\n","operationId":"createVoucher","requestBody":{"content":{"application/json":{"schema":{"$schema":"http://json-schema.org/draft-07/schema#","title":"Create Voucher","type":"object","allOf":[{"$ref":"#/paths/~1vouchers/post/responses/201/content/application~1json/schema/definitions/create"}]}}}},"responses":{"201":{"description":"The request succeeded","content":{"application/json":{"schema":{"$schema":"http://json-schema.org/draft-07/schema#","title":"Voucher","type":"object","allOf":[{"$ref":"#/paths/~1vouchers/post/responses/201/content/application~1json/schema/definitions/readonly"},{"$ref":"#/paths/~1vouchers/post/responses/201/content/application~1json/schema/definitions/editable"}],"definitions":{"create":{"properties":{"title":{"type":"string","minLength":1,"maxLength":255},"code":{"type":"string","pattern":"^[A-Za-z0-9]*$","minLength":1,"maxLength":255},"voucherSchemeId":{"type":"string","pattern":"^[0-9a-fA-F]{24}$","description":"Id of the voucher scheme"},"startDate":{"type":"string","format":"date-time"},"endDate":{"type":"string","format":"date-time"},"numRedemptionsPerUser":{"type":"integer","minimum":1},"numGlobalRedemptions":{"type":"integer","minimum":1}},"additionalProperties":false,"required":["title","code","startDate","endDate","numRedemptionsPerUser","numGlobalRedemptions"]},"readonly":{"properties":{"_id":{"type":"string","description":"Voucher Id"},"tenantId":{"type":"string","description":"Id of the tenant"}}},"editable":{"properties":{"title":{"type":"string","minLength":1,"maxLength":255},"code":{"type":"string","pattern":"^[A-Za-z0-9]*$","minLength":1,"maxLength":255},"voucherSchemeId":{"type":"string","pattern":"^[a-fA-F0-9]{24}$","description":"Id of the voucher scheme"},"startDate":{"type":"string","format":"date-time"},"endDate":{"type":"string","format":"date-time"},"numRedemptionsPerUser":{"type":"integer","minimum":1},"numGlobalRedemptions":{"type":"integer","minimum":1}},"minProperties":1,"additionalProperties":false}}}}}},"401":{"$ref":"#/paths/~1users/get/responses/401"},"404":{"$ref":"#/paths/~1users/get/responses/404"},"422":{"$ref":"#/paths/~1users/get/responses/422"},"500":{"$ref":"#/paths/~1users/get/responses/500"}}},"get":{"tags":["Vouchers"],"summary":"Get Vouchers","description":"Gets vouchers for the tenantId, matching any query parameters.\n\nThis path is versioned via the `x-api-version` header, which should be '10' or higher.\nWhen x-api-version header is not present, the legacy resource is returned.\n","operationId":"getVouchers","parameters":[{"name":"x-api-version","required":false,"in":"header","description":"The behaviour of this path is versioned via the `x-api-version` header.  The version should be an integer number as a string, eg `'2'`.\nFor this endpoint, the supported values are:\n- '1' ... '9': deprecated behaviour (default)\n- '10' or higher: current behaviour as described here\n","schema":{"type":"number"}},{"$ref":"#/paths/~1users/get/parameters/9"},{"$ref":"#/paths/~1users/get/parameters/8"},{"name":"voucherSchemeId","in":"query","description":"Return vouchers matching voucherSchemeId","required":false,"schema":{"type":"string"}},{"name":"sort","in":"query","description":"The names of the fields to sort the results by, in decreasing order of precendence.  Allowed values are `startDate`, `endDate`, `code`.  Separate each field by a comma.  Prepend the field name with `-` sign to sort that field in descending order.","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"The request succeeded","content":{"application/json":{"schema":{"title":"Voucher Collection","type":"object","properties":{"items":{"type":"array","items":{"$ref":"#/paths/~1vouchers/post/responses/201/content/application~1json/schema"}},"page":{"$ref":"#/paths/~1perks/get/responses/200/content/application~1json/schema/properties/page"}}}}}},"401":{"$ref":"#/paths/~1users/get/responses/401"},"404":{"$ref":"#/paths/~1users/get/responses/404"},"422":{"$ref":"#/paths/~1users/get/responses/422"},"500":{"$ref":"#/paths/~1users/get/responses/500"}}}},"/vouchers/redeem":{"post":{"tags":["Vouchers"],"summary":"Redeem a Voucher","description":"Redeems a voucher for a user\n","operationId":"redeemVoucher","requestBody":{"content":{"application/json":{"schema":{"title":"Redeem Voucher","type":"object","properties":{"code":{"type":"string","pattern":"^[A-Za-z0-9]*$","minLength":1,"maxLength":255}},"additionalProperties":false,"required":["code"],"errorMessage":"invalid voucher code"}}}},"responses":{"201":{"description":"The request succeeded","content":{"application/json":{"schema":{"$schema":"http://json-schema.org/draft-07/schema#","title":"Voucher Redemption","type":"object","allOf":[{"$ref":"#/paths/~1vouchers~1redeem/post/responses/201/content/application~1json/schema/definitions/readonly"},{"$ref":"#/paths/~1vouchers~1redeem/post/responses/201/content/application~1json/schema/definitions/editable"}],"definitions":{"readonly":{"properties":{"_id":{"type":"string","description":"Redemption Id"},"tenantId":{"type":"string","description":"Id of the tenant"},"userId":{"type":"string","description":"Id of the user"},"voucherId":{"type":"string","description":"Id of the voucher"},"dateRedeemed":{"type":"string","description":"Date and time of the redemption in ISO 8061"}}},"editable":{"properties":{}}}}}}},"401":{"$ref":"#/paths/~1users/get/responses/401"},"404":{"$ref":"#/paths/~1users/get/responses/404"},"422":{"$ref":"#/paths/~1users/get/responses/422"},"500":{"$ref":"#/paths/~1users/get/responses/500"}}}},"/vouchers/:voucherId":{"get":{"tags":["Vouchers"],"summary":"Get Voucher by Id","description":"Retrieves a voucher via a voucher Id\n","operationId":"getVoucherById","parameters":[{"name":"voucherId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"The request succeeded","content":{"application/json":{"schema":{"type":"object","allOf":[{"$ref":"#/paths/~1vouchers/post/responses/201/content/application~1json/schema"},{"properties":{"numRedemptions":{"type":"integer"}}}]}}}},"401":{"$ref":"#/paths/~1users/get/responses/401"},"404":{"$ref":"#/paths/~1users/get/responses/404"},"422":{"$ref":"#/paths/~1users/get/responses/422"},"500":{"$ref":"#/paths/~1users/get/responses/500"}}},"put":{"tags":["Vouchers"],"summary":"Update a Voucher","description":"Updates a specific Voucher\n","operationId":"updateVoucher","parameters":[{"name":"voucherId","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"$schema":"http://json-schema.org/draft-07/schema#","title":"Update Voucher","type":"object","allOf":[{"$ref":"#/paths/~1vouchers/post/responses/201/content/application~1json/schema/definitions/editable"}]}}}},"responses":{"200":{"description":"The voucher was updated","content":{"application/json":{"schema":{"$ref":"#/paths/~1vouchers/post/responses/201/content/application~1json/schema"}}}},"401":{"$ref":"#/paths/~1users/get/responses/401"},"404":{"$ref":"#/paths/~1users/get/responses/404"},"422":{"$ref":"#/paths/~1users/get/responses/422"},"500":{"$ref":"#/paths/~1users/get/responses/500"}}}},"/rules":{"post":{"tags":["Rules"],"summary":"Create a Rule","description":"Create a rule for a tenant.\n","operationId":"createRule","parameters":[],"requestBody":{"content":{"application/json":{"schema":{"$schema":"http://json-schema.org/draft-07/schema#","title":"Create Rule","description":"Create Perk request","type":"object","allOf":[{"$ref":"#/paths/~1rules/post/responses/201/content/application~1json/schema/definitions/fields-editable"}]}}}},"responses":{"201":{"description":"The request succeeded","content":{"application/json":{"schema":{"$schema":"http://json-schema.org/draft-07/schema#","title":"Rule","type":"object","allOf":[{"$ref":"#/paths/~1rules/post/responses/201/content/application~1json/schema/definitions/fields-readonly"},{"$ref":"#/paths/~1rules/post/responses/201/content/application~1json/schema/definitions/fields-editable"}],"definitions":{"fields-readonly":{"properties":{"_id":{"type":"string","description":"Rule Id"},"tenantId":{"type":"string","description":"Id of the tenant"},"created":{"type":"string","description":"creation time stamp"},"updated":{"type":"string","description":"last updated time stamp"}}},"condition":{"type":"object","oneOf":[{"title":"string subjects","properties":{"subject":{"type":"string","enum":["type","metadata.audienceId","context.location._id","context.clientPlatform","when.daypart","context.user.primaryPlatform","metadata.scenario","metadata.order.scenario","metadata.channel","metadata.voucherId","metadata.voucherSchemeId","metadata.voucherTitle","metadata.username","metadata.credential.id","metadata.awardId","metadata.perkId","metadata.trigger","metadata.schemeId","metadata.status","metadata.externalId","metadata.type","metadata.ratePlan","metadata.bookingSource","metadata.booker.email","metadata.booker.firstName","metadata.booker.lastName","metadata.booker.phone","metadata.billingPeriodInterval","metadata.subscriptionSchemeId","metadata.stripe.priceId","metadata.cancellationReason"]},"predicate":{"type":"string","enum":["EQUAL","NOT_EQUAL","IN","NOT_IN","ENDS_WITH","EQ","NEQ","NIN"]},"object":{"oneOf":[{"type":["string"]},{"type":["array"],"items":{"type":"string"}}]}}},{"title":"number subjects","properties":{"subject":{"type":"string","enum":["when.dayofweek","when.weekofyear","when.monthofyear","metadata.value.amount","metadata.pointsAdded","metadata.pointsAvailable","metadata.pointsRefunded","metadata.pointsRedeemed","metadata.lengthOfStayNights","metadata.cost","metadata.taxAdded","metadata.taxToAdd","metadata.guests","metadata.billingPeriodIntervalCount"]},"predicate":{"type":"string","enum":["EQUAL","NOT_EQUAL","IN","NOT_IN","GREATER","LESSER"]},"object":{"oneOf":[{"type":["number"]},{"type":["array"],"items":{"type":"number"}}]}}},{"title":"boolean subjects","properties":{"subject":{"type":"string","enum":["metadata.hasAgreedToReceiveMarketing","metadata.hasAgreedToShareData"]},"predicate":{"type":"string","enum":["EQUAL","NOT_EQUAL"]},"object":{"type":"number"}}},{"title":"basket subjects","properties":{"subject":{"type":"string","enum":["metadata.basket","metadata.order.items"]},"predicate":{"type":"string","enum":["HAS_PRODUCT_ID","HAS_CATEGORY_ID"]},"object":{"oneOf":[{"type":["string"]},{"type":["array"],"items":{"type":"string"}}]}}},{"title":"payments subjects","properties":{"subject":{"type":"string","enum":["metadata.order.payments"]},"predicate":{"type":"string","enum":["HAS_PAYMENT_WITH_TYPE"]},"object":{"type":["string"]}}},{"title":"extended tests","properties":{"subject":{"type":"string","enum":["context.user._id"]},"predicate":{"type":"string","enum":["IS_MEMBER_OF","NOT_IS_MEMBER_OF"]},"object":{"type":["string"]}}}],"additionalProperties":false,"required":["subject","object","predicate"]},"effect":{"type":"object","oneOf":[{"title":"segment","properties":{"controller":{"type":"string","enum":["segment"]},"method":{"type":"string","enum":["addMemberToSegment","removeMemberFromSegment"]}}},{"title":"pointPerk","properties":{"controller":{"type":"string","enum":["pointPerk"]},"method":{"type":"string","enum":["grantPerkFromImpact","grantExternalPerkFromImpact"]}}},{"title":"pointAward","properties":{"controller":{"type":"string","enum":["pointAward"]},"method":{"type":"string","enum":["revokeFromImpact"]}}},{"title":"credential","properties":{"controller":{"type":"string","enum":["credential"]},"method":{"type":"string","enum":["unverifyManyFromImpact"]}}},{"title":"scheduledTask","properties":{"controller":{"type":"string","enum":["scheduledTask"]},"method":{"type":"string","enum":["createScheduledTask"]}}}],"required":["controller","method"],"additionalProperties":false},"impact":{"title":"Impact","type":"object","description":"**Note**: `calculatePseudoCurrencyPointsEarnedFromBasket` and `calculateStampCardPointsEarnedFromBasket` are deprecated - use `calcPointsFromValueOfItems` and `calcPointsFromCountOfItems` respectively instead.","oneOf":[{"title":"calculatePseudoCurrency","properties":{"evaluatorName":{"type":"string","enum":["calculatePseudoCurrency"]},"parameters":{"type":"object","properties":{"perkId":{"type":"string"},"blockSize":{"type":"number"},"earningsPerBlock":{"type":"number"},"field":{"type":"string"}},"required":["blockSize","earningsPerBlock","perkId"]}}},{"title":"calculatePseudoCurrencyPointsEarnedFromBasket","deprecated":true,"properties":{"evaluatorName":{"type":"string","enum":["calculatePseudoCurrencyPointsEarnedFromBasket"]},"parameters":{"type":"object","properties":{"subject":{"type":"string"},"categoryIds":{"type":"array","items":{"type":"string"}},"productIds":{"type":"array","items":{"type":"string"}},"step":{"type":"number"},"redemption":{"type":"number"},"perkId":{"type":"string"}},"required":["subject","step","redemption","perkId"]}}},{"title":"calcPointsFromValueOfItems","properties":{"evaluatorName":{"type":"string","enum":["calcPointsFromValueOfItems"]},"parameters":{"type":"object","properties":{"subject":{"type":"string"},"categoryIds":{"type":"array","items":{"type":"string"}},"productIds":{"type":"array","items":{"type":"string"}},"step":{"type":"number"},"redemption":{"type":"number"},"perkId":{"type":"string"}},"required":["subject","step","redemption","perkId"]}}},{"title":"calcPointsFromValueOfItemsIncModifiers","properties":{"evaluatorName":{"type":"string","enum":["calcPointsFromValueOfItemsIncModifiers"]},"parameters":{"type":"object","properties":{"subject":{"type":"string"},"categoryIds":{"type":"array","items":{"type":"string"}},"productIds":{"type":"array","items":{"type":"string"}},"step":{"type":"number"},"redemption":{"type":"number"},"perkId":{"type":"string"}},"required":["subject","step","redemption","perkId"]}}},{"title":"calculateStampCardPointsEarnedFromBasket","deprecated":true,"properties":{"evaluatorName":{"type":"string","enum":["calculateStampCardPointsEarnedFromBasket"]},"parameters":{"type":"object","properties":{"subject":{"type":"string"},"categoryIds":{"type":"array","items":{"type":"string"}},"productIds":{"type":"array","items":{"type":"string"}},"currencyEarned":{"type":"number"},"perkId":{"type":"string"}},"required":["subject","currencyEarned","perkId"]}}},{"title":"calcPointsFromCountOfItems","properties":{"evaluatorName":{"type":"string","enum":["calcPointsFromCountOfItems"]},"parameters":{"type":"object","properties":{"subject":{"type":"string"},"categoryIds":{"type":"array","items":{"type":"string"}},"productIds":{"type":"array","items":{"type":"string"}},"currencyEarned":{"type":"number"},"perkId":{"type":"string"}},"required":["subject","currencyEarned","perkId"]}}},{"title":"calcPointsFromCountOfItemsIncModifiers","properties":{"evaluatorName":{"type":"string","enum":["calcPointsFromCountOfItemsIncModifiers"]},"parameters":{"type":"object","properties":{"subject":{"type":"string"},"categoryIds":{"type":"array","items":{"type":"string"}},"productIds":{"type":"array","items":{"type":"string"}},"currencyEarned":{"type":"number"},"perkId":{"type":"string"}},"required":["subject","currencyEarned","perkId"]}}},{"title":"calculatePseudoCurrencyExcludeServiceCharge","properties":{"evaluatorName":{"type":"string","enum":["calculatePseudoCurrencyExcludeServiceCharge"]},"parameters":{"type":"object","properties":{"step":{"type":"number"},"redemption":{"type":"number"},"perkId":{"type":"string"}},"required":["step","redemption","perkId"]}}},{"title":"passThru","properties":{"evaluatorName":{"type":"string","enum":["passThru"]},"parameters":{"oneOf":[{"title":"suffix","type":"object","properties":{"suffix":{"type":"string"}},"required":["suffix"]},{"title":"segmentId","type":"object","properties":{"segmentId":{"type":"string"}},"required":["segmentId"]},{"title":"perkId","type":"object","properties":{"perkId":{"type":"string"},"currencyEarned":{"type":"number"}},"required":["perkId"]},{"$ref":"#/paths/~1scheduledtasks/post/responses/201/content/application~1json/schema/definitions/fields-editable"}]}}}],"required":["evaluatorName"],"additionalProperties":false},"fields-editable":{"properties":{"occurrences":{"type":"object","properties":{"period":{"type":"string","enum":["MONTH","WEEK","DAY"]},"count":{"type":"number","multipleOf":1}},"additionalProperties":false,"required":["period","count"]},"matchType":{"type":"string","enum":["TYPE","TIME"]},"conditions":{"type":"array","items":{"$ref":"#/paths/~1rules/post/responses/201/content/application~1json/schema/definitions/condition"},"minItems":1,"uniqueItems":true},"effect":{"allOf":[{"$ref":"#/paths/~1rules/post/responses/201/content/application~1json/schema/definitions/effect"},{"title":"Impact","properties":{"impact":{"$ref":"#/paths/~1rules/post/responses/201/content/application~1json/schema/definitions/impact"}},"required":["impact"],"additionalProperties":false}]},"active":{"type":"boolean"}},"additionalProperties":false,"required":["matchType","conditions","effect"]}}}}}},"401":{"$ref":"#/paths/~1users/get/responses/401"},"404":{"$ref":"#/paths/~1users/get/responses/404"},"422":{"$ref":"#/paths/~1users/get/responses/422"},"500":{"$ref":"#/paths/~1users/get/responses/500"}}},"get":{"tags":["Rules"],"summary":"Get All Rules","description":"Retrieve all the rules for a tenant\n","operationId":"getAllRules","parameters":[],"responses":{"200":{"description":"Rules","content":{"application/json":{"schema":{"title":"An array of Rules","type":"array","items":{"$ref":"#/paths/~1rules/post/responses/201/content/application~1json/schema"}}}}},"401":{"$ref":"#/paths/~1users/get/responses/401"},"404":{"$ref":"#/paths/~1users/get/responses/404"},"422":{"$ref":"#/paths/~1users/get/responses/422"},"500":{"$ref":"#/paths/~1users/get/responses/500"}}}},"/rules/validate":{"post":{"tags":["Rules"],"summary":"Validate All Rules","description":"Checks all rules for a tenant and reports any issues\n","operationId":"validateRules","parameters":[],"responses":{"200":{"description":"The request succeeded","content":{"application/json":{"schema":{"type":"object","properties":{"validation":{"type":"object","properties":{"okCount":{"type":"number","description":"number of rules that passed validation"},"errorCount":{"type":"number","description":"number of rules that failed validation"},"hasImpactIdCount":{"type":"number","description":"number of rules that use a separate impact record, as opposed to an inline impact inside rule.effect"},"rules with errors":{"type":"object","description":"list of rule ids with errors, by error type","properties":{"invalid matchType":{"type":"array","items":{"type":"string"}},"invalid conditions":{"type":"array","items":{"type":"string"}},"invalid effect":{"type":"array","items":{"type":"string"}},"TIME not supported":{"type":"array","items":{"type":"string"}},"no type condition":{"type":"array","items":{"type":"string"}},"condition object wrong type":{"type":"array","items":{"type":"string"}},"perkId not found":{"type":"array","items":{"type":"string"}},"segmentId not found":{"type":"array","items":{"type":"string"}},"locationId not found":{"type":"array","items":{"type":"string"}}}},"unusedImpacts":{"type":"array","description":"list of impact record Ids in a tenant that are not referenced by any rule","items":{"type":"string"}}}},"logic":{"type":"array","description":"text description of the logic of each of the tenant's rules","items":{"type":"string"}}}}}}},"401":{"$ref":"#/paths/~1users/get/responses/401"},"404":{"$ref":"#/paths/~1users/get/responses/404"},"422":{"$ref":"#/paths/~1users/get/responses/422"},"500":{"$ref":"#/paths/~1users/get/responses/500"}}}},"/rules/:ruleId":{"get":{"tags":["Rules"],"summary":"Get a Rule","description":"Retrieves a rule for a tenant by Id","operationId":"getRuleById","parameters":[{"name":"ruleId","in":"path","description":"The Id of the rule to retrieve.","required":true,"schema":{"type":"string"}}],"requestBody":null,"responses":{"200":{"description":"The request succeeded","content":{"application/json":{"schema":{"$ref":"#/paths/~1rules/post/responses/201/content/application~1json/schema"}}}},"401":{"$ref":"#/paths/~1users/get/responses/401"},"404":{"$ref":"#/paths/~1users/get/responses/404"},"422":{"$ref":"#/paths/~1users/get/responses/422"},"500":{"$ref":"#/paths/~1users/get/responses/500"}}},"delete":{"tags":["Rules"],"summary":"Delete a Rule","description":"Removes a specific rule for a tenant\n","operationId":"deleteRule","parameters":[{"name":"perkId","in":"path","description":"The unique Id of the rule to remove.","required":true,"schema":{"type":"string"}},{"name":"includeEffect","in":"query","description":"If true, the deletion will include effects related to the rule, such as removing pending ScheduledTasks.\n","required":false,"schema":{"type":"boolean","default":false}}],"requestBody":null,"responses":{"200":{"description":"The request succeeded"},"401":{"$ref":"#/paths/~1users/get/responses/401"},"404":{"$ref":"#/paths/~1users/get/responses/404"},"422":{"$ref":"#/paths/~1users/get/responses/422"},"500":{"$ref":"#/paths/~1users/get/responses/500"}}},"put":{"tags":["Rules"],"summary":"Update a Rule","description":"Update a rule for a tenant.\n","operationId":"updateRule","parameters":[{"name":"ruleId","in":"path","description":"The Id of the rule to update.","required":true,"schema":{"type":"string"}},{"name":"includeEffect","in":"query","description":"If true, the update will include effects related to the rule, such as removing pending ScheduledTasks.\n","required":false,"schema":{"type":"boolean","default":false}}],"requestBody":{"content":{"application/json":{"schema":{"$schema":"http://json-schema.org/draft-07/schema#","title":"Update Rule","description":"Update Rule Request","type":"object","allOf":[{"$ref":"#/paths/~1rules/post/responses/201/content/application~1json/schema/definitions/fields-editable"}]}}}},"responses":{"200":{"description":"The request succeeded"},"401":{"$ref":"#/paths/~1users/get/responses/401"},"404":{"$ref":"#/paths/~1users/get/responses/404"},"422":{"$ref":"#/paths/~1users/get/responses/422"},"500":{"$ref":"#/paths/~1users/get/responses/500"}}}},"/operations":{"get":{"tags":["Operations"],"summary":"Get Operations","description":"Gets a paged list of operations.\n","operationId":"getOperations","parameters":[{"$ref":"#/paths/~1users/get/parameters/8"},{"$ref":"#/paths/~1users/get/parameters/9"}],"requestBody":null,"responses":{"200":{"description":"The request succeeded","content":{"application/json":{"schema":{"$schema":"http://json-schema.org/draft-07/schema#","title":"Operation List","description":"A paged list of Operations","type":"object","properties":{"items":{"type":"array","title":"Operations","items":{"$ref":"#/paths/~1users~1exports/post/responses/202/content/application~1json/schema"}},"page":{"$ref":"#/paths/~1perks/get/responses/200/content/application~1json/schema/properties/page"},"links":{"type":"object","title":"Page links","description":"Links to current and next page","properties":{"self":{"type":"string","description":"Link to the current page"},"next":{"type":"string","description":"Link to the next page"}}}}}}}},"401":{"$ref":"#/paths/~1users/get/responses/401"},"404":{"$ref":"#/paths/~1users/get/responses/404"},"422":{"$ref":"#/paths/~1users/get/responses/422"},"500":{"$ref":"#/paths/~1users/get/responses/500"}}}},"/operations/:operationId":{"get":{"tags":["Operations"],"summary":"Get an Operation","description":"Retrieves a specific operation","operationId":"getOperationById","parameters":[{"name":"operationId","in":"path","description":"The ID of the Operation to retrieve.","required":true,"schema":{"type":"string"}}],"requestBody":null,"responses":{"200":{"description":"The request succeeded","content":{"application/json":{"schema":{"$ref":"#/paths/~1users~1exports/post/responses/202/content/application~1json/schema"}}}},"401":{"$ref":"#/paths/~1users/get/responses/401"},"404":{"$ref":"#/paths/~1users/get/responses/404"},"422":{"$ref":"#/paths/~1users/get/responses/422"},"500":{"$ref":"#/paths/~1users/get/responses/500"}}}},"/operations/:operationId/suboperations":{"get":{"tags":["Operations"],"summary":"Get Sub Operations","description":"Gets a paged list of sub operations associated with an operation id.\n","operationId":"getSubOperations","parameters":[{"$ref":"#/paths/~1users/get/parameters/8"},{"$ref":"#/paths/~1users/get/parameters/9"}],"requestBody":null,"responses":{"200":{"description":"The request succeeded","content":{"application/json":{"schema":{"$schema":"http://json-schema.org/draft-07/schema#","title":"Sub Operation List","description":"A paged list of sub operations","type":"object","properties":{"items":{"type":"array","title":"Sub-operations","items":{"$schema":"http://json-schema.org/draft-07/schema#","title":"Sub Operation","description":"An individual step in a running operation","type":"object","allOf":[{"$ref":"#/paths/~1operations~1%3AoperationId~1suboperations/get/responses/200/content/application~1json/schema/properties/items/items/definitions/read"},{"$ref":"#/paths/~1operations~1%3AoperationId~1suboperations/get/responses/200/content/application~1json/schema/properties/items/items/definitions/create"}],"definitions":{"create":{"properties":{}},"read":{"properties":{"_id":{"type":"string","description":"Sub operation id"},"tenantId":{"type":"string"},"namespace":{"type":"string","description":"A name identifying the area of the platform the sub operation is associated with e.g segments"},"entityId":{"type":"string","description":"A reference to a specific entity within the area defined by namespace e.g segment ID"},"metadata":{"type":"string","description":"The metadata associated with a sub operation such as IDs for other entities it may use"},"result":{"description":"The result of the sub operation. The exact schema of the result depends on the specific operation."},"error":{"description":"The error that has occurred if the sub operation has failed. The exact schema of the error depends on the specific operation."},"createdAt":{"type":"string","description":"UTC iso formatted date of when the sub operation was created"},"updatedAt":{"type":"string","description":"UTC iso formatted date of when the sub operation was updated"},"endedAt":{"type":"string","description":"UTC iso formatted date of when the sub operation was ended"}}}}}},"page":{"$ref":"#/paths/~1perks/get/responses/200/content/application~1json/schema/properties/page"},"links":{"$ref":"#/paths/~1operations/get/responses/200/content/application~1json/schema/properties/links"}}}}}},"401":{"$ref":"#/paths/~1users/get/responses/401"},"404":{"$ref":"#/paths/~1users/get/responses/404"},"422":{"$ref":"#/paths/~1users/get/responses/422"},"500":{"$ref":"#/paths/~1users/get/responses/500"}}}},"/addresses/suggest":{"post":{"tags":["Addresses"],"summary":"Suggest addresses based on a query string","description":"Suggest addresses based on a text query or a set of coordinates.\n","operationId":"suggestAddresses","parameters":[],"requestBody":{"content":{"application/json":{"schema":{"$schema":"http://json-schema.org/draft-07/schema#","title":"Address","description":"Fields for suggesting addresses","type":"object","oneOf":[{"title":"Address + Position","properties":{"address":{"type":"string"},"position":{"$ref":"#/paths/~1addresses~1geocode/post/responses/200/content/application~1json/schema/properties/position"}},"required":["address"]},{"title":"Position Only","properties":{"position":{"$ref":"#/paths/~1addresses~1geocode/post/responses/200/content/application~1json/schema/properties/position"}},"required":["position"]}]}}}},"responses":{"200":{"description":"Suggested addresses","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"allOf":[{"properties":{"title":{"type":"string"},"position":{"$ref":"#/paths/~1addresses~1geocode/post/responses/200/content/application~1json/schema/properties/position"}},"required":["title"]},{"$ref":"#/paths/~1addresses~1geocode/post/requestBody/content/application~1json/schema"}]}}}}}}},"400":{"$ref":"#/paths/~1locations/post/responses/400"},"401":{"$ref":"#/paths/~1users/get/responses/401"},"404":{"$ref":"#/paths/~1users/get/responses/404"},"422":{"$ref":"#/paths/~1users/get/responses/422"},"500":{"$ref":"#/paths/~1users/get/responses/500"}}}},"/addresses/geocode":{"post":{"tags":["Addresses"],"summary":"Get an addresses' coordinates","description":"Get an addresses' coordinates based on a partial or full address.\n","operationId":"geocodeAddress","parameters":[],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"line1":{"type":"string"},"line2":{"type":"string"},"city":{"type":"string"},"region":{"type":"string"},"postalCode":{"type":"string"},"country":{"type":"string"}},"required":["line1","city","country"]}}}},"responses":{"200":{"description":"Coordinates","content":{"application/json":{"schema":{"type":"object","properties":{"position":{"type":"array","description":"[Longitude, Latitude]","items":{"type":"number","minItems":2,"maxItems":2}}}}}}},"400":{"$ref":"#/paths/~1locations/post/responses/400"},"401":{"$ref":"#/paths/~1users/get/responses/401"},"404":{"$ref":"#/paths/~1users/get/responses/404"},"422":{"$ref":"#/paths/~1users/get/responses/422"},"500":{"$ref":"#/paths/~1users/get/responses/500"}}}},"/subscriptionschemes":{"post":{"tags":["Subscription Schemes"],"summary":"Create a Subscription Scheme","description":"Creates a subscription scheme for a tenant.\n\nA Subscription Scheme defines a recurring billing plan that users can subscribe to with various benefits (perks).\n","operationId":"createSubscriptionScheme","requestBody":{"content":{"application/json":{"schema":{"$schema":"http://json-schema.org/draft-07/schema#","title":"Create Subscription Scheme","description":"Create Subscription Scheme request","type":"object","allOf":[{"$ref":"#/paths/~1subscriptionschemes/post/responses/201/content/application~1json/schema/definitions/fields-editable"},{"type":"object","properties":{"pricing":{"type":"array","description":"Pricing options","items":{"type":"object","properties":{"price":{"type":"number","description":"Price of the subscription scheme in cents"},"billing":{"type":"object","description":"Billing details (x intervals of y)","properties":{"interval":{"type":"string","enum":["day","week","month","year"],"description":"Billing interval"},"intervalCount":{"type":"number","description":"Number of intervals between each cycle"}},"required":["interval","intervalCount"]},"active":{"type":"boolean","description":"Whether the price scheme is available for new subscriptions"},"default":{"type":"boolean","description":"Whether this is the default price scheme for new subscriptions"},"visualisation":{"type":"object","description":"Visualisation details for the pricing option","properties":{"name":{"type":"string"}}}},"required":["price","billing"]}}},"required":["pricing","perks","title"]}]}}}},"responses":{"201":{"description":"The request succeeded","content":{"application/json":{"schema":{"$schema":"http://json-schema.org/draft-07/schema#","title":"Subscription Scheme","description":"Subscription Scheme object","type":"object","allOf":[{"$ref":"#/paths/~1subscriptionschemes/post/responses/201/content/application~1json/schema/definitions/fields-readonly"},{"$ref":"#/paths/~1subscriptionschemes/post/responses/201/content/application~1json/schema/definitions/fields-editable"}],"definitions":{"fields-readonly":{"type":"object","properties":{"_id":{"type":"string","description":"SubscriptionScheme Id"},"tenantId":{"type":"string","description":"Id of the tenant"},"stripe":{"type":"object","description":"Stripe related details","properties":{"productId":{"type":"string","description":"Stripe Product Id associated with this subscription scheme"},"taxRateIds":{"type":"array","description":"List of Stripe Tax Rate Ids associated with this subscription scheme","items":{"type":"string"}}},"required":["priceId","productId"]},"pricing":{"type":"array","description":"Pricing options","items":{"type":"object","properties":{"id":{"type":"string","description":"Stripe Price Id associated with this subscription scheme"},"price":{"type":"number","description":"Price of the subscription scheme in cents"},"billing":{"type":"object","description":"Billing details (x intervals of y)","properties":{"interval":{"type":"string","enum":["day","week","month","year"],"description":"Billing interval"},"intervalCount":{"type":"number","description":"Number of intervals between each cycle"}},"required":["interval","intervalCount"]},"active":{"type":"boolean","description":"Whether the price scheme is available for new subscriptions"},"default":{"type":"boolean","description":"Whether this is the default price scheme for new subscriptions"},"visualisation":{"type":"object","description":"Visualisation details for the pricing option","properties":{"name":{"type":"string"}}}},"required":["id","price","billing"]}},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"deletedAt":{"type":["string","null"],"format":"date-time"}},"required":["_id","tenantId","stripe","price","billing","createdAt","updatedAt"]},"fields-editable":{"type":"object","properties":{"pricing":{"type":"array","description":"Pricing options","items":{"type":"object","properties":{"id":{"type":"string","description":"Stripe Price Id associated with this subscription scheme"},"active":{"type":"boolean","description":"Whether the price scheme is available for new subscriptions"},"default":{"type":"boolean","description":"Whether this is the default price scheme for new subscriptions"},"visualisation":{"type":"object","description":"Visualisation details for the pricing option","properties":{"name":{"type":"string"}}}},"required":["id"]}},"perks":{"type":"array","description":"List of perk Ids associated with this subscription scheme","items":{"type":"object","properties":{"perkId":{"type":"string","description":"Id of the perk"},"interval":{"type":"string","enum":["day","week","month","year"],"description":"Interval at which the perk is granted"}},"required":["perkId"]}},"active":{"type":"boolean","description":"Whether the subscription scheme is active (available for new subscriptions)"},"title":{"type":"string","description":"Title of the subscription scheme"},"terms":{"type":"string","description":"Terms and conditions of the subscription scheme"},"visualisation":{"type":"object","description":"Visualisation details for the subscription scheme","properties":{"titleText":{"type":"string"},"heroImageUrl":{"type":"string"},"heroTitleText":{"type":"string"},"heroText":{"type":"string"},"calloutTitleText":{"type":"string"},"calloutBullets":{"type":"array","items":{"type":"string"}},"calloutFooterText":{"type":"string"},"footerText":{"type":"string"}}}}}}}}}},"401":{"$ref":"#/paths/~1users/get/responses/401"},"404":{"$ref":"#/paths/~1users/get/responses/404"},"422":{"$ref":"#/paths/~1users/get/responses/422"},"500":{"$ref":"#/paths/~1users/get/responses/500"}}},"get":{"tags":["Subscription Schemes"],"summary":"Get all Subscription Schemes","description":"Retrieves all the subscription schemes for a tenant.\n","operationId":"getAllSubscriptionSchemes","parameters":[{"$ref":"#/paths/~1perks/get/parameters/0"},{"$ref":"#/paths/~1users/get/parameters/8"},{"$ref":"#/paths/~1users/get/parameters/9"}],"deprecated":false,"responses":{"200":{"description":"A paged list of subscription schemes","content":{"application/json":{"schema":{"title":"Subscription Schemes List","description":"A paged list of subscription schemes","type":"object","properties":{"items":{"type":"array","title":"A list of subscription schemes","items":{"$ref":"#/paths/~1subscriptionschemes/post/responses/201/content/application~1json/schema"}},"page":{"$ref":"#/paths/~1perks/get/responses/200/content/application~1json/schema/properties/page"}}}}}},"401":{"$ref":"#/paths/~1users/get/responses/401"},"404":{"$ref":"#/paths/~1users/get/responses/404"},"422":{"$ref":"#/paths/~1users/get/responses/422"},"500":{"$ref":"#/paths/~1users/get/responses/500"}}}},"/subscriptionschemes/:schemeId":{"get":{"tags":["Subscription Schemes"],"summary":"Get a Subscription Scheme","description":"Retrieves a subscription scheme for a tenant by Id.\n","operationId":"getSubscriptionSchemeById","parameters":[{"name":"schemeId","in":"path","description":"The Id of the subscription scheme to retrieve.","required":true,"schema":{"type":"string"}}],"requestBody":null,"responses":{"200":{"description":"The request succeeded","content":{"application/json":{"schema":{"$ref":"#/paths/~1subscriptionschemes/post/responses/201/content/application~1json/schema"}}}},"401":{"$ref":"#/paths/~1users/get/responses/401"},"404":{"$ref":"#/paths/~1users/get/responses/404"},"422":{"$ref":"#/paths/~1users/get/responses/422"},"500":{"$ref":"#/paths/~1users/get/responses/500"}}},"put":{"tags":["Subscription Schemes"],"summary":"Update a Subscription Scheme","description":"Update a subscription scheme for a tenant.\n\nNote: price updates (Stripe Price changes) are not allowed via this endpoint.\n","operationId":"updateSubscriptionScheme","parameters":[{"name":"schemeId","in":"path","description":"The Id of the subscription scheme to update.","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"$schema":"http://json-schema.org/draft-07/schema#","title":"Update Subscription Scheme","description":"Update Subscription Scheme request","type":"object","allOf":[{"$ref":"#/paths/~1subscriptionschemes/post/responses/201/content/application~1json/schema/definitions/fields-editable"}]}}}},"responses":{"200":{"description":"The request succeeded"},"401":{"$ref":"#/paths/~1users/get/responses/401"},"404":{"$ref":"#/paths/~1users/get/responses/404"},"422":{"$ref":"#/paths/~1users/get/responses/422"},"500":{"$ref":"#/paths/~1users/get/responses/500"}}},"delete":{"tags":["Subscription Schemes"],"summary":"Delete a Subscription Scheme","description":"Delete a subscription scheme for a tenant.\n","operationId":"deleteSubscriptionScheme","parameters":[{"name":"schemeId","in":"path","description":"The unique Id of the subscription scheme to remove.","required":true,"schema":{"type":"string"}}],"requestBody":null,"responses":{"200":{"description":"The request succeeded"},"401":{"$ref":"#/paths/~1users/get/responses/401"},"404":{"$ref":"#/paths/~1users/get/responses/404"},"422":{"$ref":"#/paths/~1users/get/responses/422"},"500":{"$ref":"#/paths/~1users/get/responses/500"}}}},"/subscriptions":{"post":{"tags":["Subscriptions"],"summary":"Create a Subscription","description":"Creates a subscription for a user.\n","operationId":"createSubscription","parameters":[{"$ref":"#/paths/~1segments~1%3AsegmentId~1awards/parameters/0"}],"requestBody":{"content":{"application/json":{"schema":{"$schema":"http://json-schema.org/draft-07/schema#","title":"Subscription","type":"object","properties":{"userId":{"type":"string","description":"Id of the user who will own this subscription. Only allowed for admin users to set."},"subscriptionSchemeId":{"type":"string","description":"Id of the subscription scheme"},"paymentMethodId":{"type":"string","description":"Id of the payment method to be used for this subscription"},"priceId":{"type":"string","description":"Id of the price to be used for this subscription"}},"required":["subscriptionSchemeId"]}}}},"responses":{"201":{"description":"The request succeeded","content":{"application/json":{"schema":{"$schema":"http://json-schema.org/draft-07/schema#","title":"Subscription","type":"object","properties":{"_id":{"type":"string","description":"Subscription Id"},"tenantId":{"type":"string","description":"Id of the tenant"},"userId":{"type":"string","description":"Id of the user who owns this subscription"},"subscriptionSchemeId":{"type":"string","description":"Id of the subscription scheme associated with this subscription"},"subscriptionScheme":{"description":"Subscription Scheme details. Included only when explicitly requested.","$ref":"#/paths/~1subscriptionschemes/post/responses/201/content/application~1json/schema"},"stripe":{"type":"object","description":"Stripe related details","properties":{"subscriptionId":{"type":"string","description":"Stripe Subscription Id associated with this subscription"},"priceId":{"type":"string","description":"Stripe Price Id associated with this subscription"}}},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"paymentMethod":{"type":"object","properties":{"id":{"type":"string","description":"Payment method identifier"},"methodType":{"type":"string","description":"Type of payment method used"},"type":{"type":"string","description":"Specific type of the payment method"},"last4":{"type":"string","description":"Last 4 digits of the payment method"},"expires":{"type":"string","description":"Expiration date of the payment method in MM/YYYY format"},"walletType":{"type":"string","description":"Type of digital wallet if applicable"}}},"active":{"type":"boolean","description":"Indicates if the subscription is currently active"},"cancelAt":{"type":["string","null"],"format":"date-time"},"nextPaymentAt":{"type":["string","null"],"format":"date-time"}},"required":["_id","tenantId","userId","subscriptionSchemeId","stripe","active","createdAt","updatedAt"]}}}},"401":{"$ref":"#/paths/~1users/get/responses/401"},"404":{"$ref":"#/paths/~1users/get/responses/404"},"422":{"$ref":"#/paths/~1users/get/responses/422"},"500":{"$ref":"#/paths/~1users/get/responses/500"}}},"get":{"tags":["Subscriptions"],"summary":"Get all Subscription","description":"Retrieves all the subscriptions.\n","operationId":"getAllSubscriptions","parameters":[{"$ref":"#/paths/~1users/get/parameters/8"},{"$ref":"#/paths/~1users/get/parameters/9"}],"deprecated":false,"responses":{"200":{"description":"A paged list of subscriptions","content":{"application/json":{"schema":{"title":"Subscription List","description":"A paged list of subscriptions","type":"object","properties":{"items":{"type":"array","title":"A list of subscriptions","items":{"$ref":"#/paths/~1subscriptions/post/responses/201/content/application~1json/schema"}},"page":{"$ref":"#/paths/~1perks/get/responses/200/content/application~1json/schema/properties/page"}}}}}},"401":{"$ref":"#/paths/~1users/get/responses/401"},"404":{"$ref":"#/paths/~1users/get/responses/404"},"422":{"$ref":"#/paths/~1users/get/responses/422"},"500":{"$ref":"#/paths/~1users/get/responses/500"}}}},"/subscriptions/:subscriptionId":{"get":{"tags":["Subscriptions"],"summary":"Get a Subscription","description":"Retrieves a subscription.\n","operationId":"getSubscriptionById","parameters":[{"name":"subscriptionId","in":"path","description":"The Id of the subscription to retrieve.","required":true,"schema":{"type":"string"}},{"name":"expand","in":"query","style":"form","description":"Optional list of extra fields to be returned in addition to the default subscription fields.  Eg `expand=subscriptionScheme`","required":false,"schema":{"type":"array","items":{"type":"string","enum":["subscriptionScheme"]}}}],"requestBody":null,"responses":{"200":{"description":"The request succeeded","content":{"application/json":{"schema":{"$ref":"#/paths/~1subscriptions/post/responses/201/content/application~1json/schema"}}}},"401":{"$ref":"#/paths/~1users/get/responses/401"},"404":{"$ref":"#/paths/~1users/get/responses/404"},"422":{"$ref":"#/paths/~1users/get/responses/422"},"500":{"$ref":"#/paths/~1users/get/responses/500"}}}},"/subscriptions/:subscriptionId/cancel":{"post":{"tags":["Subscriptions"],"summary":"Cancel a Subscription","description":"Cancels a subscription.\n","operationId":"cancelSubscription","parameters":[{"name":"subscriptionId","in":"path","description":"The unique Id of the subscription to cancel.","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"$schema":"http://json-schema.org/draft-07/schema#","title":"Subscription","type":"object","properties":{"comment":{"type":"string","description":"Reason for cancelling the subscription"}}}}}},"responses":{"200":{"description":"The request succeeded","content":{"application/json":{"schema":{"$ref":"#/paths/~1subscriptions/post/responses/201/content/application~1json/schema"}}}},"401":{"$ref":"#/paths/~1users/get/responses/401"},"404":{"$ref":"#/paths/~1users/get/responses/404"},"422":{"$ref":"#/paths/~1users/get/responses/422"},"500":{"$ref":"#/paths/~1users/get/responses/500"}}}},"/subscriptions/:subscriptionId/resume":{"post":{"tags":["Subscriptions"],"summary":"Resume a Subscription","description":"Resumes a subscription.\n","operationId":"resumeSubscription","parameters":[{"name":"subscriptionId","in":"path","description":"The unique Id of the subscription to resume.","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"$schema":"http://json-schema.org/draft-07/schema#","title":"Subscription","type":"object","properties":{"paymentMethodId":{"type":"string","description":"Id of the payment method to be used for this subscription"}}}}}},"responses":{"200":{"description":"The request succeeded","content":{"application/json":{"schema":{"$ref":"#/paths/~1subscriptions/post/responses/201/content/application~1json/schema"}}}},"401":{"$ref":"#/paths/~1users/get/responses/401"},"404":{"$ref":"#/paths/~1users/get/responses/404"},"422":{"$ref":"#/paths/~1users/get/responses/422"},"500":{"$ref":"#/paths/~1users/get/responses/500"}}}},"/applepay/web/domainassociation":{"post":{"tags":["Settings"],"summary":"Upload Apple Pay Domain Association File","description":"Upload the apple-developer-merchantid-domain-association.txt file for Apple Pay web domain verification.\nThe file is stored in S3 at `{tenantTitle}/.well-known/apple-developer-merchantid-domain-association.txt`.\n","operationId":"uploadApplePayDomainAssociation","requestBody":{"content":{"multipart/form-data":{"schema":{"type":"object","properties":{"file":{"type":"string","format":"binary","description":"The .txt domain association file from Apple"}}}}}},"responses":{"201":{"description":"File uploaded successfully"},"401":{"$ref":"#/paths/~1users/get/responses/401"},"500":{"$ref":"#/paths/~1users/get/responses/500"}}}},"/metrics/segment":{"post":{"tags":["Metrics - Segment"],"description":"Create a segment metric definition","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"scheduled":{"type":"boolean"},"factType":{"type":"string","enum":["ATV","TotalSpend","OrderCount"]},"query":{"type":"object","properties":{"segmentId":{"type":"string"}},"required":["segmentId"]},"periods":{"type":"array","items":{"anyOf":[{"type":"object","properties":{"name":{"type":"string"},"windowStartOffsetMins":{"type":"number","minimum":0,"maximum":527040},"windowEndOffsetMins":{"type":"number","minimum":0,"maximum":527040},"gt":{"type":"string","format":"date-time"},"lt":{"type":"string","format":"date-time"}},"required":["name","windowStartOffsetMins"]},{"type":"object","properties":{"name":{"type":"string"},"gt":{"type":"string","format":"date-time"},"lt":{"type":"string","format":"date-time"}},"required":["name","gt"]},{"type":"string","enum":["Today","Yesterday","WeekToDate","LastWeek","MonthToDate","LastMonth","QuarterToDate","LastQuarter","YearToDate","LastYear"]}]},"minItems":1}},"required":["scheduled","factType","query","periods"]}}}},"responses":{"201":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"scheduled":{"type":"boolean"},"factType":{"type":"string","enum":["ATV","TotalSpend","OrderCount"]},"query":{"type":"object","properties":{"segmentId":{"type":"string"}},"required":["segmentId"]},"periods":{"type":"array","items":{"anyOf":[{"type":"object","properties":{"name":{"type":"string"},"windowStartOffsetMins":{"type":"number","minimum":0,"maximum":527040},"windowEndOffsetMins":{"type":"number","minimum":0,"maximum":527040},"gt":{"type":"string","format":"date-time"},"lt":{"type":"string","format":"date-time"}},"required":["name","windowStartOffsetMins"]},{"type":"object","properties":{"name":{"type":"string"},"gt":{"type":"string","format":"date-time"},"lt":{"type":"string","format":"date-time"}},"required":["name","gt"]},{"type":"string","enum":["Today","Yesterday","WeekToDate","LastWeek","MonthToDate","LastMonth","QuarterToDate","LastQuarter","YearToDate","LastYear"]}]},"minItems":1},"_id":{"type":"string"},"tenantId":{"type":"string"},"metricClass":{"type":"string","enum":["SegmentMetric"]}},"required":["scheduled","factType","query","periods","_id","tenantId","metricClass"]}}}},"400":{"description":"Invalid request.  The request cannot be processed","content":{"application/json":{"schema":{"$ref":"#/components/responses/BadRequestError/content/application~1json/schema"}}}},"401":{"description":"Access denied","content":{"application/json":{"schema":{"$ref":"#/components/responses/BadRequestError/content/application~1json/schema"}}}},"404":{"description":"Resource not found","content":{"application/json":{"schema":{"$ref":"#/components/responses/BadRequestError/content/application~1json/schema"}}}},"422":{"description":"Unprocessable request.  The request cannot be processed","content":{"application/json":{"schema":{"$ref":"#/components/responses/BadRequestError/content/application~1json/schema"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/responses/BadRequestError/content/application~1json/schema"}}}}}},"get":{"tags":["Metrics - Segment"],"description":"Get segment metric definitions","parameters":[{"schema":{"type":"string"},"required":true,"description":"Request results to start at the record represented by this key.  You can page through a dataset by making requests, setting `startKey` to the `nextKey` value provided in the last response.","name":"startKey","in":"query"},{"schema":{"type":"string"},"required":true,"description":"Set the response to be paged, and limit by this number of results.  If not provided, a default limit (usually 100) will be used","name":"limit","in":"query"},{"schema":{"type":"boolean"},"required":false,"name":"scheduled","in":"query"}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"scheduled":{"type":"boolean"},"factType":{"type":"string","enum":["ATV","TotalSpend","OrderCount"]},"query":{"type":"object","properties":{"segmentId":{"type":"string"}},"required":["segmentId"]},"periods":{"type":"array","items":{"anyOf":[{"type":"object","properties":{"name":{"type":"string"},"windowStartOffsetMins":{"type":"number","minimum":0,"maximum":527040},"windowEndOffsetMins":{"type":"number","minimum":0,"maximum":527040},"gt":{"type":"string","format":"date-time"},"lt":{"type":"string","format":"date-time"}},"required":["name","windowStartOffsetMins"]},{"type":"object","properties":{"name":{"type":"string"},"gt":{"type":"string","format":"date-time"},"lt":{"type":"string","format":"date-time"}},"required":["name","gt"]},{"type":"string","enum":["Today","Yesterday","WeekToDate","LastWeek","MonthToDate","LastMonth","QuarterToDate","LastQuarter","YearToDate","LastYear"]}]},"minItems":1},"_id":{"type":"string"},"tenantId":{"type":"string"},"metricClass":{"type":"string","enum":["SegmentMetric"]}},"required":["scheduled","factType","query","periods","_id","tenantId","metricClass"]}},"page":{"type":"object","properties":{"limit":{"type":"number","description":"The limit used in the request"},"count":{"type":"number","description":"Total number of records in the current page"},"startKey":{"type":"string","description":"A value representing the record at the start of the page.  Do not use this value for any purpose other than paging."},"nextKey":{"type":"string","description":"A value representing the record at the start of the next page.  Use this as the `startKey` in another request.  Do not use this value for any purpose other than paging."}},"required":["limit","count","startKey","nextKey"]}},"required":["items","page"]}}}},"400":{"description":"Invalid request.  The request cannot be processed","content":{"application/json":{"schema":{"$ref":"#/components/responses/BadRequestError/content/application~1json/schema"}}}},"401":{"description":"Access denied","content":{"application/json":{"schema":{"$ref":"#/components/responses/BadRequestError/content/application~1json/schema"}}}},"404":{"description":"Resource not found","content":{"application/json":{"schema":{"$ref":"#/components/responses/BadRequestError/content/application~1json/schema"}}}},"422":{"description":"Unprocessable request.  The request cannot be processed","content":{"application/json":{"schema":{"$ref":"#/components/responses/BadRequestError/content/application~1json/schema"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/responses/BadRequestError/content/application~1json/schema"}}}}}}},"/metrics/segment/:definitionId":{"put":{"tags":["Metrics - Segment"],"description":"Update a segment metric definition","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"scheduled":{"type":"boolean"},"factType":{"type":"string","enum":["ATV","TotalSpend","OrderCount"]},"query":{"type":"object","properties":{"segmentId":{"type":"string"}},"required":["segmentId"]},"periods":{"type":"array","items":{"anyOf":[{"type":"object","properties":{"name":{"type":"string"},"windowStartOffsetMins":{"type":"number","minimum":0,"maximum":527040},"windowEndOffsetMins":{"type":"number","minimum":0,"maximum":527040},"gt":{"type":"string","format":"date-time"},"lt":{"type":"string","format":"date-time"}},"required":["name","windowStartOffsetMins"]},{"type":"object","properties":{"name":{"type":"string"},"gt":{"type":"string","format":"date-time"},"lt":{"type":"string","format":"date-time"}},"required":["name","gt"]},{"type":"string","enum":["Today","Yesterday","WeekToDate","LastWeek","MonthToDate","LastMonth","QuarterToDate","LastQuarter","YearToDate","LastYear"]}]},"minItems":1}}}}}},"responses":{"201":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"scheduled":{"type":"boolean"},"factType":{"type":"string","enum":["ATV","TotalSpend","OrderCount"]},"query":{"type":"object","properties":{"segmentId":{"type":"string"}},"required":["segmentId"]},"periods":{"type":"array","items":{"anyOf":[{"type":"object","properties":{"name":{"type":"string"},"windowStartOffsetMins":{"type":"number","minimum":0,"maximum":527040},"windowEndOffsetMins":{"type":"number","minimum":0,"maximum":527040},"gt":{"type":"string","format":"date-time"},"lt":{"type":"string","format":"date-time"}},"required":["name","windowStartOffsetMins"]},{"type":"object","properties":{"name":{"type":"string"},"gt":{"type":"string","format":"date-time"},"lt":{"type":"string","format":"date-time"}},"required":["name","gt"]},{"type":"string","enum":["Today","Yesterday","WeekToDate","LastWeek","MonthToDate","LastMonth","QuarterToDate","LastQuarter","YearToDate","LastYear"]}]},"minItems":1},"_id":{"type":"string"},"tenantId":{"type":"string"},"metricClass":{"type":"string","enum":["SegmentMetric"]}},"required":["scheduled","factType","query","periods","_id","tenantId","metricClass"]}}}},"400":{"description":"Invalid request.  The request cannot be processed","content":{"application/json":{"schema":{"$ref":"#/components/responses/BadRequestError/content/application~1json/schema"}}}},"401":{"description":"Access denied","content":{"application/json":{"schema":{"$ref":"#/components/responses/BadRequestError/content/application~1json/schema"}}}},"404":{"description":"Resource not found","content":{"application/json":{"schema":{"$ref":"#/components/responses/BadRequestError/content/application~1json/schema"}}}},"422":{"description":"Unprocessable request.  The request cannot be processed","content":{"application/json":{"schema":{"$ref":"#/components/responses/BadRequestError/content/application~1json/schema"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/responses/BadRequestError/content/application~1json/schema"}}}}}},"get":{"tags":["Metrics - Segment"],"description":"Get segment metric definition by id","parameters":[{"schema":{"type":"string"},"required":true,"name":"definitionId","in":"path"}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"scheduled":{"type":"boolean"},"factType":{"type":"string","enum":["ATV","TotalSpend","OrderCount"]},"query":{"type":"object","properties":{"segmentId":{"type":"string"}},"required":["segmentId"]},"periods":{"type":"array","items":{"anyOf":[{"type":"object","properties":{"name":{"type":"string"},"windowStartOffsetMins":{"type":"number","minimum":0,"maximum":527040},"windowEndOffsetMins":{"type":"number","minimum":0,"maximum":527040},"gt":{"type":"string","format":"date-time"},"lt":{"type":"string","format":"date-time"}},"required":["name","windowStartOffsetMins"]},{"type":"object","properties":{"name":{"type":"string"},"gt":{"type":"string","format":"date-time"},"lt":{"type":"string","format":"date-time"}},"required":["name","gt"]},{"type":"string","enum":["Today","Yesterday","WeekToDate","LastWeek","MonthToDate","LastMonth","QuarterToDate","LastQuarter","YearToDate","LastYear"]}]},"minItems":1},"_id":{"type":"string"},"tenantId":{"type":"string"},"metricClass":{"type":"string","enum":["SegmentMetric"]}},"required":["scheduled","factType","query","periods","_id","tenantId","metricClass"]}}}},"400":{"description":"Invalid request.  The request cannot be processed","content":{"application/json":{"schema":{"$ref":"#/components/responses/BadRequestError/content/application~1json/schema"}}}},"401":{"description":"Access denied","content":{"application/json":{"schema":{"$ref":"#/components/responses/BadRequestError/content/application~1json/schema"}}}},"404":{"description":"Resource not found","content":{"application/json":{"schema":{"$ref":"#/components/responses/BadRequestError/content/application~1json/schema"}}}},"422":{"description":"Unprocessable request.  The request cannot be processed","content":{"application/json":{"schema":{"$ref":"#/components/responses/BadRequestError/content/application~1json/schema"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/responses/BadRequestError/content/application~1json/schema"}}}}}},"delete":{"tags":["Metrics - Segment"],"description":"Delete a segment metric definition","parameters":[{"schema":{"type":"string"},"required":true,"name":"definitionId","in":"path"}],"responses":{"200":{"description":"Success"},"400":{"description":"Invalid request.  The request cannot be processed","content":{"application/json":{"schema":{"$ref":"#/components/responses/BadRequestError/content/application~1json/schema"}}}},"401":{"description":"Access denied","content":{"application/json":{"schema":{"$ref":"#/components/responses/BadRequestError/content/application~1json/schema"}}}},"404":{"description":"Resource not found","content":{"application/json":{"schema":{"$ref":"#/components/responses/BadRequestError/content/application~1json/schema"}}}},"422":{"description":"Unprocessable request.  The request cannot be processed","content":{"application/json":{"schema":{"$ref":"#/components/responses/BadRequestError/content/application~1json/schema"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/responses/BadRequestError/content/application~1json/schema"}}}}}}},"/metrics/segment/:definitionId/compute":{"post":{"tags":["Metrics - Segment"],"description":"Compute a segment metric definition","parameters":[{"schema":{"type":"string"},"required":true,"name":"definitionId","in":"path"},{"schema":{"type":"string","description":"This call requires a nonce in this header to prevent duplicate processing of calls.  The nonce value represents an individual call.\nIt should be set to a guid.  Each new call should have a new guid.  In the rare occasion you want to repeat a call, use the original guid value.\n"},"required":true,"name":"x-pepper-req-nonce","in":"header"}],"responses":{"202":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/paths/~1metrics~1user~1%3AdefinitionId~1compute/post/responses/202/content/application~1json/schema"}}}},"400":{"description":"Invalid request.  The request cannot be processed","content":{"application/json":{"schema":{"$ref":"#/components/responses/BadRequestError/content/application~1json/schema"}}}},"401":{"description":"Access denied","content":{"application/json":{"schema":{"$ref":"#/components/responses/BadRequestError/content/application~1json/schema"}}}},"404":{"description":"Resource not found","content":{"application/json":{"schema":{"$ref":"#/components/responses/BadRequestError/content/application~1json/schema"}}}},"422":{"description":"Unprocessable request.  The request cannot be processed","content":{"application/json":{"schema":{"$ref":"#/components/responses/BadRequestError/content/application~1json/schema"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/responses/BadRequestError/content/application~1json/schema"}}}}}}},"/metrics/segment/:definitionId/values":{"get":{"tags":["Metrics - Segment"],"description":"Get segment metrics","parameters":[{"schema":{"type":"string"},"required":true,"name":"definitionId","in":"path"},{"schema":{"type":"string"},"required":true,"description":"Request results to start at the record represented by this key.  You can page through a dataset by making requests, setting `startKey` to the `nextKey` value provided in the last response.","name":"startKey","in":"query"},{"schema":{"type":"string"},"required":true,"description":"Set the response to be paged, and limit by this number of results.  If not provided, a default limit (usually 100) will be used","name":"limit","in":"query"},{"schema":{"type":"string"},"required":false,"name":"metricId","in":"query"}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"_id":{"type":"string"},"tenantId":{"type":"string"},"definitionId":{"type":"string"},"metricId":{"type":"string"},"segmentId":{"type":"string"},"value":{"type":"number"},"updatedAt":{"type":"string"}},"required":["_id","tenantId","definitionId","metricId","segmentId","value","updatedAt"]}},"page":{"type":"object","properties":{"limit":{"type":"number","description":"The limit used in the request"},"count":{"type":"number","description":"Total number of records in the current page"},"startKey":{"type":"string","description":"A value representing the record at the start of the page.  Do not use this value for any purpose other than paging."},"nextKey":{"type":"string","description":"A value representing the record at the start of the next page.  Use this as the `startKey` in another request.  Do not use this value for any purpose other than paging."}},"required":["limit","count","startKey","nextKey"]}},"required":["items","page"]}}}},"400":{"description":"Invalid request.  The request cannot be processed","content":{"application/json":{"schema":{"$ref":"#/components/responses/BadRequestError/content/application~1json/schema"}}}},"401":{"description":"Access denied","content":{"application/json":{"schema":{"$ref":"#/components/responses/BadRequestError/content/application~1json/schema"}}}},"404":{"description":"Resource not found","content":{"application/json":{"schema":{"$ref":"#/components/responses/BadRequestError/content/application~1json/schema"}}}},"422":{"description":"Unprocessable request.  The request cannot be processed","content":{"application/json":{"schema":{"$ref":"#/components/responses/BadRequestError/content/application~1json/schema"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/responses/BadRequestError/content/application~1json/schema"}}}}}}},"/metrics/user":{"post":{"tags":["Metrics - User"],"description":"Create a user metric definition","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"scheduled":{"type":"boolean"},"realtime":{"type":"boolean"},"name":{"type":"string"},"displayName":{"type":"string"},"tags":{"type":"array","items":{"type":"string"}},"recomputeOn":{"type":"array","items":{"type":"string","enum":["NOOP","CARD_CREATED","CARD_DELETED","CHECKIN","USER_CREDITED","GIFT_CARD_TOPUP","GIFT_CARD_ACTIVATED","ORDER_CREATED","ORDER_ITEMS_ADDED","ORDER_USER_JOINED","ORDER_PAYMENT_RECEIVED","ORDER_PAYMENT_REFUNDED","ORDER_COMPLETED","ORDER_USER_BILLED","REFERAL_CLAIMED_REFEREE","REFERAL_CLAIMED_REFERER","REWARD_EARNED","REDEEM_PERK","AWARD_POINTS_REFUNDED","AWARD_POINTS_RESET","MEMBER_ADDED","MEMBER_REMOVED","USER_CREATED","USER_CHANGED","USER_DELETED","USER_ACTIVATION_RESENT","USER_ACTIVATED","CREDENTIAL_VERIFIED","VOUCHER_REDEEMED","COUPON_REDEEMED","COUPON_REFUNDED","BOOKING_CREATED","BOOKING_CHANGED","BOOKING_COMPLETED","SUBSCRIPTION_STARTED","SUBSCRIPTION_PAYMENT_RECEIVED","SUBSCRIPTION_PAYMENT_FAILED","SUBSCRIPTION_CANCELLATION_REQUESTED","SUBSCRIPTION_CANCELLED"]}},"query":{"type":"object","properties":{"created":{"anyOf":[{"type":"object","properties":{"or":{"type":"array","items":{"anyOf":[{"type":"string","format":"date-time"},{"type":"object","properties":{"year":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]},"month":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]},"dayOfMonth":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]},"dayOfYear":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]}}},{"type":"object","properties":{"eq":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"gte":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"lte":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"gt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"lt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]}},"additionalProperties":false}]}}},"required":["or"]},{"type":"string","format":"date-time"},{"type":"object","properties":{"year":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]},"month":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]},"dayOfMonth":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]},"dayOfYear":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]}}},{"type":"object","properties":{"eq":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"gte":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"lte":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"gt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"lt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]}},"additionalProperties":false}]},"birthdate":{"anyOf":[{"type":"object","properties":{"or":{"type":"array","items":{"anyOf":[{"type":"string","format":"date-time"},{"type":"object","properties":{"year":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]},"month":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]},"dayOfMonth":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]},"dayOfYear":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]}}},{"type":"object","properties":{"eq":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"gte":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"lte":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"gt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"lt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]}},"additionalProperties":false}]}}},"required":["or"]},{"type":"string","format":"date-time"},{"type":"object","properties":{"year":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]},"month":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]},"dayOfMonth":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]},"dayOfYear":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]}}},{"type":"object","properties":{"eq":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"gte":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"lte":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"gt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"lt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]}},"additionalProperties":false}]},"hasAgreedToReceiveMarketing":{"type":"boolean"},"hasAgreedToShareData":{"type":"boolean"},"primaryPlatform":{"type":"string","enum":["UNKNOWN","IOS","ANDROID","WEB"]},"gender":{"type":"string","enum":["MALE","FEMALE"]},"favouriteLocations":{"type":"object","properties":{"in":{"type":"array","items":{"type":"string"}}}}}},"metrics":{"type":"object","additionalProperties":{"allOf":[{"type":"object","properties":{"name":{"type":"string"},"displayName":{"type":"string"},"timeRange":{"anyOf":[{"type":"object","properties":{"windowStartOffsetMins":{"type":"number","minimum":0,"maximum":527040},"windowEndOffsetMins":{"type":"number","minimum":0,"maximum":527040},"gt":{"type":"string","format":"date-time"},"lt":{"type":"string","format":"date-time"}},"required":["windowStartOffsetMins"]},{"type":"object","properties":{"gt":{"type":"string","format":"date-time"},"lt":{"type":"string","format":"date-time"}},"required":["gt"]},{"type":"string","enum":["Today","Yesterday","WeekToDate","LastWeek","MonthToDate","LastMonth","QuarterToDate","LastQuarter","YearToDate","LastYear"]}]}},"required":["name","displayName","timeRange"]},{"anyOf":[{"type":"object","properties":{"type":{"type":"string","enum":["TIPS_GIVEN","NOOP","CARD_CREATED","CARD_DELETED","CHECKIN","USER_CREDITED","GIFT_CARD_TOPUP","GIFT_CARD_ACTIVATED","ORDER_CREATED","ORDER_ITEMS_ADDED","ORDER_USER_JOINED","ORDER_PAYMENT_RECEIVED","ORDER_PAYMENT_REFUNDED","ORDER_COMPLETED","ORDER_USER_BILLED","REFERAL_CLAIMED_REFEREE","REFERAL_CLAIMED_REFERER","REWARD_EARNED","REDEEM_PERK","AWARD_POINTS_REFUNDED","AWARD_POINTS_RESET","MEMBER_ADDED","MEMBER_REMOVED","USER_CREATED","USER_CHANGED","USER_DELETED","USER_ACTIVATION_RESENT","USER_ACTIVATED","CREDENTIAL_VERIFIED","VOUCHER_REDEEMED","COUPON_REDEEMED","COUPON_REFUNDED","BOOKING_CREATED","BOOKING_CHANGED","BOOKING_COMPLETED","SUBSCRIPTION_STARTED","SUBSCRIPTION_PAYMENT_RECEIVED","SUBSCRIPTION_PAYMENT_FAILED","SUBSCRIPTION_CANCELLATION_REQUESTED","SUBSCRIPTION_CANCELLED"]}},"required":["type"]},{"type":"object","properties":{"type":{"type":"string","enum":["SPEND"]},"includeTips":{"type":"boolean"}},"required":["type"]},{"type":"object","properties":{"type":{"type":"string","enum":["POINTS_EARNED","POINTS_BURNED"]},"perkId":{"type":"string"}},"required":["type"]}]}]}},"effects":{"type":"array","items":{"allOf":[{"type":"object","properties":{"conditions":{"type":"array","items":{"anyOf":[{"type":"object","properties":{"metricId":{"type":"string"},"operator":{"type":"string","enum":["EQUAL","NOT_EQUAL","GREATER_THAN","LESS_THAN"]},"value":{"type":"number"}},"required":["metricId","operator","value"]},{"type":"object","properties":{"metricId":{"type":"string"},"operator":{"type":"string","enum":["IS_WITHIN_TOP_PERCENTAGE","IS_NOT_WITHIN_TOP_PERCENTAGE"]},"value":{"type":"number","minimum":1,"maximum":100}},"required":["metricId","operator","value"]},{"type":"object","properties":{"userProperty":{"type":"string","enum":["hasAgreedToReceiveMarketing","hasAgreedToShareData"]},"operator":{"type":"string","enum":["EQUAL","NOT_EQUAL"]},"value":{"type":"boolean"}},"required":["userProperty","operator","value"]},{"type":"object","properties":{"userProperty":{"type":"string","enum":["primaryPlatform"]},"operator":{"type":"string","enum":["EQUAL","NOT_EQUAL"]},"value":{"type":"string","enum":["UNKNOWN","IOS","ANDROID","WEB"]}},"required":["userProperty","operator","value"]},{"type":"object","properties":{"userProperty":{"type":"string","enum":["created","birthdate"]},"datePart":{"type":"string","enum":["year","month","dayOfYear","dayOfMonth"]},"operator":{"type":"string","enum":["EQUAL","NOT_EQUAL","GREATER_THAN","LESS_THAN"]},"value":{"anyOf":[{"type":"string","format":"date-time"},{"type":"number"},{"type":"string"}]}},"required":["userProperty","operator","value"]},{"type":"object","properties":{"userProperty":{"type":"string","enum":["gender"]},"operator":{"type":"string","enum":["EQUAL","NOT_EQUAL"]},"value":{"type":"string","enum":["MALE","FEMALE"]}},"required":["userProperty","operator","value"]},{"type":"object","properties":{"userProperty":{"type":"string","enum":["favouriteLocations"]},"operator":{"type":"string","enum":["CONTAINS","NOT_CONTAINS"]},"value":{"type":"string"}},"required":["userProperty","operator","value"]},{"type":"object","properties":{"operator":{"type":"string","enum":["IS_IN_SEGMENT","IS_NOT_IN_SEGMENT"]},"value":{"type":"string"}},"required":["operator","value"]}]}}}},{"anyOf":[{"type":"object","properties":{"type":{"type":"string","enum":["ADD_TO_SEGMENT","REMOVE_FROM_SEGMENT"]},"segmentId":{"type":"string"}},"required":["type","segmentId"]},{"type":"object","properties":{"type":{"type":"string","enum":["TRIGGER_NOTIFICATION"]},"message":{"type":"string"},"isProcessingMessage":{"type":"boolean"},"counter":{"type":"object","properties":{"max":{"type":"number"},"resetsAfterMins":{"type":"number"}},"required":["max"]}},"required":["type","message","isProcessingMessage","counter"]},{"type":"object","properties":{"type":{"type":"string","enum":["TRIGGER_SMS"]},"message":{"type":"string"},"isProcessingMessage":{"type":"boolean"},"counter":{"type":"object","properties":{"max":{"type":"number"},"resetsAfterMins":{"type":"number"}},"required":["max"]}},"required":["type","message","isProcessingMessage","counter"]},{"type":"object","properties":{"type":{"type":"string","enum":["TRIGGER_EMAIL"]},"subject":{"type":"string"},"body":{"type":"string"},"bodyMarkupLanguage":{"type":"string","enum":["HTML","MJML"]},"isProcessingMessage":{"type":"boolean"},"counter":{"type":"object","properties":{"max":{"type":"number"},"resetsAfterMins":{"type":"number"}},"required":["max"]}},"required":["type","subject","body","isProcessingMessage","counter"]},{"type":"object","properties":{"type":{"type":"string","enum":["GRANT_PERK","REVOKE_PERK"]},"perkId":{"type":"string"},"points":{"type":"number"},"counter":{"type":"object","properties":{"max":{"type":"number"},"resetsAfterMins":{"type":"number"}},"required":["max"]}},"required":["type","perkId","counter"]}]}]}}},"required":["scheduled","realtime","name","displayName","effects"]}}}},"responses":{"201":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"scheduled":{"type":"boolean"},"realtime":{"type":"boolean"},"name":{"type":"string"},"displayName":{"type":"string"},"tags":{"type":"array","items":{"type":"string"}},"recomputeOn":{"type":"array","items":{"type":"string","enum":["NOOP","CARD_CREATED","CARD_DELETED","CHECKIN","USER_CREDITED","GIFT_CARD_TOPUP","GIFT_CARD_ACTIVATED","ORDER_CREATED","ORDER_ITEMS_ADDED","ORDER_USER_JOINED","ORDER_PAYMENT_RECEIVED","ORDER_PAYMENT_REFUNDED","ORDER_COMPLETED","ORDER_USER_BILLED","REFERAL_CLAIMED_REFEREE","REFERAL_CLAIMED_REFERER","REWARD_EARNED","REDEEM_PERK","AWARD_POINTS_REFUNDED","AWARD_POINTS_RESET","MEMBER_ADDED","MEMBER_REMOVED","USER_CREATED","USER_CHANGED","USER_DELETED","USER_ACTIVATION_RESENT","USER_ACTIVATED","CREDENTIAL_VERIFIED","VOUCHER_REDEEMED","COUPON_REDEEMED","COUPON_REFUNDED","BOOKING_CREATED","BOOKING_CHANGED","BOOKING_COMPLETED","SUBSCRIPTION_STARTED","SUBSCRIPTION_PAYMENT_RECEIVED","SUBSCRIPTION_PAYMENT_FAILED","SUBSCRIPTION_CANCELLATION_REQUESTED","SUBSCRIPTION_CANCELLED"]}},"query":{"type":"object","properties":{"created":{"anyOf":[{"type":"object","properties":{"or":{"type":"array","items":{"anyOf":[{"type":"string","format":"date-time"},{"type":"object","properties":{"year":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]},"month":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]},"dayOfMonth":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]},"dayOfYear":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]}}},{"type":"object","properties":{"eq":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"gte":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"lte":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"gt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"lt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]}},"additionalProperties":false}]}}},"required":["or"]},{"type":"string","format":"date-time"},{"type":"object","properties":{"year":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]},"month":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]},"dayOfMonth":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]},"dayOfYear":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]}}},{"type":"object","properties":{"eq":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"gte":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"lte":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"gt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"lt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]}},"additionalProperties":false}]},"birthdate":{"anyOf":[{"type":"object","properties":{"or":{"type":"array","items":{"anyOf":[{"type":"string","format":"date-time"},{"type":"object","properties":{"year":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]},"month":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]},"dayOfMonth":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]},"dayOfYear":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]}}},{"type":"object","properties":{"eq":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"gte":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"lte":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"gt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"lt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]}},"additionalProperties":false}]}}},"required":["or"]},{"type":"string","format":"date-time"},{"type":"object","properties":{"year":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]},"month":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]},"dayOfMonth":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]},"dayOfYear":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]}}},{"type":"object","properties":{"eq":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"gte":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"lte":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"gt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"lt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]}},"additionalProperties":false}]},"hasAgreedToReceiveMarketing":{"type":"boolean"},"hasAgreedToShareData":{"type":"boolean"},"primaryPlatform":{"type":"string","enum":["UNKNOWN","IOS","ANDROID","WEB"]},"gender":{"type":"string","enum":["MALE","FEMALE"]},"favouriteLocations":{"type":"object","properties":{"in":{"type":"array","items":{"type":"string"}}}}}},"metrics":{"type":"object","additionalProperties":{"allOf":[{"type":"object","properties":{"name":{"type":"string"},"displayName":{"type":"string"},"timeRange":{"anyOf":[{"type":"object","properties":{"windowStartOffsetMins":{"type":"number","minimum":0,"maximum":527040},"windowEndOffsetMins":{"type":"number","minimum":0,"maximum":527040},"gt":{"type":"string","format":"date-time"},"lt":{"type":"string","format":"date-time"}},"required":["windowStartOffsetMins"]},{"type":"object","properties":{"gt":{"type":"string","format":"date-time"},"lt":{"type":"string","format":"date-time"}},"required":["gt"]},{"type":"string","enum":["Today","Yesterday","WeekToDate","LastWeek","MonthToDate","LastMonth","QuarterToDate","LastQuarter","YearToDate","LastYear"]}]}},"required":["name","displayName","timeRange"]},{"anyOf":[{"type":"object","properties":{"type":{"type":"string","enum":["TIPS_GIVEN","NOOP","CARD_CREATED","CARD_DELETED","CHECKIN","USER_CREDITED","GIFT_CARD_TOPUP","GIFT_CARD_ACTIVATED","ORDER_CREATED","ORDER_ITEMS_ADDED","ORDER_USER_JOINED","ORDER_PAYMENT_RECEIVED","ORDER_PAYMENT_REFUNDED","ORDER_COMPLETED","ORDER_USER_BILLED","REFERAL_CLAIMED_REFEREE","REFERAL_CLAIMED_REFERER","REWARD_EARNED","REDEEM_PERK","AWARD_POINTS_REFUNDED","AWARD_POINTS_RESET","MEMBER_ADDED","MEMBER_REMOVED","USER_CREATED","USER_CHANGED","USER_DELETED","USER_ACTIVATION_RESENT","USER_ACTIVATED","CREDENTIAL_VERIFIED","VOUCHER_REDEEMED","COUPON_REDEEMED","COUPON_REFUNDED","BOOKING_CREATED","BOOKING_CHANGED","BOOKING_COMPLETED","SUBSCRIPTION_STARTED","SUBSCRIPTION_PAYMENT_RECEIVED","SUBSCRIPTION_PAYMENT_FAILED","SUBSCRIPTION_CANCELLATION_REQUESTED","SUBSCRIPTION_CANCELLED"]}},"required":["type"]},{"type":"object","properties":{"type":{"type":"string","enum":["SPEND"]},"includeTips":{"type":"boolean"}},"required":["type"]},{"type":"object","properties":{"type":{"type":"string","enum":["POINTS_EARNED","POINTS_BURNED"]},"perkId":{"type":"string"}},"required":["type"]}]}]}},"_id":{"type":"string"},"tenantId":{"type":"string"},"effects":{"type":"array","items":{"allOf":[{"type":"object","properties":{"conditions":{"type":"array","items":{"anyOf":[{"type":"object","properties":{"metricId":{"type":"string"},"operator":{"type":"string","enum":["EQUAL","NOT_EQUAL","GREATER_THAN","LESS_THAN"]},"value":{"type":"number"}},"required":["metricId","operator","value"]},{"type":"object","properties":{"metricId":{"type":"string"},"operator":{"type":"string","enum":["IS_WITHIN_TOP_PERCENTAGE","IS_NOT_WITHIN_TOP_PERCENTAGE"]},"value":{"type":"number","minimum":1,"maximum":100}},"required":["metricId","operator","value"]},{"type":"object","properties":{"userProperty":{"type":"string","enum":["hasAgreedToReceiveMarketing","hasAgreedToShareData"]},"operator":{"type":"string","enum":["EQUAL","NOT_EQUAL"]},"value":{"type":"boolean"}},"required":["userProperty","operator","value"]},{"type":"object","properties":{"userProperty":{"type":"string","enum":["primaryPlatform"]},"operator":{"type":"string","enum":["EQUAL","NOT_EQUAL"]},"value":{"type":"string","enum":["UNKNOWN","IOS","ANDROID","WEB"]}},"required":["userProperty","operator","value"]},{"type":"object","properties":{"userProperty":{"type":"string","enum":["created","birthdate"]},"datePart":{"type":"string","enum":["year","month","dayOfYear","dayOfMonth"]},"operator":{"type":"string","enum":["EQUAL","NOT_EQUAL","GREATER_THAN","LESS_THAN"]},"value":{"anyOf":[{"type":"string","format":"date-time"},{"type":"number"},{"type":"string"}]}},"required":["userProperty","operator","value"]},{"type":"object","properties":{"userProperty":{"type":"string","enum":["gender"]},"operator":{"type":"string","enum":["EQUAL","NOT_EQUAL"]},"value":{"type":"string","enum":["MALE","FEMALE"]}},"required":["userProperty","operator","value"]},{"type":"object","properties":{"userProperty":{"type":"string","enum":["favouriteLocations"]},"operator":{"type":"string","enum":["CONTAINS","NOT_CONTAINS"]},"value":{"type":"string"}},"required":["userProperty","operator","value"]},{"type":"object","properties":{"operator":{"type":"string","enum":["IS_IN_SEGMENT","IS_NOT_IN_SEGMENT"]},"value":{"type":"string"}},"required":["operator","value"]}]}}}},{"anyOf":[{"type":"object","properties":{"type":{"type":"string","enum":["ADD_TO_SEGMENT","REMOVE_FROM_SEGMENT"]},"segmentId":{"type":"string"}},"required":["type","segmentId"]},{"type":"object","properties":{"type":{"type":"string","enum":["TRIGGER_NOTIFICATION"]},"message":{"type":"string"},"isProcessingMessage":{"type":"boolean"},"counter":{"type":"object","properties":{"max":{"type":"number"},"resetsAfterMins":{"type":"number"}},"required":["max"]}},"required":["type","message","isProcessingMessage","counter"]},{"type":"object","properties":{"type":{"type":"string","enum":["TRIGGER_SMS"]},"message":{"type":"string"},"isProcessingMessage":{"type":"boolean"},"counter":{"type":"object","properties":{"max":{"type":"number"},"resetsAfterMins":{"type":"number"}},"required":["max"]}},"required":["type","message","isProcessingMessage","counter"]},{"type":"object","properties":{"type":{"type":"string","enum":["TRIGGER_EMAIL"]},"subject":{"type":"string"},"body":{"type":"string"},"bodyMarkupLanguage":{"type":"string","enum":["HTML","MJML"]},"isProcessingMessage":{"type":"boolean"},"counter":{"type":"object","properties":{"max":{"type":"number"},"resetsAfterMins":{"type":"number"}},"required":["max"]}},"required":["type","subject","body","isProcessingMessage","counter"]},{"type":"object","properties":{"type":{"type":"string","enum":["GRANT_PERK","REVOKE_PERK"]},"perkId":{"type":"string"},"points":{"type":"number"},"counter":{"type":"object","properties":{"max":{"type":"number"},"resetsAfterMins":{"type":"number"}},"required":["max"]}},"required":["type","perkId","counter"]}]},{"type":"object","properties":{"_id":{"type":"string"},"conditions":{"type":"array","items":{"allOf":[{"anyOf":[{"type":"object","properties":{"metricId":{"type":"string"},"operator":{"type":"string","enum":["EQUAL","NOT_EQUAL","GREATER_THAN","LESS_THAN"]},"value":{"type":"number"}},"required":["metricId","operator","value"]},{"type":"object","properties":{"metricId":{"type":"string"},"operator":{"type":"string","enum":["IS_WITHIN_TOP_PERCENTAGE","IS_NOT_WITHIN_TOP_PERCENTAGE"]},"value":{"type":"number","minimum":1,"maximum":100}},"required":["metricId","operator","value"]},{"type":"object","properties":{"userProperty":{"type":"string","enum":["hasAgreedToReceiveMarketing","hasAgreedToShareData"]},"operator":{"type":"string","enum":["EQUAL","NOT_EQUAL"]},"value":{"type":"boolean"}},"required":["userProperty","operator","value"]},{"type":"object","properties":{"userProperty":{"type":"string","enum":["primaryPlatform"]},"operator":{"type":"string","enum":["EQUAL","NOT_EQUAL"]},"value":{"type":"string","enum":["UNKNOWN","IOS","ANDROID","WEB"]}},"required":["userProperty","operator","value"]},{"type":"object","properties":{"userProperty":{"type":"string","enum":["created","birthdate"]},"datePart":{"type":"string","enum":["year","month","dayOfYear","dayOfMonth"]},"operator":{"type":"string","enum":["EQUAL","NOT_EQUAL","GREATER_THAN","LESS_THAN"]},"value":{"anyOf":[{"type":"string","format":"date-time"},{"type":"number"},{"type":"string"}]}},"required":["userProperty","operator","value"]},{"type":"object","properties":{"userProperty":{"type":"string","enum":["gender"]},"operator":{"type":"string","enum":["EQUAL","NOT_EQUAL"]},"value":{"type":"string","enum":["MALE","FEMALE"]}},"required":["userProperty","operator","value"]},{"type":"object","properties":{"userProperty":{"type":"string","enum":["favouriteLocations"]},"operator":{"type":"string","enum":["CONTAINS","NOT_CONTAINS"]},"value":{"type":"string"}},"required":["userProperty","operator","value"]},{"type":"object","properties":{"operator":{"type":"string","enum":["IS_IN_SEGMENT","IS_NOT_IN_SEGMENT"]},"value":{"type":"string"}},"required":["operator","value"]}]},{"type":"object","properties":{"_id":{"type":"string"}},"required":["_id"]}]}}},"required":["_id"]}]}}},"required":["scheduled","realtime","name","displayName","_id","tenantId","effects"]}}}},"400":{"description":"Invalid request.  The request cannot be processed","content":{"application/json":{"schema":{"$ref":"#/components/responses/BadRequestError/content/application~1json/schema"}}}},"401":{"description":"Access denied","content":{"application/json":{"schema":{"$ref":"#/components/responses/BadRequestError/content/application~1json/schema"}}}},"404":{"description":"Resource not found","content":{"application/json":{"schema":{"$ref":"#/components/responses/BadRequestError/content/application~1json/schema"}}}},"422":{"description":"Unprocessable request.  The request cannot be processed","content":{"application/json":{"schema":{"$ref":"#/components/responses/BadRequestError/content/application~1json/schema"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/responses/BadRequestError/content/application~1json/schema"}}}}}},"get":{"tags":["Metrics - User"],"description":"Get user metric definitions","parameters":[{"schema":{"type":"string"},"required":true,"description":"Request results to start at the record represented by this key.  You can page through a dataset by making requests, setting `startKey` to the `nextKey` value provided in the last response.","name":"startKey","in":"query"},{"schema":{"type":"string"},"required":true,"description":"Set the response to be paged, and limit by this number of results.  If not provided, a default limit (usually 100) will be used","name":"limit","in":"query"},{"schema":{"type":"boolean"},"required":false,"name":"scheduled","in":"query"},{"schema":{"type":"string","description":"Filter user metric definitions by matching on a value in the tags field"},"required":false,"name":"tag","in":"query"}],"responses":{"201":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"scheduled":{"type":"boolean"},"realtime":{"type":"boolean"},"name":{"type":"string"},"displayName":{"type":"string"},"tags":{"type":"array","items":{"type":"string"}},"recomputeOn":{"type":"array","items":{"type":"string","enum":["NOOP","CARD_CREATED","CARD_DELETED","CHECKIN","USER_CREDITED","GIFT_CARD_TOPUP","GIFT_CARD_ACTIVATED","ORDER_CREATED","ORDER_ITEMS_ADDED","ORDER_USER_JOINED","ORDER_PAYMENT_RECEIVED","ORDER_PAYMENT_REFUNDED","ORDER_COMPLETED","ORDER_USER_BILLED","REFERAL_CLAIMED_REFEREE","REFERAL_CLAIMED_REFERER","REWARD_EARNED","REDEEM_PERK","AWARD_POINTS_REFUNDED","AWARD_POINTS_RESET","MEMBER_ADDED","MEMBER_REMOVED","USER_CREATED","USER_CHANGED","USER_DELETED","USER_ACTIVATION_RESENT","USER_ACTIVATED","CREDENTIAL_VERIFIED","VOUCHER_REDEEMED","COUPON_REDEEMED","COUPON_REFUNDED","BOOKING_CREATED","BOOKING_CHANGED","BOOKING_COMPLETED","SUBSCRIPTION_STARTED","SUBSCRIPTION_PAYMENT_RECEIVED","SUBSCRIPTION_PAYMENT_FAILED","SUBSCRIPTION_CANCELLATION_REQUESTED","SUBSCRIPTION_CANCELLED"]}},"query":{"type":"object","properties":{"created":{"anyOf":[{"type":"object","properties":{"or":{"type":"array","items":{"anyOf":[{"type":"string","format":"date-time"},{"type":"object","properties":{"year":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]},"month":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]},"dayOfMonth":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]},"dayOfYear":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]}}},{"type":"object","properties":{"eq":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"gte":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"lte":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"gt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"lt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]}},"additionalProperties":false}]}}},"required":["or"]},{"type":"string","format":"date-time"},{"type":"object","properties":{"year":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]},"month":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]},"dayOfMonth":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]},"dayOfYear":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]}}},{"type":"object","properties":{"eq":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"gte":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"lte":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"gt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"lt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]}},"additionalProperties":false}]},"birthdate":{"anyOf":[{"type":"object","properties":{"or":{"type":"array","items":{"anyOf":[{"type":"string","format":"date-time"},{"type":"object","properties":{"year":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]},"month":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]},"dayOfMonth":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]},"dayOfYear":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]}}},{"type":"object","properties":{"eq":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"gte":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"lte":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"gt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"lt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]}},"additionalProperties":false}]}}},"required":["or"]},{"type":"string","format":"date-time"},{"type":"object","properties":{"year":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]},"month":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]},"dayOfMonth":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]},"dayOfYear":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]}}},{"type":"object","properties":{"eq":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"gte":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"lte":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"gt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"lt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]}},"additionalProperties":false}]},"hasAgreedToReceiveMarketing":{"type":"boolean"},"hasAgreedToShareData":{"type":"boolean"},"primaryPlatform":{"type":"string","enum":["UNKNOWN","IOS","ANDROID","WEB"]},"gender":{"type":"string","enum":["MALE","FEMALE"]},"favouriteLocations":{"type":"object","properties":{"in":{"type":"array","items":{"type":"string"}}}}}},"metrics":{"type":"object","additionalProperties":{"allOf":[{"type":"object","properties":{"name":{"type":"string"},"displayName":{"type":"string"},"timeRange":{"anyOf":[{"type":"object","properties":{"windowStartOffsetMins":{"type":"number","minimum":0,"maximum":527040},"windowEndOffsetMins":{"type":"number","minimum":0,"maximum":527040},"gt":{"type":"string","format":"date-time"},"lt":{"type":"string","format":"date-time"}},"required":["windowStartOffsetMins"]},{"type":"object","properties":{"gt":{"type":"string","format":"date-time"},"lt":{"type":"string","format":"date-time"}},"required":["gt"]},{"type":"string","enum":["Today","Yesterday","WeekToDate","LastWeek","MonthToDate","LastMonth","QuarterToDate","LastQuarter","YearToDate","LastYear"]}]}},"required":["name","displayName","timeRange"]},{"anyOf":[{"type":"object","properties":{"type":{"type":"string","enum":["TIPS_GIVEN","NOOP","CARD_CREATED","CARD_DELETED","CHECKIN","USER_CREDITED","GIFT_CARD_TOPUP","GIFT_CARD_ACTIVATED","ORDER_CREATED","ORDER_ITEMS_ADDED","ORDER_USER_JOINED","ORDER_PAYMENT_RECEIVED","ORDER_PAYMENT_REFUNDED","ORDER_COMPLETED","ORDER_USER_BILLED","REFERAL_CLAIMED_REFEREE","REFERAL_CLAIMED_REFERER","REWARD_EARNED","REDEEM_PERK","AWARD_POINTS_REFUNDED","AWARD_POINTS_RESET","MEMBER_ADDED","MEMBER_REMOVED","USER_CREATED","USER_CHANGED","USER_DELETED","USER_ACTIVATION_RESENT","USER_ACTIVATED","CREDENTIAL_VERIFIED","VOUCHER_REDEEMED","COUPON_REDEEMED","COUPON_REFUNDED","BOOKING_CREATED","BOOKING_CHANGED","BOOKING_COMPLETED","SUBSCRIPTION_STARTED","SUBSCRIPTION_PAYMENT_RECEIVED","SUBSCRIPTION_PAYMENT_FAILED","SUBSCRIPTION_CANCELLATION_REQUESTED","SUBSCRIPTION_CANCELLED"]}},"required":["type"]},{"type":"object","properties":{"type":{"type":"string","enum":["SPEND"]},"includeTips":{"type":"boolean"}},"required":["type"]},{"type":"object","properties":{"type":{"type":"string","enum":["POINTS_EARNED","POINTS_BURNED"]},"perkId":{"type":"string"}},"required":["type"]}]}]}},"_id":{"type":"string"},"tenantId":{"type":"string"},"effects":{"type":"array","items":{"allOf":[{"type":"object","properties":{"conditions":{"type":"array","items":{"anyOf":[{"type":"object","properties":{"metricId":{"type":"string"},"operator":{"type":"string","enum":["EQUAL","NOT_EQUAL","GREATER_THAN","LESS_THAN"]},"value":{"type":"number"}},"required":["metricId","operator","value"]},{"type":"object","properties":{"metricId":{"type":"string"},"operator":{"type":"string","enum":["IS_WITHIN_TOP_PERCENTAGE","IS_NOT_WITHIN_TOP_PERCENTAGE"]},"value":{"type":"number","minimum":1,"maximum":100}},"required":["metricId","operator","value"]},{"type":"object","properties":{"userProperty":{"type":"string","enum":["hasAgreedToReceiveMarketing","hasAgreedToShareData"]},"operator":{"type":"string","enum":["EQUAL","NOT_EQUAL"]},"value":{"type":"boolean"}},"required":["userProperty","operator","value"]},{"type":"object","properties":{"userProperty":{"type":"string","enum":["primaryPlatform"]},"operator":{"type":"string","enum":["EQUAL","NOT_EQUAL"]},"value":{"type":"string","enum":["UNKNOWN","IOS","ANDROID","WEB"]}},"required":["userProperty","operator","value"]},{"type":"object","properties":{"userProperty":{"type":"string","enum":["created","birthdate"]},"datePart":{"type":"string","enum":["year","month","dayOfYear","dayOfMonth"]},"operator":{"type":"string","enum":["EQUAL","NOT_EQUAL","GREATER_THAN","LESS_THAN"]},"value":{"anyOf":[{"type":"string","format":"date-time"},{"type":"number"},{"type":"string"}]}},"required":["userProperty","operator","value"]},{"type":"object","properties":{"userProperty":{"type":"string","enum":["gender"]},"operator":{"type":"string","enum":["EQUAL","NOT_EQUAL"]},"value":{"type":"string","enum":["MALE","FEMALE"]}},"required":["userProperty","operator","value"]},{"type":"object","properties":{"userProperty":{"type":"string","enum":["favouriteLocations"]},"operator":{"type":"string","enum":["CONTAINS","NOT_CONTAINS"]},"value":{"type":"string"}},"required":["userProperty","operator","value"]},{"type":"object","properties":{"operator":{"type":"string","enum":["IS_IN_SEGMENT","IS_NOT_IN_SEGMENT"]},"value":{"type":"string"}},"required":["operator","value"]}]}}}},{"anyOf":[{"type":"object","properties":{"type":{"type":"string","enum":["ADD_TO_SEGMENT","REMOVE_FROM_SEGMENT"]},"segmentId":{"type":"string"}},"required":["type","segmentId"]},{"type":"object","properties":{"type":{"type":"string","enum":["TRIGGER_NOTIFICATION"]},"message":{"type":"string"},"isProcessingMessage":{"type":"boolean"},"counter":{"type":"object","properties":{"max":{"type":"number"},"resetsAfterMins":{"type":"number"}},"required":["max"]}},"required":["type","message","isProcessingMessage","counter"]},{"type":"object","properties":{"type":{"type":"string","enum":["TRIGGER_SMS"]},"message":{"type":"string"},"isProcessingMessage":{"type":"boolean"},"counter":{"type":"object","properties":{"max":{"type":"number"},"resetsAfterMins":{"type":"number"}},"required":["max"]}},"required":["type","message","isProcessingMessage","counter"]},{"type":"object","properties":{"type":{"type":"string","enum":["TRIGGER_EMAIL"]},"subject":{"type":"string"},"body":{"type":"string"},"bodyMarkupLanguage":{"type":"string","enum":["HTML","MJML"]},"isProcessingMessage":{"type":"boolean"},"counter":{"type":"object","properties":{"max":{"type":"number"},"resetsAfterMins":{"type":"number"}},"required":["max"]}},"required":["type","subject","body","isProcessingMessage","counter"]},{"type":"object","properties":{"type":{"type":"string","enum":["GRANT_PERK","REVOKE_PERK"]},"perkId":{"type":"string"},"points":{"type":"number"},"counter":{"type":"object","properties":{"max":{"type":"number"},"resetsAfterMins":{"type":"number"}},"required":["max"]}},"required":["type","perkId","counter"]}]},{"type":"object","properties":{"_id":{"type":"string"},"conditions":{"type":"array","items":{"allOf":[{"anyOf":[{"type":"object","properties":{"metricId":{"type":"string"},"operator":{"type":"string","enum":["EQUAL","NOT_EQUAL","GREATER_THAN","LESS_THAN"]},"value":{"type":"number"}},"required":["metricId","operator","value"]},{"type":"object","properties":{"metricId":{"type":"string"},"operator":{"type":"string","enum":["IS_WITHIN_TOP_PERCENTAGE","IS_NOT_WITHIN_TOP_PERCENTAGE"]},"value":{"type":"number","minimum":1,"maximum":100}},"required":["metricId","operator","value"]},{"type":"object","properties":{"userProperty":{"type":"string","enum":["hasAgreedToReceiveMarketing","hasAgreedToShareData"]},"operator":{"type":"string","enum":["EQUAL","NOT_EQUAL"]},"value":{"type":"boolean"}},"required":["userProperty","operator","value"]},{"type":"object","properties":{"userProperty":{"type":"string","enum":["primaryPlatform"]},"operator":{"type":"string","enum":["EQUAL","NOT_EQUAL"]},"value":{"type":"string","enum":["UNKNOWN","IOS","ANDROID","WEB"]}},"required":["userProperty","operator","value"]},{"type":"object","properties":{"userProperty":{"type":"string","enum":["created","birthdate"]},"datePart":{"type":"string","enum":["year","month","dayOfYear","dayOfMonth"]},"operator":{"type":"string","enum":["EQUAL","NOT_EQUAL","GREATER_THAN","LESS_THAN"]},"value":{"anyOf":[{"type":"string","format":"date-time"},{"type":"number"},{"type":"string"}]}},"required":["userProperty","operator","value"]},{"type":"object","properties":{"userProperty":{"type":"string","enum":["gender"]},"operator":{"type":"string","enum":["EQUAL","NOT_EQUAL"]},"value":{"type":"string","enum":["MALE","FEMALE"]}},"required":["userProperty","operator","value"]},{"type":"object","properties":{"userProperty":{"type":"string","enum":["favouriteLocations"]},"operator":{"type":"string","enum":["CONTAINS","NOT_CONTAINS"]},"value":{"type":"string"}},"required":["userProperty","operator","value"]},{"type":"object","properties":{"operator":{"type":"string","enum":["IS_IN_SEGMENT","IS_NOT_IN_SEGMENT"]},"value":{"type":"string"}},"required":["operator","value"]}]},{"type":"object","properties":{"_id":{"type":"string"}},"required":["_id"]}]}}},"required":["_id"]}]}},"id":{"type":"string"}},"required":["scheduled","realtime","name","displayName","_id","tenantId","effects","id"]}},"page":{"type":"object","properties":{"limit":{"type":"number","description":"The limit used in the request"},"count":{"type":"number","description":"Total number of records in the current page"},"startKey":{"type":"string","description":"A value representing the record at the start of the page.  Do not use this value for any purpose other than paging."},"nextKey":{"type":"string","description":"A value representing the record at the start of the next page.  Use this as the `startKey` in another request.  Do not use this value for any purpose other than paging."}},"required":["limit","count","startKey","nextKey"]}},"required":["items","page"]}}}},"400":{"description":"Invalid request.  The request cannot be processed","content":{"application/json":{"schema":{"$ref":"#/components/responses/BadRequestError/content/application~1json/schema"}}}},"401":{"description":"Access denied","content":{"application/json":{"schema":{"$ref":"#/components/responses/BadRequestError/content/application~1json/schema"}}}},"404":{"description":"Resource not found","content":{"application/json":{"schema":{"$ref":"#/components/responses/BadRequestError/content/application~1json/schema"}}}},"422":{"description":"Unprocessable request.  The request cannot be processed","content":{"application/json":{"schema":{"$ref":"#/components/responses/BadRequestError/content/application~1json/schema"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/responses/BadRequestError/content/application~1json/schema"}}}}}}},"/metrics/user/:definitionId":{"put":{"tags":["Metrics - User"],"description":"Update a user metric definition","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"scheduled":{"type":"boolean"},"realtime":{"type":"boolean"},"name":{"type":"string"},"displayName":{"type":"string"},"tags":{"type":"array","items":{"type":"string"}},"recomputeOn":{"type":"array","items":{"type":"string","enum":["NOOP","CARD_CREATED","CARD_DELETED","CHECKIN","USER_CREDITED","GIFT_CARD_TOPUP","GIFT_CARD_ACTIVATED","ORDER_CREATED","ORDER_ITEMS_ADDED","ORDER_USER_JOINED","ORDER_PAYMENT_RECEIVED","ORDER_PAYMENT_REFUNDED","ORDER_COMPLETED","ORDER_USER_BILLED","REFERAL_CLAIMED_REFEREE","REFERAL_CLAIMED_REFERER","REWARD_EARNED","REDEEM_PERK","AWARD_POINTS_REFUNDED","AWARD_POINTS_RESET","MEMBER_ADDED","MEMBER_REMOVED","USER_CREATED","USER_CHANGED","USER_DELETED","USER_ACTIVATION_RESENT","USER_ACTIVATED","CREDENTIAL_VERIFIED","VOUCHER_REDEEMED","COUPON_REDEEMED","COUPON_REFUNDED","BOOKING_CREATED","BOOKING_CHANGED","BOOKING_COMPLETED","SUBSCRIPTION_STARTED","SUBSCRIPTION_PAYMENT_RECEIVED","SUBSCRIPTION_PAYMENT_FAILED","SUBSCRIPTION_CANCELLATION_REQUESTED","SUBSCRIPTION_CANCELLED"]}},"query":{"type":"object","properties":{"created":{"anyOf":[{"type":"object","properties":{"or":{"type":"array","items":{"anyOf":[{"type":"string","format":"date-time"},{"type":"object","properties":{"year":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]},"month":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]},"dayOfMonth":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]},"dayOfYear":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]}}},{"type":"object","properties":{"eq":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"gte":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"lte":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"gt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"lt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]}},"additionalProperties":false}]}}},"required":["or"]},{"type":"string","format":"date-time"},{"type":"object","properties":{"year":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]},"month":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]},"dayOfMonth":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]},"dayOfYear":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]}}},{"type":"object","properties":{"eq":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"gte":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"lte":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"gt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"lt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]}},"additionalProperties":false}]},"birthdate":{"anyOf":[{"type":"object","properties":{"or":{"type":"array","items":{"anyOf":[{"type":"string","format":"date-time"},{"type":"object","properties":{"year":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]},"month":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]},"dayOfMonth":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]},"dayOfYear":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]}}},{"type":"object","properties":{"eq":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"gte":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"lte":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"gt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"lt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]}},"additionalProperties":false}]}}},"required":["or"]},{"type":"string","format":"date-time"},{"type":"object","properties":{"year":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]},"month":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]},"dayOfMonth":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]},"dayOfYear":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]}}},{"type":"object","properties":{"eq":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"gte":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"lte":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"gt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"lt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]}},"additionalProperties":false}]},"hasAgreedToReceiveMarketing":{"type":"boolean"},"hasAgreedToShareData":{"type":"boolean"},"primaryPlatform":{"type":"string","enum":["UNKNOWN","IOS","ANDROID","WEB"]},"gender":{"type":"string","enum":["MALE","FEMALE"]},"favouriteLocations":{"type":"object","properties":{"in":{"type":"array","items":{"type":"string"}}}}}}}}}}},"responses":{"201":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"scheduled":{"type":"boolean"},"realtime":{"type":"boolean"},"name":{"type":"string"},"displayName":{"type":"string"},"tags":{"type":"array","items":{"type":"string"}},"recomputeOn":{"type":"array","items":{"type":"string","enum":["NOOP","CARD_CREATED","CARD_DELETED","CHECKIN","USER_CREDITED","GIFT_CARD_TOPUP","GIFT_CARD_ACTIVATED","ORDER_CREATED","ORDER_ITEMS_ADDED","ORDER_USER_JOINED","ORDER_PAYMENT_RECEIVED","ORDER_PAYMENT_REFUNDED","ORDER_COMPLETED","ORDER_USER_BILLED","REFERAL_CLAIMED_REFEREE","REFERAL_CLAIMED_REFERER","REWARD_EARNED","REDEEM_PERK","AWARD_POINTS_REFUNDED","AWARD_POINTS_RESET","MEMBER_ADDED","MEMBER_REMOVED","USER_CREATED","USER_CHANGED","USER_DELETED","USER_ACTIVATION_RESENT","USER_ACTIVATED","CREDENTIAL_VERIFIED","VOUCHER_REDEEMED","COUPON_REDEEMED","COUPON_REFUNDED","BOOKING_CREATED","BOOKING_CHANGED","BOOKING_COMPLETED","SUBSCRIPTION_STARTED","SUBSCRIPTION_PAYMENT_RECEIVED","SUBSCRIPTION_PAYMENT_FAILED","SUBSCRIPTION_CANCELLATION_REQUESTED","SUBSCRIPTION_CANCELLED"]}},"query":{"type":"object","properties":{"created":{"anyOf":[{"type":"object","properties":{"or":{"type":"array","items":{"anyOf":[{"type":"string","format":"date-time"},{"type":"object","properties":{"year":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]},"month":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]},"dayOfMonth":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]},"dayOfYear":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]}}},{"type":"object","properties":{"eq":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"gte":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"lte":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"gt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"lt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]}},"additionalProperties":false}]}}},"required":["or"]},{"type":"string","format":"date-time"},{"type":"object","properties":{"year":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]},"month":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]},"dayOfMonth":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]},"dayOfYear":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]}}},{"type":"object","properties":{"eq":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"gte":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"lte":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"gt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"lt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]}},"additionalProperties":false}]},"birthdate":{"anyOf":[{"type":"object","properties":{"or":{"type":"array","items":{"anyOf":[{"type":"string","format":"date-time"},{"type":"object","properties":{"year":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]},"month":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]},"dayOfMonth":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]},"dayOfYear":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]}}},{"type":"object","properties":{"eq":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"gte":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"lte":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"gt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"lt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]}},"additionalProperties":false}]}}},"required":["or"]},{"type":"string","format":"date-time"},{"type":"object","properties":{"year":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]},"month":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]},"dayOfMonth":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]},"dayOfYear":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]}}},{"type":"object","properties":{"eq":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"gte":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"lte":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"gt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"lt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]}},"additionalProperties":false}]},"hasAgreedToReceiveMarketing":{"type":"boolean"},"hasAgreedToShareData":{"type":"boolean"},"primaryPlatform":{"type":"string","enum":["UNKNOWN","IOS","ANDROID","WEB"]},"gender":{"type":"string","enum":["MALE","FEMALE"]},"favouriteLocations":{"type":"object","properties":{"in":{"type":"array","items":{"type":"string"}}}}}},"metrics":{"type":"object","additionalProperties":{"allOf":[{"type":"object","properties":{"name":{"type":"string"},"displayName":{"type":"string"},"timeRange":{"anyOf":[{"type":"object","properties":{"windowStartOffsetMins":{"type":"number","minimum":0,"maximum":527040},"windowEndOffsetMins":{"type":"number","minimum":0,"maximum":527040},"gt":{"type":"string","format":"date-time"},"lt":{"type":"string","format":"date-time"}},"required":["windowStartOffsetMins"]},{"type":"object","properties":{"gt":{"type":"string","format":"date-time"},"lt":{"type":"string","format":"date-time"}},"required":["gt"]},{"type":"string","enum":["Today","Yesterday","WeekToDate","LastWeek","MonthToDate","LastMonth","QuarterToDate","LastQuarter","YearToDate","LastYear"]}]}},"required":["name","displayName","timeRange"]},{"anyOf":[{"type":"object","properties":{"type":{"type":"string","enum":["TIPS_GIVEN","NOOP","CARD_CREATED","CARD_DELETED","CHECKIN","USER_CREDITED","GIFT_CARD_TOPUP","GIFT_CARD_ACTIVATED","ORDER_CREATED","ORDER_ITEMS_ADDED","ORDER_USER_JOINED","ORDER_PAYMENT_RECEIVED","ORDER_PAYMENT_REFUNDED","ORDER_COMPLETED","ORDER_USER_BILLED","REFERAL_CLAIMED_REFEREE","REFERAL_CLAIMED_REFERER","REWARD_EARNED","REDEEM_PERK","AWARD_POINTS_REFUNDED","AWARD_POINTS_RESET","MEMBER_ADDED","MEMBER_REMOVED","USER_CREATED","USER_CHANGED","USER_DELETED","USER_ACTIVATION_RESENT","USER_ACTIVATED","CREDENTIAL_VERIFIED","VOUCHER_REDEEMED","COUPON_REDEEMED","COUPON_REFUNDED","BOOKING_CREATED","BOOKING_CHANGED","BOOKING_COMPLETED","SUBSCRIPTION_STARTED","SUBSCRIPTION_PAYMENT_RECEIVED","SUBSCRIPTION_PAYMENT_FAILED","SUBSCRIPTION_CANCELLATION_REQUESTED","SUBSCRIPTION_CANCELLED"]}},"required":["type"]},{"type":"object","properties":{"type":{"type":"string","enum":["SPEND"]},"includeTips":{"type":"boolean"}},"required":["type"]},{"type":"object","properties":{"type":{"type":"string","enum":["POINTS_EARNED","POINTS_BURNED"]},"perkId":{"type":"string"}},"required":["type"]}]}]}},"_id":{"type":"string"},"tenantId":{"type":"string"},"effects":{"type":"array","items":{"allOf":[{"type":"object","properties":{"conditions":{"type":"array","items":{"anyOf":[{"type":"object","properties":{"metricId":{"type":"string"},"operator":{"type":"string","enum":["EQUAL","NOT_EQUAL","GREATER_THAN","LESS_THAN"]},"value":{"type":"number"}},"required":["metricId","operator","value"]},{"type":"object","properties":{"metricId":{"type":"string"},"operator":{"type":"string","enum":["IS_WITHIN_TOP_PERCENTAGE","IS_NOT_WITHIN_TOP_PERCENTAGE"]},"value":{"type":"number","minimum":1,"maximum":100}},"required":["metricId","operator","value"]},{"type":"object","properties":{"userProperty":{"type":"string","enum":["hasAgreedToReceiveMarketing","hasAgreedToShareData"]},"operator":{"type":"string","enum":["EQUAL","NOT_EQUAL"]},"value":{"type":"boolean"}},"required":["userProperty","operator","value"]},{"type":"object","properties":{"userProperty":{"type":"string","enum":["primaryPlatform"]},"operator":{"type":"string","enum":["EQUAL","NOT_EQUAL"]},"value":{"type":"string","enum":["UNKNOWN","IOS","ANDROID","WEB"]}},"required":["userProperty","operator","value"]},{"type":"object","properties":{"userProperty":{"type":"string","enum":["created","birthdate"]},"datePart":{"type":"string","enum":["year","month","dayOfYear","dayOfMonth"]},"operator":{"type":"string","enum":["EQUAL","NOT_EQUAL","GREATER_THAN","LESS_THAN"]},"value":{"anyOf":[{"type":"string","format":"date-time"},{"type":"number"},{"type":"string"}]}},"required":["userProperty","operator","value"]},{"type":"object","properties":{"userProperty":{"type":"string","enum":["gender"]},"operator":{"type":"string","enum":["EQUAL","NOT_EQUAL"]},"value":{"type":"string","enum":["MALE","FEMALE"]}},"required":["userProperty","operator","value"]},{"type":"object","properties":{"userProperty":{"type":"string","enum":["favouriteLocations"]},"operator":{"type":"string","enum":["CONTAINS","NOT_CONTAINS"]},"value":{"type":"string"}},"required":["userProperty","operator","value"]},{"type":"object","properties":{"operator":{"type":"string","enum":["IS_IN_SEGMENT","IS_NOT_IN_SEGMENT"]},"value":{"type":"string"}},"required":["operator","value"]}]}}}},{"anyOf":[{"type":"object","properties":{"type":{"type":"string","enum":["ADD_TO_SEGMENT","REMOVE_FROM_SEGMENT"]},"segmentId":{"type":"string"}},"required":["type","segmentId"]},{"type":"object","properties":{"type":{"type":"string","enum":["TRIGGER_NOTIFICATION"]},"message":{"type":"string"},"isProcessingMessage":{"type":"boolean"},"counter":{"type":"object","properties":{"max":{"type":"number"},"resetsAfterMins":{"type":"number"}},"required":["max"]}},"required":["type","message","isProcessingMessage","counter"]},{"type":"object","properties":{"type":{"type":"string","enum":["TRIGGER_SMS"]},"message":{"type":"string"},"isProcessingMessage":{"type":"boolean"},"counter":{"type":"object","properties":{"max":{"type":"number"},"resetsAfterMins":{"type":"number"}},"required":["max"]}},"required":["type","message","isProcessingMessage","counter"]},{"type":"object","properties":{"type":{"type":"string","enum":["TRIGGER_EMAIL"]},"subject":{"type":"string"},"body":{"type":"string"},"bodyMarkupLanguage":{"type":"string","enum":["HTML","MJML"]},"isProcessingMessage":{"type":"boolean"},"counter":{"type":"object","properties":{"max":{"type":"number"},"resetsAfterMins":{"type":"number"}},"required":["max"]}},"required":["type","subject","body","isProcessingMessage","counter"]},{"type":"object","properties":{"type":{"type":"string","enum":["GRANT_PERK","REVOKE_PERK"]},"perkId":{"type":"string"},"points":{"type":"number"},"counter":{"type":"object","properties":{"max":{"type":"number"},"resetsAfterMins":{"type":"number"}},"required":["max"]}},"required":["type","perkId","counter"]}]},{"type":"object","properties":{"_id":{"type":"string"},"conditions":{"type":"array","items":{"allOf":[{"anyOf":[{"type":"object","properties":{"metricId":{"type":"string"},"operator":{"type":"string","enum":["EQUAL","NOT_EQUAL","GREATER_THAN","LESS_THAN"]},"value":{"type":"number"}},"required":["metricId","operator","value"]},{"type":"object","properties":{"metricId":{"type":"string"},"operator":{"type":"string","enum":["IS_WITHIN_TOP_PERCENTAGE","IS_NOT_WITHIN_TOP_PERCENTAGE"]},"value":{"type":"number","minimum":1,"maximum":100}},"required":["metricId","operator","value"]},{"type":"object","properties":{"userProperty":{"type":"string","enum":["hasAgreedToReceiveMarketing","hasAgreedToShareData"]},"operator":{"type":"string","enum":["EQUAL","NOT_EQUAL"]},"value":{"type":"boolean"}},"required":["userProperty","operator","value"]},{"type":"object","properties":{"userProperty":{"type":"string","enum":["primaryPlatform"]},"operator":{"type":"string","enum":["EQUAL","NOT_EQUAL"]},"value":{"type":"string","enum":["UNKNOWN","IOS","ANDROID","WEB"]}},"required":["userProperty","operator","value"]},{"type":"object","properties":{"userProperty":{"type":"string","enum":["created","birthdate"]},"datePart":{"type":"string","enum":["year","month","dayOfYear","dayOfMonth"]},"operator":{"type":"string","enum":["EQUAL","NOT_EQUAL","GREATER_THAN","LESS_THAN"]},"value":{"anyOf":[{"type":"string","format":"date-time"},{"type":"number"},{"type":"string"}]}},"required":["userProperty","operator","value"]},{"type":"object","properties":{"userProperty":{"type":"string","enum":["gender"]},"operator":{"type":"string","enum":["EQUAL","NOT_EQUAL"]},"value":{"type":"string","enum":["MALE","FEMALE"]}},"required":["userProperty","operator","value"]},{"type":"object","properties":{"userProperty":{"type":"string","enum":["favouriteLocations"]},"operator":{"type":"string","enum":["CONTAINS","NOT_CONTAINS"]},"value":{"type":"string"}},"required":["userProperty","operator","value"]},{"type":"object","properties":{"operator":{"type":"string","enum":["IS_IN_SEGMENT","IS_NOT_IN_SEGMENT"]},"value":{"type":"string"}},"required":["operator","value"]}]},{"type":"object","properties":{"_id":{"type":"string"}},"required":["_id"]}]}}},"required":["_id"]}]}}},"required":["scheduled","realtime","name","displayName","_id","tenantId","effects"]}}}},"400":{"description":"Invalid request.  The request cannot be processed","content":{"application/json":{"schema":{"$ref":"#/components/responses/BadRequestError/content/application~1json/schema"}}}},"401":{"description":"Access denied","content":{"application/json":{"schema":{"$ref":"#/components/responses/BadRequestError/content/application~1json/schema"}}}},"404":{"description":"Resource not found","content":{"application/json":{"schema":{"$ref":"#/components/responses/BadRequestError/content/application~1json/schema"}}}},"422":{"description":"Unprocessable request.  The request cannot be processed","content":{"application/json":{"schema":{"$ref":"#/components/responses/BadRequestError/content/application~1json/schema"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/responses/BadRequestError/content/application~1json/schema"}}}}}},"get":{"tags":["Metrics - User"],"description":"Get a user metric definition by id","parameters":[{"schema":{"type":"string"},"required":true,"name":"definitionId","in":"path"}],"responses":{"201":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"scheduled":{"type":"boolean"},"realtime":{"type":"boolean"},"name":{"type":"string"},"displayName":{"type":"string"},"tags":{"type":"array","items":{"type":"string"}},"recomputeOn":{"type":"array","items":{"type":"string","enum":["NOOP","CARD_CREATED","CARD_DELETED","CHECKIN","USER_CREDITED","GIFT_CARD_TOPUP","GIFT_CARD_ACTIVATED","ORDER_CREATED","ORDER_ITEMS_ADDED","ORDER_USER_JOINED","ORDER_PAYMENT_RECEIVED","ORDER_PAYMENT_REFUNDED","ORDER_COMPLETED","ORDER_USER_BILLED","REFERAL_CLAIMED_REFEREE","REFERAL_CLAIMED_REFERER","REWARD_EARNED","REDEEM_PERK","AWARD_POINTS_REFUNDED","AWARD_POINTS_RESET","MEMBER_ADDED","MEMBER_REMOVED","USER_CREATED","USER_CHANGED","USER_DELETED","USER_ACTIVATION_RESENT","USER_ACTIVATED","CREDENTIAL_VERIFIED","VOUCHER_REDEEMED","COUPON_REDEEMED","COUPON_REFUNDED","BOOKING_CREATED","BOOKING_CHANGED","BOOKING_COMPLETED","SUBSCRIPTION_STARTED","SUBSCRIPTION_PAYMENT_RECEIVED","SUBSCRIPTION_PAYMENT_FAILED","SUBSCRIPTION_CANCELLATION_REQUESTED","SUBSCRIPTION_CANCELLED"]}},"query":{"type":"object","properties":{"created":{"anyOf":[{"type":"object","properties":{"or":{"type":"array","items":{"anyOf":[{"type":"string","format":"date-time"},{"type":"object","properties":{"year":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]},"month":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]},"dayOfMonth":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]},"dayOfYear":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]}}},{"type":"object","properties":{"eq":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"gte":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"lte":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"gt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"lt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]}},"additionalProperties":false}]}}},"required":["or"]},{"type":"string","format":"date-time"},{"type":"object","properties":{"year":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]},"month":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]},"dayOfMonth":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]},"dayOfYear":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]}}},{"type":"object","properties":{"eq":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"gte":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"lte":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"gt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"lt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]}},"additionalProperties":false}]},"birthdate":{"anyOf":[{"type":"object","properties":{"or":{"type":"array","items":{"anyOf":[{"type":"string","format":"date-time"},{"type":"object","properties":{"year":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]},"month":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]},"dayOfMonth":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]},"dayOfYear":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]}}},{"type":"object","properties":{"eq":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"gte":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"lte":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"gt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"lt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]}},"additionalProperties":false}]}}},"required":["or"]},{"type":"string","format":"date-time"},{"type":"object","properties":{"year":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]},"month":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]},"dayOfMonth":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]},"dayOfYear":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]}}},{"type":"object","properties":{"eq":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"gte":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"lte":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"gt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"lt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]}},"additionalProperties":false}]},"hasAgreedToReceiveMarketing":{"type":"boolean"},"hasAgreedToShareData":{"type":"boolean"},"primaryPlatform":{"type":"string","enum":["UNKNOWN","IOS","ANDROID","WEB"]},"gender":{"type":"string","enum":["MALE","FEMALE"]},"favouriteLocations":{"type":"object","properties":{"in":{"type":"array","items":{"type":"string"}}}}}},"metrics":{"type":"object","additionalProperties":{"allOf":[{"type":"object","properties":{"name":{"type":"string"},"displayName":{"type":"string"},"timeRange":{"anyOf":[{"type":"object","properties":{"windowStartOffsetMins":{"type":"number","minimum":0,"maximum":527040},"windowEndOffsetMins":{"type":"number","minimum":0,"maximum":527040},"gt":{"type":"string","format":"date-time"},"lt":{"type":"string","format":"date-time"}},"required":["windowStartOffsetMins"]},{"type":"object","properties":{"gt":{"type":"string","format":"date-time"},"lt":{"type":"string","format":"date-time"}},"required":["gt"]},{"type":"string","enum":["Today","Yesterday","WeekToDate","LastWeek","MonthToDate","LastMonth","QuarterToDate","LastQuarter","YearToDate","LastYear"]}]}},"required":["name","displayName","timeRange"]},{"anyOf":[{"type":"object","properties":{"type":{"type":"string","enum":["TIPS_GIVEN","NOOP","CARD_CREATED","CARD_DELETED","CHECKIN","USER_CREDITED","GIFT_CARD_TOPUP","GIFT_CARD_ACTIVATED","ORDER_CREATED","ORDER_ITEMS_ADDED","ORDER_USER_JOINED","ORDER_PAYMENT_RECEIVED","ORDER_PAYMENT_REFUNDED","ORDER_COMPLETED","ORDER_USER_BILLED","REFERAL_CLAIMED_REFEREE","REFERAL_CLAIMED_REFERER","REWARD_EARNED","REDEEM_PERK","AWARD_POINTS_REFUNDED","AWARD_POINTS_RESET","MEMBER_ADDED","MEMBER_REMOVED","USER_CREATED","USER_CHANGED","USER_DELETED","USER_ACTIVATION_RESENT","USER_ACTIVATED","CREDENTIAL_VERIFIED","VOUCHER_REDEEMED","COUPON_REDEEMED","COUPON_REFUNDED","BOOKING_CREATED","BOOKING_CHANGED","BOOKING_COMPLETED","SUBSCRIPTION_STARTED","SUBSCRIPTION_PAYMENT_RECEIVED","SUBSCRIPTION_PAYMENT_FAILED","SUBSCRIPTION_CANCELLATION_REQUESTED","SUBSCRIPTION_CANCELLED"]}},"required":["type"]},{"type":"object","properties":{"type":{"type":"string","enum":["SPEND"]},"includeTips":{"type":"boolean"}},"required":["type"]},{"type":"object","properties":{"type":{"type":"string","enum":["POINTS_EARNED","POINTS_BURNED"]},"perkId":{"type":"string"}},"required":["type"]}]}]}},"_id":{"type":"string"},"tenantId":{"type":"string"},"effects":{"type":"array","items":{"allOf":[{"type":"object","properties":{"conditions":{"type":"array","items":{"anyOf":[{"type":"object","properties":{"metricId":{"type":"string"},"operator":{"type":"string","enum":["EQUAL","NOT_EQUAL","GREATER_THAN","LESS_THAN"]},"value":{"type":"number"}},"required":["metricId","operator","value"]},{"type":"object","properties":{"metricId":{"type":"string"},"operator":{"type":"string","enum":["IS_WITHIN_TOP_PERCENTAGE","IS_NOT_WITHIN_TOP_PERCENTAGE"]},"value":{"type":"number","minimum":1,"maximum":100}},"required":["metricId","operator","value"]},{"type":"object","properties":{"userProperty":{"type":"string","enum":["hasAgreedToReceiveMarketing","hasAgreedToShareData"]},"operator":{"type":"string","enum":["EQUAL","NOT_EQUAL"]},"value":{"type":"boolean"}},"required":["userProperty","operator","value"]},{"type":"object","properties":{"userProperty":{"type":"string","enum":["primaryPlatform"]},"operator":{"type":"string","enum":["EQUAL","NOT_EQUAL"]},"value":{"type":"string","enum":["UNKNOWN","IOS","ANDROID","WEB"]}},"required":["userProperty","operator","value"]},{"type":"object","properties":{"userProperty":{"type":"string","enum":["created","birthdate"]},"datePart":{"type":"string","enum":["year","month","dayOfYear","dayOfMonth"]},"operator":{"type":"string","enum":["EQUAL","NOT_EQUAL","GREATER_THAN","LESS_THAN"]},"value":{"anyOf":[{"type":"string","format":"date-time"},{"type":"number"},{"type":"string"}]}},"required":["userProperty","operator","value"]},{"type":"object","properties":{"userProperty":{"type":"string","enum":["gender"]},"operator":{"type":"string","enum":["EQUAL","NOT_EQUAL"]},"value":{"type":"string","enum":["MALE","FEMALE"]}},"required":["userProperty","operator","value"]},{"type":"object","properties":{"userProperty":{"type":"string","enum":["favouriteLocations"]},"operator":{"type":"string","enum":["CONTAINS","NOT_CONTAINS"]},"value":{"type":"string"}},"required":["userProperty","operator","value"]},{"type":"object","properties":{"operator":{"type":"string","enum":["IS_IN_SEGMENT","IS_NOT_IN_SEGMENT"]},"value":{"type":"string"}},"required":["operator","value"]}]}}}},{"anyOf":[{"type":"object","properties":{"type":{"type":"string","enum":["ADD_TO_SEGMENT","REMOVE_FROM_SEGMENT"]},"segmentId":{"type":"string"}},"required":["type","segmentId"]},{"type":"object","properties":{"type":{"type":"string","enum":["TRIGGER_NOTIFICATION"]},"message":{"type":"string"},"isProcessingMessage":{"type":"boolean"},"counter":{"type":"object","properties":{"max":{"type":"number"},"resetsAfterMins":{"type":"number"}},"required":["max"]}},"required":["type","message","isProcessingMessage","counter"]},{"type":"object","properties":{"type":{"type":"string","enum":["TRIGGER_SMS"]},"message":{"type":"string"},"isProcessingMessage":{"type":"boolean"},"counter":{"type":"object","properties":{"max":{"type":"number"},"resetsAfterMins":{"type":"number"}},"required":["max"]}},"required":["type","message","isProcessingMessage","counter"]},{"type":"object","properties":{"type":{"type":"string","enum":["TRIGGER_EMAIL"]},"subject":{"type":"string"},"body":{"type":"string"},"bodyMarkupLanguage":{"type":"string","enum":["HTML","MJML"]},"isProcessingMessage":{"type":"boolean"},"counter":{"type":"object","properties":{"max":{"type":"number"},"resetsAfterMins":{"type":"number"}},"required":["max"]}},"required":["type","subject","body","isProcessingMessage","counter"]},{"type":"object","properties":{"type":{"type":"string","enum":["GRANT_PERK","REVOKE_PERK"]},"perkId":{"type":"string"},"points":{"type":"number"},"counter":{"type":"object","properties":{"max":{"type":"number"},"resetsAfterMins":{"type":"number"}},"required":["max"]}},"required":["type","perkId","counter"]}]},{"type":"object","properties":{"_id":{"type":"string"},"conditions":{"type":"array","items":{"allOf":[{"anyOf":[{"type":"object","properties":{"metricId":{"type":"string"},"operator":{"type":"string","enum":["EQUAL","NOT_EQUAL","GREATER_THAN","LESS_THAN"]},"value":{"type":"number"}},"required":["metricId","operator","value"]},{"type":"object","properties":{"metricId":{"type":"string"},"operator":{"type":"string","enum":["IS_WITHIN_TOP_PERCENTAGE","IS_NOT_WITHIN_TOP_PERCENTAGE"]},"value":{"type":"number","minimum":1,"maximum":100}},"required":["metricId","operator","value"]},{"type":"object","properties":{"userProperty":{"type":"string","enum":["hasAgreedToReceiveMarketing","hasAgreedToShareData"]},"operator":{"type":"string","enum":["EQUAL","NOT_EQUAL"]},"value":{"type":"boolean"}},"required":["userProperty","operator","value"]},{"type":"object","properties":{"userProperty":{"type":"string","enum":["primaryPlatform"]},"operator":{"type":"string","enum":["EQUAL","NOT_EQUAL"]},"value":{"type":"string","enum":["UNKNOWN","IOS","ANDROID","WEB"]}},"required":["userProperty","operator","value"]},{"type":"object","properties":{"userProperty":{"type":"string","enum":["created","birthdate"]},"datePart":{"type":"string","enum":["year","month","dayOfYear","dayOfMonth"]},"operator":{"type":"string","enum":["EQUAL","NOT_EQUAL","GREATER_THAN","LESS_THAN"]},"value":{"anyOf":[{"type":"string","format":"date-time"},{"type":"number"},{"type":"string"}]}},"required":["userProperty","operator","value"]},{"type":"object","properties":{"userProperty":{"type":"string","enum":["gender"]},"operator":{"type":"string","enum":["EQUAL","NOT_EQUAL"]},"value":{"type":"string","enum":["MALE","FEMALE"]}},"required":["userProperty","operator","value"]},{"type":"object","properties":{"userProperty":{"type":"string","enum":["favouriteLocations"]},"operator":{"type":"string","enum":["CONTAINS","NOT_CONTAINS"]},"value":{"type":"string"}},"required":["userProperty","operator","value"]},{"type":"object","properties":{"operator":{"type":"string","enum":["IS_IN_SEGMENT","IS_NOT_IN_SEGMENT"]},"value":{"type":"string"}},"required":["operator","value"]}]},{"type":"object","properties":{"_id":{"type":"string"}},"required":["_id"]}]}}},"required":["_id"]}]}},"id":{"type":"string"}},"required":["scheduled","realtime","name","displayName","_id","tenantId","effects","id"]}}}},"400":{"description":"Invalid request.  The request cannot be processed","content":{"application/json":{"schema":{"$ref":"#/components/responses/BadRequestError/content/application~1json/schema"}}}},"401":{"description":"Access denied","content":{"application/json":{"schema":{"$ref":"#/components/responses/BadRequestError/content/application~1json/schema"}}}},"404":{"description":"Resource not found","content":{"application/json":{"schema":{"$ref":"#/components/responses/BadRequestError/content/application~1json/schema"}}}},"422":{"description":"Unprocessable request.  The request cannot be processed","content":{"application/json":{"schema":{"$ref":"#/components/responses/BadRequestError/content/application~1json/schema"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/responses/BadRequestError/content/application~1json/schema"}}}}}},"delete":{"tags":["Metrics - User"],"description":"Delete a user metric definition","parameters":[{"schema":{"type":"string"},"required":true,"name":"definitionId","in":"path"}],"responses":{"200":{"description":"Success"},"400":{"description":"Invalid request.  The request cannot be processed","content":{"application/json":{"schema":{"$ref":"#/components/responses/BadRequestError/content/application~1json/schema"}}}},"401":{"description":"Access denied","content":{"application/json":{"schema":{"$ref":"#/components/responses/BadRequestError/content/application~1json/schema"}}}},"404":{"description":"Resource not found","content":{"application/json":{"schema":{"$ref":"#/components/responses/BadRequestError/content/application~1json/schema"}}}},"422":{"description":"Unprocessable request.  The request cannot be processed","content":{"application/json":{"schema":{"$ref":"#/components/responses/BadRequestError/content/application~1json/schema"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/responses/BadRequestError/content/application~1json/schema"}}}}}}},"/metrics/user/:definitionId/metrics/:metricId":{"post":{"tags":["Metrics - User"],"description":"Add a metric to a user metric definition","parameters":[{"schema":{"type":"string"},"required":true,"name":"definitionId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"metricId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"allOf":[{"type":"object","properties":{"name":{"type":"string"},"displayName":{"type":"string"},"timeRange":{"anyOf":[{"type":"object","properties":{"windowStartOffsetMins":{"type":"number","minimum":0,"maximum":527040},"windowEndOffsetMins":{"type":"number","minimum":0,"maximum":527040},"gt":{"type":"string","format":"date-time"},"lt":{"type":"string","format":"date-time"}},"required":["windowStartOffsetMins"]},{"type":"object","properties":{"gt":{"type":"string","format":"date-time"},"lt":{"type":"string","format":"date-time"}},"required":["gt"]},{"type":"string","enum":["Today","Yesterday","WeekToDate","LastWeek","MonthToDate","LastMonth","QuarterToDate","LastQuarter","YearToDate","LastYear"]}]}},"required":["name","displayName","timeRange"]},{"anyOf":[{"type":"object","properties":{"type":{"type":"string","enum":["TIPS_GIVEN","NOOP","CARD_CREATED","CARD_DELETED","CHECKIN","USER_CREDITED","GIFT_CARD_TOPUP","GIFT_CARD_ACTIVATED","ORDER_CREATED","ORDER_ITEMS_ADDED","ORDER_USER_JOINED","ORDER_PAYMENT_RECEIVED","ORDER_PAYMENT_REFUNDED","ORDER_COMPLETED","ORDER_USER_BILLED","REFERAL_CLAIMED_REFEREE","REFERAL_CLAIMED_REFERER","REWARD_EARNED","REDEEM_PERK","AWARD_POINTS_REFUNDED","AWARD_POINTS_RESET","MEMBER_ADDED","MEMBER_REMOVED","USER_CREATED","USER_CHANGED","USER_DELETED","USER_ACTIVATION_RESENT","USER_ACTIVATED","CREDENTIAL_VERIFIED","VOUCHER_REDEEMED","COUPON_REDEEMED","COUPON_REFUNDED","BOOKING_CREATED","BOOKING_CHANGED","BOOKING_COMPLETED","SUBSCRIPTION_STARTED","SUBSCRIPTION_PAYMENT_RECEIVED","SUBSCRIPTION_PAYMENT_FAILED","SUBSCRIPTION_CANCELLATION_REQUESTED","SUBSCRIPTION_CANCELLED"]}},"required":["type"]},{"type":"object","properties":{"type":{"type":"string","enum":["SPEND"]},"includeTips":{"type":"boolean"}},"required":["type"]},{"type":"object","properties":{"type":{"type":"string","enum":["POINTS_EARNED","POINTS_BURNED"]},"perkId":{"type":"string"}},"required":["type"]}]}]}}}},"responses":{"201":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"scheduled":{"type":"boolean"},"realtime":{"type":"boolean"},"name":{"type":"string"},"displayName":{"type":"string"},"tags":{"type":"array","items":{"type":"string"}},"recomputeOn":{"type":"array","items":{"type":"string","enum":["NOOP","CARD_CREATED","CARD_DELETED","CHECKIN","USER_CREDITED","GIFT_CARD_TOPUP","GIFT_CARD_ACTIVATED","ORDER_CREATED","ORDER_ITEMS_ADDED","ORDER_USER_JOINED","ORDER_PAYMENT_RECEIVED","ORDER_PAYMENT_REFUNDED","ORDER_COMPLETED","ORDER_USER_BILLED","REFERAL_CLAIMED_REFEREE","REFERAL_CLAIMED_REFERER","REWARD_EARNED","REDEEM_PERK","AWARD_POINTS_REFUNDED","AWARD_POINTS_RESET","MEMBER_ADDED","MEMBER_REMOVED","USER_CREATED","USER_CHANGED","USER_DELETED","USER_ACTIVATION_RESENT","USER_ACTIVATED","CREDENTIAL_VERIFIED","VOUCHER_REDEEMED","COUPON_REDEEMED","COUPON_REFUNDED","BOOKING_CREATED","BOOKING_CHANGED","BOOKING_COMPLETED","SUBSCRIPTION_STARTED","SUBSCRIPTION_PAYMENT_RECEIVED","SUBSCRIPTION_PAYMENT_FAILED","SUBSCRIPTION_CANCELLATION_REQUESTED","SUBSCRIPTION_CANCELLED"]}},"query":{"type":"object","properties":{"created":{"anyOf":[{"type":"object","properties":{"or":{"type":"array","items":{"anyOf":[{"type":"string","format":"date-time"},{"type":"object","properties":{"year":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]},"month":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]},"dayOfMonth":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]},"dayOfYear":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]}}},{"type":"object","properties":{"eq":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"gte":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"lte":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"gt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"lt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]}},"additionalProperties":false}]}}},"required":["or"]},{"type":"string","format":"date-time"},{"type":"object","properties":{"year":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]},"month":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]},"dayOfMonth":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]},"dayOfYear":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]}}},{"type":"object","properties":{"eq":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"gte":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"lte":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"gt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"lt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]}},"additionalProperties":false}]},"birthdate":{"anyOf":[{"type":"object","properties":{"or":{"type":"array","items":{"anyOf":[{"type":"string","format":"date-time"},{"type":"object","properties":{"year":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]},"month":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]},"dayOfMonth":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]},"dayOfYear":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]}}},{"type":"object","properties":{"eq":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"gte":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"lte":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"gt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"lt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]}},"additionalProperties":false}]}}},"required":["or"]},{"type":"string","format":"date-time"},{"type":"object","properties":{"year":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]},"month":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]},"dayOfMonth":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]},"dayOfYear":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]}}},{"type":"object","properties":{"eq":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"gte":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"lte":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"gt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"lt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]}},"additionalProperties":false}]},"hasAgreedToReceiveMarketing":{"type":"boolean"},"hasAgreedToShareData":{"type":"boolean"},"primaryPlatform":{"type":"string","enum":["UNKNOWN","IOS","ANDROID","WEB"]},"gender":{"type":"string","enum":["MALE","FEMALE"]},"favouriteLocations":{"type":"object","properties":{"in":{"type":"array","items":{"type":"string"}}}}}},"metrics":{"type":"object","additionalProperties":{"allOf":[{"type":"object","properties":{"name":{"type":"string"},"displayName":{"type":"string"},"timeRange":{"anyOf":[{"type":"object","properties":{"windowStartOffsetMins":{"type":"number","minimum":0,"maximum":527040},"windowEndOffsetMins":{"type":"number","minimum":0,"maximum":527040},"gt":{"type":"string","format":"date-time"},"lt":{"type":"string","format":"date-time"}},"required":["windowStartOffsetMins"]},{"type":"object","properties":{"gt":{"type":"string","format":"date-time"},"lt":{"type":"string","format":"date-time"}},"required":["gt"]},{"type":"string","enum":["Today","Yesterday","WeekToDate","LastWeek","MonthToDate","LastMonth","QuarterToDate","LastQuarter","YearToDate","LastYear"]}]}},"required":["name","displayName","timeRange"]},{"anyOf":[{"type":"object","properties":{"type":{"type":"string","enum":["TIPS_GIVEN","NOOP","CARD_CREATED","CARD_DELETED","CHECKIN","USER_CREDITED","GIFT_CARD_TOPUP","GIFT_CARD_ACTIVATED","ORDER_CREATED","ORDER_ITEMS_ADDED","ORDER_USER_JOINED","ORDER_PAYMENT_RECEIVED","ORDER_PAYMENT_REFUNDED","ORDER_COMPLETED","ORDER_USER_BILLED","REFERAL_CLAIMED_REFEREE","REFERAL_CLAIMED_REFERER","REWARD_EARNED","REDEEM_PERK","AWARD_POINTS_REFUNDED","AWARD_POINTS_RESET","MEMBER_ADDED","MEMBER_REMOVED","USER_CREATED","USER_CHANGED","USER_DELETED","USER_ACTIVATION_RESENT","USER_ACTIVATED","CREDENTIAL_VERIFIED","VOUCHER_REDEEMED","COUPON_REDEEMED","COUPON_REFUNDED","BOOKING_CREATED","BOOKING_CHANGED","BOOKING_COMPLETED","SUBSCRIPTION_STARTED","SUBSCRIPTION_PAYMENT_RECEIVED","SUBSCRIPTION_PAYMENT_FAILED","SUBSCRIPTION_CANCELLATION_REQUESTED","SUBSCRIPTION_CANCELLED"]}},"required":["type"]},{"type":"object","properties":{"type":{"type":"string","enum":["SPEND"]},"includeTips":{"type":"boolean"}},"required":["type"]},{"type":"object","properties":{"type":{"type":"string","enum":["POINTS_EARNED","POINTS_BURNED"]},"perkId":{"type":"string"}},"required":["type"]}]}]}},"_id":{"type":"string"},"tenantId":{"type":"string"},"effects":{"type":"array","items":{"allOf":[{"type":"object","properties":{"conditions":{"type":"array","items":{"anyOf":[{"type":"object","properties":{"metricId":{"type":"string"},"operator":{"type":"string","enum":["EQUAL","NOT_EQUAL","GREATER_THAN","LESS_THAN"]},"value":{"type":"number"}},"required":["metricId","operator","value"]},{"type":"object","properties":{"metricId":{"type":"string"},"operator":{"type":"string","enum":["IS_WITHIN_TOP_PERCENTAGE","IS_NOT_WITHIN_TOP_PERCENTAGE"]},"value":{"type":"number","minimum":1,"maximum":100}},"required":["metricId","operator","value"]},{"type":"object","properties":{"userProperty":{"type":"string","enum":["hasAgreedToReceiveMarketing","hasAgreedToShareData"]},"operator":{"type":"string","enum":["EQUAL","NOT_EQUAL"]},"value":{"type":"boolean"}},"required":["userProperty","operator","value"]},{"type":"object","properties":{"userProperty":{"type":"string","enum":["primaryPlatform"]},"operator":{"type":"string","enum":["EQUAL","NOT_EQUAL"]},"value":{"type":"string","enum":["UNKNOWN","IOS","ANDROID","WEB"]}},"required":["userProperty","operator","value"]},{"type":"object","properties":{"userProperty":{"type":"string","enum":["created","birthdate"]},"datePart":{"type":"string","enum":["year","month","dayOfYear","dayOfMonth"]},"operator":{"type":"string","enum":["EQUAL","NOT_EQUAL","GREATER_THAN","LESS_THAN"]},"value":{"anyOf":[{"type":"string","format":"date-time"},{"type":"number"},{"type":"string"}]}},"required":["userProperty","operator","value"]},{"type":"object","properties":{"userProperty":{"type":"string","enum":["gender"]},"operator":{"type":"string","enum":["EQUAL","NOT_EQUAL"]},"value":{"type":"string","enum":["MALE","FEMALE"]}},"required":["userProperty","operator","value"]},{"type":"object","properties":{"userProperty":{"type":"string","enum":["favouriteLocations"]},"operator":{"type":"string","enum":["CONTAINS","NOT_CONTAINS"]},"value":{"type":"string"}},"required":["userProperty","operator","value"]},{"type":"object","properties":{"operator":{"type":"string","enum":["IS_IN_SEGMENT","IS_NOT_IN_SEGMENT"]},"value":{"type":"string"}},"required":["operator","value"]}]}}}},{"anyOf":[{"type":"object","properties":{"type":{"type":"string","enum":["ADD_TO_SEGMENT","REMOVE_FROM_SEGMENT"]},"segmentId":{"type":"string"}},"required":["type","segmentId"]},{"type":"object","properties":{"type":{"type":"string","enum":["TRIGGER_NOTIFICATION"]},"message":{"type":"string"},"isProcessingMessage":{"type":"boolean"},"counter":{"type":"object","properties":{"max":{"type":"number"},"resetsAfterMins":{"type":"number"}},"required":["max"]}},"required":["type","message","isProcessingMessage","counter"]},{"type":"object","properties":{"type":{"type":"string","enum":["TRIGGER_SMS"]},"message":{"type":"string"},"isProcessingMessage":{"type":"boolean"},"counter":{"type":"object","properties":{"max":{"type":"number"},"resetsAfterMins":{"type":"number"}},"required":["max"]}},"required":["type","message","isProcessingMessage","counter"]},{"type":"object","properties":{"type":{"type":"string","enum":["TRIGGER_EMAIL"]},"subject":{"type":"string"},"body":{"type":"string"},"bodyMarkupLanguage":{"type":"string","enum":["HTML","MJML"]},"isProcessingMessage":{"type":"boolean"},"counter":{"type":"object","properties":{"max":{"type":"number"},"resetsAfterMins":{"type":"number"}},"required":["max"]}},"required":["type","subject","body","isProcessingMessage","counter"]},{"type":"object","properties":{"type":{"type":"string","enum":["GRANT_PERK","REVOKE_PERK"]},"perkId":{"type":"string"},"points":{"type":"number"},"counter":{"type":"object","properties":{"max":{"type":"number"},"resetsAfterMins":{"type":"number"}},"required":["max"]}},"required":["type","perkId","counter"]}]},{"type":"object","properties":{"_id":{"type":"string"},"conditions":{"type":"array","items":{"allOf":[{"anyOf":[{"type":"object","properties":{"metricId":{"type":"string"},"operator":{"type":"string","enum":["EQUAL","NOT_EQUAL","GREATER_THAN","LESS_THAN"]},"value":{"type":"number"}},"required":["metricId","operator","value"]},{"type":"object","properties":{"metricId":{"type":"string"},"operator":{"type":"string","enum":["IS_WITHIN_TOP_PERCENTAGE","IS_NOT_WITHIN_TOP_PERCENTAGE"]},"value":{"type":"number","minimum":1,"maximum":100}},"required":["metricId","operator","value"]},{"type":"object","properties":{"userProperty":{"type":"string","enum":["hasAgreedToReceiveMarketing","hasAgreedToShareData"]},"operator":{"type":"string","enum":["EQUAL","NOT_EQUAL"]},"value":{"type":"boolean"}},"required":["userProperty","operator","value"]},{"type":"object","properties":{"userProperty":{"type":"string","enum":["primaryPlatform"]},"operator":{"type":"string","enum":["EQUAL","NOT_EQUAL"]},"value":{"type":"string","enum":["UNKNOWN","IOS","ANDROID","WEB"]}},"required":["userProperty","operator","value"]},{"type":"object","properties":{"userProperty":{"type":"string","enum":["created","birthdate"]},"datePart":{"type":"string","enum":["year","month","dayOfYear","dayOfMonth"]},"operator":{"type":"string","enum":["EQUAL","NOT_EQUAL","GREATER_THAN","LESS_THAN"]},"value":{"anyOf":[{"type":"string","format":"date-time"},{"type":"number"},{"type":"string"}]}},"required":["userProperty","operator","value"]},{"type":"object","properties":{"userProperty":{"type":"string","enum":["gender"]},"operator":{"type":"string","enum":["EQUAL","NOT_EQUAL"]},"value":{"type":"string","enum":["MALE","FEMALE"]}},"required":["userProperty","operator","value"]},{"type":"object","properties":{"userProperty":{"type":"string","enum":["favouriteLocations"]},"operator":{"type":"string","enum":["CONTAINS","NOT_CONTAINS"]},"value":{"type":"string"}},"required":["userProperty","operator","value"]},{"type":"object","properties":{"operator":{"type":"string","enum":["IS_IN_SEGMENT","IS_NOT_IN_SEGMENT"]},"value":{"type":"string"}},"required":["operator","value"]}]},{"type":"object","properties":{"_id":{"type":"string"}},"required":["_id"]}]}}},"required":["_id"]}]}}},"required":["scheduled","realtime","name","displayName","_id","tenantId","effects"]}}}},"400":{"description":"Invalid request.  The request cannot be processed","content":{"application/json":{"schema":{"$ref":"#/components/responses/BadRequestError/content/application~1json/schema"}}}},"401":{"description":"Access denied","content":{"application/json":{"schema":{"$ref":"#/components/responses/BadRequestError/content/application~1json/schema"}}}},"404":{"description":"Resource not found","content":{"application/json":{"schema":{"$ref":"#/components/responses/BadRequestError/content/application~1json/schema"}}}},"422":{"description":"Unprocessable request.  The request cannot be processed","content":{"application/json":{"schema":{"$ref":"#/components/responses/BadRequestError/content/application~1json/schema"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/responses/BadRequestError/content/application~1json/schema"}}}}}},"delete":{"tags":["Metrics - User"],"description":"Delete a metric from a user metric definition","parameters":[{"schema":{"type":"string"},"required":true,"name":"definitionId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"metricId","in":"path"}],"responses":{"201":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"scheduled":{"type":"boolean"},"realtime":{"type":"boolean"},"name":{"type":"string"},"displayName":{"type":"string"},"tags":{"type":"array","items":{"type":"string"}},"recomputeOn":{"type":"array","items":{"type":"string","enum":["NOOP","CARD_CREATED","CARD_DELETED","CHECKIN","USER_CREDITED","GIFT_CARD_TOPUP","GIFT_CARD_ACTIVATED","ORDER_CREATED","ORDER_ITEMS_ADDED","ORDER_USER_JOINED","ORDER_PAYMENT_RECEIVED","ORDER_PAYMENT_REFUNDED","ORDER_COMPLETED","ORDER_USER_BILLED","REFERAL_CLAIMED_REFEREE","REFERAL_CLAIMED_REFERER","REWARD_EARNED","REDEEM_PERK","AWARD_POINTS_REFUNDED","AWARD_POINTS_RESET","MEMBER_ADDED","MEMBER_REMOVED","USER_CREATED","USER_CHANGED","USER_DELETED","USER_ACTIVATION_RESENT","USER_ACTIVATED","CREDENTIAL_VERIFIED","VOUCHER_REDEEMED","COUPON_REDEEMED","COUPON_REFUNDED","BOOKING_CREATED","BOOKING_CHANGED","BOOKING_COMPLETED","SUBSCRIPTION_STARTED","SUBSCRIPTION_PAYMENT_RECEIVED","SUBSCRIPTION_PAYMENT_FAILED","SUBSCRIPTION_CANCELLATION_REQUESTED","SUBSCRIPTION_CANCELLED"]}},"query":{"type":"object","properties":{"created":{"anyOf":[{"type":"object","properties":{"or":{"type":"array","items":{"anyOf":[{"type":"string","format":"date-time"},{"type":"object","properties":{"year":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]},"month":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]},"dayOfMonth":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]},"dayOfYear":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]}}},{"type":"object","properties":{"eq":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"gte":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"lte":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"gt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"lt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]}},"additionalProperties":false}]}}},"required":["or"]},{"type":"string","format":"date-time"},{"type":"object","properties":{"year":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]},"month":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]},"dayOfMonth":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]},"dayOfYear":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]}}},{"type":"object","properties":{"eq":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"gte":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"lte":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"gt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"lt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]}},"additionalProperties":false}]},"birthdate":{"anyOf":[{"type":"object","properties":{"or":{"type":"array","items":{"anyOf":[{"type":"string","format":"date-time"},{"type":"object","properties":{"year":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]},"month":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]},"dayOfMonth":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]},"dayOfYear":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]}}},{"type":"object","properties":{"eq":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"gte":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"lte":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"gt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"lt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]}},"additionalProperties":false}]}}},"required":["or"]},{"type":"string","format":"date-time"},{"type":"object","properties":{"year":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]},"month":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]},"dayOfMonth":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]},"dayOfYear":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]}}},{"type":"object","properties":{"eq":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"gte":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"lte":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"gt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"lt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]}},"additionalProperties":false}]},"hasAgreedToReceiveMarketing":{"type":"boolean"},"hasAgreedToShareData":{"type":"boolean"},"primaryPlatform":{"type":"string","enum":["UNKNOWN","IOS","ANDROID","WEB"]},"gender":{"type":"string","enum":["MALE","FEMALE"]},"favouriteLocations":{"type":"object","properties":{"in":{"type":"array","items":{"type":"string"}}}}}},"metrics":{"type":"object","additionalProperties":{"allOf":[{"type":"object","properties":{"name":{"type":"string"},"displayName":{"type":"string"},"timeRange":{"anyOf":[{"type":"object","properties":{"windowStartOffsetMins":{"type":"number","minimum":0,"maximum":527040},"windowEndOffsetMins":{"type":"number","minimum":0,"maximum":527040},"gt":{"type":"string","format":"date-time"},"lt":{"type":"string","format":"date-time"}},"required":["windowStartOffsetMins"]},{"type":"object","properties":{"gt":{"type":"string","format":"date-time"},"lt":{"type":"string","format":"date-time"}},"required":["gt"]},{"type":"string","enum":["Today","Yesterday","WeekToDate","LastWeek","MonthToDate","LastMonth","QuarterToDate","LastQuarter","YearToDate","LastYear"]}]}},"required":["name","displayName","timeRange"]},{"anyOf":[{"type":"object","properties":{"type":{"type":"string","enum":["TIPS_GIVEN","NOOP","CARD_CREATED","CARD_DELETED","CHECKIN","USER_CREDITED","GIFT_CARD_TOPUP","GIFT_CARD_ACTIVATED","ORDER_CREATED","ORDER_ITEMS_ADDED","ORDER_USER_JOINED","ORDER_PAYMENT_RECEIVED","ORDER_PAYMENT_REFUNDED","ORDER_COMPLETED","ORDER_USER_BILLED","REFERAL_CLAIMED_REFEREE","REFERAL_CLAIMED_REFERER","REWARD_EARNED","REDEEM_PERK","AWARD_POINTS_REFUNDED","AWARD_POINTS_RESET","MEMBER_ADDED","MEMBER_REMOVED","USER_CREATED","USER_CHANGED","USER_DELETED","USER_ACTIVATION_RESENT","USER_ACTIVATED","CREDENTIAL_VERIFIED","VOUCHER_REDEEMED","COUPON_REDEEMED","COUPON_REFUNDED","BOOKING_CREATED","BOOKING_CHANGED","BOOKING_COMPLETED","SUBSCRIPTION_STARTED","SUBSCRIPTION_PAYMENT_RECEIVED","SUBSCRIPTION_PAYMENT_FAILED","SUBSCRIPTION_CANCELLATION_REQUESTED","SUBSCRIPTION_CANCELLED"]}},"required":["type"]},{"type":"object","properties":{"type":{"type":"string","enum":["SPEND"]},"includeTips":{"type":"boolean"}},"required":["type"]},{"type":"object","properties":{"type":{"type":"string","enum":["POINTS_EARNED","POINTS_BURNED"]},"perkId":{"type":"string"}},"required":["type"]}]}]}},"_id":{"type":"string"},"tenantId":{"type":"string"},"effects":{"type":"array","items":{"allOf":[{"type":"object","properties":{"conditions":{"type":"array","items":{"anyOf":[{"type":"object","properties":{"metricId":{"type":"string"},"operator":{"type":"string","enum":["EQUAL","NOT_EQUAL","GREATER_THAN","LESS_THAN"]},"value":{"type":"number"}},"required":["metricId","operator","value"]},{"type":"object","properties":{"metricId":{"type":"string"},"operator":{"type":"string","enum":["IS_WITHIN_TOP_PERCENTAGE","IS_NOT_WITHIN_TOP_PERCENTAGE"]},"value":{"type":"number","minimum":1,"maximum":100}},"required":["metricId","operator","value"]},{"type":"object","properties":{"userProperty":{"type":"string","enum":["hasAgreedToReceiveMarketing","hasAgreedToShareData"]},"operator":{"type":"string","enum":["EQUAL","NOT_EQUAL"]},"value":{"type":"boolean"}},"required":["userProperty","operator","value"]},{"type":"object","properties":{"userProperty":{"type":"string","enum":["primaryPlatform"]},"operator":{"type":"string","enum":["EQUAL","NOT_EQUAL"]},"value":{"type":"string","enum":["UNKNOWN","IOS","ANDROID","WEB"]}},"required":["userProperty","operator","value"]},{"type":"object","properties":{"userProperty":{"type":"string","enum":["created","birthdate"]},"datePart":{"type":"string","enum":["year","month","dayOfYear","dayOfMonth"]},"operator":{"type":"string","enum":["EQUAL","NOT_EQUAL","GREATER_THAN","LESS_THAN"]},"value":{"anyOf":[{"type":"string","format":"date-time"},{"type":"number"},{"type":"string"}]}},"required":["userProperty","operator","value"]},{"type":"object","properties":{"userProperty":{"type":"string","enum":["gender"]},"operator":{"type":"string","enum":["EQUAL","NOT_EQUAL"]},"value":{"type":"string","enum":["MALE","FEMALE"]}},"required":["userProperty","operator","value"]},{"type":"object","properties":{"userProperty":{"type":"string","enum":["favouriteLocations"]},"operator":{"type":"string","enum":["CONTAINS","NOT_CONTAINS"]},"value":{"type":"string"}},"required":["userProperty","operator","value"]},{"type":"object","properties":{"operator":{"type":"string","enum":["IS_IN_SEGMENT","IS_NOT_IN_SEGMENT"]},"value":{"type":"string"}},"required":["operator","value"]}]}}}},{"anyOf":[{"type":"object","properties":{"type":{"type":"string","enum":["ADD_TO_SEGMENT","REMOVE_FROM_SEGMENT"]},"segmentId":{"type":"string"}},"required":["type","segmentId"]},{"type":"object","properties":{"type":{"type":"string","enum":["TRIGGER_NOTIFICATION"]},"message":{"type":"string"},"isProcessingMessage":{"type":"boolean"},"counter":{"type":"object","properties":{"max":{"type":"number"},"resetsAfterMins":{"type":"number"}},"required":["max"]}},"required":["type","message","isProcessingMessage","counter"]},{"type":"object","properties":{"type":{"type":"string","enum":["TRIGGER_SMS"]},"message":{"type":"string"},"isProcessingMessage":{"type":"boolean"},"counter":{"type":"object","properties":{"max":{"type":"number"},"resetsAfterMins":{"type":"number"}},"required":["max"]}},"required":["type","message","isProcessingMessage","counter"]},{"type":"object","properties":{"type":{"type":"string","enum":["TRIGGER_EMAIL"]},"subject":{"type":"string"},"body":{"type":"string"},"bodyMarkupLanguage":{"type":"string","enum":["HTML","MJML"]},"isProcessingMessage":{"type":"boolean"},"counter":{"type":"object","properties":{"max":{"type":"number"},"resetsAfterMins":{"type":"number"}},"required":["max"]}},"required":["type","subject","body","isProcessingMessage","counter"]},{"type":"object","properties":{"type":{"type":"string","enum":["GRANT_PERK","REVOKE_PERK"]},"perkId":{"type":"string"},"points":{"type":"number"},"counter":{"type":"object","properties":{"max":{"type":"number"},"resetsAfterMins":{"type":"number"}},"required":["max"]}},"required":["type","perkId","counter"]}]},{"type":"object","properties":{"_id":{"type":"string"},"conditions":{"type":"array","items":{"allOf":[{"anyOf":[{"type":"object","properties":{"metricId":{"type":"string"},"operator":{"type":"string","enum":["EQUAL","NOT_EQUAL","GREATER_THAN","LESS_THAN"]},"value":{"type":"number"}},"required":["metricId","operator","value"]},{"type":"object","properties":{"metricId":{"type":"string"},"operator":{"type":"string","enum":["IS_WITHIN_TOP_PERCENTAGE","IS_NOT_WITHIN_TOP_PERCENTAGE"]},"value":{"type":"number","minimum":1,"maximum":100}},"required":["metricId","operator","value"]},{"type":"object","properties":{"userProperty":{"type":"string","enum":["hasAgreedToReceiveMarketing","hasAgreedToShareData"]},"operator":{"type":"string","enum":["EQUAL","NOT_EQUAL"]},"value":{"type":"boolean"}},"required":["userProperty","operator","value"]},{"type":"object","properties":{"userProperty":{"type":"string","enum":["primaryPlatform"]},"operator":{"type":"string","enum":["EQUAL","NOT_EQUAL"]},"value":{"type":"string","enum":["UNKNOWN","IOS","ANDROID","WEB"]}},"required":["userProperty","operator","value"]},{"type":"object","properties":{"userProperty":{"type":"string","enum":["created","birthdate"]},"datePart":{"type":"string","enum":["year","month","dayOfYear","dayOfMonth"]},"operator":{"type":"string","enum":["EQUAL","NOT_EQUAL","GREATER_THAN","LESS_THAN"]},"value":{"anyOf":[{"type":"string","format":"date-time"},{"type":"number"},{"type":"string"}]}},"required":["userProperty","operator","value"]},{"type":"object","properties":{"userProperty":{"type":"string","enum":["gender"]},"operator":{"type":"string","enum":["EQUAL","NOT_EQUAL"]},"value":{"type":"string","enum":["MALE","FEMALE"]}},"required":["userProperty","operator","value"]},{"type":"object","properties":{"userProperty":{"type":"string","enum":["favouriteLocations"]},"operator":{"type":"string","enum":["CONTAINS","NOT_CONTAINS"]},"value":{"type":"string"}},"required":["userProperty","operator","value"]},{"type":"object","properties":{"operator":{"type":"string","enum":["IS_IN_SEGMENT","IS_NOT_IN_SEGMENT"]},"value":{"type":"string"}},"required":["operator","value"]}]},{"type":"object","properties":{"_id":{"type":"string"}},"required":["_id"]}]}}},"required":["_id"]}]}}},"required":["scheduled","realtime","name","displayName","_id","tenantId","effects"]}}}},"400":{"description":"Invalid request.  The request cannot be processed","content":{"application/json":{"schema":{"$ref":"#/components/responses/BadRequestError/content/application~1json/schema"}}}},"401":{"description":"Access denied","content":{"application/json":{"schema":{"$ref":"#/components/responses/BadRequestError/content/application~1json/schema"}}}},"404":{"description":"Resource not found","content":{"application/json":{"schema":{"$ref":"#/components/responses/BadRequestError/content/application~1json/schema"}}}},"422":{"description":"Unprocessable request.  The request cannot be processed","content":{"application/json":{"schema":{"$ref":"#/components/responses/BadRequestError/content/application~1json/schema"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/responses/BadRequestError/content/application~1json/schema"}}}}}}},"/metrics/user/:definitionId/effects":{"post":{"tags":["Metrics - User"],"description":"Add an effect to a user metric definition","parameters":[{"schema":{"type":"string"},"required":true,"name":"definitionId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"allOf":[{"type":"object","properties":{"conditions":{"type":"array","items":{"anyOf":[{"type":"object","properties":{"metricId":{"type":"string"},"operator":{"type":"string","enum":["EQUAL","NOT_EQUAL","GREATER_THAN","LESS_THAN"]},"value":{"type":"number"}},"required":["metricId","operator","value"]},{"type":"object","properties":{"metricId":{"type":"string"},"operator":{"type":"string","enum":["IS_WITHIN_TOP_PERCENTAGE","IS_NOT_WITHIN_TOP_PERCENTAGE"]},"value":{"type":"number","minimum":1,"maximum":100}},"required":["metricId","operator","value"]},{"type":"object","properties":{"userProperty":{"type":"string","enum":["hasAgreedToReceiveMarketing","hasAgreedToShareData"]},"operator":{"type":"string","enum":["EQUAL","NOT_EQUAL"]},"value":{"type":"boolean"}},"required":["userProperty","operator","value"]},{"type":"object","properties":{"userProperty":{"type":"string","enum":["primaryPlatform"]},"operator":{"type":"string","enum":["EQUAL","NOT_EQUAL"]},"value":{"type":"string","enum":["UNKNOWN","IOS","ANDROID","WEB"]}},"required":["userProperty","operator","value"]},{"type":"object","properties":{"userProperty":{"type":"string","enum":["created","birthdate"]},"datePart":{"type":"string","enum":["year","month","dayOfYear","dayOfMonth"]},"operator":{"type":"string","enum":["EQUAL","NOT_EQUAL","GREATER_THAN","LESS_THAN"]},"value":{"anyOf":[{"type":"string","format":"date-time"},{"type":"number"},{"type":"string"}]}},"required":["userProperty","operator","value"]},{"type":"object","properties":{"userProperty":{"type":"string","enum":["gender"]},"operator":{"type":"string","enum":["EQUAL","NOT_EQUAL"]},"value":{"type":"string","enum":["MALE","FEMALE"]}},"required":["userProperty","operator","value"]},{"type":"object","properties":{"userProperty":{"type":"string","enum":["favouriteLocations"]},"operator":{"type":"string","enum":["CONTAINS","NOT_CONTAINS"]},"value":{"type":"string"}},"required":["userProperty","operator","value"]},{"type":"object","properties":{"operator":{"type":"string","enum":["IS_IN_SEGMENT","IS_NOT_IN_SEGMENT"]},"value":{"type":"string"}},"required":["operator","value"]}]}}}},{"anyOf":[{"type":"object","properties":{"type":{"type":"string","enum":["ADD_TO_SEGMENT","REMOVE_FROM_SEGMENT"]},"segmentId":{"type":"string"}},"required":["type","segmentId"]},{"type":"object","properties":{"type":{"type":"string","enum":["TRIGGER_NOTIFICATION"]},"message":{"type":"string"},"isProcessingMessage":{"type":"boolean"},"counter":{"type":"object","properties":{"max":{"type":"number"},"resetsAfterMins":{"type":"number"}},"required":["max"]}},"required":["type","message","isProcessingMessage","counter"]},{"type":"object","properties":{"type":{"type":"string","enum":["TRIGGER_SMS"]},"message":{"type":"string"},"isProcessingMessage":{"type":"boolean"},"counter":{"type":"object","properties":{"max":{"type":"number"},"resetsAfterMins":{"type":"number"}},"required":["max"]}},"required":["type","message","isProcessingMessage","counter"]},{"type":"object","properties":{"type":{"type":"string","enum":["TRIGGER_EMAIL"]},"subject":{"type":"string"},"body":{"type":"string"},"bodyMarkupLanguage":{"type":"string","enum":["HTML","MJML"]},"isProcessingMessage":{"type":"boolean"},"counter":{"type":"object","properties":{"max":{"type":"number"},"resetsAfterMins":{"type":"number"}},"required":["max"]}},"required":["type","subject","body","isProcessingMessage","counter"]},{"type":"object","properties":{"type":{"type":"string","enum":["GRANT_PERK","REVOKE_PERK"]},"perkId":{"type":"string"},"points":{"type":"number"},"counter":{"type":"object","properties":{"max":{"type":"number"},"resetsAfterMins":{"type":"number"}},"required":["max"]}},"required":["type","perkId","counter"]}]}]}}}},"responses":{"201":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"scheduled":{"type":"boolean"},"realtime":{"type":"boolean"},"name":{"type":"string"},"displayName":{"type":"string"},"tags":{"type":"array","items":{"type":"string"}},"recomputeOn":{"type":"array","items":{"type":"string","enum":["NOOP","CARD_CREATED","CARD_DELETED","CHECKIN","USER_CREDITED","GIFT_CARD_TOPUP","GIFT_CARD_ACTIVATED","ORDER_CREATED","ORDER_ITEMS_ADDED","ORDER_USER_JOINED","ORDER_PAYMENT_RECEIVED","ORDER_PAYMENT_REFUNDED","ORDER_COMPLETED","ORDER_USER_BILLED","REFERAL_CLAIMED_REFEREE","REFERAL_CLAIMED_REFERER","REWARD_EARNED","REDEEM_PERK","AWARD_POINTS_REFUNDED","AWARD_POINTS_RESET","MEMBER_ADDED","MEMBER_REMOVED","USER_CREATED","USER_CHANGED","USER_DELETED","USER_ACTIVATION_RESENT","USER_ACTIVATED","CREDENTIAL_VERIFIED","VOUCHER_REDEEMED","COUPON_REDEEMED","COUPON_REFUNDED","BOOKING_CREATED","BOOKING_CHANGED","BOOKING_COMPLETED","SUBSCRIPTION_STARTED","SUBSCRIPTION_PAYMENT_RECEIVED","SUBSCRIPTION_PAYMENT_FAILED","SUBSCRIPTION_CANCELLATION_REQUESTED","SUBSCRIPTION_CANCELLED"]}},"query":{"type":"object","properties":{"created":{"anyOf":[{"type":"object","properties":{"or":{"type":"array","items":{"anyOf":[{"type":"string","format":"date-time"},{"type":"object","properties":{"year":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]},"month":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]},"dayOfMonth":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]},"dayOfYear":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]}}},{"type":"object","properties":{"eq":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"gte":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"lte":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"gt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"lt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]}},"additionalProperties":false}]}}},"required":["or"]},{"type":"string","format":"date-time"},{"type":"object","properties":{"year":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]},"month":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]},"dayOfMonth":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]},"dayOfYear":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]}}},{"type":"object","properties":{"eq":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"gte":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"lte":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"gt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"lt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]}},"additionalProperties":false}]},"birthdate":{"anyOf":[{"type":"object","properties":{"or":{"type":"array","items":{"anyOf":[{"type":"string","format":"date-time"},{"type":"object","properties":{"year":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]},"month":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]},"dayOfMonth":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]},"dayOfYear":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]}}},{"type":"object","properties":{"eq":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"gte":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"lte":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"gt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"lt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]}},"additionalProperties":false}]}}},"required":["or"]},{"type":"string","format":"date-time"},{"type":"object","properties":{"year":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]},"month":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]},"dayOfMonth":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]},"dayOfYear":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]}}},{"type":"object","properties":{"eq":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"gte":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"lte":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"gt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"lt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]}},"additionalProperties":false}]},"hasAgreedToReceiveMarketing":{"type":"boolean"},"hasAgreedToShareData":{"type":"boolean"},"primaryPlatform":{"type":"string","enum":["UNKNOWN","IOS","ANDROID","WEB"]},"gender":{"type":"string","enum":["MALE","FEMALE"]},"favouriteLocations":{"type":"object","properties":{"in":{"type":"array","items":{"type":"string"}}}}}},"metrics":{"type":"object","additionalProperties":{"allOf":[{"type":"object","properties":{"name":{"type":"string"},"displayName":{"type":"string"},"timeRange":{"anyOf":[{"type":"object","properties":{"windowStartOffsetMins":{"type":"number","minimum":0,"maximum":527040},"windowEndOffsetMins":{"type":"number","minimum":0,"maximum":527040},"gt":{"type":"string","format":"date-time"},"lt":{"type":"string","format":"date-time"}},"required":["windowStartOffsetMins"]},{"type":"object","properties":{"gt":{"type":"string","format":"date-time"},"lt":{"type":"string","format":"date-time"}},"required":["gt"]},{"type":"string","enum":["Today","Yesterday","WeekToDate","LastWeek","MonthToDate","LastMonth","QuarterToDate","LastQuarter","YearToDate","LastYear"]}]}},"required":["name","displayName","timeRange"]},{"anyOf":[{"type":"object","properties":{"type":{"type":"string","enum":["TIPS_GIVEN","NOOP","CARD_CREATED","CARD_DELETED","CHECKIN","USER_CREDITED","GIFT_CARD_TOPUP","GIFT_CARD_ACTIVATED","ORDER_CREATED","ORDER_ITEMS_ADDED","ORDER_USER_JOINED","ORDER_PAYMENT_RECEIVED","ORDER_PAYMENT_REFUNDED","ORDER_COMPLETED","ORDER_USER_BILLED","REFERAL_CLAIMED_REFEREE","REFERAL_CLAIMED_REFERER","REWARD_EARNED","REDEEM_PERK","AWARD_POINTS_REFUNDED","AWARD_POINTS_RESET","MEMBER_ADDED","MEMBER_REMOVED","USER_CREATED","USER_CHANGED","USER_DELETED","USER_ACTIVATION_RESENT","USER_ACTIVATED","CREDENTIAL_VERIFIED","VOUCHER_REDEEMED","COUPON_REDEEMED","COUPON_REFUNDED","BOOKING_CREATED","BOOKING_CHANGED","BOOKING_COMPLETED","SUBSCRIPTION_STARTED","SUBSCRIPTION_PAYMENT_RECEIVED","SUBSCRIPTION_PAYMENT_FAILED","SUBSCRIPTION_CANCELLATION_REQUESTED","SUBSCRIPTION_CANCELLED"]}},"required":["type"]},{"type":"object","properties":{"type":{"type":"string","enum":["SPEND"]},"includeTips":{"type":"boolean"}},"required":["type"]},{"type":"object","properties":{"type":{"type":"string","enum":["POINTS_EARNED","POINTS_BURNED"]},"perkId":{"type":"string"}},"required":["type"]}]}]}},"_id":{"type":"string"},"tenantId":{"type":"string"},"effects":{"type":"array","items":{"allOf":[{"type":"object","properties":{"conditions":{"type":"array","items":{"anyOf":[{"type":"object","properties":{"metricId":{"type":"string"},"operator":{"type":"string","enum":["EQUAL","NOT_EQUAL","GREATER_THAN","LESS_THAN"]},"value":{"type":"number"}},"required":["metricId","operator","value"]},{"type":"object","properties":{"metricId":{"type":"string"},"operator":{"type":"string","enum":["IS_WITHIN_TOP_PERCENTAGE","IS_NOT_WITHIN_TOP_PERCENTAGE"]},"value":{"type":"number","minimum":1,"maximum":100}},"required":["metricId","operator","value"]},{"type":"object","properties":{"userProperty":{"type":"string","enum":["hasAgreedToReceiveMarketing","hasAgreedToShareData"]},"operator":{"type":"string","enum":["EQUAL","NOT_EQUAL"]},"value":{"type":"boolean"}},"required":["userProperty","operator","value"]},{"type":"object","properties":{"userProperty":{"type":"string","enum":["primaryPlatform"]},"operator":{"type":"string","enum":["EQUAL","NOT_EQUAL"]},"value":{"type":"string","enum":["UNKNOWN","IOS","ANDROID","WEB"]}},"required":["userProperty","operator","value"]},{"type":"object","properties":{"userProperty":{"type":"string","enum":["created","birthdate"]},"datePart":{"type":"string","enum":["year","month","dayOfYear","dayOfMonth"]},"operator":{"type":"string","enum":["EQUAL","NOT_EQUAL","GREATER_THAN","LESS_THAN"]},"value":{"anyOf":[{"type":"string","format":"date-time"},{"type":"number"},{"type":"string"}]}},"required":["userProperty","operator","value"]},{"type":"object","properties":{"userProperty":{"type":"string","enum":["gender"]},"operator":{"type":"string","enum":["EQUAL","NOT_EQUAL"]},"value":{"type":"string","enum":["MALE","FEMALE"]}},"required":["userProperty","operator","value"]},{"type":"object","properties":{"userProperty":{"type":"string","enum":["favouriteLocations"]},"operator":{"type":"string","enum":["CONTAINS","NOT_CONTAINS"]},"value":{"type":"string"}},"required":["userProperty","operator","value"]},{"type":"object","properties":{"operator":{"type":"string","enum":["IS_IN_SEGMENT","IS_NOT_IN_SEGMENT"]},"value":{"type":"string"}},"required":["operator","value"]}]}}}},{"anyOf":[{"type":"object","properties":{"type":{"type":"string","enum":["ADD_TO_SEGMENT","REMOVE_FROM_SEGMENT"]},"segmentId":{"type":"string"}},"required":["type","segmentId"]},{"type":"object","properties":{"type":{"type":"string","enum":["TRIGGER_NOTIFICATION"]},"message":{"type":"string"},"isProcessingMessage":{"type":"boolean"},"counter":{"type":"object","properties":{"max":{"type":"number"},"resetsAfterMins":{"type":"number"}},"required":["max"]}},"required":["type","message","isProcessingMessage","counter"]},{"type":"object","properties":{"type":{"type":"string","enum":["TRIGGER_SMS"]},"message":{"type":"string"},"isProcessingMessage":{"type":"boolean"},"counter":{"type":"object","properties":{"max":{"type":"number"},"resetsAfterMins":{"type":"number"}},"required":["max"]}},"required":["type","message","isProcessingMessage","counter"]},{"type":"object","properties":{"type":{"type":"string","enum":["TRIGGER_EMAIL"]},"subject":{"type":"string"},"body":{"type":"string"},"bodyMarkupLanguage":{"type":"string","enum":["HTML","MJML"]},"isProcessingMessage":{"type":"boolean"},"counter":{"type":"object","properties":{"max":{"type":"number"},"resetsAfterMins":{"type":"number"}},"required":["max"]}},"required":["type","subject","body","isProcessingMessage","counter"]},{"type":"object","properties":{"type":{"type":"string","enum":["GRANT_PERK","REVOKE_PERK"]},"perkId":{"type":"string"},"points":{"type":"number"},"counter":{"type":"object","properties":{"max":{"type":"number"},"resetsAfterMins":{"type":"number"}},"required":["max"]}},"required":["type","perkId","counter"]}]},{"type":"object","properties":{"_id":{"type":"string"},"conditions":{"type":"array","items":{"allOf":[{"anyOf":[{"type":"object","properties":{"metricId":{"type":"string"},"operator":{"type":"string","enum":["EQUAL","NOT_EQUAL","GREATER_THAN","LESS_THAN"]},"value":{"type":"number"}},"required":["metricId","operator","value"]},{"type":"object","properties":{"metricId":{"type":"string"},"operator":{"type":"string","enum":["IS_WITHIN_TOP_PERCENTAGE","IS_NOT_WITHIN_TOP_PERCENTAGE"]},"value":{"type":"number","minimum":1,"maximum":100}},"required":["metricId","operator","value"]},{"type":"object","properties":{"userProperty":{"type":"string","enum":["hasAgreedToReceiveMarketing","hasAgreedToShareData"]},"operator":{"type":"string","enum":["EQUAL","NOT_EQUAL"]},"value":{"type":"boolean"}},"required":["userProperty","operator","value"]},{"type":"object","properties":{"userProperty":{"type":"string","enum":["primaryPlatform"]},"operator":{"type":"string","enum":["EQUAL","NOT_EQUAL"]},"value":{"type":"string","enum":["UNKNOWN","IOS","ANDROID","WEB"]}},"required":["userProperty","operator","value"]},{"type":"object","properties":{"userProperty":{"type":"string","enum":["created","birthdate"]},"datePart":{"type":"string","enum":["year","month","dayOfYear","dayOfMonth"]},"operator":{"type":"string","enum":["EQUAL","NOT_EQUAL","GREATER_THAN","LESS_THAN"]},"value":{"anyOf":[{"type":"string","format":"date-time"},{"type":"number"},{"type":"string"}]}},"required":["userProperty","operator","value"]},{"type":"object","properties":{"userProperty":{"type":"string","enum":["gender"]},"operator":{"type":"string","enum":["EQUAL","NOT_EQUAL"]},"value":{"type":"string","enum":["MALE","FEMALE"]}},"required":["userProperty","operator","value"]},{"type":"object","properties":{"userProperty":{"type":"string","enum":["favouriteLocations"]},"operator":{"type":"string","enum":["CONTAINS","NOT_CONTAINS"]},"value":{"type":"string"}},"required":["userProperty","operator","value"]},{"type":"object","properties":{"operator":{"type":"string","enum":["IS_IN_SEGMENT","IS_NOT_IN_SEGMENT"]},"value":{"type":"string"}},"required":["operator","value"]}]},{"type":"object","properties":{"_id":{"type":"string"}},"required":["_id"]}]}}},"required":["_id"]}]}}},"required":["scheduled","realtime","name","displayName","_id","tenantId","effects"]}}}},"400":{"description":"Invalid request.  The request cannot be processed","content":{"application/json":{"schema":{"$ref":"#/components/responses/BadRequestError/content/application~1json/schema"}}}},"401":{"description":"Access denied","content":{"application/json":{"schema":{"$ref":"#/components/responses/BadRequestError/content/application~1json/schema"}}}},"404":{"description":"Resource not found","content":{"application/json":{"schema":{"$ref":"#/components/responses/BadRequestError/content/application~1json/schema"}}}},"422":{"description":"Unprocessable request.  The request cannot be processed","content":{"application/json":{"schema":{"$ref":"#/components/responses/BadRequestError/content/application~1json/schema"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/responses/BadRequestError/content/application~1json/schema"}}}}}}},"/metrics/user/:definitionId/effects/:effectId":{"delete":{"tags":["Metrics - User"],"description":"Delete an effect from a user metric definition","parameters":[{"schema":{"type":"string"},"required":true,"name":"definitionId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"effectId","in":"path"}],"responses":{"201":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"scheduled":{"type":"boolean"},"realtime":{"type":"boolean"},"name":{"type":"string"},"displayName":{"type":"string"},"tags":{"type":"array","items":{"type":"string"}},"recomputeOn":{"type":"array","items":{"type":"string","enum":["NOOP","CARD_CREATED","CARD_DELETED","CHECKIN","USER_CREDITED","GIFT_CARD_TOPUP","GIFT_CARD_ACTIVATED","ORDER_CREATED","ORDER_ITEMS_ADDED","ORDER_USER_JOINED","ORDER_PAYMENT_RECEIVED","ORDER_PAYMENT_REFUNDED","ORDER_COMPLETED","ORDER_USER_BILLED","REFERAL_CLAIMED_REFEREE","REFERAL_CLAIMED_REFERER","REWARD_EARNED","REDEEM_PERK","AWARD_POINTS_REFUNDED","AWARD_POINTS_RESET","MEMBER_ADDED","MEMBER_REMOVED","USER_CREATED","USER_CHANGED","USER_DELETED","USER_ACTIVATION_RESENT","USER_ACTIVATED","CREDENTIAL_VERIFIED","VOUCHER_REDEEMED","COUPON_REDEEMED","COUPON_REFUNDED","BOOKING_CREATED","BOOKING_CHANGED","BOOKING_COMPLETED","SUBSCRIPTION_STARTED","SUBSCRIPTION_PAYMENT_RECEIVED","SUBSCRIPTION_PAYMENT_FAILED","SUBSCRIPTION_CANCELLATION_REQUESTED","SUBSCRIPTION_CANCELLED"]}},"query":{"type":"object","properties":{"created":{"anyOf":[{"type":"object","properties":{"or":{"type":"array","items":{"anyOf":[{"type":"string","format":"date-time"},{"type":"object","properties":{"year":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]},"month":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]},"dayOfMonth":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]},"dayOfYear":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]}}},{"type":"object","properties":{"eq":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"gte":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"lte":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"gt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"lt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]}},"additionalProperties":false}]}}},"required":["or"]},{"type":"string","format":"date-time"},{"type":"object","properties":{"year":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]},"month":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]},"dayOfMonth":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]},"dayOfYear":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]}}},{"type":"object","properties":{"eq":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"gte":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"lte":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"gt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"lt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]}},"additionalProperties":false}]},"birthdate":{"anyOf":[{"type":"object","properties":{"or":{"type":"array","items":{"anyOf":[{"type":"string","format":"date-time"},{"type":"object","properties":{"year":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]},"month":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]},"dayOfMonth":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]},"dayOfYear":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]}}},{"type":"object","properties":{"eq":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"gte":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"lte":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"gt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"lt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]}},"additionalProperties":false}]}}},"required":["or"]},{"type":"string","format":"date-time"},{"type":"object","properties":{"year":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]},"month":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]},"dayOfMonth":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]},"dayOfYear":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]}}},{"type":"object","properties":{"eq":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"gte":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"lte":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"gt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"lt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]}},"additionalProperties":false}]},"hasAgreedToReceiveMarketing":{"type":"boolean"},"hasAgreedToShareData":{"type":"boolean"},"primaryPlatform":{"type":"string","enum":["UNKNOWN","IOS","ANDROID","WEB"]},"gender":{"type":"string","enum":["MALE","FEMALE"]},"favouriteLocations":{"type":"object","properties":{"in":{"type":"array","items":{"type":"string"}}}}}},"metrics":{"type":"object","additionalProperties":{"allOf":[{"type":"object","properties":{"name":{"type":"string"},"displayName":{"type":"string"},"timeRange":{"anyOf":[{"type":"object","properties":{"windowStartOffsetMins":{"type":"number","minimum":0,"maximum":527040},"windowEndOffsetMins":{"type":"number","minimum":0,"maximum":527040},"gt":{"type":"string","format":"date-time"},"lt":{"type":"string","format":"date-time"}},"required":["windowStartOffsetMins"]},{"type":"object","properties":{"gt":{"type":"string","format":"date-time"},"lt":{"type":"string","format":"date-time"}},"required":["gt"]},{"type":"string","enum":["Today","Yesterday","WeekToDate","LastWeek","MonthToDate","LastMonth","QuarterToDate","LastQuarter","YearToDate","LastYear"]}]}},"required":["name","displayName","timeRange"]},{"anyOf":[{"type":"object","properties":{"type":{"type":"string","enum":["TIPS_GIVEN","NOOP","CARD_CREATED","CARD_DELETED","CHECKIN","USER_CREDITED","GIFT_CARD_TOPUP","GIFT_CARD_ACTIVATED","ORDER_CREATED","ORDER_ITEMS_ADDED","ORDER_USER_JOINED","ORDER_PAYMENT_RECEIVED","ORDER_PAYMENT_REFUNDED","ORDER_COMPLETED","ORDER_USER_BILLED","REFERAL_CLAIMED_REFEREE","REFERAL_CLAIMED_REFERER","REWARD_EARNED","REDEEM_PERK","AWARD_POINTS_REFUNDED","AWARD_POINTS_RESET","MEMBER_ADDED","MEMBER_REMOVED","USER_CREATED","USER_CHANGED","USER_DELETED","USER_ACTIVATION_RESENT","USER_ACTIVATED","CREDENTIAL_VERIFIED","VOUCHER_REDEEMED","COUPON_REDEEMED","COUPON_REFUNDED","BOOKING_CREATED","BOOKING_CHANGED","BOOKING_COMPLETED","SUBSCRIPTION_STARTED","SUBSCRIPTION_PAYMENT_RECEIVED","SUBSCRIPTION_PAYMENT_FAILED","SUBSCRIPTION_CANCELLATION_REQUESTED","SUBSCRIPTION_CANCELLED"]}},"required":["type"]},{"type":"object","properties":{"type":{"type":"string","enum":["SPEND"]},"includeTips":{"type":"boolean"}},"required":["type"]},{"type":"object","properties":{"type":{"type":"string","enum":["POINTS_EARNED","POINTS_BURNED"]},"perkId":{"type":"string"}},"required":["type"]}]}]}},"_id":{"type":"string"},"tenantId":{"type":"string"},"effects":{"type":"array","items":{"allOf":[{"type":"object","properties":{"conditions":{"type":"array","items":{"anyOf":[{"type":"object","properties":{"metricId":{"type":"string"},"operator":{"type":"string","enum":["EQUAL","NOT_EQUAL","GREATER_THAN","LESS_THAN"]},"value":{"type":"number"}},"required":["metricId","operator","value"]},{"type":"object","properties":{"metricId":{"type":"string"},"operator":{"type":"string","enum":["IS_WITHIN_TOP_PERCENTAGE","IS_NOT_WITHIN_TOP_PERCENTAGE"]},"value":{"type":"number","minimum":1,"maximum":100}},"required":["metricId","operator","value"]},{"type":"object","properties":{"userProperty":{"type":"string","enum":["hasAgreedToReceiveMarketing","hasAgreedToShareData"]},"operator":{"type":"string","enum":["EQUAL","NOT_EQUAL"]},"value":{"type":"boolean"}},"required":["userProperty","operator","value"]},{"type":"object","properties":{"userProperty":{"type":"string","enum":["primaryPlatform"]},"operator":{"type":"string","enum":["EQUAL","NOT_EQUAL"]},"value":{"type":"string","enum":["UNKNOWN","IOS","ANDROID","WEB"]}},"required":["userProperty","operator","value"]},{"type":"object","properties":{"userProperty":{"type":"string","enum":["created","birthdate"]},"datePart":{"type":"string","enum":["year","month","dayOfYear","dayOfMonth"]},"operator":{"type":"string","enum":["EQUAL","NOT_EQUAL","GREATER_THAN","LESS_THAN"]},"value":{"anyOf":[{"type":"string","format":"date-time"},{"type":"number"},{"type":"string"}]}},"required":["userProperty","operator","value"]},{"type":"object","properties":{"userProperty":{"type":"string","enum":["gender"]},"operator":{"type":"string","enum":["EQUAL","NOT_EQUAL"]},"value":{"type":"string","enum":["MALE","FEMALE"]}},"required":["userProperty","operator","value"]},{"type":"object","properties":{"userProperty":{"type":"string","enum":["favouriteLocations"]},"operator":{"type":"string","enum":["CONTAINS","NOT_CONTAINS"]},"value":{"type":"string"}},"required":["userProperty","operator","value"]},{"type":"object","properties":{"operator":{"type":"string","enum":["IS_IN_SEGMENT","IS_NOT_IN_SEGMENT"]},"value":{"type":"string"}},"required":["operator","value"]}]}}}},{"anyOf":[{"type":"object","properties":{"type":{"type":"string","enum":["ADD_TO_SEGMENT","REMOVE_FROM_SEGMENT"]},"segmentId":{"type":"string"}},"required":["type","segmentId"]},{"type":"object","properties":{"type":{"type":"string","enum":["TRIGGER_NOTIFICATION"]},"message":{"type":"string"},"isProcessingMessage":{"type":"boolean"},"counter":{"type":"object","properties":{"max":{"type":"number"},"resetsAfterMins":{"type":"number"}},"required":["max"]}},"required":["type","message","isProcessingMessage","counter"]},{"type":"object","properties":{"type":{"type":"string","enum":["TRIGGER_SMS"]},"message":{"type":"string"},"isProcessingMessage":{"type":"boolean"},"counter":{"type":"object","properties":{"max":{"type":"number"},"resetsAfterMins":{"type":"number"}},"required":["max"]}},"required":["type","message","isProcessingMessage","counter"]},{"type":"object","properties":{"type":{"type":"string","enum":["TRIGGER_EMAIL"]},"subject":{"type":"string"},"body":{"type":"string"},"bodyMarkupLanguage":{"type":"string","enum":["HTML","MJML"]},"isProcessingMessage":{"type":"boolean"},"counter":{"type":"object","properties":{"max":{"type":"number"},"resetsAfterMins":{"type":"number"}},"required":["max"]}},"required":["type","subject","body","isProcessingMessage","counter"]},{"type":"object","properties":{"type":{"type":"string","enum":["GRANT_PERK","REVOKE_PERK"]},"perkId":{"type":"string"},"points":{"type":"number"},"counter":{"type":"object","properties":{"max":{"type":"number"},"resetsAfterMins":{"type":"number"}},"required":["max"]}},"required":["type","perkId","counter"]}]},{"type":"object","properties":{"_id":{"type":"string"},"conditions":{"type":"array","items":{"allOf":[{"anyOf":[{"type":"object","properties":{"metricId":{"type":"string"},"operator":{"type":"string","enum":["EQUAL","NOT_EQUAL","GREATER_THAN","LESS_THAN"]},"value":{"type":"number"}},"required":["metricId","operator","value"]},{"type":"object","properties":{"metricId":{"type":"string"},"operator":{"type":"string","enum":["IS_WITHIN_TOP_PERCENTAGE","IS_NOT_WITHIN_TOP_PERCENTAGE"]},"value":{"type":"number","minimum":1,"maximum":100}},"required":["metricId","operator","value"]},{"type":"object","properties":{"userProperty":{"type":"string","enum":["hasAgreedToReceiveMarketing","hasAgreedToShareData"]},"operator":{"type":"string","enum":["EQUAL","NOT_EQUAL"]},"value":{"type":"boolean"}},"required":["userProperty","operator","value"]},{"type":"object","properties":{"userProperty":{"type":"string","enum":["primaryPlatform"]},"operator":{"type":"string","enum":["EQUAL","NOT_EQUAL"]},"value":{"type":"string","enum":["UNKNOWN","IOS","ANDROID","WEB"]}},"required":["userProperty","operator","value"]},{"type":"object","properties":{"userProperty":{"type":"string","enum":["created","birthdate"]},"datePart":{"type":"string","enum":["year","month","dayOfYear","dayOfMonth"]},"operator":{"type":"string","enum":["EQUAL","NOT_EQUAL","GREATER_THAN","LESS_THAN"]},"value":{"anyOf":[{"type":"string","format":"date-time"},{"type":"number"},{"type":"string"}]}},"required":["userProperty","operator","value"]},{"type":"object","properties":{"userProperty":{"type":"string","enum":["gender"]},"operator":{"type":"string","enum":["EQUAL","NOT_EQUAL"]},"value":{"type":"string","enum":["MALE","FEMALE"]}},"required":["userProperty","operator","value"]},{"type":"object","properties":{"userProperty":{"type":"string","enum":["favouriteLocations"]},"operator":{"type":"string","enum":["CONTAINS","NOT_CONTAINS"]},"value":{"type":"string"}},"required":["userProperty","operator","value"]},{"type":"object","properties":{"operator":{"type":"string","enum":["IS_IN_SEGMENT","IS_NOT_IN_SEGMENT"]},"value":{"type":"string"}},"required":["operator","value"]}]},{"type":"object","properties":{"_id":{"type":"string"}},"required":["_id"]}]}}},"required":["_id"]}]}}},"required":["scheduled","realtime","name","displayName","_id","tenantId","effects"]}}}},"400":{"description":"Invalid request.  The request cannot be processed","content":{"application/json":{"schema":{"$ref":"#/components/responses/BadRequestError/content/application~1json/schema"}}}},"401":{"description":"Access denied","content":{"application/json":{"schema":{"$ref":"#/components/responses/BadRequestError/content/application~1json/schema"}}}},"404":{"description":"Resource not found","content":{"application/json":{"schema":{"$ref":"#/components/responses/BadRequestError/content/application~1json/schema"}}}},"422":{"description":"Unprocessable request.  The request cannot be processed","content":{"application/json":{"schema":{"$ref":"#/components/responses/BadRequestError/content/application~1json/schema"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/responses/BadRequestError/content/application~1json/schema"}}}}}}},"/metrics/user/:definitionId/effects/:effectId/conditions":{"post":{"tags":["Metrics - User"],"description":"Add a condition to a user metric definition effect","parameters":[{"schema":{"type":"string"},"required":true,"name":"definitionId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"effectId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"anyOf":[{"type":"object","properties":{"metricId":{"type":"string"},"operator":{"type":"string","enum":["EQUAL","NOT_EQUAL","GREATER_THAN","LESS_THAN"]},"value":{"type":"number"}},"required":["metricId","operator","value"]},{"type":"object","properties":{"metricId":{"type":"string"},"operator":{"type":"string","enum":["IS_WITHIN_TOP_PERCENTAGE","IS_NOT_WITHIN_TOP_PERCENTAGE"]},"value":{"type":"number","minimum":1,"maximum":100}},"required":["metricId","operator","value"]},{"type":"object","properties":{"userProperty":{"type":"string","enum":["hasAgreedToReceiveMarketing","hasAgreedToShareData"]},"operator":{"type":"string","enum":["EQUAL","NOT_EQUAL"]},"value":{"type":"boolean"}},"required":["userProperty","operator","value"]},{"type":"object","properties":{"userProperty":{"type":"string","enum":["primaryPlatform"]},"operator":{"type":"string","enum":["EQUAL","NOT_EQUAL"]},"value":{"type":"string","enum":["UNKNOWN","IOS","ANDROID","WEB"]}},"required":["userProperty","operator","value"]},{"type":"object","properties":{"userProperty":{"type":"string","enum":["created","birthdate"]},"datePart":{"type":"string","enum":["year","month","dayOfYear","dayOfMonth"]},"operator":{"type":"string","enum":["EQUAL","NOT_EQUAL","GREATER_THAN","LESS_THAN"]},"value":{"anyOf":[{"type":"string","format":"date-time"},{"type":"number"},{"type":"string"}]}},"required":["userProperty","operator","value"]},{"type":"object","properties":{"userProperty":{"type":"string","enum":["gender"]},"operator":{"type":"string","enum":["EQUAL","NOT_EQUAL"]},"value":{"type":"string","enum":["MALE","FEMALE"]}},"required":["userProperty","operator","value"]},{"type":"object","properties":{"userProperty":{"type":"string","enum":["favouriteLocations"]},"operator":{"type":"string","enum":["CONTAINS","NOT_CONTAINS"]},"value":{"type":"string"}},"required":["userProperty","operator","value"]},{"type":"object","properties":{"operator":{"type":"string","enum":["IS_IN_SEGMENT","IS_NOT_IN_SEGMENT"]},"value":{"type":"string"}},"required":["operator","value"]}]}}}},"responses":{"201":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"scheduled":{"type":"boolean"},"realtime":{"type":"boolean"},"name":{"type":"string"},"displayName":{"type":"string"},"tags":{"type":"array","items":{"type":"string"}},"recomputeOn":{"type":"array","items":{"type":"string","enum":["NOOP","CARD_CREATED","CARD_DELETED","CHECKIN","USER_CREDITED","GIFT_CARD_TOPUP","GIFT_CARD_ACTIVATED","ORDER_CREATED","ORDER_ITEMS_ADDED","ORDER_USER_JOINED","ORDER_PAYMENT_RECEIVED","ORDER_PAYMENT_REFUNDED","ORDER_COMPLETED","ORDER_USER_BILLED","REFERAL_CLAIMED_REFEREE","REFERAL_CLAIMED_REFERER","REWARD_EARNED","REDEEM_PERK","AWARD_POINTS_REFUNDED","AWARD_POINTS_RESET","MEMBER_ADDED","MEMBER_REMOVED","USER_CREATED","USER_CHANGED","USER_DELETED","USER_ACTIVATION_RESENT","USER_ACTIVATED","CREDENTIAL_VERIFIED","VOUCHER_REDEEMED","COUPON_REDEEMED","COUPON_REFUNDED","BOOKING_CREATED","BOOKING_CHANGED","BOOKING_COMPLETED","SUBSCRIPTION_STARTED","SUBSCRIPTION_PAYMENT_RECEIVED","SUBSCRIPTION_PAYMENT_FAILED","SUBSCRIPTION_CANCELLATION_REQUESTED","SUBSCRIPTION_CANCELLED"]}},"query":{"type":"object","properties":{"created":{"anyOf":[{"type":"object","properties":{"or":{"type":"array","items":{"anyOf":[{"type":"string","format":"date-time"},{"type":"object","properties":{"year":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]},"month":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]},"dayOfMonth":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]},"dayOfYear":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]}}},{"type":"object","properties":{"eq":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"gte":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"lte":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"gt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"lt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]}},"additionalProperties":false}]}}},"required":["or"]},{"type":"string","format":"date-time"},{"type":"object","properties":{"year":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]},"month":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]},"dayOfMonth":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]},"dayOfYear":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]}}},{"type":"object","properties":{"eq":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"gte":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"lte":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"gt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"lt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]}},"additionalProperties":false}]},"birthdate":{"anyOf":[{"type":"object","properties":{"or":{"type":"array","items":{"anyOf":[{"type":"string","format":"date-time"},{"type":"object","properties":{"year":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]},"month":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]},"dayOfMonth":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]},"dayOfYear":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]}}},{"type":"object","properties":{"eq":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"gte":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"lte":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"gt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"lt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]}},"additionalProperties":false}]}}},"required":["or"]},{"type":"string","format":"date-time"},{"type":"object","properties":{"year":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]},"month":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]},"dayOfMonth":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]},"dayOfYear":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]}}},{"type":"object","properties":{"eq":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"gte":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"lte":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"gt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"lt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]}},"additionalProperties":false}]},"hasAgreedToReceiveMarketing":{"type":"boolean"},"hasAgreedToShareData":{"type":"boolean"},"primaryPlatform":{"type":"string","enum":["UNKNOWN","IOS","ANDROID","WEB"]},"gender":{"type":"string","enum":["MALE","FEMALE"]},"favouriteLocations":{"type":"object","properties":{"in":{"type":"array","items":{"type":"string"}}}}}},"metrics":{"type":"object","additionalProperties":{"allOf":[{"type":"object","properties":{"name":{"type":"string"},"displayName":{"type":"string"},"timeRange":{"anyOf":[{"type":"object","properties":{"windowStartOffsetMins":{"type":"number","minimum":0,"maximum":527040},"windowEndOffsetMins":{"type":"number","minimum":0,"maximum":527040},"gt":{"type":"string","format":"date-time"},"lt":{"type":"string","format":"date-time"}},"required":["windowStartOffsetMins"]},{"type":"object","properties":{"gt":{"type":"string","format":"date-time"},"lt":{"type":"string","format":"date-time"}},"required":["gt"]},{"type":"string","enum":["Today","Yesterday","WeekToDate","LastWeek","MonthToDate","LastMonth","QuarterToDate","LastQuarter","YearToDate","LastYear"]}]}},"required":["name","displayName","timeRange"]},{"anyOf":[{"type":"object","properties":{"type":{"type":"string","enum":["TIPS_GIVEN","NOOP","CARD_CREATED","CARD_DELETED","CHECKIN","USER_CREDITED","GIFT_CARD_TOPUP","GIFT_CARD_ACTIVATED","ORDER_CREATED","ORDER_ITEMS_ADDED","ORDER_USER_JOINED","ORDER_PAYMENT_RECEIVED","ORDER_PAYMENT_REFUNDED","ORDER_COMPLETED","ORDER_USER_BILLED","REFERAL_CLAIMED_REFEREE","REFERAL_CLAIMED_REFERER","REWARD_EARNED","REDEEM_PERK","AWARD_POINTS_REFUNDED","AWARD_POINTS_RESET","MEMBER_ADDED","MEMBER_REMOVED","USER_CREATED","USER_CHANGED","USER_DELETED","USER_ACTIVATION_RESENT","USER_ACTIVATED","CREDENTIAL_VERIFIED","VOUCHER_REDEEMED","COUPON_REDEEMED","COUPON_REFUNDED","BOOKING_CREATED","BOOKING_CHANGED","BOOKING_COMPLETED","SUBSCRIPTION_STARTED","SUBSCRIPTION_PAYMENT_RECEIVED","SUBSCRIPTION_PAYMENT_FAILED","SUBSCRIPTION_CANCELLATION_REQUESTED","SUBSCRIPTION_CANCELLED"]}},"required":["type"]},{"type":"object","properties":{"type":{"type":"string","enum":["SPEND"]},"includeTips":{"type":"boolean"}},"required":["type"]},{"type":"object","properties":{"type":{"type":"string","enum":["POINTS_EARNED","POINTS_BURNED"]},"perkId":{"type":"string"}},"required":["type"]}]}]}},"_id":{"type":"string"},"tenantId":{"type":"string"},"effects":{"type":"array","items":{"allOf":[{"type":"object","properties":{"conditions":{"type":"array","items":{"anyOf":[{"type":"object","properties":{"metricId":{"type":"string"},"operator":{"type":"string","enum":["EQUAL","NOT_EQUAL","GREATER_THAN","LESS_THAN"]},"value":{"type":"number"}},"required":["metricId","operator","value"]},{"type":"object","properties":{"metricId":{"type":"string"},"operator":{"type":"string","enum":["IS_WITHIN_TOP_PERCENTAGE","IS_NOT_WITHIN_TOP_PERCENTAGE"]},"value":{"type":"number","minimum":1,"maximum":100}},"required":["metricId","operator","value"]},{"type":"object","properties":{"userProperty":{"type":"string","enum":["hasAgreedToReceiveMarketing","hasAgreedToShareData"]},"operator":{"type":"string","enum":["EQUAL","NOT_EQUAL"]},"value":{"type":"boolean"}},"required":["userProperty","operator","value"]},{"type":"object","properties":{"userProperty":{"type":"string","enum":["primaryPlatform"]},"operator":{"type":"string","enum":["EQUAL","NOT_EQUAL"]},"value":{"type":"string","enum":["UNKNOWN","IOS","ANDROID","WEB"]}},"required":["userProperty","operator","value"]},{"type":"object","properties":{"userProperty":{"type":"string","enum":["created","birthdate"]},"datePart":{"type":"string","enum":["year","month","dayOfYear","dayOfMonth"]},"operator":{"type":"string","enum":["EQUAL","NOT_EQUAL","GREATER_THAN","LESS_THAN"]},"value":{"anyOf":[{"type":"string","format":"date-time"},{"type":"number"},{"type":"string"}]}},"required":["userProperty","operator","value"]},{"type":"object","properties":{"userProperty":{"type":"string","enum":["gender"]},"operator":{"type":"string","enum":["EQUAL","NOT_EQUAL"]},"value":{"type":"string","enum":["MALE","FEMALE"]}},"required":["userProperty","operator","value"]},{"type":"object","properties":{"userProperty":{"type":"string","enum":["favouriteLocations"]},"operator":{"type":"string","enum":["CONTAINS","NOT_CONTAINS"]},"value":{"type":"string"}},"required":["userProperty","operator","value"]},{"type":"object","properties":{"operator":{"type":"string","enum":["IS_IN_SEGMENT","IS_NOT_IN_SEGMENT"]},"value":{"type":"string"}},"required":["operator","value"]}]}}}},{"anyOf":[{"type":"object","properties":{"type":{"type":"string","enum":["ADD_TO_SEGMENT","REMOVE_FROM_SEGMENT"]},"segmentId":{"type":"string"}},"required":["type","segmentId"]},{"type":"object","properties":{"type":{"type":"string","enum":["TRIGGER_NOTIFICATION"]},"message":{"type":"string"},"isProcessingMessage":{"type":"boolean"},"counter":{"type":"object","properties":{"max":{"type":"number"},"resetsAfterMins":{"type":"number"}},"required":["max"]}},"required":["type","message","isProcessingMessage","counter"]},{"type":"object","properties":{"type":{"type":"string","enum":["TRIGGER_SMS"]},"message":{"type":"string"},"isProcessingMessage":{"type":"boolean"},"counter":{"type":"object","properties":{"max":{"type":"number"},"resetsAfterMins":{"type":"number"}},"required":["max"]}},"required":["type","message","isProcessingMessage","counter"]},{"type":"object","properties":{"type":{"type":"string","enum":["TRIGGER_EMAIL"]},"subject":{"type":"string"},"body":{"type":"string"},"bodyMarkupLanguage":{"type":"string","enum":["HTML","MJML"]},"isProcessingMessage":{"type":"boolean"},"counter":{"type":"object","properties":{"max":{"type":"number"},"resetsAfterMins":{"type":"number"}},"required":["max"]}},"required":["type","subject","body","isProcessingMessage","counter"]},{"type":"object","properties":{"type":{"type":"string","enum":["GRANT_PERK","REVOKE_PERK"]},"perkId":{"type":"string"},"points":{"type":"number"},"counter":{"type":"object","properties":{"max":{"type":"number"},"resetsAfterMins":{"type":"number"}},"required":["max"]}},"required":["type","perkId","counter"]}]},{"type":"object","properties":{"_id":{"type":"string"},"conditions":{"type":"array","items":{"allOf":[{"anyOf":[{"type":"object","properties":{"metricId":{"type":"string"},"operator":{"type":"string","enum":["EQUAL","NOT_EQUAL","GREATER_THAN","LESS_THAN"]},"value":{"type":"number"}},"required":["metricId","operator","value"]},{"type":"object","properties":{"metricId":{"type":"string"},"operator":{"type":"string","enum":["IS_WITHIN_TOP_PERCENTAGE","IS_NOT_WITHIN_TOP_PERCENTAGE"]},"value":{"type":"number","minimum":1,"maximum":100}},"required":["metricId","operator","value"]},{"type":"object","properties":{"userProperty":{"type":"string","enum":["hasAgreedToReceiveMarketing","hasAgreedToShareData"]},"operator":{"type":"string","enum":["EQUAL","NOT_EQUAL"]},"value":{"type":"boolean"}},"required":["userProperty","operator","value"]},{"type":"object","properties":{"userProperty":{"type":"string","enum":["primaryPlatform"]},"operator":{"type":"string","enum":["EQUAL","NOT_EQUAL"]},"value":{"type":"string","enum":["UNKNOWN","IOS","ANDROID","WEB"]}},"required":["userProperty","operator","value"]},{"type":"object","properties":{"userProperty":{"type":"string","enum":["created","birthdate"]},"datePart":{"type":"string","enum":["year","month","dayOfYear","dayOfMonth"]},"operator":{"type":"string","enum":["EQUAL","NOT_EQUAL","GREATER_THAN","LESS_THAN"]},"value":{"anyOf":[{"type":"string","format":"date-time"},{"type":"number"},{"type":"string"}]}},"required":["userProperty","operator","value"]},{"type":"object","properties":{"userProperty":{"type":"string","enum":["gender"]},"operator":{"type":"string","enum":["EQUAL","NOT_EQUAL"]},"value":{"type":"string","enum":["MALE","FEMALE"]}},"required":["userProperty","operator","value"]},{"type":"object","properties":{"userProperty":{"type":"string","enum":["favouriteLocations"]},"operator":{"type":"string","enum":["CONTAINS","NOT_CONTAINS"]},"value":{"type":"string"}},"required":["userProperty","operator","value"]},{"type":"object","properties":{"operator":{"type":"string","enum":["IS_IN_SEGMENT","IS_NOT_IN_SEGMENT"]},"value":{"type":"string"}},"required":["operator","value"]}]},{"type":"object","properties":{"_id":{"type":"string"}},"required":["_id"]}]}}},"required":["_id"]}]}}},"required":["scheduled","realtime","name","displayName","_id","tenantId","effects"]}}}},"400":{"description":"Invalid request.  The request cannot be processed","content":{"application/json":{"schema":{"$ref":"#/components/responses/BadRequestError/content/application~1json/schema"}}}},"401":{"description":"Access denied","content":{"application/json":{"schema":{"$ref":"#/components/responses/BadRequestError/content/application~1json/schema"}}}},"404":{"description":"Resource not found","content":{"application/json":{"schema":{"$ref":"#/components/responses/BadRequestError/content/application~1json/schema"}}}},"422":{"description":"Unprocessable request.  The request cannot be processed","content":{"application/json":{"schema":{"$ref":"#/components/responses/BadRequestError/content/application~1json/schema"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/responses/BadRequestError/content/application~1json/schema"}}}}}}},"/metrics/user/:definitionId/listeners/:effectId/conditions/:conditionId":{"delete":{"tags":["Metrics - User"],"description":"Delete a condition from a user metric definition effect","parameters":[{"schema":{"type":"string"},"required":true,"name":"definitionId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"effectId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"conditionId","in":"path"}],"responses":{"201":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"scheduled":{"type":"boolean"},"realtime":{"type":"boolean"},"name":{"type":"string"},"displayName":{"type":"string"},"tags":{"type":"array","items":{"type":"string"}},"recomputeOn":{"type":"array","items":{"type":"string","enum":["NOOP","CARD_CREATED","CARD_DELETED","CHECKIN","USER_CREDITED","GIFT_CARD_TOPUP","GIFT_CARD_ACTIVATED","ORDER_CREATED","ORDER_ITEMS_ADDED","ORDER_USER_JOINED","ORDER_PAYMENT_RECEIVED","ORDER_PAYMENT_REFUNDED","ORDER_COMPLETED","ORDER_USER_BILLED","REFERAL_CLAIMED_REFEREE","REFERAL_CLAIMED_REFERER","REWARD_EARNED","REDEEM_PERK","AWARD_POINTS_REFUNDED","AWARD_POINTS_RESET","MEMBER_ADDED","MEMBER_REMOVED","USER_CREATED","USER_CHANGED","USER_DELETED","USER_ACTIVATION_RESENT","USER_ACTIVATED","CREDENTIAL_VERIFIED","VOUCHER_REDEEMED","COUPON_REDEEMED","COUPON_REFUNDED","BOOKING_CREATED","BOOKING_CHANGED","BOOKING_COMPLETED","SUBSCRIPTION_STARTED","SUBSCRIPTION_PAYMENT_RECEIVED","SUBSCRIPTION_PAYMENT_FAILED","SUBSCRIPTION_CANCELLATION_REQUESTED","SUBSCRIPTION_CANCELLED"]}},"query":{"type":"object","properties":{"created":{"anyOf":[{"type":"object","properties":{"or":{"type":"array","items":{"anyOf":[{"type":"string","format":"date-time"},{"type":"object","properties":{"year":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]},"month":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]},"dayOfMonth":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]},"dayOfYear":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]}}},{"type":"object","properties":{"eq":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"gte":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"lte":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"gt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"lt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]}},"additionalProperties":false}]}}},"required":["or"]},{"type":"string","format":"date-time"},{"type":"object","properties":{"year":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]},"month":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]},"dayOfMonth":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]},"dayOfYear":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]}}},{"type":"object","properties":{"eq":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"gte":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"lte":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"gt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"lt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]}},"additionalProperties":false}]},"birthdate":{"anyOf":[{"type":"object","properties":{"or":{"type":"array","items":{"anyOf":[{"type":"string","format":"date-time"},{"type":"object","properties":{"year":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]},"month":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]},"dayOfMonth":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]},"dayOfYear":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]}}},{"type":"object","properties":{"eq":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"gte":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"lte":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"gt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"lt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]}},"additionalProperties":false}]}}},"required":["or"]},{"type":"string","format":"date-time"},{"type":"object","properties":{"year":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]},"month":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]},"dayOfMonth":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]},"dayOfYear":{"anyOf":[{"type":"number"},{"type":"object","properties":{"eq":{"anyOf":[{"type":"number"},{"type":"string"}]},"gte":{"anyOf":[{"type":"number"},{"type":"string"}]},"lte":{"anyOf":[{"type":"number"},{"type":"string"}]},"gt":{"anyOf":[{"type":"number"},{"type":"string"}]},"lt":{"anyOf":[{"type":"number"},{"type":"string"}]}},"additionalProperties":false}]}}},{"type":"object","properties":{"eq":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"gte":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"lte":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"gt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]},"lt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string"}]}},"additionalProperties":false}]},"hasAgreedToReceiveMarketing":{"type":"boolean"},"hasAgreedToShareData":{"type":"boolean"},"primaryPlatform":{"type":"string","enum":["UNKNOWN","IOS","ANDROID","WEB"]},"gender":{"type":"string","enum":["MALE","FEMALE"]},"favouriteLocations":{"type":"object","properties":{"in":{"type":"array","items":{"type":"string"}}}}}},"metrics":{"type":"object","additionalProperties":{"allOf":[{"type":"object","properties":{"name":{"type":"string"},"displayName":{"type":"string"},"timeRange":{"anyOf":[{"type":"object","properties":{"windowStartOffsetMins":{"type":"number","minimum":0,"maximum":527040},"windowEndOffsetMins":{"type":"number","minimum":0,"maximum":527040},"gt":{"type":"string","format":"date-time"},"lt":{"type":"string","format":"date-time"}},"required":["windowStartOffsetMins"]},{"type":"object","properties":{"gt":{"type":"string","format":"date-time"},"lt":{"type":"string","format":"date-time"}},"required":["gt"]},{"type":"string","enum":["Today","Yesterday","WeekToDate","LastWeek","MonthToDate","LastMonth","QuarterToDate","LastQuarter","YearToDate","LastYear"]}]}},"required":["name","displayName","timeRange"]},{"anyOf":[{"type":"object","properties":{"type":{"type":"string","enum":["TIPS_GIVEN","NOOP","CARD_CREATED","CARD_DELETED","CHECKIN","USER_CREDITED","GIFT_CARD_TOPUP","GIFT_CARD_ACTIVATED","ORDER_CREATED","ORDER_ITEMS_ADDED","ORDER_USER_JOINED","ORDER_PAYMENT_RECEIVED","ORDER_PAYMENT_REFUNDED","ORDER_COMPLETED","ORDER_USER_BILLED","REFERAL_CLAIMED_REFEREE","REFERAL_CLAIMED_REFERER","REWARD_EARNED","REDEEM_PERK","AWARD_POINTS_REFUNDED","AWARD_POINTS_RESET","MEMBER_ADDED","MEMBER_REMOVED","USER_CREATED","USER_CHANGED","USER_DELETED","USER_ACTIVATION_RESENT","USER_ACTIVATED","CREDENTIAL_VERIFIED","VOUCHER_REDEEMED","COUPON_REDEEMED","COUPON_REFUNDED","BOOKING_CREATED","BOOKING_CHANGED","BOOKING_COMPLETED","SUBSCRIPTION_STARTED","SUBSCRIPTION_PAYMENT_RECEIVED","SUBSCRIPTION_PAYMENT_FAILED","SUBSCRIPTION_CANCELLATION_REQUESTED","SUBSCRIPTION_CANCELLED"]}},"required":["type"]},{"type":"object","properties":{"type":{"type":"string","enum":["SPEND"]},"includeTips":{"type":"boolean"}},"required":["type"]},{"type":"object","properties":{"type":{"type":"string","enum":["POINTS_EARNED","POINTS_BURNED"]},"perkId":{"type":"string"}},"required":["type"]}]}]}},"_id":{"type":"string"},"tenantId":{"type":"string"},"effects":{"type":"array","items":{"allOf":[{"type":"object","properties":{"conditions":{"type":"array","items":{"anyOf":[{"type":"object","properties":{"metricId":{"type":"string"},"operator":{"type":"string","enum":["EQUAL","NOT_EQUAL","GREATER_THAN","LESS_THAN"]},"value":{"type":"number"}},"required":["metricId","operator","value"]},{"type":"object","properties":{"metricId":{"type":"string"},"operator":{"type":"string","enum":["IS_WITHIN_TOP_PERCENTAGE","IS_NOT_WITHIN_TOP_PERCENTAGE"]},"value":{"type":"number","minimum":1,"maximum":100}},"required":["metricId","operator","value"]},{"type":"object","properties":{"userProperty":{"type":"string","enum":["hasAgreedToReceiveMarketing","hasAgreedToShareData"]},"operator":{"type":"string","enum":["EQUAL","NOT_EQUAL"]},"value":{"type":"boolean"}},"required":["userProperty","operator","value"]},{"type":"object","properties":{"userProperty":{"type":"string","enum":["primaryPlatform"]},"operator":{"type":"string","enum":["EQUAL","NOT_EQUAL"]},"value":{"type":"string","enum":["UNKNOWN","IOS","ANDROID","WEB"]}},"required":["userProperty","operator","value"]},{"type":"object","properties":{"userProperty":{"type":"string","enum":["created","birthdate"]},"datePart":{"type":"string","enum":["year","month","dayOfYear","dayOfMonth"]},"operator":{"type":"string","enum":["EQUAL","NOT_EQUAL","GREATER_THAN","LESS_THAN"]},"value":{"anyOf":[{"type":"string","format":"date-time"},{"type":"number"},{"type":"string"}]}},"required":["userProperty","operator","value"]},{"type":"object","properties":{"userProperty":{"type":"string","enum":["gender"]},"operator":{"type":"string","enum":["EQUAL","NOT_EQUAL"]},"value":{"type":"string","enum":["MALE","FEMALE"]}},"required":["userProperty","operator","value"]},{"type":"object","properties":{"userProperty":{"type":"string","enum":["favouriteLocations"]},"operator":{"type":"string","enum":["CONTAINS","NOT_CONTAINS"]},"value":{"type":"string"}},"required":["userProperty","operator","value"]},{"type":"object","properties":{"operator":{"type":"string","enum":["IS_IN_SEGMENT","IS_NOT_IN_SEGMENT"]},"value":{"type":"string"}},"required":["operator","value"]}]}}}},{"anyOf":[{"type":"object","properties":{"type":{"type":"string","enum":["ADD_TO_SEGMENT","REMOVE_FROM_SEGMENT"]},"segmentId":{"type":"string"}},"required":["type","segmentId"]},{"type":"object","properties":{"type":{"type":"string","enum":["TRIGGER_NOTIFICATION"]},"message":{"type":"string"},"isProcessingMessage":{"type":"boolean"},"counter":{"type":"object","properties":{"max":{"type":"number"},"resetsAfterMins":{"type":"number"}},"required":["max"]}},"required":["type","message","isProcessingMessage","counter"]},{"type":"object","properties":{"type":{"type":"string","enum":["TRIGGER_SMS"]},"message":{"type":"string"},"isProcessingMessage":{"type":"boolean"},"counter":{"type":"object","properties":{"max":{"type":"number"},"resetsAfterMins":{"type":"number"}},"required":["max"]}},"required":["type","message","isProcessingMessage","counter"]},{"type":"object","properties":{"type":{"type":"string","enum":["TRIGGER_EMAIL"]},"subject":{"type":"string"},"body":{"type":"string"},"bodyMarkupLanguage":{"type":"string","enum":["HTML","MJML"]},"isProcessingMessage":{"type":"boolean"},"counter":{"type":"object","properties":{"max":{"type":"number"},"resetsAfterMins":{"type":"number"}},"required":["max"]}},"required":["type","subject","body","isProcessingMessage","counter"]},{"type":"object","properties":{"type":{"type":"string","enum":["GRANT_PERK","REVOKE_PERK"]},"perkId":{"type":"string"},"points":{"type":"number"},"counter":{"type":"object","properties":{"max":{"type":"number"},"resetsAfterMins":{"type":"number"}},"required":["max"]}},"required":["type","perkId","counter"]}]},{"type":"object","properties":{"_id":{"type":"string"},"conditions":{"type":"array","items":{"allOf":[{"anyOf":[{"type":"object","properties":{"metricId":{"type":"string"},"operator":{"type":"string","enum":["EQUAL","NOT_EQUAL","GREATER_THAN","LESS_THAN"]},"value":{"type":"number"}},"required":["metricId","operator","value"]},{"type":"object","properties":{"metricId":{"type":"string"},"operator":{"type":"string","enum":["IS_WITHIN_TOP_PERCENTAGE","IS_NOT_WITHIN_TOP_PERCENTAGE"]},"value":{"type":"number","minimum":1,"maximum":100}},"required":["metricId","operator","value"]},{"type":"object","properties":{"userProperty":{"type":"string","enum":["hasAgreedToReceiveMarketing","hasAgreedToShareData"]},"operator":{"type":"string","enum":["EQUAL","NOT_EQUAL"]},"value":{"type":"boolean"}},"required":["userProperty","operator","value"]},{"type":"object","properties":{"userProperty":{"type":"string","enum":["primaryPlatform"]},"operator":{"type":"string","enum":["EQUAL","NOT_EQUAL"]},"value":{"type":"string","enum":["UNKNOWN","IOS","ANDROID","WEB"]}},"required":["userProperty","operator","value"]},{"type":"object","properties":{"userProperty":{"type":"string","enum":["created","birthdate"]},"datePart":{"type":"string","enum":["year","month","dayOfYear","dayOfMonth"]},"operator":{"type":"string","enum":["EQUAL","NOT_EQUAL","GREATER_THAN","LESS_THAN"]},"value":{"anyOf":[{"type":"string","format":"date-time"},{"type":"number"},{"type":"string"}]}},"required":["userProperty","operator","value"]},{"type":"object","properties":{"userProperty":{"type":"string","enum":["gender"]},"operator":{"type":"string","enum":["EQUAL","NOT_EQUAL"]},"value":{"type":"string","enum":["MALE","FEMALE"]}},"required":["userProperty","operator","value"]},{"type":"object","properties":{"userProperty":{"type":"string","enum":["favouriteLocations"]},"operator":{"type":"string","enum":["CONTAINS","NOT_CONTAINS"]},"value":{"type":"string"}},"required":["userProperty","operator","value"]},{"type":"object","properties":{"operator":{"type":"string","enum":["IS_IN_SEGMENT","IS_NOT_IN_SEGMENT"]},"value":{"type":"string"}},"required":["operator","value"]}]},{"type":"object","properties":{"_id":{"type":"string"}},"required":["_id"]}]}}},"required":["_id"]}]}}},"required":["scheduled","realtime","name","displayName","_id","tenantId","effects"]}}}},"400":{"description":"Invalid request.  The request cannot be processed","content":{"application/json":{"schema":{"$ref":"#/components/responses/BadRequestError/content/application~1json/schema"}}}},"401":{"description":"Access denied","content":{"application/json":{"schema":{"$ref":"#/components/responses/BadRequestError/content/application~1json/schema"}}}},"404":{"description":"Resource not found","content":{"application/json":{"schema":{"$ref":"#/components/responses/BadRequestError/content/application~1json/schema"}}}},"422":{"description":"Unprocessable request.  The request cannot be processed","content":{"application/json":{"schema":{"$ref":"#/components/responses/BadRequestError/content/application~1json/schema"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/responses/BadRequestError/content/application~1json/schema"}}}}}}},"/metrics/user/:definitionId/compute":{"post":{"tags":["Metrics - User"],"description":"Compute user metric definition","parameters":[{"schema":{"type":"string"},"required":true,"name":"definitionId","in":"path"},{"schema":{"type":"string","description":"This call requires a nonce in this header to prevent duplicate processing of calls.  The nonce value represents an individual call.\nIt should be set to a guid.  Each new call should have a new guid.  In the rare occasion you want to repeat a call, use the original guid value.\n"},"required":true,"name":"x-pepper-req-nonce","in":"header"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"userId":{"type":"string"}}}}}},"responses":{"202":{"description":"Success","content":{"application/json":{"schema":{"$schema":"http://json-schema.org/draft-07/schema#","title":"Operation","description":"An asynchronous operation","type":"object","allOf":[{"$ref":"#/paths/~1metrics~1user~1%3AdefinitionId~1compute/post/responses/202/content/application~1json/schema/definitions/read"},{"$ref":"#/paths/~1metrics~1user~1%3AdefinitionId~1compute/post/responses/202/content/application~1json/schema/definitions/create"}],"definitions":{"status":{"enum":["DONE","ERROR","PENDING","TIMEOUT"],"type":"string"},"create":{"properties":{}},"read":{"properties":{"_id":{"type":"string","description":"Operation id"},"tenantId":{"type":"string"},"namespace":{"type":"string","description":"A name identifying the area of the platform the operation is associated with e.g segments"},"entityId":{"type":"string","description":"A reference to a specific entity within the area defined by namespace e.g segment ID"},"nonce":{"type":"string","description":"A unique key that prevents non-idempotent operations from occurring twice."},"name":{"type":"string","description":"The name of the operation"},"status":{"$ref":"#/paths/~1metrics~1user~1%3AdefinitionId~1compute/post/responses/202/content/application~1json/schema/definitions/status"},"metadata":{"description":"Specific data/parameters associated with the operation. The exact schema of the metadata depends on the specific operation."},"result":{"description":"The result of the operation. The exact schema of the result depends on the specific operation."},"error":{"description":"The error that has occurred if the operation has failed. The exact schema of the error depends on the specific operation."},"isRetryable":{"type":"boolean","description":"Whether or not the operation can be retried."},"createdAt":{"type":"string","description":"UTC iso formatted date of when the operation was created"},"updatedAt":{"type":"string","description":"UTC iso formatted date of when the operation was updated"},"endedAt":{"type":"string","description":"UTC iso formatted date of when the operation was ended"}}}}}}}},"400":{"description":"Invalid request.  The request cannot be processed","content":{"application/json":{"schema":{"$ref":"#/components/responses/BadRequestError/content/application~1json/schema"}}}},"401":{"description":"Access denied","content":{"application/json":{"schema":{"$ref":"#/components/responses/BadRequestError/content/application~1json/schema"}}}},"404":{"description":"Resource not found","content":{"application/json":{"schema":{"$ref":"#/components/responses/BadRequestError/content/application~1json/schema"}}}},"422":{"description":"Unprocessable request.  The request cannot be processed","content":{"application/json":{"schema":{"$ref":"#/components/responses/BadRequestError/content/application~1json/schema"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/responses/BadRequestError/content/application~1json/schema"}}}}}}},"/metrics/user/:definitionId/values":{"get":{"tags":["Metrics - User"],"description":"Get user metric values","parameters":[{"schema":{"type":"string"},"required":true,"name":"definitionId","in":"path"},{"schema":{"type":"string"},"required":true,"description":"Request results to start at the record represented by this key.  You can page through a dataset by making requests, setting `startKey` to the `nextKey` value provided in the last response.","name":"startKey","in":"query"},{"schema":{"type":"string"},"required":true,"description":"Set the response to be paged, and limit by this number of results.  If not provided, a default limit (usually 100) will be used","name":"limit","in":"query"},{"schema":{"type":"string"},"required":false,"name":"metricId","in":"query"},{"schema":{"type":"string"},"required":false,"name":"userId","in":"query"}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"_id":{"type":"string"},"tenantId":{"type":"string"},"definitionId":{"type":"string"},"metricId":{"type":"string"},"userId":{"type":"string"},"value":{"type":"number"},"updatedAt":{"type":"string"}},"required":["_id","tenantId","definitionId","metricId","userId","value","updatedAt"]}},"page":{"type":"object","properties":{"limit":{"type":"number","description":"The limit used in the request"},"count":{"type":"number","description":"Total number of records in the current page"},"startKey":{"type":"string","description":"A value representing the record at the start of the page.  Do not use this value for any purpose other than paging."},"nextKey":{"type":"string","description":"A value representing the record at the start of the next page.  Use this as the `startKey` in another request.  Do not use this value for any purpose other than paging."}},"required":["limit","count","startKey","nextKey"]}},"required":["items","page"]}}}},"400":{"description":"Invalid request.  The request cannot be processed","content":{"application/json":{"schema":{"$ref":"#/components/responses/BadRequestError/content/application~1json/schema"}}}},"401":{"description":"Access denied","content":{"application/json":{"schema":{"$ref":"#/components/responses/BadRequestError/content/application~1json/schema"}}}},"404":{"description":"Resource not found","content":{"application/json":{"schema":{"$ref":"#/components/responses/BadRequestError/content/application~1json/schema"}}}},"422":{"description":"Unprocessable request.  The request cannot be processed","content":{"application/json":{"schema":{"$ref":"#/components/responses/BadRequestError/content/application~1json/schema"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/responses/BadRequestError/content/application~1json/schema"}}}}}}},"/reviews":{"post":{"tags":["Reviews"],"summary":"Create a Review","description":"Creates a review for a location. Requires locationId, with optional fields (orderId, rating 1-5, text). Supports source tracking (PROMPT or WEB_UI_ORDER_CONFIRMATION, with optional promptId). Platform and userId is inferred from client headers and session respectively. When the source is PROMPT, the related prompt is updated asynchronously with the reviewId.","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"locationId":{"type":"string","description":"Location being reviewed"},"rating":{"type":"number","minimum":1,"maximum":5,"description":"Rating from 1 to 5"},"text":{"type":"string","description":"Review text"},"source":{"type":"object","properties":{"type":{"type":"string","enum":["PROMPT","WEB_UI_ORDER_CONFIRMATION"],"description":"Type of source that generated the review"},"promptId":{"type":"string","description":"Prompt ID if source type is PROMPT"}},"description":"Source of the review"},"orderId":{"type":"number","description":"Associated order ID"}},"required":["locationId","orderId"]}}}},"responses":{"201":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"_id":{"type":"string","description":"Review ID"},"tenantId":{"type":"string","description":"Tenant in which the location, user and order is associated with"},"locationId":{"type":"string","description":"Location being reviewed"},"userId":{"type":"string","description":"User creating the review (defaults to authenticated user, admin can override)"},"orderId":{"type":"number","description":"Associated order ID"},"rating":{"type":"number","minimum":1,"maximum":5,"description":"Rating from 1 to 5"},"text":{"type":"string","description":"Review text"},"source":{"type":"object","properties":{"type":{"type":"string","enum":["PROMPT","WEB_UI_ORDER_CONFIRMATION"],"description":"Type of source that generated the review"},"promptId":{"type":"string","description":"Prompt ID if source type is PROMPT"},"platform":{"type":"string","enum":["UNKNOWN","IOS","ANDROID","WEB"],"description":"Platform inferred from client headers"}},"required":["platform"],"description":"Source of the review"},"createdAt":{"type":"string","description":"UTC ISO formatted date of when the review was created"},"updatedAt":{"type":"string","description":"UTC ISO formatted date of when the review was last updated"}},"required":["_id","tenantId","locationId","userId","source","createdAt","updatedAt"]}}}},"400":{"description":"Invalid request.  The request cannot be processed","content":{"application/json":{"schema":{"$ref":"#/components/responses/BadRequestError/content/application~1json/schema"}}}},"401":{"description":"Access denied","content":{"application/json":{"schema":{"$ref":"#/components/responses/BadRequestError/content/application~1json/schema"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/responses/BadRequestError/content/application~1json/schema"}}}},"404":{"description":"Resource not found","content":{"application/json":{"schema":{"$ref":"#/components/responses/BadRequestError/content/application~1json/schema"}}}},"422":{"description":"Unprocessable request.  The request cannot be processed","content":{"application/json":{"schema":{"$ref":"#/components/responses/BadRequestError/content/application~1json/schema"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/responses/BadRequestError/content/application~1json/schema"}}}}}},"get":{"tags":["Reviews"],"summary":"Retrieve a list of reviews","description":"Retrieves a paginated list of reviews with optional filters. Non-admin users (USER, GUEST) can only retrieve their own reviews - the userId parameter is ignored and automatically scoped to the authenticated user. Admins can query any user's reviews using the userId parameter. Supports filtering by locationId, orderId, rating, and text (case-insensitive partial match). Returns paginated results with cursor-based pagination.","parameters":[{"schema":{"type":"string"},"required":true,"description":"Request results to start at the record represented by this key.  You can page through a dataset by making requests, setting `startKey` to the `nextKey` value provided in the last response.","name":"startKey","in":"query"},{"schema":{"type":"string"},"required":true,"description":"Set the response to be paged, and limit by this number of results.  If not provided, a default limit (usually 100) will be used","name":"limit","in":"query"},{"schema":{"type":"string","description":"Filter by location ID (exact match)","example":"507f1f77bcf86cd799439011"},"required":false,"name":"locationId","in":"query"},{"schema":{"type":"number","description":"Filter by order ID (exact match)","example":12345},"required":false,"name":"orderId","in":"query"},{"schema":{"type":"string","description":"Filter by user ID (exact match). Admin-only: non-admin users cannot query other users' reviews","example":"507f1f77bcf86cd799439013"},"required":false,"name":"userId","in":"query"},{"schema":{"type":"number","minimum":1,"maximum":5,"description":"Filter by rating (exact match, 1-5)","example":5},"required":false,"name":"rating","in":"query"},{"schema":{"type":"string","description":"Filter by review text (case-insensitive partial match)","example":"great"},"required":false,"name":"text","in":"query"},{"schema":{"type":"string","description":"Sort fields (comma-separated, prefix with - for descending). Supported: createdAt, updatedAt, rating","example":"-createdAt,rating"},"required":false,"name":"sort","in":"query"}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"_id":{"type":"string","description":"Review ID"},"tenantId":{"type":"string","description":"Tenant in which the location, user and order is associated with"},"locationId":{"type":"string","description":"Location being reviewed"},"userId":{"type":"string","description":"User creating the review (defaults to authenticated user, admin can override)"},"orderId":{"type":"number","description":"Associated order ID"},"rating":{"type":"number","minimum":1,"maximum":5,"description":"Rating from 1 to 5"},"text":{"type":"string","description":"Review text"},"source":{"type":"object","properties":{"type":{"type":"string","enum":["PROMPT","WEB_UI_ORDER_CONFIRMATION"],"description":"Type of source that generated the review"},"promptId":{"type":"string","description":"Prompt ID if source type is PROMPT"},"platform":{"type":"string","enum":["UNKNOWN","IOS","ANDROID","WEB"],"description":"Platform inferred from client headers"}},"required":["platform"],"description":"Source of the review"},"createdAt":{"type":"string","description":"UTC ISO formatted date of when the review was created"},"updatedAt":{"type":"string","description":"UTC ISO formatted date of when the review was last updated"},"fullName":{"type":"string","description":"Full name of the user who created the review"}},"required":["_id","tenantId","locationId","userId","source","createdAt","updatedAt"]}},"page":{"type":"object","properties":{"limit":{"type":"number","description":"The limit used in the request"},"count":{"type":"number","description":"Total number of records in the current page"},"startKey":{"type":"string","description":"A value representing the record at the start of the page.  Do not use this value for any purpose other than paging."},"nextKey":{"type":"string","description":"A value representing the record at the start of the next page.  Use this as the `startKey` in another request.  Do not use this value for any purpose other than paging."}},"required":["limit","count","startKey","nextKey"]}},"required":["items","page"]}}}},"400":{"description":"Invalid request.  The request cannot be processed","content":{"application/json":{"schema":{"$ref":"#/components/responses/BadRequestError/content/application~1json/schema"}}}},"401":{"description":"Access denied","content":{"application/json":{"schema":{"$ref":"#/components/responses/BadRequestError/content/application~1json/schema"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/responses/BadRequestError/content/application~1json/schema"}}}},"404":{"description":"Resource not found","content":{"application/json":{"schema":{"$ref":"#/components/responses/BadRequestError/content/application~1json/schema"}}}},"422":{"description":"Unprocessable request.  The request cannot be processed","content":{"application/json":{"schema":{"$ref":"#/components/responses/BadRequestError/content/application~1json/schema"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/responses/BadRequestError/content/application~1json/schema"}}}}}}},"/reviews/:id":{"put":{"tags":["Reviews"],"summary":"Update a Review","description":"Updates an existing review. Users can only update their own reviews (rating and text fields only). Admins can update any review. At least one field must be provided.","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"rating":{"type":"number","minimum":1,"maximum":5,"description":"Rating from 1 to 5"},"text":{"type":"string","description":"Review text"}}}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"_id":{"type":"string","description":"Review ID"},"tenantId":{"type":"string","description":"Tenant in which the location, user and order is associated with"},"locationId":{"type":"string","description":"Location being reviewed"},"userId":{"type":"string","description":"User creating the review (defaults to authenticated user, admin can override)"},"orderId":{"type":"number","description":"Associated order ID"},"rating":{"type":"number","minimum":1,"maximum":5,"description":"Rating from 1 to 5"},"text":{"type":"string","description":"Review text"},"source":{"type":"object","properties":{"type":{"type":"string","enum":["PROMPT","WEB_UI_ORDER_CONFIRMATION"],"description":"Type of source that generated the review"},"promptId":{"type":"string","description":"Prompt ID if source type is PROMPT"},"platform":{"type":"string","enum":["UNKNOWN","IOS","ANDROID","WEB"],"description":"Platform inferred from client headers"}},"required":["platform"],"description":"Source of the review"},"createdAt":{"type":"string","description":"UTC ISO formatted date of when the review was created"},"updatedAt":{"type":"string","description":"UTC ISO formatted date of when the review was last updated"}},"required":["_id","tenantId","locationId","userId","source","createdAt","updatedAt"]}}}},"400":{"description":"Invalid request.  The request cannot be processed","content":{"application/json":{"schema":{"$ref":"#/components/responses/BadRequestError/content/application~1json/schema"}}}},"401":{"description":"Access denied","content":{"application/json":{"schema":{"$ref":"#/components/responses/BadRequestError/content/application~1json/schema"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/responses/BadRequestError/content/application~1json/schema"}}}},"404":{"description":"Resource not found","content":{"application/json":{"schema":{"$ref":"#/components/responses/BadRequestError/content/application~1json/schema"}}}},"422":{"description":"Unprocessable request.  The request cannot be processed","content":{"application/json":{"schema":{"$ref":"#/components/responses/BadRequestError/content/application~1json/schema"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/responses/BadRequestError/content/application~1json/schema"}}}}}},"get":{"tags":["Reviews"],"summary":"Retrieve a Review","description":"Retrieves a single review by ID. Admin-only access. Returns 404 if review not found, 401 if not authorized.","parameters":[{"schema":{"type":"string","description":"Review ID"},"required":true,"description":"Review ID","name":"id","in":"path"}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"_id":{"type":"string","description":"Review ID"},"tenantId":{"type":"string","description":"Tenant in which the location, user and order is associated with"},"locationId":{"type":"string","description":"Location being reviewed"},"userId":{"type":"string","description":"User creating the review (defaults to authenticated user, admin can override)"},"orderId":{"type":"number","description":"Associated order ID"},"rating":{"type":"number","minimum":1,"maximum":5,"description":"Rating from 1 to 5"},"text":{"type":"string","description":"Review text"},"source":{"type":"object","properties":{"type":{"type":"string","enum":["PROMPT","WEB_UI_ORDER_CONFIRMATION"],"description":"Type of source that generated the review"},"promptId":{"type":"string","description":"Prompt ID if source type is PROMPT"},"platform":{"type":"string","enum":["UNKNOWN","IOS","ANDROID","WEB"],"description":"Platform inferred from client headers"}},"required":["platform"],"description":"Source of the review"},"createdAt":{"type":"string","description":"UTC ISO formatted date of when the review was created"},"updatedAt":{"type":"string","description":"UTC ISO formatted date of when the review was last updated"}},"required":["_id","tenantId","locationId","userId","source","createdAt","updatedAt"]}}}},"400":{"description":"Invalid request.  The request cannot be processed","content":{"application/json":{"schema":{"$ref":"#/components/responses/BadRequestError/content/application~1json/schema"}}}},"401":{"description":"Access denied","content":{"application/json":{"schema":{"$ref":"#/components/responses/BadRequestError/content/application~1json/schema"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/responses/BadRequestError/content/application~1json/schema"}}}},"404":{"description":"Resource not found","content":{"application/json":{"schema":{"$ref":"#/components/responses/BadRequestError/content/application~1json/schema"}}}},"422":{"description":"Unprocessable request.  The request cannot be processed","content":{"application/json":{"schema":{"$ref":"#/components/responses/BadRequestError/content/application~1json/schema"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/responses/BadRequestError/content/application~1json/schema"}}}}}}},"/prompts/pending":{"get":{"tags":["Prompts"],"summary":"Get pending prompts","description":"Retrieve the next pending prompt to show to user, based on prompts relevance, time since previous review, and prior user actions. Returns a single-element array, and cancels old prompts.","parameters":[{"schema":{"type":"string"},"required":true,"description":"ISO 8601 timestamp to determine the relevant prompt for given date","name":"date","in":"query"}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"_id":{"type":"string","description":"Prompt ID"},"tenantId":{"type":"string","description":"Tenant in which the location, user and order is associated with"},"userId":{"type":"string","description":"User who should respond to the prompt"},"type":{"type":"string","enum":["REVIEW"],"description":"Type of the prompt"},"shownAt":{"type":"string","description":"ISO 8601 timestamp of when this prompt was shown to the user"},"dismissedAt":{"type":"string","description":"ISO 8601 timestamp of when this prompt was dismissed by the user"},"triggerAt":{"type":"string","description":"ISO 8601 timestamp of when this prompt should show to the user"},"cancelledAt":{"type":"string","description":"ISO 8601 timestamp of when this prompt was cancelled/superseded"},"expireAt":{"type":"string","description":"ISO 8601 timestamp of when this prompt expires"},"createdAt":{"type":"string","description":"ISO 8601 timestamp of when this prompt was created"},"updatedAt":{"type":"string","description":"ISO 8601 timestamp of when this prompt was updated most recently"},"completedAt":{"type":"string","description":"ISO 8601 timestamp of when this prompt was completed"},"output":{"type":"object","properties":{"reviewId":{"type":"string","description":"Review ID that was generated from this prompt"}},"required":["reviewId"],"description":"Resources created as a result of this prompt"},"reviewParameters":{"type":"object","properties":{"orderId":{"type":"number","description":"Order ID that this prompt was generated from and associated with"},"orderDate":{"type":"string","description":"ISO 8601 timestamp of when this prompt was generated"},"locationId":{"type":"string","description":"Location the prompt is associated with"},"locationTitle":{"type":"string","description":"User-friendly equivalent of location ID"},"externalReviewUrl":{"type":"string","description":"The external review URL to redirect the user to if the rating is greater than `minimumRatingToTriggerExternalReview`"},"minimumRatingToTriggerExternalReview":{"type":"number","description":"The minimum rating the user gives before redirecting to `externalReviewUrl`"}},"required":["orderId","orderDate","locationId","locationTitle"],"description":"Values to forward when creating a review from this prompt"},"source":{"type":"object","properties":{"type":{"type":"string","enum":["EVENT"],"description":"Type of source that generated the prompt"},"eventId":{"type":"string","description":"ID of the action that generated this prompt"}},"required":["type","eventId"],"description":"Details of how the prompt was generated"}},"required":["_id","tenantId","userId","type","triggerAt","createdAt","updatedAt","reviewParameters","source"]}}}}},"400":{"description":"Invalid request.  The request cannot be processed","content":{"application/json":{"schema":{"$ref":"#/components/responses/BadRequestError/content/application~1json/schema"}}}},"401":{"description":"Access denied","content":{"application/json":{"schema":{"$ref":"#/components/responses/BadRequestError/content/application~1json/schema"}}}},"404":{"description":"Resource not found","content":{"application/json":{"schema":{"$ref":"#/components/responses/BadRequestError/content/application~1json/schema"}}}},"422":{"description":"Unprocessable request.  The request cannot be processed","content":{"application/json":{"schema":{"$ref":"#/components/responses/BadRequestError/content/application~1json/schema"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/responses/BadRequestError/content/application~1json/schema"}}}}}}},"/prompts/:id":{"put":{"tags":["Prompts"],"summary":"Update prompt timestamps","description":"Update a prompt's `shownAt` or `dismissedAt` timestamp by ID. At least one property must be supplied.","parameters":[{"schema":{"type":"string"},"required":true,"description":"ID of the prompt to update","name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"shownAt":{"type":"string","description":"ISO 8601 timestamp of when this prompt was shown to the user"},"dismissedAt":{"type":"string","description":"ISO 8601 timestamp of when this prompt was dismissed by the user"}}}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"shownAt":{"type":"string","description":"ISO 8601 timestamp of when this prompt was shown to the user"},"dismissedAt":{"type":"string","description":"ISO 8601 timestamp of when this prompt was dismissed by the user"}}}}}},"400":{"description":"Invalid request.  The request cannot be processed","content":{"application/json":{"schema":{"$ref":"#/components/responses/BadRequestError/content/application~1json/schema"}}}},"401":{"description":"Access denied","content":{"application/json":{"schema":{"$ref":"#/components/responses/BadRequestError/content/application~1json/schema"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/responses/BadRequestError/content/application~1json/schema"}}}},"404":{"description":"Resource not found","content":{"application/json":{"schema":{"$ref":"#/components/responses/BadRequestError/content/application~1json/schema"}}}},"422":{"description":"Unprocessable request.  The request cannot be processed","content":{"application/json":{"schema":{"$ref":"#/components/responses/BadRequestError/content/application~1json/schema"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/responses/BadRequestError/content/application~1json/schema"}}}}}}},"/links":{"post":{"tags":["Links"],"summary":"Create a Link","description":"Creates a link for the authenticated tenant. The server generates the `shortLinkId` (nanoid). Supports two types: `EXTERNAL_LINK` for direct redirects and `APP_LINK` for app/store redirects (with optional platform-specific overrides via `androidCustomUrl`/`iosCustomUrl`). \n\nUTM parameters (`utmCampaign`, `utmSource`, `utmContent`, and optionally `utmMedium`/`utmTerm`) are optional but gated — if any are provided, the premium links feature must be enabled for the tenant. The three core UTM fields (`utmCampaign`, `utmSource`, `utmContent`) must all be provided together or omitted entirely.\nFree users may only create 1 App Link whereas Premium users may create unlimited links. Both user groups may create unlimited External links","requestBody":{"content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/CreateAppLink"},{"$ref":"#/components/schemas/CreateExternalLink"}]}}}},"responses":{"201":{"description":"Success","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/AppLink"},{"$ref":"#/components/schemas/ExternalLink"}]}}}},"400":{"description":"Invalid request.  The request cannot be processed","content":{"application/json":{"schema":{"$ref":"#/components/responses/BadRequestError/content/application~1json/schema"}}}},"401":{"description":"Access denied","content":{"application/json":{"schema":{"$ref":"#/components/responses/BadRequestError/content/application~1json/schema"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/responses/BadRequestError/content/application~1json/schema"}}}},"404":{"description":"Resource not found","content":{"application/json":{"schema":{"$ref":"#/components/responses/BadRequestError/content/application~1json/schema"}}}},"422":{"description":"Unprocessable request.  The request cannot be processed","content":{"application/json":{"schema":{"$ref":"#/components/responses/BadRequestError/content/application~1json/schema"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/responses/BadRequestError/content/application~1json/schema"}}}}}},"get":{"tags":["Links"],"summary":"Get links","description":"Gets all links with pagination for authenticated tenant. Callers should use `limit` and `startKey` to control the page returned. `startKey` should be set to each page's `nextKey` value in order to fetch the next set of results. Callers can hide links from view by setting `isArchived` to `true` and querying with filter `archived` = `false`","parameters":[{"schema":{"type":"string"},"required":true,"description":"Request results to start at the record represented by this key.  You can page through a dataset by making requests, setting `startKey` to the `nextKey` value provided in the last response.","name":"startKey","in":"query"},{"schema":{"type":"string"},"required":true,"description":"Set the response to be paged, and limit by this number of results.  If not provided, a default limit (usually 100) will be used","name":"limit","in":"query"},{"schema":{"type":"boolean","description":"Filter the results by archived status. If not provided, all link records will be returned."},"required":false,"description":"Filter the results by archived status. If not provided, all link records will be returned.","name":"archived","in":"query"}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"anyOf":[{"$ref":"#/components/schemas/AppLink"},{"$ref":"#/components/schemas/ExternalLink"}]}},"page":{"type":"object","properties":{"limit":{"type":"number","description":"The limit used in the request"},"count":{"type":"number","description":"Total number of records in the current page"},"startKey":{"type":"string","description":"A value representing the record at the start of the page.  Do not use this value for any purpose other than paging."},"nextKey":{"type":"string","description":"A value representing the record at the start of the next page.  Use this as the `startKey` in another request.  Do not use this value for any purpose other than paging."}},"required":["limit","count","startKey","nextKey"]}},"required":["items","page"]}}}},"400":{"description":"Invalid request.  The request cannot be processed","content":{"application/json":{"schema":{"$ref":"#/components/responses/BadRequestError/content/application~1json/schema"}}}},"401":{"description":"Access denied","content":{"application/json":{"schema":{"$ref":"#/components/responses/BadRequestError/content/application~1json/schema"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/responses/BadRequestError/content/application~1json/schema"}}}},"404":{"description":"Resource not found","content":{"application/json":{"schema":{"$ref":"#/components/responses/BadRequestError/content/application~1json/schema"}}}},"422":{"description":"Unprocessable request.  The request cannot be processed","content":{"application/json":{"schema":{"$ref":"#/components/responses/BadRequestError/content/application~1json/schema"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/responses/BadRequestError/content/application~1json/schema"}}}}}}},"/links/:id":{"put":{"tags":["Links"],"summary":"Update link by ID","description":"Updates a link for the authenticated tenant. Callers should use the short link ID to key the link to be modified","requestBody":{"content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/UpdateAppLink"},{"$ref":"#/components/schemas/UpdateExternalLink"}]}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/AppLink"},{"$ref":"#/components/schemas/ExternalLink"}]}}}},"400":{"description":"Invalid request.  The request cannot be processed","content":{"application/json":{"schema":{"$ref":"#/components/responses/BadRequestError/content/application~1json/schema"}}}},"401":{"description":"Access denied","content":{"application/json":{"schema":{"$ref":"#/components/responses/BadRequestError/content/application~1json/schema"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/responses/BadRequestError/content/application~1json/schema"}}}},"404":{"description":"Resource not found","content":{"application/json":{"schema":{"$ref":"#/components/responses/BadRequestError/content/application~1json/schema"}}}},"422":{"description":"Unprocessable request.  The request cannot be processed","content":{"application/json":{"schema":{"$ref":"#/components/responses/BadRequestError/content/application~1json/schema"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/responses/BadRequestError/content/application~1json/schema"}}}}}},"get":{"tags":["Links"],"summary":"Get link by ID","description":"Gets link by short link id for authenticated tenant, returning link resource","parameters":[{"schema":{"type":"string","description":"Short Link ID"},"required":true,"description":"Short Link ID","name":"id","in":"path"}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/AppLink"},{"$ref":"#/components/schemas/ExternalLink"}]}}}},"400":{"description":"Invalid request.  The request cannot be processed","content":{"application/json":{"schema":{"$ref":"#/components/responses/BadRequestError/content/application~1json/schema"}}}},"401":{"description":"Access denied","content":{"application/json":{"schema":{"$ref":"#/components/responses/BadRequestError/content/application~1json/schema"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/responses/BadRequestError/content/application~1json/schema"}}}},"404":{"description":"Resource not found","content":{"application/json":{"schema":{"$ref":"#/components/responses/BadRequestError/content/application~1json/schema"}}}},"422":{"description":"Unprocessable request.  The request cannot be processed","content":{"application/json":{"schema":{"$ref":"#/components/responses/BadRequestError/content/application~1json/schema"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/responses/BadRequestError/content/application~1json/schema"}}}}}},"delete":{"tags":["Links"],"summary":"Delete link by ID","description":"Deletes a link by ID for authenticated tenant. Deletion will perform a hard delete (erasure).","parameters":[{"schema":{"type":"string","description":"Short Link ID"},"required":true,"description":"Short Link ID","name":"id","in":"path"}],"responses":{"204":{"description":"Success"},"400":{"description":"Invalid request.  The request cannot be processed","content":{"application/json":{"schema":{"$ref":"#/components/responses/BadRequestError/content/application~1json/schema"}}}},"401":{"description":"Access denied","content":{"application/json":{"schema":{"$ref":"#/components/responses/BadRequestError/content/application~1json/schema"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/responses/BadRequestError/content/application~1json/schema"}}}},"404":{"description":"Resource not found","content":{"application/json":{"schema":{"$ref":"#/components/responses/BadRequestError/content/application~1json/schema"}}}},"422":{"description":"Unprocessable request.  The request cannot be processed","content":{"application/json":{"schema":{"$ref":"#/components/responses/BadRequestError/content/application~1json/schema"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/responses/BadRequestError/content/application~1json/schema"}}}}}}}},"components":{"parameters":{},"headers":{"x-api-version12":{"name":"x-api-version","required":false,"in":"header","description":"The behaviour of this path is versioned via the `x-api-version` header.  The version should be an integer number as a string, eg `'2'`.\nFor this endpoint, the supported values are:\n- '1' ... '11': deprecated behaviour (default)\n- '12' or higher: current behaviour as described here\n","schema":{"type":"number"}},"x-api-version11":{"name":"x-api-version","required":false,"in":"header","description":"The behaviour of this path is versioned via the `x-api-version` header.  The version should be an integer number as a string, eg `'2'`.\nFor this endpoint, the supported values are:\n- '1' ... '10': deprecated behaviour (default)\n- '11' or higher: current behaviour as described here\n","schema":{"type":"number"}},"x-api-version10":{"name":"x-api-version","required":false,"in":"header","description":"The behaviour of this path is versioned via the `x-api-version` header.  The version should be an integer number as a string, eg `'2'`.\nFor this endpoint, the supported values are:\n- '1' ... '9': deprecated behaviour (default)\n- '10' or higher: current behaviour as described here\n","schema":{"type":"number"}},"x-api-version9":{"name":"x-api-version","required":false,"in":"header","description":"The behaviour of this path is versioned via the `x-api-version` header.  The version should be an integer number as a string, eg `'2'`.\nFor this endpoint, the supported values are:\n- '1' ... '8': deprecated behaviour (default)\n- '9' or higher: current behaviour as described here\n","schema":{"type":"number"}},"x-api-version8":{"name":"x-api-version","required":false,"in":"header","description":"The behaviour of this path is versioned via the `x-api-version` header.  The version should be an integer number as a string, eg `'2'`.\nFor this endpoint, the supported values are:\n- '1' ... '7': deprecated behaviour (default)\n- '8' or higher: current behaviour as described here\n","schema":{"type":"number"}},"x-api-version7":{"name":"x-api-version","required":false,"in":"header","description":"The behaviour of this path is versioned via the `x-api-version` header.  The version should be an integer number as a string, eg `'2'`.\nFor this endpoint, the supported values are:\n- '1' ... '6': deprecated behaviour (default)\n- '7' or higher: current behaviour as described here\n","schema":{"type":"number"}},"x-api-version6":{"name":"x-api-version","required":false,"in":"header","description":"The behaviour of this path is versioned via the `x-api-version` header.  The version should be an integer number as a string, eg `'2'`.\nFor this endpoint, the supported values are:\n- '1' ... '5': deprecated behaviour (default)\n- '6' or higher: current behaviour as described here\n","schema":{"type":"number"}},"x-api-version5":{"name":"x-api-version","required":false,"in":"header","description":"The behaviour of this path is versioned via the `x-api-version` header.  The version should be an integer number as a string, eg `'2'`.\nFor this endpoint, the supported values are:\n- '1' ... '4': deprecated behaviour (default)\n- '5' or higher: current behaviour as described here\n","schema":{"type":"number"}},"x-api-version4":{"name":"x-api-version","required":false,"in":"header","description":"The behaviour of this path is versioned via the `x-api-version` header.  The version should be an integer number as a string, eg `'2'`.\nFor this endpoint, the supported values are:\n- '1', '2', '3': deprecated behaviour (default)\n- '4' or higher: current behaviour as described here\n","schema":{"type":"number"}},"x-api-version3":{"name":"x-api-version","required":false,"in":"header","description":"The behaviour of this path is versioned via the `x-api-version` header.  The version should be an integer number as a string, eg `'2'`.\nFor this endpoint, the supported values are:\n- '1', '2': deprecated behaviour (default)\n- '3' or higher: current behaviour as described here\n","schema":{"type":"number"}},"x-api-version2":{"name":"x-api-version","required":false,"in":"header","description":"The behaviour of this path is versioned via the `x-api-version` header.  The version should be an integer number as a string, eg `'2'`.\nFor this endpoint, the supported values are:\n- '1': not supported any longer\n- '2' or higher: current behaviour as described here\n\nIf missing, the default value is '1' which is no longer support by this endpoint.  You must set the header to '2' or higher.\n","schema":{"type":"number"}},"x-client-platform":{"name":"x-client-platform","required":false,"in":"header","description":"Identifies the platform type of the caller.\n","schema":{"type":"string","enum":["ANDROID","IOS"]}},"x-auth-id":{"name":"x-auth-id","required":false,"in":"header","description":"This header is required if you are using `bearer-auth-token` auth method.\nSpecifies the identity environment for managing users.  Currently there is only one environment, which is the beta console.\nFor beta console client api calls, `x-auth-id` should be `platform-beta-adb75`\n","schema":{"type":"string"}},"x-application-id":{"name":"x-application-id","required":false,"in":"header","description":"This header is required if you are using `auth-token` auth method.\nIdentifier that specifies the tenant.\n","schema":{"type":"string"}},"x-pepper-req-nonce":{"name":"x-pepper-req-nonce","required":false,"in":"header","description":"This call requires a nonce in this header to prevent duplicate processing of calls.  The nonce value represents an individual call.\nIt should be set to a guid.  Each new call should have a new guid.  In the rare occasion you want to repeat a call, use the original guid value.\n","schema":{"type":"string"}}},"securitySchemes":{"basic":{"type":"http","description":"Basic authentication is only used for App user login with a user name and password.  See `GET /users/login` in the Platform API for details.\nAuthenticate using basic http authentication, namely a `Basic` authorization header containing a base64 encoded user name and password.\n","in":"header","name":"Authorization","scheme":"Basic"},"auth-token":{"type":"apiKey","description":"Standard authentication for a user call to the API using a token retrieved by `GET /users/login`.\nFor example: `Authorization: Token 5ba0cd14a7a81c229332f134`\nRefer to the description under user login in the Platform API reference to see how to retrieve the authorization token for a user.\n","in":"header","name":"Authorization","scheme":"Token"},"x-service-auth-token":{"type":"apiKey","description":"Calls must be secured using a `x-service-auth-token` authorization header.\nThis auth method is for internal use only.\n","in":"header","name":"x-service-auth-token"},"bearer-auth-token":{"type":"apiKey","description":"This authentication method is used for web users only. All calls must be secured using a `Bearer` authorization header.\nYou must also set the `x-auth-id` header.\nRefer to the description under `POST /tokens` (under User API reference) to see how to retrieve the authorization token for a user.\n","in":"header","name":"Authorization","scheme":"Bearer","bearerFormat":"Decode using Pepper auth package"}},"schemas":{"AppLink":{"type":"object","properties":{"shortLinkId":{"type":"string","description":"Short link identifier and record identifier"},"tenantId":{"type":"string","description":"Tenant of whom the link is associated with"},"utmCampaign":{"type":"string","description":"UTM campaign parameter"},"utmSource":{"type":"string","description":"UTM source parameter"},"utmContent":{"type":"string","description":"UTM content parameter"},"utmMedium":{"type":"string","description":"UTM medium parameter"},"utmTerm":{"type":"string","description":"UTM term parameter"},"internalTitle":{"type":"string","description":"Internal title for the link"},"isActive":{"type":"boolean","description":"Whether the link is active. A link that is active will redirect users to the given locations. An inactive link will return an error when visiting the short link URL"},"isArchived":{"type":"boolean","description":"Whether the link should be hidden from view. A link that is still active but archived will continue to function, but not show when fetching links by page filtered by archived status"},"updatedAt":{"type":"string","description":"UTC ISO formatted date of when the link was last updated"},"createdAt":{"type":"string","description":"UTC ISO formatted date of when the link was created"},"customQueryParameters":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","pattern":"^[a-zA-Z][a-zA-Z0-9_-]{0,15}$","description":"Query parameter key. Must not conflict with `utm_source`, `utm_medium`, `utm_campaign`, `utm_content`, `utm_term`, `referrer`, `pt`, `ct`, `id`, `data`"},"value":{"type":"string","minLength":1,"maxLength":100}},"required":["key","value"]},"maxItems":5},"type":{"type":"string","enum":["APP_LINK"],"description":"Type of link - open app if available/installation store"},"androidCustomUrl":{"type":"string","description":"Custom URL redirect for Android instead of Play Store/fallbackUrl"},"iosCustomUrl":{"type":"string","description":"Custom URL redirect for iOS instead of App Store/fallbackUrl"},"fallbackUrl":{"type":"string","description":"URL for directing users clicking on app links as a desktop user"}},"required":["shortLinkId","tenantId","internalTitle","isActive","isArchived","updatedAt","createdAt","type","fallbackUrl"]},"ExternalLink":{"type":"object","properties":{"shortLinkId":{"type":"string","description":"Short link identifier and record identifier"},"tenantId":{"type":"string","description":"Tenant of whom the link is associated with"},"utmCampaign":{"type":"string","description":"UTM campaign parameter"},"utmSource":{"type":"string","description":"UTM source parameter"},"utmContent":{"type":"string","description":"UTM content parameter"},"utmMedium":{"type":"string","description":"UTM medium parameter"},"utmTerm":{"type":"string","description":"UTM term parameter"},"internalTitle":{"type":"string","description":"Internal title for the link"},"isActive":{"type":"boolean","description":"Whether the link is active. A link that is active will redirect users to the given locations. An inactive link will return an error when visiting the short link URL"},"isArchived":{"type":"boolean","description":"Whether the link should be hidden from view. A link that is still active but archived will continue to function, but not show when fetching links by page filtered by archived status"},"updatedAt":{"type":"string","description":"UTC ISO formatted date of when the link was last updated"},"createdAt":{"type":"string","description":"UTC ISO formatted date of when the link was created"},"customQueryParameters":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","pattern":"^[a-zA-Z][a-zA-Z0-9_-]{0,15}$","description":"Query parameter key. Must not conflict with `utm_source`, `utm_medium`, `utm_campaign`, `utm_content`, `utm_term`, `referrer`, `pt`, `ct`, `id`, `data`"},"value":{"type":"string","minLength":1,"maxLength":100}},"required":["key","value"]},"maxItems":5},"type":{"type":"string","enum":["EXTERNAL_LINK"],"description":"Type of link - externally redirecting to the web app domain."},"fallbackUrl":{"type":"string","description":"URL fallback for when web client is not enabled."},"customPath":{"type":"string","description":"Optional path on web app domain to navigate to"}},"required":["shortLinkId","tenantId","internalTitle","isActive","isArchived","updatedAt","createdAt","type"]},"CreateAppLink":{"type":"object","properties":{"utmCampaign":{"type":"string","description":"UTM campaign parameter"},"utmSource":{"type":"string","description":"UTM source parameter"},"utmContent":{"type":"string","description":"UTM content parameter"},"utmMedium":{"type":"string","description":"UTM medium parameter"},"utmTerm":{"type":"string","description":"UTM term parameter"},"internalTitle":{"type":"string","description":"Internal title for the link"},"customQueryParameters":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","pattern":"^[a-zA-Z][a-zA-Z0-9_-]{0,15}$","description":"Query parameter key. Must not conflict with `utm_source`, `utm_medium`, `utm_campaign`, `utm_content`, `utm_term`, `referrer`, `pt`, `ct`, `id`, `data`"},"value":{"type":"string","minLength":1,"maxLength":100}},"required":["key","value"]},"maxItems":5},"type":{"type":"string","enum":["APP_LINK"],"description":"Type of link - open app if available/installation store"},"androidCustomUrl":{"type":"string","description":"Custom URL redirect for Android instead of Play Store/fallbackUrl"},"iosCustomUrl":{"type":"string","description":"Custom URL redirect for iOS instead of App Store/fallbackUrl"},"fallbackUrl":{"type":"string","description":"URL for directing users clicking on app links as a desktop user"}},"required":["internalTitle","type","fallbackUrl"]},"CreateExternalLink":{"type":"object","properties":{"utmCampaign":{"type":"string","description":"UTM campaign parameter"},"utmSource":{"type":"string","description":"UTM source parameter"},"utmContent":{"type":"string","description":"UTM content parameter"},"utmMedium":{"type":"string","description":"UTM medium parameter"},"utmTerm":{"type":"string","description":"UTM term parameter"},"internalTitle":{"type":"string","description":"Internal title for the link"},"customQueryParameters":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","pattern":"^[a-zA-Z][a-zA-Z0-9_-]{0,15}$","description":"Query parameter key. Must not conflict with `utm_source`, `utm_medium`, `utm_campaign`, `utm_content`, `utm_term`, `referrer`, `pt`, `ct`, `id`, `data`"},"value":{"type":"string","minLength":1,"maxLength":100}},"required":["key","value"]},"maxItems":5},"type":{"type":"string","enum":["EXTERNAL_LINK"],"description":"Type of link - externally redirecting to the web app domain."},"fallbackUrl":{"type":"string","description":"URL fallback for when web client is not enabled."},"customPath":{"type":"string","description":"Optional path on web app domain to navigate to"}},"required":["internalTitle","type"]},"UpdateAppLink":{"type":"object","properties":{"isActive":{"type":"boolean","description":"Whether the link is active. A link that is active will redirect users to the given locations. An inactive link will return an error when visiting the short link URL"},"internalTitle":{"type":"string","description":"Internal title for the link"},"isArchived":{"type":"boolean","description":"Whether the link should be hidden from view. A link that is still active but archived will continue to function, but not show when fetching links by page filtered by archived status"},"customQueryParameters":{"type":"array","nullable":true,"items":{"type":"object","properties":{"key":{"type":"string","pattern":"^[a-zA-Z][a-zA-Z0-9_-]{0,15}$","description":"Query parameter key. Must not conflict with `utm_source`, `utm_medium`, `utm_campaign`, `utm_content`, `utm_term`, `referrer`, `pt`, `ct`, `id`, `data`"},"value":{"type":"string","minLength":1,"maxLength":100}},"required":["key","value"]},"maxItems":5},"androidCustomUrl":{"type":"string","nullable":true,"description":"Custom URL redirect for Android instead of Play Store/fallbackUrl"},"iosCustomUrl":{"type":"string","nullable":true,"description":"Custom URL redirect for iOS instead of App Store/fallbackUrl"},"fallbackUrl":{"type":"string","description":"URL for directing users clicking on app links as a desktop user"}}},"UpdateExternalLink":{"type":"object","properties":{"isActive":{"type":"boolean","description":"Whether the link is active. A link that is active will redirect users to the given locations. An inactive link will return an error when visiting the short link URL"},"internalTitle":{"type":"string","description":"Internal title for the link"},"isArchived":{"type":"boolean","description":"Whether the link should be hidden from view. A link that is still active but archived will continue to function, but not show when fetching links by page filtered by archived status"},"customQueryParameters":{"type":"array","nullable":true,"items":{"type":"object","properties":{"key":{"type":"string","pattern":"^[a-zA-Z][a-zA-Z0-9_-]{0,15}$","description":"Query parameter key. Must not conflict with `utm_source`, `utm_medium`, `utm_campaign`, `utm_content`, `utm_term`, `referrer`, `pt`, `ct`, `id`, `data`"},"value":{"type":"string","minLength":1,"maxLength":100}},"required":["key","value"]},"maxItems":5},"fallbackUrl":{"type":"string","nullable":true,"description":"URL fallback for when web client is not enabled."},"customPath":{"type":"string","nullable":true,"description":"Optional path on web app domain to navigate to"}}}},"responses":{"ResourceCreated":{"description":"Created successfully"},"ResourceUpdated":{"description":"Updated successfully"},"ResourceFound":{"description":"Resource found"},"ResourceDeleted":{"description":"Deleted successfully"},"ResourceNotFoundError":{"description":"Resource not found","content":{"application/json":{"schema":{"$ref":"#/components/responses/BadRequestError/content/application~1json/schema"}}}},"InternalServerError":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/responses/BadRequestError/content/application~1json/schema"}}}},"UnauthorizedError":{"description":"Access denied","content":{"application/json":{"schema":{"$ref":"#/components/responses/BadRequestError/content/application~1json/schema"}}}},"InvalidRequestError":{"description":"Unprocessable request.  The request cannot be processed","content":{"application/json":{"schema":{"$ref":"#/components/responses/BadRequestError/content/application~1json/schema"}}}},"BadRequestError":{"description":"Invalid request.  The request cannot be processed","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string","description":"The internal error code.  This is used by us to identify the cause."},"message":{"type":"string","description":"A description of the error that has occurred."}}}}}}}}}