{
  "openapi": "3.1.0",
  "info": {
    "title": "Smile UI Object Schemas",
    "version": "1.0.0",
    "description": "Object schemas for Smile UI"
  },
  "components": {
    "schemas": {
      "Apierror": {
        "type": "object",
        "properties": {
          "status": {
            "type": "number",
            "description": "The HTTP status code from the API response, or `0` for network-level errors (e.g. the user is offline).",
            "example": 400
          },
          "message": {
            "type": "string",
            "description": "A human-readable error message describing what went wrong.",
            "example": "A points_to_spend value is required."
          },
          "requestId": {
            "type": "string",
            "description": "A unique identifier for the request, useful when contacting Smile's support team.",
            "example": "5b36eda6-1460-44c2-95cb-bd38755e5451"
          }
        },
        "required": []
      },
      "Activity": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "description": "Unique identifier for the activity.",
            "example": 503256787
          },
          "customer_id": {
            "type": "integer",
            "description": "The ID of the customer who performed the activity.",
            "example": 304169228
          },
          "token": {
            "type": "string",
            "description": "A token identifying the activity that was performed.",
            "example": "activity_f57a9b5a8d0ac5"
          },
          "properties": {
            "type": "object",
            "description": "An arbitrary hash of additional information related to the activity."
          },
          "distinct_id": {
            "type": "string",
            "description": "A unique identifier for the activity in the external system (e.g. the order number). When provided, it must be unique among activities with the same token. Creating a second activity with the same token and distinct_id will fail, preventing duplicates.",
            "example": "212993"
          },
          "created_on_origin_at": {
            "type": "string",
            "description": "The date and time the activity was performed by the customer in the external system. Defaults to the activity's `created_at` date when not explicitly specified.",
            "example": "2024-04-04T15:10:42.030Z",
            "format": "date-time"
          },
          "updated_on_origin_at": {
            "type": "string",
            "description": "The date and time the activity was last updated outside of Smile.",
            "example": "2024-04-04T15:10:42.030Z",
            "format": "date-time"
          },
          "created_at": {
            "type": "string",
            "description": "The date and time when the activity was created.",
            "example": "2024-05-15T08:35:08.920Z",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "description": "The date and time when the activity was last updated.",
            "example": "2024-05-15T08:35:08.920Z",
            "format": "date-time"
          }
        },
        "required": []
      },
      "PointsPurchase": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "description": "The unique identifier for the points purchase.",
            "example": 665523890
          },
          "points_product_id": {
            "type": "integer",
            "description": "The unique identifier of the points product that was purchased.",
            "example": 132456921
          },
          "points_spent": {
            "type": "integer",
            "description": "The total points spent by the customer.",
            "example": 500
          },
          "reward_fulfillment": {
            "$ref": "#/components/schemas/RewardFulfillment",
            "description": "The nesetd Reward Fulfillment object representing the reward issued to the customer when they purchased the points product."
          },
          "created_at": {
            "type": "string",
            "description": "Date and time at which the points purchase was created.",
            "format": "date-time",
            "example": "2024-12-07T20:15:27.893Z"
          },
          "updated_at": {
            "type": "string",
            "description": "Date and time at which the points purchase was updated.",
            "format": "date-time",
            "example": "2024-12-07T20:15:27.893Z"
          }
        },
        "required": []
      },
      "RewardFulfillment": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "description": "The unique identifier of the reward fulfillment.",
            "example": 625478984
          },
          "name": {
            "type": "string",
            "description": "The reward fulfillment's name.",
            "example": "$5 off coupon"
          },
          "code": {
            "type": "string",
            "description": "A unique code for the customer to use. This is commonly a discount code the customer applies at checkout on their next order, but it can be a unique code they use for other purposes like accessing an exclusive page on the merchant's website.",
            "example": "5off-e26d02e39149"
          },
          "fulfillment_status": {
            "type": "string",
            "enum": [
              "pending",
              "issued",
              "cancelled",
              "failed"
            ],
            "description": "The fulfillment status of the reward fulfillment, indicating whether the reward is available to the customer. Possible values: \n- `pending` - The reward fulfillment is pending issuance. \n- `issued` - The reward fulfillment has been issued to the customer. \n- `cancelled` - The reward fulfillment has been cancelled. \n- `failed` - The reward fulfillment has failed to be issued.",
            "example": "issued"
          },
          "expires_at": {
            "type": [
              "string",
              "null"
            ],
            "description": "Date and time at which the code associated with the reward fulfillment expires and is no longer valid. If empty, the code does not expire.",
            "format": "date-time",
            "example": "2025-06-07T23:59:59.999Z"
          },
          "image_url": {
            "type": "string",
            "description": "The reward fulfillment's image.",
            "example": "https://platform-images.smilecdn.co/9283449.png"
          },
          "used_at": {
            "type": [
              "string",
              "null"
            ],
            "description": "Date and time at which the reward fulfillment was used by the customer. This field will be blank if the reward fulfillment has not yet been used, or if it does not support usage tracking.",
            "format": "date-time",
            "example": null
          },
          "created_at": {
            "type": "string",
            "description": "Date and time at which the reward fulfillment was created.",
            "format": "date-time",
            "example": "2024-12-07T20:15:27.893Z"
          },
          "updated_at": {
            "type": "string",
            "description": "Date and time at which the reward fulfillment was updated.",
            "format": "date-time",
            "example": "2024-12-07T20:15:27.893Z"
          }
        },
        "required": []
      },
      "Reward": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "description": "Unique identifier for the reward.",
            "example": 924565472
          },
          "name": {
            "type": "string",
            "description": "The name of the reward.",
            "example": "Order discount"
          },
          "description": {
            "type": [
              "string",
              "null"
            ],
            "description": "A description of the reward.",
            "example": "Applies to one-time purchases."
          },
          "image_url": {
            "type": "string",
            "description": "An image for the reward.",
            "example": "https://platform-images.smilecdn.co/3755938.png"
          },
          "created_at": {
            "type": "string",
            "description": "The date and time when the reward was created.",
            "example": "2024-04-04T15:10:42.030Z",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "description": "The date and time when the reward was last updated.",
            "example": "2024-04-04T15:10:42.030Z",
            "format": "date-time"
          }
        },
        "required": []
      },
      "CustomerPointsProduct": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "description": "Name of the reward that the customer will receive when their points are redeemed.",
            "example": "$5 off coupon"
          },
          "points_price": {
            "type": "integer",
            "description": "Number of points needed to purchase this reward.",
            "example": "500"
          },
          "points_product": {
            "$ref": "#/components/schemas/PointsProduct",
            "description": "A nested Points Product object representing the points product that this reward is based on."
          }
        },
        "required": []
      },
      "PointsSetting": {
        "type": "object",
        "properties": {
          "points_label": {
            "type": "object",
            "description": "The branding of the account's points currency.",
            "properties": {
              "one": {
                "type": "string",
                "description": "The singular unit for a point.",
                "example": "Coin"
              },
              "other": {
                "type": "string",
                "description": "The unit for zero or many points.",
                "example": "Coins"
              }
            }
          }
        },
        "required": []
      },
      "PointsProduct": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "description": "Unique identifier for the points product."
          },
          "exchange_type": {
            "type": "string",
            "enum": [
              "fixed",
              "variable"
            ],
            "description": "How points are exchanged for the reward. Possible values: \n- `fixed` - Customer must spend a fixed amount of points for a predetermined reward value. \n- `variable` - Customer can spend a variable amount of points for a dynamic reward value.",
            "example": "variable"
          },
          "exchange_description": {
            "type": "string",
            "description": "A human readable description of how a customer spends points on this reward. It includes the points branding for the program.",
            "example": "100 Points = $1 off"
          },
          "points_price": {
            "type": [
              "integer",
              "null"
            ],
            "description": "Number of points needed to purchase this reward. Only present when `exchange_type` is `fixed`.",
            "example": null
          },
          "variable_points_step": {
            "type": [
              "integer",
              "null"
            ],
            "description": "Imagine there's a points slider your customers can drag to spend more or less points on a reward. The `variable_points_step` represents the number of points between each notch on the slider. E.g. If this value is set to 100, it means customers can spend their points in increments of 100. They will drag the slider from 100, 200, 300, etc. Only present when `exchange_type` is `variable`.",
            "example": 100
          },
          "variable_points_step_reward_value": {
            "type": [
              "integer",
              "null"
            ],
            "description": "Imagine there's a points slider your customers can drag to spend more or less points on a reward. The `variable_points_step_reward_value` represents the corresponding reward value for each step increment on the slider. E.g. if this value is set to 1, and the variable_points_step is set to 100, the customer will get $1 off for every 100 points they spend. Only present when `exchange_type` is `variable.`",
            "example": 1
          },
          "variable_points_min": {
            "type": [
              "integer",
              "null"
            ],
            "description": "The minimum amount of points the customer must spend to get this reward. Only present when `exchange_type` is `variable.`",
            "example": 100
          },
          "variable_points_max": {
            "type": [
              "integer",
              "null"
            ],
            "description": "The maximum amount of points the customer can spend on this reward. Only present when `exchange_type` is `variable.`",
            "example": 5000
          },
          "reward": {
            "$ref": "#/components/schemas/Reward",
            "description": "A nested Reward object representing the reward issued to the customer when they purchase the points product."
          },
          "created_at": {
            "type": "string",
            "description": "The date and time when the points product was created.",
            "format": "date-time",
            "example": "2024-04-04T15:10:42.030Z"
          },
          "updated_at": {
            "type": "string",
            "description": "The date and time when the points product was last updated.",
            "format": "date-time",
            "example": "2024-04-04T15:10:42.030Z"
          }
        },
        "required": []
      },
      "Customer": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "description": "Unique identifier for the customer in Smile.",
            "example": 304169228
          },
          "first_name": {
            "type": "string",
            "description": "The customer's first name.",
            "example": "Jane"
          },
          "last_name": {
            "type": "string",
            "description": "The customer's last name.",
            "example": "Doe"
          },
          "email": {
            "type": "string",
            "description": "The customer's email address.",
            "example": "jane@doe.com"
          },
          "state": {
            "type": "string",
            "description": "The customer's state in the loyalty program. Possible values: \n- `candidate` - An individual that has not yet joined the loyalty program. Depending on program settings, they may or may not earn points. \n- `member` - An active loyalty program participant. \n- `disabled` - An individual that has been excluded from the program and cannot earn or redeem rewards.",
            "example": "member"
          },
          "date_of_birth": {
            "type": "string",
            "description": "The customer's birthday. A year value of `1004` means only the customer's birth day and month is available.",
            "example": "1004-05-27"
          },
          "points_balance": {
            "type": "integer",
            "description": "The customer's current points balance.",
            "example": 100
          },
          "referral_url": {
            "type": "string",
            "description": "The customer's unique referral URL. Used to share with friends as part of the referral program.",
            "example": "http://i.refs.cc/9qr5Pw"
          },
          "vip_tier": {
            "$ref": "#/components/schemas/VipTier",
            "description": "A nested VIP Tier object representing the customer's current VIP tier. \n\n**Note:** This object is not included by default and must be explicitly requested using the `include` parameter when [reloading the customer](/ui/resources/customers/reload-customer)."
          },
          "created_at": {
            "type": "string",
            "description": "The date and time when the customer was created.",
            "example": "2024-04-04T15:10:42.030Z",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "description": "The date and time when the customer was last updated.",
            "example": "2024-04-04T15:10:42.030Z",
            "format": "date-time"
          }
        },
        "required": []
      },
      "VipTier": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "description": "The unique identifier of the VIP tier.",
            "example": 426715799
          },
          "name": {
            "type": "string",
            "description": "The VIP tier's name.",
            "example": "Gold"
          },
          "image_url": {
            "type": "string",
            "description": "The VIP tier's image.",
            "example": "https://platform.smile.io/v1/images/vip_tiers/vip-tier-3.svg"
          }
        },
        "required": []
      }
    }
  }
}
