> ## Documentation Index
> Fetch the complete documentation index at: https://docs.thanx.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Get Account

> This endpoint allows the retrieval of a user account information, including the user's rewards.

### Parameters

<ParamField query="location_id" type="string" optional>
  Thanx Location UID. Providing this information allows Thanx to return rewards
  that can be used at this location.

  A mapping of Thanx location identifiers can be provided by the Thanx developer
  support team or fetched from the following endpoints depending on your integration type:

  * Consumer API [Get Locations](/consumer/locations/get-locations) endpoint.
  * Partner API [Get Locations](/partner/metadata/get-locations) endpoint.
</ParamField>

<ParamField query="redemption_venue" type="string" optional>
  Currently either `instore` or `online`, defaults to `online`. This is used to
  adjust which configured product IDs are returned in the applicable reward and
  points product entities.
</ParamField>

<ParamField query="reward_states" type="array" optional>
  Filter rewards by state. Valid values: `delivered`, `active`. Defaults to
  `delivered` if not provided. Multiple states can be specified to return
  rewards matching any of the specified states.
</ParamField>

### Response

<ResponseField name="id" type="string">
  The ID of user
</ResponseField>

<ResponseField name="email" type="string">
  The user's email
</ResponseField>

<ResponseField name="rewards" type="array(hash)">
  The user's rewards for the merchant specified in the header. This array can
  be empty.

  <Expandable title="rewards">
    <ResponseField name="id" type="string">
      The Reward Identifier
    </ResponseField>

    <ResponseField name="value" type="number">
      The value of the discount, present for 'amount' and 'percent' types
    </ResponseField>

    <ResponseField name="minimum" type="number">
      The minimum spend for this reward, if applicable
    </ResponseField>

    <ResponseField name="maximum" type="number">
      The maximum discount possible for this reward, if applicable
    </ResponseField>

    <ResponseField name="label" type="string">
      The reward description
    </ResponseField>

    <ResponseField name="state" type="enum">
      The state of the reward (`redeemable`, `unredeemable`)
    </ResponseField>

    <ResponseField name="type" type="enum">
      The type of reward (`amount`, `percent`, `item`)
    </ResponseField>

    <ResponseField name="products" type="array(string)">
      POS Identifiers for items this discount applies to, if applicable
    </ResponseField>

    <ResponseField name="fine_print" type="string">
      Any fine print for the reward.
    </ResponseField>

    <ResponseField name="retire_at" type="string">
      Time the reward will be automatically retired in ISO8601-format if a retire
      date is set
    </ResponseField>

    <ResponseField name="restriction_location_ids" type="array(string)">
      The list of locations the reward can be redeemed.
    </ResponseField>
  </Expandable>
</ResponseField>

<Note>
  For conditional rewards (e.g. BOGO / "buy X get Y"), `products` lists only the
  items the reward **discounts**, not the items required to **trigger** it, and
  there is no field distinguishing conditional from simple rewards. To confirm
  eligibility for these, send a `checkout` basket and read the returned
  `discount`. Some rewards may also return `type: fixed_price`.
</Note>

<Note>
  Reward IDs are not stable references — a reward leaves this list once it is
  used, expired, or retired. Pull a fresh `GET /account` immediately before
  submitting a basket and use the current `rewards[].id`; a stale ID returns a
  not-found error at `POST /baskets`.
</Note>

<ResponseField name="points_products" type="array(hash)">
  The merchant's configured points product available for online redemption.
  This array can be empty.

  <Expandable title="points_products">
    <ResponseField name="id" type="string">
      The points product ID
    </ResponseField>

    <ResponseField name="points_experience_id" type="string">
      The points experience ID
    </ResponseField>

    <ResponseField name="points" type="decimal">
      The amount of points of the given currency this points product costs
    </ResponseField>

    <ResponseField name="value" type="number">
      The value of the discount, present for 'amount' and 'percent' types
    </ResponseField>

    <ResponseField name="minimum" type="number">
      The minimum spend for the reward this points product can be exchanged
      for, if applicable.
    </ResponseField>

    <ResponseField name="maximum" type="number">
      The maximum discount possible for the reward this points product can be
      exchanged for, if applicable.
    </ResponseField>

    <ResponseField name="label" type="string">
      The description of the reward this points product can be exchanged for
    </ResponseField>

    <ResponseField name="state" type="enum">
      The state of the points product (`redeemable`, `unredeemable`). This will
      be `redeemable` if the user has enough points for this points product and
      `unredeemable` if the user does not have enough points for this points
      product.
    </ResponseField>

    <ResponseField name="type" type="enum">
      The type of reward (`amount`, `percent`, `item`) that this points product
      can be exchanged for.
    </ResponseField>

    <ResponseField name="products" type="array(string)">
      POS Identifiers for items the discount applies to, if applicable
    </ResponseField>

    <ResponseField name="fine_print" type="string">
      Any fine print for the reward this points product can be exchanged for.
    </ResponseField>

    <ResponseField name="restriction_location_ids" type="array(string)">
      The list of locations the points product can be redeemed.
    </ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="progress" type="hash">
  A user's progress toward their next loyalty reward

  <Note>Only present for merchants that have not yet upgraded to points</Note>

  <Expandable title="progress">
    <ResponseField name="percentage" type="integer">
      Percent progress toward the next loyalty reward
    </ResponseField>

    <ResponseField name="towards" type="string">
      Description of progress toward the next loyalty reward
    </ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="points" type="array">
  Array of information about the configured points experiences and the current
  user's balance at each

  <Note>Only present for merchants that have enabled points</Note>

  <Expandable title="points">
    <ResponseField name="points_experience_id" type="integer">
      ID of the points experience. This matches the IDs of the points
      experiences returned in
      [GET /points\_experiences](/consumer/points/get-experiences).
    </ResponseField>

    <ResponseField name="currency" type="hash">
      <Expandable title="currency">
        <ResponseField name="name" type="string">
          The points experience's currency name
        </ResponseField>

        <ResponseField name="plural" type="string">
          The plural tense of the points experience's currency name
        </ResponseField>
      </Expandable>
    </ResponseField>

    <ResponseField name="balance" type="decimal">
      The user's current currency balance of the points experience
    </ResponseField>
  </Expandable>
</ResponseField>

<RequestExample>
  ```bash theme={null}
  curl https://loyalty.thanxsandbox.com/api/account \
    -H "Authorization: Bearer ${token}" \
    -H "Content-Type: application/json" \
    -H "Accept: application/vnd.thanx-v1+json" \
    -H "Merchant-Key: ${merchant_key}" \
    -G \
    --data-urlencode "location_id=${location_id}" \
    --data-urlencode "redemption_venue=online" \
    --data-urlencode "reward_states[]=delivered" \
    --data-urlencode "reward_states[]=active"
  ```
</RequestExample>

<ResponseExample>
  ```json 200 theme={null}
  {
    "id": "wer23gtTT",
    "email": "john.smith@example.com.com",
    "rewards": [
      {
        "id": "gheTfR",
        "value": 10,
        "minimum": 20,
        "maximum": 20,
        "label": "A free hamburger",
        "state": "redeemable",
        "type": "amount",
        "products": ["234234-23423423", "3458-345345"],
        "fine_print": "Reward fine print",
        "retire_at": "2020-05-01T20:00:00Z",
        "restriction_location_ids": ["a", "b"]
      }
    ],
    "points_products": [
      {
        "id": "9xw6543wh8jmde0",
        "points_experience_id": "590485d6f0",
        "points": 10,
        "value": 10,
        "minimum": 20,
        "maximum": 20,
        "label": "Onion rings",
        "state": "redeemable",
        "products": ["234234-23423423", "3458-345345"],
        "fine_print": "Points product fine print",
        "restriction_location_ids": ["a", "b"]
      }
    ],
    "progress": {
      "percentage": 20,
      "towards": "$5 off next purchase"
    },
    "points": [
      {
        "points_experience_id": "590485d6f0",
        "currency": {
          "name": "Star",
          "plural": "Stars"
        },
        "balance": 10.0
      }
    ]
  }
  ```

  ```bash 401 theme={null}
  {
    "code": 401,
    "message": "There was an error authenticating you."
  }
  ```
</ResponseExample>
