info:
  contact:
    name: Rewards
    url: https://www.mx.com/products/platform-api
  description: >-
    The MX Platform API is a powerful, fully-featured API designed to make
    aggregating and enhancing financial data easy and reliable. It can
    seamlessly connect your app or website to tens of thousands of financial
    institutions.
  title: Rewards
  version: '1.0'
openapi: 3.0.0
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
    basicAuth:
      scheme: basic
      type: http
  schemas:
    Account:
      type: object
      properties:
        account_number:
          type: string
          example: '1234567890'
        apr:
          type: number
          example: null
        apy:
          type: number
          example: null
        available_balance:
          type: number
          example: 1000
        available_credit:
          type: number
          example: null
        balance:
          type: number
          example: 1000
        cash_balance:
          type: number
          example: null
        cash_surrender_value:
          type: number
          example: null
        created_at:
          type: string
          format: date-time
          example: '2019-06-07T21:16:01Z'
        credit_card_product_guid:
          type: string
          example: CCA-b5bcd822-6d01-4e23-b8d6-846a225e714a
        credit_limit:
          type: number
          example: null
        currency_code:
          type: string
          example: null
        current_reward_level:
          type: string
          example: null
        day_payment_is_due:
          type: integer
          example: null
        death_benefit:
          type: number
          example: null
        enrolled_in_rewards_on:
          type: string
          format: date
          example: '2019-06-07'
        guid:
          type: string
          example: ACT-481fa472-bb3e-47b5-954d-1cd296261d5d
        holdings_value:
          type: number
          example: null
        institution_code:
          type: string
          example: mxbank
        interest_rate:
          type: number
          example: null
        is_closed:
          type: boolean
          example: false
        last_payment:
          type: number
          example: null
        last_payment_at:
          type: string
          example: null
        loan_amount:
          type: number
          example: null
        matures_on:
          type: string
          example: null
        member_guid:
          type: string
          example: MBR-a4652b66-3ee5-cb9f-295a-72eddef61db5
        minimum_balance:
          type: number
          example: null
        minimum_payment:
          type: number
          example: null
        name:
          type: string
          example: Test Account 3
        next_reward_level:
          type: string
          example: null
        original_balance:
          type: number
          example: null
        payment_due_at:
          type: string
          example: null
        payoff_balance:
          type: number
          example: null
        primary_reward_unit:
          type: string
          example: null
        started_on:
          type: string
          example: null
        subtype:
          type: string
          example: null
        total_account_value:
          type: number
          example: null
        type:
          type: string
          example: INVESTMENT
        updated_at:
          type: string
          format: date-time
          example: '2019-06-07T21:16:01Z'
        user_guid:
          type: string
          example: USR-72aba5cc-8c74-b22c-227c-4b1c095fa12e
    RewardsResponse:
      properties:
        account_guid:
          example: ACT-1234
          type: string
        balance_type:
          example: EXPIRING_BALANCE
          type: string
        balance:
          example: 102
          type: integer
        created_at:
          example: 2020-01-28T21:09:01+0000
          type: string
        description:
          example: A description of the reward.
          type: string
        expires_on:
          example: 2020-02-28T00:00:00.000Z
          type: string
        guid:
          example: RWD-1234
          type: string
        member_guid:
          example: MBR-4567
          type: string
        unit_type:
          example: POINTS
          type: string
        user_guid:
          example: USR-1234
          type: string
    RewardsResponseBody:
      properties:
        rewards:
          items:
            $ref: '#/components/schemas/RewardsResponse'
          type: array
        pagination:
          $ref: '#/components/schemas/PaginationResponse'
      type: object
    RewardResponse:
      properties:
        account_guid:
          example: ACT-1234
          type: string
        balance_type:
          example: EXPIRING_BALANCE
          type: string
        balance:
          example: 102
          type: integer
        created_at:
          example: 2020-01-28T21:09:01+0000
          type: string
        description:
          example: A description of the reward.
          type: string
        expires_on:
          example: 2020-02-28T00:00:00.000Z
          type: string
        guid:
          example: RWD-1234
          type: string
        member_guid:
          example: MBR-4567
          type: string
        unit_type:
          example: POINTS
          type: string
        user_guid:
          example: USR-1234
          type: string
    RewardResponseBody:
      properties:
        reward:
          $ref: '#/components/schemas/RewardResponse'
      type: object
    CreditCardProduct:
      properties:
        annual_fee:
          example: 45
        duration_of_introductory_rate_on_balance_transfer:
          example: null
        duration_of_introductory_rate_on_purchases:
          example: null
        guid:
          example: CCA-b5bcd822-6d01-4e23-b8d6-846a225e714a
        has_cashback_rewards:
          example: false
          type: boolean
        has_other_rewards:
          example: true
          type: boolean
        has_travel_rewards:
          example: true
          type: boolean
        has_zero_introductory_annual_fee:
          example: true
          type: boolean
        has_zero_percent_introductory_rate:
          example: false
          type: boolean
        has_zero_percent_introductory_rate_on_balance_transfer:
          example: true
          type: boolean
        financial_institution:
          example: true
          type: boolean
        is_accepting_applications:
          example: true
          type: boolean
        is_small_business_card:
          example: true
          type: boolean
        name:
          example: Chase Credit Card
          type: string
    CreditCardProductResponse:
      properties:
        reward:
          $ref: '#/components/schemas/CreditCardProduct'
      type: object
    MemberResponse:
      properties:
        aggregated_at:
          example: '2016-10-13T18:07:57.000Z'
          nullable: true
          type: string
        background_aggregation_is_disabled:
          example: false
          type: boolean
        connection_status:
          example: CONNECTED
          nullable: true
          type: string
        guid:
          example: MBR-7c6f361b-e582-15b6-60c0-358f12466b4b
          nullable: true
          type: string
        id:
          example: unique_id
          nullable: true
          type: string
        institution_code:
          example: chase
          nullable: true
          type: string
        is_being_aggregated:
          example: false
          nullable: true
          type: boolean
        is_managed_by_user:
          example: false
          nullable: true
          type: boolean
        is_oauth:
          example: false
          nullable: true
          type: boolean
        metadata:
          example: '\"credentials_last_refreshed_at\": \"2015-10-15\"'
          nullable: true
          type: string
        name:
          example: Chase Bank
          nullable: true
          type: string
        oauth_window_uri:
          example: >-
            https://mxbank.mx.com/oauth/authorize?client_id=b8OikQ4Ep3NuSUrQ13DdvFuwpNx-qqoAsJDVAQCyLkQ&redirect_uri=https%3A%2F%2Fint-app.moneydesktop.com%2Foauth%2Fredirect_from&response_type=code&scope=openid&state=d745bd4ee6f0f9c184757f574bcc2df2
          nullable: true
          type: string
        successfully_aggregated_at:
          example: '2016-10-13T17:57:38.000Z'
          nullable: true
          type: string
        user_guid:
          example: USR-fa7537f3-48aa-a683-a02a-b18940482f54
          nullable: true
          type: string
        user_id:
          example: user123
          nullable: true
          type: string
      type: object
    MemberResponseBody:
      properties:
        member:
          $ref: '#/components/schemas/MemberResponse'
      type: object
    PaginationResponse:
      properties:
        current_page:
          example: 1
          type: integer
        per_page:
          example: 25
          type: integer
        total_entries:
          example: 1
          type: integer
        total_pages:
          example: 1
          type: integer
      type: object
paths:
  /users/{user_guid}/members/{member_guid}/fetch_rewards:
    post:
      description: >-
        Calling this endpoint initiates an aggregation-type event which will
        gather the member's rewards information, as well as account and
        transaction information. Rewards data is also gathered with daily
        background aggregations.
      operationId: fetchRewards
      parameters:
        - description: The unique id for a `user`.
          example: USR-fa7537f3-48aa-a683-a02a-b18940482f54
          in: path
          name: user_guid
          required: true
          schema:
            type: string
        - description: The unique identifier for the member. Defined by MX.
          example: MBR-fa7537f3-48aa-a683-a02a-b18345562f54
          in: path
          name: member_guid
          required: true
          schema:
            type: string
      responses:
        '200':
          content:
            application/vnd.mx.api.v1beta+json:
              schema:
                $ref: '#/components/schemas/MemberResponseBody'
          description: OK
      summary: Fetch Rewards
      tags:
        - rewards
  /users/{user_guid}/members/{member_guid}/rewards:
    get:
      description: >-
        Use this endpoint to list all the `rewards` associated with a specified
        `member`.
      operationId: listRewards
      parameters:
        - description: The unique id for a `user`.
          example: USR-fa7537f3-48aa-a683-a02a-b18940482f54
          in: path
          name: user_guid
          required: true
          schema:
            type: string
        - description: The unique identifier for the member. Defined by MX.
          example: MBR-fa7537f3-48aa-a683-a02a-b18345562f54
          in: path
          name: member_guid
          required: true
          schema:
            type: string
      responses:
        '200':
          content:
            'Accept: application/vnd.mx.api.v1beta+json':
              schema:
                $ref: '#/components/schemas/RewardsResponseBody'
          description: OK
      summary: List Rewards
      tags:
        - rewards
  /users/{user_guid}/members/{member_guid}/rewards/{reward_guid}:
    get:
      description: Use this endpoint to read a specific `reward` based on its unique GUID..
      operationId: readRewards
      parameters:
        - description: The unique id for a `user`.
          example: USR-fa7537f3-48aa-a683-a02a-b18940482f54
          in: path
          name: user_guid
          required: true
          schema:
            type: string
        - description: The unique identifier for the member. Defined by MX.
          example: MBR-fa7537f3-48aa-a683-a02a-b18345562f54
          in: path
          name: member_guid
          required: true
          schema:
            type: string
        - description: The unique identifier for the rewards. Defined by MX.
          example: RWD-fa7537f3-48aa-a683-a02a-b324322f54
          in: path
          name: reward_guid
          required: true
          schema:
            type: string
      responses:
        '200':
          content:
            'Accept: application/vnd.mx.api.v1beta+json':
              schema:
                $ref: '#/components/schemas/RewardResponseBody'
          description: OK
      summary: Read Reward
      tags:
        - rewards
  /credit_card_products/{credit_card_product_guid}:
    get:
      description: >-
        This endpoint returns the specified `credit_card_product` according to
        the unique GUID.
      operationId: creditCard
      parameters:
        - description: >-
            The required `credit_card_product_guid` can be found on the
            `account` object.
          example: credit_card_product_guid
          in: path
          name: credit_card_product_guid
          required: true
          schema:
            type: string
      responses:
        '200':
          content:
            'Accept: application/vnd.mx.api.v1beta+json':
              schema:
                $ref: '#/components/schemas/CreditCardProductResponse'
          description: OK
      summary: Read a Credit Card Product
      tags:
        - rewards
  /users/{user_guid}/accounts/{account_guid}:
    get:
      summary: Read account
      description: >-
        An account represents a financial account held by a financial
        institution, like a user's checking or savings account. For more
        information on accounts, visit our Platform API Reference.  Five fields
        that are especially important for rewards and credit card products
        `credit_card_product_guid`, `enrolled_in_rewards_on`,
        `primary_reward_unit` `current_reward_level`, and `next_reward_level`.
        You must use the beta header in order for the account details endpoint
        to return rewards-related data after you have fetched it.
      parameters:
        - description: The unique id for an `account`.
          example: ACT-06d7f44b-caae-0f6e-1384-01f52e75dcb1
          in: path
          name: account_guid
          required: true
          schema:
            type: string
        - description: The unique id for a `user`.
          example: USR-fa7537f3-48aa-a683-a02a-b18940482f54
          in: path
          name: user_guid
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Successful response
          content:
            application/vnd.mx.api.v1beta+json:
              schema:
                $ref: '#/components/schemas/Account'
security:
  - basicAuth: []
servers:
  - url: https://int-api.mx.com
  - url: https://api.mx.com
