openapi: 3.0.0
paths:
  /analytics/affiliates:
    get:
      description: >-
        Returns the project affiliates with their totals for a period, oldest
        joiner first. Affiliates with no activity in the period are omitted.
        Note 1: this endpoint is only accessible with a secret API key. Note 2:
        a period may span at most 90 days; request a longer window a period at a
        time. Note 3: up to 100 affiliates are returned per request; page
        through the rest with `offset`.
      operationId: getAffiliateAnalytics
      parameters:
        - name: limit
          required: false
          in: query
          description: How many affiliates to return, from 10 to 100.
          schema:
            minimum: 10
            maximum: 100
            default: 100
            example: 100
            type: number
        - name: offset
          required: false
          in: query
          description: How many affiliates to skip before the page.
          schema:
            minimum: 0
            default: 0
            example: 0
            type: number
        - name: from
          required: true
          in: query
          description: The first day of the period, inclusive, as YYYY-MM-DD (UTC).
          schema:
            format: date
            example: '2026-01-01'
            type: string
        - name: to
          required: true
          in: query
          description: >-
            The last day of the period, inclusive, as YYYY-MM-DD (UTC). Must not
            be before `from`, and the period must be at most 90 days long.
          schema:
            format: date
            example: '2026-03-31'
            type: string
        - name: x-api-key
          in: header
          description: The secret API key.
          required: true
          schema:
            type: string
      responses:
        '200':
          description: The page of affiliates and their totals for the period.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AffiliateAnalyticsResponse'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorsResponse'
        '422':
          description: The request is invalid.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorsResponse'
        '429':
          description: The rate limit for this endpoint has been exceeded.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorsResponse'
      summary: Get Affiliate Analytics
      tags:
        - Analytics
  /codes/{code}:
    get:
      description: >-
        Resolves a code to its type (affiliate, promo or referral) and returns
        the relevant data for that type. Requires no app user id.
      operationId: getCode
      parameters:
        - name: code
          required: true
          in: path
          description: The code to look up.
          schema:
            type: string
        - name: x-api-key
          in: header
          required: true
          schema:
            type: string
          description: The API key to authenticate with.
      responses:
        '200':
          description: The resolved code.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CodeResponse'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorsResponse'
        '404':
          description: The code has not been found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorsResponse'
      summary: Get Code
      tags:
        - Codes
  /users/{app_user_id}/rewards/withdraw-credits:
    post:
      description: Withdraws credits from a user.
      operationId: withdrawCredits
      parameters:
        - name: app_user_id
          required: true
          in: path
          description: The app user id of the user to withdraw credits from.
          schema:
            type: string
        - name: x-api-key
          in: header
          required: true
          schema:
            type: string
          description: The API key to authenticate with.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UserWithdrawCreditsRequest'
      responses:
        '200':
          description: The result of the withdrawal of credits
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UserWithdrawCreditsResponse'
        '400':
          description: The request is invalid.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorsResponse'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorsResponse'
        '404':
          description: The user has not been found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorsResponse'
        '422':
          description: The request is invalid.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorsResponse'
      summary: Withdraw Credits
      tags:
        - Rewards Actions
  /users/{app_user_id}/rewards/grant:
    post:
      description: >-
        Grants a reward for a user. Note 1: currently only granting of credit
        rewards is supported. Note 2: this endpoint is only accessible with a
        secret API key.
      operationId: grantReward
      parameters:
        - name: app_user_id
          required: true
          in: path
          description: The app user id of the user to grant a reward to.
          schema:
            type: string
        - name: x-api-key
          in: header
          description: The secret API key.
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UserGrantRewardRequest'
      responses:
        '200':
          description: >-
            The reward has been already available for the user and cannot be
            granted again.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UserGrantRewardResponse'
        '201':
          description: The reward has been successfully granted.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UserGrantRewardResponse'
        '400':
          description: The request is invalid.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorsResponse'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorsResponse'
        '404':
          description: The user has not been found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorsResponse'
        '422':
          description: The request is invalid.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorsResponse'
      summary: Grant a Reward
      tags:
        - Rewards Actions
  /users:
    post:
      description: Create or update a user if already exists.
      operationId: createOrUpdateUser
      parameters:
        - name: x-api-key
          in: header
          required: true
          schema:
            type: string
          description: The API key to authenticate with.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UserCreateRequest'
      responses:
        '200':
          description: The user has been successfully updated.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UserResponse'
        '201':
          description: The user has been successfully created.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UserResponse'
        '400':
          description: The request is invalid.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorsResponse'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorsResponse'
        '422':
          description: The request is invalid.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorsResponse'
      summary: Create or Update User
      tags:
        - Users
  /users/{app_user_id}:
    get:
      description: Retrieves a user by their app user id.
      operationId: getUser
      parameters:
        - name: app_user_id
          required: true
          in: path
          description: The app user id of the user to retrieve.
          schema:
            type: string
        - name: x-api-key
          in: header
          required: true
          schema:
            type: string
          description: The API key to authenticate with.
      responses:
        '200':
          description: The user has been successfully retrieved.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UserResponse'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorsResponse'
        '404':
          description: The user has not been found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorsResponse'
      summary: Get User
      tags:
        - Users
  /users/{app_user_id}/affiliate-apply-link:
    post:
      description: >-
        Builds an affiliate apply link for the user, carrying a short-lived
        token so the affiliate they become is attributed back to them. Request
        it when the user asks to apply, rather than ahead of time.
      operationId: createAffiliateApplyLink
      parameters:
        - name: app_user_id
          required: true
          in: path
          description: The app user id of the user applying.
          schema:
            type: string
        - name: x-api-key
          in: header
          required: true
          schema:
            type: string
          description: The API key to authenticate with.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UserAffiliateApplyLinkRequest'
      responses:
        '200':
          description: The apply link has been successfully built.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UserAffiliateApplyLinkResponse'
        '400':
          description: The request is invalid.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorsResponse'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorsResponse'
        '403':
          description: >-
            The app does not take in-app affiliate applications, is not on a
            plan that includes them, or the user is already an affiliate.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorsResponse'
        '404':
          description: The user or the affiliate group has not been found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorsResponse'
      summary: Create Affiliate Apply Link
      tags:
        - Users
  /users/{app_user_id}/transactions/app-store:
    post:
      description: >-
        Registers the mapping between a user and their Apple
        originalTransactionId.
      operationId: registerAppStoreTransaction
      parameters:
        - name: app_user_id
          required: true
          in: path
          description: The app user id of the user.
          schema:
            type: string
        - name: x-api-key
          in: header
          required: true
          schema:
            type: string
          description: The API key to authenticate with.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UserRegisterAppStoreTransactionRequest'
      responses:
        '204':
          description: The transaction mapping has been registered.
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorsResponse'
        '404':
          description: The user has not been found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorsResponse'
      summary: Register App Store Transaction
      tags:
        - Users
  /users/{app_user_id}/transactions/google-play:
    post:
      description: >-
        Registers the mapping between a user and their Google Play
        purchaseToken.
      operationId: registerGooglePlayTransaction
      parameters:
        - name: app_user_id
          required: true
          in: path
          description: The app user id of the user.
          schema:
            type: string
        - name: x-api-key
          in: header
          required: true
          schema:
            type: string
          description: The API key to authenticate with.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UserRegisterGooglePlayTransactionRequest'
      responses:
        '204':
          description: The transaction mapping has been registered.
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorsResponse'
        '404':
          description: The user has not been found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorsResponse'
      summary: Register Google Play Transaction
      tags:
        - Users
  /users/{app_user_id}/claim-code:
    post:
      description: Claims a code for a user. Code can be affiliate, promo or referral code.
      operationId: claimCode
      parameters:
        - name: app_user_id
          required: true
          in: path
          description: The app user id of the user to claim the code for.
          schema:
            type: string
        - name: x-api-key
          in: header
          required: true
          schema:
            type: string
          description: The API key to authenticate with.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UserClaimCodeRequest'
      responses:
        '200':
          description: Updated user and granted rewards.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UserClaimCodeResponse'
        '400':
          description: The request is invalid.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorsResponse'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorsResponse'
        '404':
          description: The user has not been found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorsResponse'
        '422':
          description: The request is invalid.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorsResponse'
      summary: Claim Code
      tags:
        - Claim Actions
info:
  title: WinWinKit API
  description: An API for interacting with WinWinKit.
  version: '1.0'
  contact:
    name: WinWinKit
    url: https://winwinkit.com
    email: support@winwinkit.com
tags:
  - name: Users
    description: User endpoints
  - name: Claim Actions
    description: Claim actions endpoints
  - name: Rewards Actions
    description: Rewards actions endpoints
  - name: Analytics
    description: Analytics endpoints
servers:
  - url: https://api.winwinkit.com
    description: Production
components:
  securitySchemes:
    x-api-key:
      type: apiKey
      in: header
      name: x-api-key
  schemas:
    ErrorObject:
      type: object
      properties:
        code:
          type: string
        status:
          type: integer
        message:
          type: string
        source:
          type: string
          nullable: true
      description: Error Object
      required:
        - code
        - status
        - message
        - source
    ErrorsResponse:
      type: object
      properties:
        errors:
          type: array
          items:
            $ref: '#/components/schemas/ErrorObject'
      description: Errors Response
      required:
        - errors
    AffiliateAnalyticsMetrics:
      type: object
      properties:
        claims:
          type: number
          example: 120
          description: The number of times the affiliate's codes were claimed
        conversions:
          type: number
          example: 34
          description: The number of claims that converted into a purchase
        revenue:
          type: number
          example: 249900
          description: The revenue attributed to the affiliate, in USD cents
        earnings:
          type: number
          example: 49980
          description: The commission owed to the affiliate on that revenue, in USD cents
      required:
        - claims
        - conversions
        - revenue
        - earnings
    AffiliateAnalyticsEntry:
      type: object
      properties:
        id:
          type: string
          example: 2772aded-9009-474c-a368-c887dda45b01
          description: The affiliate id
        name:
          type: string
          example: Jane Doe
          description: The affiliate name
        accepted_at:
          format: date-time
          type: string
          example: '2026-01-01T00:00:00.000Z'
          description: When the affiliate joined the project
        status:
          type: string
          enum:
            - pending
            - withdrawn
            - approved
            - rejected
            - archived
            - deactivated
            - banned
          example: approved
          description: >-
            The affiliate current standing with the project. Not always
            `approved`: an affiliate is reported for what they did in the
            period, so one since banned or deactivated still appears alongside
            the metrics they earned.
        totals:
          description: The affiliate's totals over the period
          allOf:
            - $ref: '#/components/schemas/AffiliateAnalyticsMetrics'
      required:
        - id
        - name
        - accepted_at
        - status
        - totals
    Pagination:
      type: object
      properties:
        limit:
          type: number
          example: 100
          description: How many results were requested
        offset:
          type: number
          example: 0
          description: How many results were skipped before this page
        total:
          type: number
          example: 512
          description: How many results matched in total, across every page
        has_more:
          type: boolean
          example: true
          description: Whether another page follows this one
      required:
        - limit
        - offset
        - total
        - has_more
    AffiliateAnalytics:
      type: object
      properties:
        from:
          type: string
          example: '2026-01-01'
          description: The first day of the period, inclusive
        to:
          type: string
          example: '2026-03-31'
          description: The last day of the period, inclusive
        totals:
          description: The totals across every affiliate in the period, not just this page
          allOf:
            - $ref: '#/components/schemas/AffiliateAnalyticsMetrics'
        affiliates:
          description: >-
            The page of affiliates, oldest joiner first. Affiliates with no
            activity in the period are omitted.
          type: array
          items:
            $ref: '#/components/schemas/AffiliateAnalyticsEntry'
        pagination:
          description: Where this page sits within the affiliates that matched
          allOf:
            - $ref: '#/components/schemas/Pagination'
      required:
        - from
        - to
        - totals
        - affiliates
        - pagination
    AffiliateAnalyticsResponse:
      type: object
      properties:
        data:
          $ref: '#/components/schemas/AffiliateAnalytics'
      required:
        - data
    AffiliatePlatform:
      type: object
      properties:
        type:
          type: string
          enum:
            - instagram
            - tiktok
            - youtube
            - twitter
            - website
          example: instagram
          description: The platform type
        handle:
          type: string
          example: winwinkit
          description: The public handle/username on the platform
        verified:
          type: boolean
          example: true
          description: Whether ownership of the platform has been verified
      required:
        - type
        - handle
        - verified
    CodeAffiliate:
      type: object
      properties:
        name:
          type: string
          example: Jane Doe
          description: The affiliate name
        logo_url:
          type: string
          nullable: true
          example: https://example.com/logo.png
          description: The affiliate logo url
        platforms:
          description: The affiliate social platforms
          type: array
          items:
            $ref: '#/components/schemas/AffiliatePlatform'
      required:
        - name
        - logo_url
        - platforms
    CodePromoCode:
      type: object
      properties:
        limit:
          type: integer
          example: 0
          description: The maximum number of times the code can be claimed (0 = unlimited)
      required:
        - limit
    CodeReferralUser:
      type: object
      properties:
        app_user_id:
          type: string
          example: user_42
          description: The app user id of the referral code owner
      required:
        - app_user_id
    ReceiverRewardNeverDeactivation:
      type: object
      properties:
        variant:
          type: string
          enum:
            - never
          example: never
          description: The reward never deactivates
      required:
        - variant
    ReceiverRewardIntervalDeactivation:
      type: object
      properties:
        variant:
          type: string
          enum:
            - interval
          example: interval
          description: The reward deactivates after a fixed interval
        duration:
          type: integer
          example: 1
          description: The duration of the interval
        period:
          type: string
          enum:
            - days
            - months
            - years
          example: months
          description: The period of the interval
      required:
        - variant
        - duration
        - period
    BasicReward:
      type: object
      properties:
        key:
          type: string
          description: The key of the reward
          example: basic-reward
        name:
          type: string
          description: The name of the reward
          example: Basic Reward
        description:
          type: string
          nullable: true
          example: This is a basic reward
          description: The description of the reward
        metadata:
          type: object
          nullable: true
          example: {}
          description: The metadata of the reward
        created_at:
          format: date-time
          type: string
          example: '2021-01-01T00:00:00.000Z'
          description: The created at of the reward
        updated_at:
          format: date-time
          type: string
          nullable: true
          example: '2021-01-01T00:00:00.000Z'
          description: The updated at of the reward
      required:
        - key
        - name
        - description
        - metadata
        - created_at
        - updated_at
    ReceiverRewardActivation:
      type: object
      properties:
        variant:
          type: string
          enum:
            - claim
            - conversion
          example: claim
          description: When the reward is activated for the receiver
      required:
        - variant
    ReceiverBasicReward:
      type: object
      properties:
        reward:
          description: The reward
          allOf:
            - $ref: '#/components/schemas/BasicReward'
        activation:
          $ref: '#/components/schemas/ReceiverRewardActivation'
        deactivation:
          oneOf:
            - $ref: '#/components/schemas/ReceiverRewardNeverDeactivation'
            - $ref: '#/components/schemas/ReceiverRewardIntervalDeactivation'
          example:
            variant: never
          description: When the reward deactivates for the receiver
      required:
        - reward
        - activation
        - deactivation
    CreditReward:
      type: object
      properties:
        key:
          type: string
          example: credit-reward
          description: The key of the reward
        credits:
          type: integer
          example: 100
          description: The credits of the reward
        name:
          type: string
          example: Credit Reward
          description: The name of the reward
        description:
          type: string
          nullable: true
          example: This is a credit reward
          description: The description of the reward
        metadata:
          type: object
          nullable: true
          example: {}
          description: The metadata of the reward
        created_at:
          format: date-time
          type: string
          example: '2021-01-01T00:00:00.000Z'
          description: The created at of the reward
        updated_at:
          format: date-time
          type: string
          nullable: true
          example: '2021-01-01T00:00:00.000Z'
          description: The updated at of the reward
      required:
        - key
        - credits
        - name
        - description
        - metadata
        - created_at
        - updated_at
    ReceiverCreditReward:
      type: object
      properties:
        reward:
          description: The reward
          allOf:
            - $ref: '#/components/schemas/CreditReward'
        activation:
          $ref: '#/components/schemas/ReceiverRewardActivation'
        deactivation:
          oneOf:
            - $ref: '#/components/schemas/ReceiverRewardNeverDeactivation'
            - $ref: '#/components/schemas/ReceiverRewardIntervalDeactivation'
          example:
            variant: never
          description: When the reward deactivates for the receiver
      required:
        - reward
        - activation
        - deactivation
    OfferCodeReward:
      type: object
      properties:
        key:
          type: string
          example: offer-code-reward
          description: The key of the reward
        offer_code_id:
          type: string
          example: 123e4567-e89b-12d3-a456-426614174000
          description: The offer code id
        offer_code_ref_name:
          type: string
          example: Free Month
          description: The offer code reference name that is set in the App Store Connect
        subscription_product_id:
          type: string
          example: com.winwinkit.monthly
          description: The subscription product id of the offer code
        name:
          type: string
          example: Offer Code Reward
          description: The name of the reward
        description:
          type: string
          nullable: true
          example: This is an offer code reward
          description: The description of the reward
        metadata:
          type: object
          nullable: true
          example: {}
          description: The metadata of the reward
        created_at:
          format: date-time
          type: string
          example: '2021-01-01T00:00:00.000Z'
          description: The created at of the reward
        updated_at:
          format: date-time
          type: string
          nullable: true
          example: '2021-01-01T00:00:00.000Z'
          description: The updated at of the reward
      required:
        - key
        - offer_code_id
        - offer_code_ref_name
        - subscription_product_id
        - name
        - description
        - metadata
        - created_at
        - updated_at
    ReceiverRewardClaimActivation:
      type: object
      properties:
        variant:
          type: string
          enum:
            - claim
          example: claim
          description: When the reward is activated for the receiver
      required:
        - variant
    ReceiverOfferCodeReward:
      type: object
      properties:
        reward:
          description: The reward
          allOf:
            - $ref: '#/components/schemas/OfferCodeReward'
        activation:
          $ref: '#/components/schemas/ReceiverRewardClaimActivation'
        deactivation:
          oneOf:
            - $ref: '#/components/schemas/ReceiverRewardNeverDeactivation'
            - $ref: '#/components/schemas/ReceiverRewardIntervalDeactivation'
          example:
            variant: never
          description: When the reward deactivates for the receiver
      required:
        - reward
        - activation
        - deactivation
    GooglePlayPromoCodeReward:
      type: object
      properties:
        key:
          type: string
          example: promo-code-reward
          description: The key of the reward
        name:
          type: string
          example: Promo Code Reward
          description: The name of the reward
        description:
          type: string
          nullable: true
          example: This is a promo code reward
          description: The description of the reward
        metadata:
          type: object
          nullable: true
          example: {}
          description: The metadata of the reward
        created_at:
          format: date-time
          type: string
          example: '2021-01-01T00:00:00.000Z'
          description: The created at of the reward
        updated_at:
          format: date-time
          type: string
          nullable: true
          example: '2021-01-01T00:00:00.000Z'
          description: The updated at of the reward
      required:
        - key
        - name
        - description
        - metadata
        - created_at
        - updated_at
    ReceiverGooglePlayPromoCodeReward:
      type: object
      properties:
        reward:
          description: The reward
          allOf:
            - $ref: '#/components/schemas/GooglePlayPromoCodeReward'
        activation:
          $ref: '#/components/schemas/ReceiverRewardClaimActivation'
        deactivation:
          oneOf:
            - $ref: '#/components/schemas/ReceiverRewardNeverDeactivation'
            - $ref: '#/components/schemas/ReceiverRewardIntervalDeactivation'
          example:
            variant: never
          description: When the reward deactivates for the receiver
      required:
        - reward
        - activation
        - deactivation
    RevenueCatEntitlementReward:
      type: object
      properties:
        key:
          type: string
          description: The key of the reward
          example: premium-entitlement
        entitlement_id:
          type: string
          description: The entitlement ID of the reward
          example: entl1234567890
        entitlement_key:
          type: string
          description: The entitlement key of the reward
          example: premium
        name:
          type: string
          description: The name of the reward
          example: Premium Access
        description:
          type: string
          nullable: true
          example: This is an RevenueCat entitlement reward
          description: The description of the reward
        metadata:
          type: object
          nullable: true
          example: {}
          description: The metadata of the reward
        created_at:
          format: date-time
          type: string
          example: '2021-01-01T00:00:00.000Z'
          description: The created at of the reward
        updated_at:
          format: date-time
          type: string
          nullable: true
          example: '2021-01-01T00:00:00.000Z'
          description: The updated at of the reward
      required:
        - key
        - entitlement_id
        - entitlement_key
        - name
        - description
        - metadata
        - created_at
        - updated_at
    ReceiverRevenueCatEntitlementReward:
      type: object
      properties:
        reward:
          description: The reward
          allOf:
            - $ref: '#/components/schemas/RevenueCatEntitlementReward'
        activation:
          $ref: '#/components/schemas/ReceiverRewardActivation'
        deactivation:
          oneOf:
            - $ref: '#/components/schemas/ReceiverRewardNeverDeactivation'
            - $ref: '#/components/schemas/ReceiverRewardIntervalDeactivation'
          example:
            variant: never
          description: When the reward deactivates for the receiver
      required:
        - reward
        - activation
        - deactivation
    RevenueCatOfferingReward:
      type: object
      properties:
        key:
          type: string
          description: The key of the reward
          example: discounted-offering
        offering_id:
          type: string
          description: The offering ID of the reward
          example: ofrng1234567890
        offering_key:
          type: string
          description: The offering key of the reward
          example: discounted
        name:
          type: string
          description: The name of the reward
          example: Discounted Offering
        description:
          type: string
          nullable: true
          example: This is an RevenueCat offering reward
          description: The description of the reward
        metadata:
          type: object
          nullable: true
          example: {}
          description: The metadata of the reward
        created_at:
          format: date-time
          type: string
          example: '2021-01-01T00:00:00.000Z'
          description: The created at of the reward
        updated_at:
          format: date-time
          type: string
          nullable: true
          example: '2021-01-01T00:00:00.000Z'
          description: The updated at of the reward
      required:
        - key
        - offering_id
        - offering_key
        - name
        - description
        - metadata
        - created_at
        - updated_at
    ReceiverRevenueCatOfferingReward:
      type: object
      properties:
        reward:
          description: The reward
          allOf:
            - $ref: '#/components/schemas/RevenueCatOfferingReward'
        activation:
          $ref: '#/components/schemas/ReceiverRewardClaimActivation'
        deactivation:
          oneOf:
            - $ref: '#/components/schemas/ReceiverRewardNeverDeactivation'
            - $ref: '#/components/schemas/ReceiverRewardIntervalDeactivation'
          example:
            variant: never
          description: When the reward deactivates for the receiver
      required:
        - reward
        - activation
        - deactivation
    ReceiverRewards:
      type: object
      properties:
        basic:
          description: The basic rewards
          type: array
          items:
            $ref: '#/components/schemas/ReceiverBasicReward'
        credit:
          description: The credit rewards
          type: array
          items:
            $ref: '#/components/schemas/ReceiverCreditReward'
        offer_code:
          description: The offer code rewards
          type: array
          items:
            $ref: '#/components/schemas/ReceiverOfferCodeReward'
        googleplay_promo_code:
          description: The Google Play promo code rewards
          type: array
          items:
            $ref: '#/components/schemas/ReceiverGooglePlayPromoCodeReward'
        revenuecat_entitlement:
          description: The RevenueCat entitlement rewards
          type: array
          items:
            $ref: '#/components/schemas/ReceiverRevenueCatEntitlementReward'
        revenuecat_offering:
          description: The RevenueCat offering rewards
          type: array
          items:
            $ref: '#/components/schemas/ReceiverRevenueCatOfferingReward'
      required:
        - basic
        - credit
        - offer_code
        - googleplay_promo_code
        - revenuecat_entitlement
        - revenuecat_offering
    Code:
      type: object
      properties:
        type:
          type: string
          enum:
            - affiliate
            - promo
            - referral
          example: affiliate
          description: The resolved code type
        code:
          type: string
          example: SUMMER
          description: The code
        is_active:
          type: boolean
          example: true
          description: Whether the code is active and can be claimed
        entity:
          oneOf:
            - $ref: '#/components/schemas/CodeAffiliate'
            - $ref: '#/components/schemas/CodePromoCode'
            - $ref: '#/components/schemas/CodeReferralUser'
          description: >-
            The type-specific entity: the affiliate, the promo code, or the
            referral code owner.
        rewards:
          description: The rewards granted to the user claiming the code
          allOf:
            - $ref: '#/components/schemas/ReceiverRewards'
      required:
        - type
        - code
        - is_active
        - entity
        - rewards
    CodeResponse:
      type: object
      properties:
        data:
          $ref: '#/components/schemas/Code'
      required:
        - data
    UserWithdrawCreditsRequest:
      type: object
      properties:
        key:
          type: string
          example: credit-reward
          description: The key of the credit reward to withdraw
        amount:
          type: integer
          example: 100
          description: The amount of credits to withdraw
          minimum: 1
        operation_id:
          type: string
          nullable: true
          example: 821fae4b5-0123-4567-9152-5297086a161c
          description: >-
            An optional operation id that ensures the same operation won't be
            performed again
      required:
        - key
        - amount
    UserWithdrawCreditsResult:
      type: object
      properties:
        credits_available_at_start:
          type: integer
          example: 100
          description: The amount of credits available at the start
        credits_available_at_end:
          type: integer
          example: 90
          description: The amount of credits available at the end
        credits_requested_to_withdraw:
          type: integer
          example: 10
          description: The amount of credits requested to withdraw
        credits_withdrawn:
          type: integer
          example: 10
          description: The amount of credits withdrawn
      required:
        - credits_available_at_start
        - credits_available_at_end
        - credits_requested_to_withdraw
        - credits_withdrawn
    UserClaimCodeEligibility:
      type: object
      properties:
        eligible:
          type: boolean
          example: true
          description: The claim code eligibility flag.
        eligible_until:
          format: date-time
          type: string
          nullable: true
          example: '2024-11-10T10:28:18.104Z'
          description: The claim code eligibility until date.
      description: User's eligibility to claim referral code.
      required:
        - eligible
        - eligible_until
    UserReferredBy:
      type: object
      properties:
        code:
          type: string
          example: XYZ123
          nullable: true
          description: >-
            The code claimed by the user. Can be null if the code's entity has
            been deleted.
        type:
          type: string
          enum:
            - affiliate
            - promo
            - referral
          example: referral
          description: >-
            The type of the code. Can be one of "affiliate", "promo", or
            "referral".
      description: The referred by of the user.
      required:
        - code
        - type
    UserStats:
      type: object
      properties:
        claims:
          type: integer
          example: 0
          description: The number of users who have claimed the referral code.
        conversions:
          type: integer
          example: 0
          description: The number of users who have converted to premium.
        churns:
          type: integer
          example: 0
          description: The number of users who have churned.
      description: The stats of the user.
      required:
        - claims
        - conversions
        - churns
    UserBasicRewardActive:
      type: object
      properties:
        reward:
          description: The reward
          allOf:
            - $ref: '#/components/schemas/BasicReward'
        expires_at:
          format: date-time
          type: string
          nullable: true
          example: '2021-01-01T00:00:00.000Z'
          description: The expiration date of the reward
        created_at:
          format: date-time
          type: string
          example: '2021-01-01T00:00:00.000Z'
          description: The created at of the reward
        updated_at:
          format: date-time
          type: string
          nullable: true
          example: '2021-01-01T00:00:00.000Z'
          description: The updated at of the reward
      required:
        - reward
        - expires_at
        - created_at
        - updated_at
    UserCreditRewardActive:
      type: object
      properties:
        reward:
          description: The reward
          allOf:
            - $ref: '#/components/schemas/CreditReward'
        credits:
          type: integer
          example: 100
          description: The amount of the reward
        expires_at:
          format: date-time
          type: string
          nullable: true
          example: '2021-01-01T00:00:00.000Z'
          description: The expiration date of the reward
        created_at:
          format: date-time
          type: string
          example: '2021-01-01T00:00:00.000Z'
          description: The created at of the reward
        updated_at:
          format: date-time
          type: string
          nullable: true
          example: '2021-01-01T00:00:00.000Z'
          description: The updated at of the reward
      required:
        - reward
        - credits
        - expires_at
        - created_at
        - updated_at
    OfferCodeValue:
      type: object
      properties:
        value:
          type: string
          example: ABCDEFGHIJKLMNOPQR
          description: The offer code value
        link:
          type: string
          example: >-
            https://apps.apple.com/redeem?ctx=offercodes&id=1234567890&code=ABCDEFGHIJKLMNOPQR
          description: The offer code redeem link
        expires_at:
          format: date-time
          type: string
          example: '2021-01-01T00:00:00.000Z'
          description: The offer code value expiration date
      required:
        - value
        - link
        - expires_at
    UserOfferCodeRewardActive:
      type: object
      properties:
        reward:
          description: The reward
          allOf:
            - $ref: '#/components/schemas/OfferCodeReward'
        value:
          nullable: true
          description: The offer code value
          allOf:
            - $ref: '#/components/schemas/OfferCodeValue'
        expires_at:
          format: date-time
          type: string
          nullable: true
          example: '2021-01-01T00:00:00.000Z'
          description: The expiration date of the reward
        created_at:
          format: date-time
          type: string
          example: '2021-01-01T00:00:00.000Z'
          description: The created at of the reward
        updated_at:
          format: date-time
          type: string
          nullable: true
          example: '2021-01-01T00:00:00.000Z'
          description: The updated at of the reward
      required:
        - reward
        - value
        - expires_at
        - created_at
        - updated_at
    GooglePlayPromoCodeValue:
      type: object
      properties:
        value:
          type: string
          example: ABCDEFGHIJKLMNOPQR
          description: The promo code value
        expires_at:
          format: date-time
          type: string
          example: '2021-01-01T00:00:00.000Z'
          description: The promo code value expiration date
      required:
        - value
        - expires_at
    UserGooglePlayPromoCodeRewardActive:
      type: object
      properties:
        reward:
          description: The reward
          allOf:
            - $ref: '#/components/schemas/GooglePlayPromoCodeReward'
        value:
          nullable: true
          description: The promo code value
          allOf:
            - $ref: '#/components/schemas/GooglePlayPromoCodeValue'
        expires_at:
          format: date-time
          type: string
          nullable: true
          example: '2021-01-01T00:00:00.000Z'
          description: The expiration date of the reward
        created_at:
          format: date-time
          type: string
          example: '2021-01-01T00:00:00.000Z'
          description: The created at of the reward
        updated_at:
          format: date-time
          type: string
          nullable: true
          example: '2021-01-01T00:00:00.000Z'
          description: The updated at of the reward
      required:
        - reward
        - value
        - expires_at
        - created_at
        - updated_at
    UserRevenueCatEntitlementRewardActive:
      type: object
      properties:
        reward:
          description: The reward
          allOf:
            - $ref: '#/components/schemas/RevenueCatEntitlementReward'
        expires_at:
          format: date-time
          type: string
          nullable: true
          example: '2021-01-01T00:00:00.000Z'
          description: The expiration date of the reward
        created_at:
          format: date-time
          type: string
          example: '2021-01-01T00:00:00.000Z'
          description: The created at of the reward
        updated_at:
          format: date-time
          type: string
          nullable: true
          example: '2021-01-01T00:00:00.000Z'
          description: The updated at of the reward
      required:
        - reward
        - expires_at
        - created_at
        - updated_at
    UserRevenueCatOfferingRewardActive:
      type: object
      properties:
        reward:
          description: The reward
          allOf:
            - $ref: '#/components/schemas/RevenueCatOfferingReward'
        expires_at:
          format: date-time
          type: string
          nullable: true
          example: '2021-01-01T00:00:00.000Z'
          description: The expiration date of the reward
        created_at:
          format: date-time
          type: string
          example: '2021-01-01T00:00:00.000Z'
          description: The created at of the reward
        updated_at:
          format: date-time
          type: string
          nullable: true
          example: '2021-01-01T00:00:00.000Z'
          description: The updated at of the reward
      required:
        - reward
        - expires_at
        - created_at
        - updated_at
    UserRewardsActive:
      type: object
      properties:
        basic:
          description: The referral user basic rewards
          type: array
          items:
            $ref: '#/components/schemas/UserBasicRewardActive'
        credit:
          description: The referral user credit rewards
          type: array
          items:
            $ref: '#/components/schemas/UserCreditRewardActive'
        offer_code:
          description: The referral user offer code rewards
          type: array
          items:
            $ref: '#/components/schemas/UserOfferCodeRewardActive'
        googleplay_promo_code:
          description: The referral user Google Play promo code rewards
          type: array
          items:
            $ref: '#/components/schemas/UserGooglePlayPromoCodeRewardActive'
        revenuecat_entitlement:
          description: The referral user RevenueCat entitlement rewards
          type: array
          items:
            $ref: '#/components/schemas/UserRevenueCatEntitlementRewardActive'
        revenuecat_offering:
          description: The referral user RevenueCat offering rewards
          type: array
          items:
            $ref: '#/components/schemas/UserRevenueCatOfferingRewardActive'
      required:
        - basic
        - credit
        - offer_code
        - googleplay_promo_code
        - revenuecat_entitlement
        - revenuecat_offering
    UserBasicRewardExpired:
      type: object
      properties:
        reward:
          description: The reward
          allOf:
            - $ref: '#/components/schemas/BasicReward'
        expired_at:
          format: date-time
          type: string
          example: '2021-01-01T00:00:00.000Z'
          description: The expiration date of the reward
        created_at:
          format: date-time
          type: string
          example: '2021-01-01T00:00:00.000Z'
          description: The created at of the reward
        updated_at:
          format: date-time
          type: string
          nullable: true
          example: '2021-01-01T00:00:00.000Z'
          description: The updated at of the reward
      required:
        - reward
        - expired_at
        - created_at
        - updated_at
    UserCreditRewardExpired:
      type: object
      properties:
        reward:
          description: The reward
          allOf:
            - $ref: '#/components/schemas/CreditReward'
        expired_at:
          format: date-time
          type: string
          example: '2021-01-01T00:00:00.000Z'
          description: The expiration date of the reward
        created_at:
          format: date-time
          type: string
          example: '2021-01-01T00:00:00.000Z'
          description: The created at of the reward
        updated_at:
          format: date-time
          type: string
          nullable: true
          example: '2021-01-01T00:00:00.000Z'
          description: The updated at of the reward
      required:
        - reward
        - expired_at
        - created_at
        - updated_at
    UserOfferCodeRewardExpired:
      type: object
      properties:
        reward:
          description: The reward
          allOf:
            - $ref: '#/components/schemas/OfferCodeReward'
        expired_at:
          format: date-time
          type: string
          example: '2021-01-01T00:00:00.000Z'
          description: The expiration date of the reward
        created_at:
          format: date-time
          type: string
          example: '2021-01-01T00:00:00.000Z'
          description: The created at of the reward
        updated_at:
          format: date-time
          type: string
          nullable: true
          example: '2021-01-01T00:00:00.000Z'
          description: The updated at of the reward
      required:
        - reward
        - expired_at
        - created_at
        - updated_at
    UserGooglePlayPromoCodeRewardExpired:
      type: object
      properties:
        reward:
          description: The reward
          allOf:
            - $ref: '#/components/schemas/GooglePlayPromoCodeReward'
        expired_at:
          format: date-time
          type: string
          example: '2021-01-01T00:00:00.000Z'
          description: The expiration date of the reward
        created_at:
          format: date-time
          type: string
          example: '2021-01-01T00:00:00.000Z'
          description: The created at of the reward
        updated_at:
          format: date-time
          type: string
          nullable: true
          example: '2021-01-01T00:00:00.000Z'
          description: The updated at of the reward
      required:
        - reward
        - expired_at
        - created_at
        - updated_at
    UserRevenueCatEntitlementRewardExpired:
      type: object
      properties:
        reward:
          description: The reward
          allOf:
            - $ref: '#/components/schemas/RevenueCatEntitlementReward'
        expired_at:
          format: date-time
          type: string
          nullable: true
          example: '2021-01-01T00:00:00.000Z'
          description: The expiration date of the reward
        created_at:
          format: date-time
          type: string
          example: '2021-01-01T00:00:00.000Z'
          description: The created at of the reward
        updated_at:
          format: date-time
          type: string
          nullable: true
          example: '2021-01-01T00:00:00.000Z'
          description: The updated at of the reward
      required:
        - reward
        - expired_at
        - created_at
        - updated_at
    UserRevenueCatOfferingRewardExpired:
      type: object
      properties:
        reward:
          description: The reward
          allOf:
            - $ref: '#/components/schemas/RevenueCatOfferingReward'
        expired_at:
          format: date-time
          type: string
          nullable: true
          example: '2021-01-01T00:00:00.000Z'
          description: The expiration date of the reward
        created_at:
          format: date-time
          type: string
          example: '2021-01-01T00:00:00.000Z'
          description: The created at of the reward
        updated_at:
          format: date-time
          type: string
          nullable: true
          example: '2021-01-01T00:00:00.000Z'
          description: The updated at of the reward
      required:
        - reward
        - expired_at
        - created_at
        - updated_at
    UserRewardsExpired:
      type: object
      properties:
        basic:
          description: The referral user basic rewards
          type: array
          items:
            $ref: '#/components/schemas/UserBasicRewardExpired'
        credit:
          description: The referral user credit rewards
          type: array
          items:
            $ref: '#/components/schemas/UserCreditRewardExpired'
        offer_code:
          description: The referral user offer code rewards
          type: array
          items:
            $ref: '#/components/schemas/UserOfferCodeRewardExpired'
        googleplay_promo_code:
          description: The referral user Google Play promo code rewards
          type: array
          items:
            $ref: '#/components/schemas/UserGooglePlayPromoCodeRewardExpired'
        revenuecat_entitlement:
          description: The referral user RevenueCat entitlement rewards
          type: array
          items:
            $ref: '#/components/schemas/UserRevenueCatEntitlementRewardExpired'
        revenuecat_offering:
          description: The referral user RevenueCat offering rewards
          type: array
          items:
            $ref: '#/components/schemas/UserRevenueCatOfferingRewardExpired'
      required:
        - basic
        - credit
        - offer_code
        - googleplay_promo_code
        - revenuecat_entitlement
        - revenuecat_offering
    UserRewards:
      type: object
      properties:
        active:
          description: The referral user active rewards
          allOf:
            - $ref: '#/components/schemas/UserRewardsActive'
        expired:
          description: The referral user expired rewards
          allOf:
            - $ref: '#/components/schemas/UserRewardsExpired'
      required:
        - active
        - expired
    ReferralProgramSenderBasicRewardNeverDeactivation:
      type: object
      properties:
        variant:
          type: string
          enum:
            - never
          example: never
          description: The variant of the deactivation configuration
      required:
        - variant
    ReferralProgramSenderBasicRewardIntervalDeactivation:
      type: object
      properties:
        variant:
          type: string
          enum:
            - interval
          example: interval
          description: The variant of the deactivation configuration
        duration:
          type: integer
          example: 1
          description: The duration of the deactivation configuration
        period:
          type: string
          enum:
            - days
            - months
            - years
          example: days
          description: The period of the deactivation configuration
      required:
        - variant
        - duration
        - period
    ReferralProgramSenderBasicRewardActivation:
      type: object
      properties:
        variant:
          type: string
          enum:
            - claim
            - conversion
          example: claim
          description: The variant of the activation configuration
        amount:
          type: integer
          example: 1
          description: The amount of the activation configuration
      required:
        - variant
        - amount
    ReferralProgramSenderBasicReward:
      type: object
      properties:
        reward:
          description: The reward
          allOf:
            - $ref: '#/components/schemas/BasicReward'
        activation:
          description: The activation configuration
          allOf:
            - $ref: '#/components/schemas/ReferralProgramSenderBasicRewardActivation'
        deactivation:
          oneOf:
            - $ref: >-
                #/components/schemas/ReferralProgramSenderBasicRewardNeverDeactivation
            - $ref: >-
                #/components/schemas/ReferralProgramSenderBasicRewardIntervalDeactivation
          example:
            variant: never
          description: The deactivation configuration
      required:
        - reward
        - activation
        - deactivation
    ReferralProgramSenderCreditRewardNeverDeactivation:
      type: object
      properties:
        variant:
          type: string
          enum:
            - never
          example: never
          description: The variant of the deactivation configuration
      required:
        - variant
    ReferralProgramSenderCreditRewardIntervalDeactivation:
      type: object
      properties:
        variant:
          type: string
          enum:
            - interval
          example: interval
          description: The variant of the deactivation configuration
        duration:
          type: integer
          example: 1
          description: The duration of the deactivation configuration
        period:
          type: string
          enum:
            - days
            - months
            - years
          example: days
          description: The period of the deactivation configuration
      required:
        - variant
        - duration
        - period
    ReferralProgramSenderCreditRewardActivation:
      type: object
      properties:
        variant:
          type: string
          enum:
            - claim
            - conversion
          example: claim
          description: The variant of the activation configuration
        amount:
          type: integer
          example: 1
          description: The amount of the activation configuration
        limit:
          type: integer
          example: 1
          description: The limit of the activation configuration
      required:
        - variant
        - amount
        - limit
    ReferralProgramSenderCreditReward:
      type: object
      properties:
        reward:
          description: The reward
          allOf:
            - $ref: '#/components/schemas/CreditReward'
        activation:
          description: The activation configuration
          allOf:
            - $ref: '#/components/schemas/ReferralProgramSenderCreditRewardActivation'
        deactivation:
          oneOf:
            - $ref: >-
                #/components/schemas/ReferralProgramSenderCreditRewardNeverDeactivation
            - $ref: >-
                #/components/schemas/ReferralProgramSenderCreditRewardIntervalDeactivation
          example:
            variant: never
          description: The deactivation configuration
      required:
        - reward
        - activation
        - deactivation
    ReferralProgramSenderOfferCodeRewardNeverDeactivation:
      type: object
      properties:
        variant:
          type: string
          enum:
            - never
          example: never
          description: The variant of the deactivation configuration
      required:
        - variant
    ReferralProgramSenderOfferCodeRewardIntervalDeactivation:
      type: object
      properties:
        variant:
          type: string
          enum:
            - interval
          example: interval
          description: The variant of the deactivation configuration
        duration:
          type: integer
          description: The duration of the deactivation configuration
          example: 1
        period:
          type: string
          enum:
            - days
            - months
            - years
          example: days
          description: The period of the deactivation configuration
      required:
        - variant
        - duration
        - period
    ReferralProgramSenderOfferCodeRewardActivation:
      type: object
      properties:
        variant:
          type: string
          enum:
            - claim
            - conversion
          example: claim
          description: The variant of the activation configuration
        amount:
          type: integer
          example: 1
          description: The amount of the activation configuration
        limit:
          type: integer
          example: 1
          description: The limit of the activation configuration
      required:
        - variant
        - amount
        - limit
    ReferralProgramSenderOfferCodeReward:
      type: object
      properties:
        reward:
          description: The reward
          allOf:
            - $ref: '#/components/schemas/OfferCodeReward'
        activation:
          description: The activation configuration
          allOf:
            - $ref: >-
                #/components/schemas/ReferralProgramSenderOfferCodeRewardActivation
        deactivation:
          oneOf:
            - $ref: >-
                #/components/schemas/ReferralProgramSenderOfferCodeRewardNeverDeactivation
            - $ref: >-
                #/components/schemas/ReferralProgramSenderOfferCodeRewardIntervalDeactivation
          example:
            variant: never
          description: The deactivation configuration
      required:
        - reward
        - activation
        - deactivation
    ReferralProgramSenderGooglePlayPromoCodeRewardNeverDeactivation:
      type: object
      properties:
        variant:
          type: string
          enum:
            - never
          example: never
          description: The variant of the deactivation configuration
      required:
        - variant
    ReferralProgramSenderGooglePlayPromoCodeRewardIntervalDeactivation:
      type: object
      properties:
        variant:
          type: string
          enum:
            - interval
          example: interval
          description: The variant of the deactivation configuration
        duration:
          type: integer
          description: The duration of the deactivation configuration
          example: 1
        period:
          type: string
          enum:
            - days
            - months
            - years
          example: days
          description: The period of the deactivation configuration
      required:
        - variant
        - duration
        - period
    ReferralProgramSenderGooglePlayPromoCodeRewardActivation:
      type: object
      properties:
        variant:
          type: string
          enum:
            - claim
            - conversion
          example: claim
          description: The variant of the activation configuration
        amount:
          type: integer
          example: 1
          description: The amount of the activation configuration
        limit:
          type: integer
          example: 1
          description: The limit of the activation configuration
      required:
        - variant
        - amount
        - limit
    ReferralProgramSenderGooglePlayPromoCodeReward:
      type: object
      properties:
        reward:
          description: The reward
          allOf:
            - $ref: '#/components/schemas/GooglePlayPromoCodeReward'
        activation:
          description: The activation configuration
          allOf:
            - $ref: >-
                #/components/schemas/ReferralProgramSenderGooglePlayPromoCodeRewardActivation
        deactivation:
          oneOf:
            - $ref: >-
                #/components/schemas/ReferralProgramSenderGooglePlayPromoCodeRewardNeverDeactivation
            - $ref: >-
                #/components/schemas/ReferralProgramSenderGooglePlayPromoCodeRewardIntervalDeactivation
          example:
            variant: never
          description: The deactivation configuration
      required:
        - reward
        - activation
        - deactivation
    ReferralProgramSenderRevenueCatEntitlementRewardNeverDeactivation:
      type: object
      properties:
        variant:
          type: string
          enum:
            - never
          example: never
          description: The variant of the deactivation configuration
      required:
        - variant
    ReferralProgramSenderRevenueCatEntitlementRewardIntervalDeactivation:
      type: object
      properties:
        variant:
          type: string
          enum:
            - interval
          example: interval
          description: The variant of the deactivation configuration
        duration:
          type: integer
          example: 1
          description: The duration of the deactivation configuration
        period:
          type: string
          enum:
            - days
            - months
            - years
          example: days
          description: The period of the deactivation configuration
      required:
        - variant
        - duration
        - period
    ReferralProgramSenderRevenueCatEntitlementRewardActivation:
      type: object
      properties:
        variant:
          type: string
          enum:
            - claim
            - conversion
          example: claim
          description: The variant of the activation configuration
        amount:
          type: integer
          example: 1
          description: The amount of the activation configuration
      required:
        - variant
        - amount
    ReferralProgramSenderRevenueCatEntitlementReward:
      type: object
      properties:
        reward:
          description: The reward
          allOf:
            - $ref: '#/components/schemas/RevenueCatEntitlementReward'
        activation:
          description: The activation configuration
          allOf:
            - $ref: >-
                #/components/schemas/ReferralProgramSenderRevenueCatEntitlementRewardActivation
        deactivation:
          oneOf:
            - $ref: >-
                #/components/schemas/ReferralProgramSenderRevenueCatEntitlementRewardNeverDeactivation
            - $ref: >-
                #/components/schemas/ReferralProgramSenderRevenueCatEntitlementRewardIntervalDeactivation
          example:
            variant: never
          description: The deactivation configuration
      required:
        - reward
        - activation
        - deactivation
    ReferralProgramSenderRevenueCatOfferingRewardNeverDeactivation:
      type: object
      properties:
        variant:
          type: string
          enum:
            - never
          example: never
          description: The variant of the deactivation configuration
      required:
        - variant
    ReferralProgramSenderRevenueCatOfferingRewardIntervalDeactivation:
      type: object
      properties:
        variant:
          type: string
          enum:
            - interval
          example: interval
          description: The variant of the deactivation configuration
        duration:
          type: integer
          example: 1
          description: The duration of the deactivation configuration
        period:
          type: string
          enum:
            - days
            - months
            - years
          example: days
          description: The period of the deactivation configuration
      required:
        - variant
        - duration
        - period
    ReferralProgramSenderRevenueCatOfferingRewardActivation:
      type: object
      properties:
        variant:
          type: string
          enum:
            - claim
            - conversion
          example: claim
          description: The variant of the activation configuration
        amount:
          type: integer
          example: 1
          description: The amount of the activation configuration
      required:
        - variant
        - amount
    ReferralProgramSenderRevenueCatOfferingReward:
      type: object
      properties:
        reward:
          description: The reward
          allOf:
            - $ref: '#/components/schemas/RevenueCatOfferingReward'
        activation:
          description: The activation configuration
          allOf:
            - $ref: >-
                #/components/schemas/ReferralProgramSenderRevenueCatOfferingRewardActivation
        deactivation:
          oneOf:
            - $ref: >-
                #/components/schemas/ReferralProgramSenderRevenueCatOfferingRewardNeverDeactivation
            - $ref: >-
                #/components/schemas/ReferralProgramSenderRevenueCatOfferingRewardIntervalDeactivation
          example:
            variant: never
          description: The deactivation configuration
      required:
        - reward
        - activation
        - deactivation
    ReferralProgramSenderRewards:
      type: object
      properties:
        basic:
          description: The program basic rewards
          type: array
          items:
            $ref: '#/components/schemas/ReferralProgramSenderBasicReward'
        credit:
          description: The program credit rewards
          type: array
          items:
            $ref: '#/components/schemas/ReferralProgramSenderCreditReward'
        offer_code:
          description: The program offer code rewards
          type: array
          items:
            $ref: '#/components/schemas/ReferralProgramSenderOfferCodeReward'
        googleplay_promo_code:
          description: The program Google Play promo code rewards
          type: array
          items:
            $ref: >-
              #/components/schemas/ReferralProgramSenderGooglePlayPromoCodeReward
        revenuecat_entitlement:
          description: The program RevenueCat entitlement rewards
          type: array
          items:
            $ref: >-
              #/components/schemas/ReferralProgramSenderRevenueCatEntitlementReward
        revenuecat_offering:
          description: The program RevenueCat offering rewards
          type: array
          items:
            $ref: '#/components/schemas/ReferralProgramSenderRevenueCatOfferingReward'
      required:
        - basic
        - credit
        - offer_code
        - googleplay_promo_code
        - revenuecat_entitlement
        - revenuecat_offering
    ReferralProgramReceiverBasicRewardNeverDeactivation:
      type: object
      properties:
        variant:
          type: string
          enum:
            - never
          example: never
          description: The variant of the deactivation configuration
      required:
        - variant
    ReferralProgramReceiverBasicRewardIntervalDeactivation:
      type: object
      properties:
        variant:
          type: string
          enum:
            - interval
          description: The variant of the deactivation configuration
          example: interval
        duration:
          type: integer
          example: 1
          description: The duration of the deactivation configuration
        period:
          type: string
          enum:
            - days
            - months
            - years
          example: days
          description: The period of the deactivation configuration
      required:
        - variant
        - duration
        - period
    ReferralProgramReceiverBasicRewardActivation:
      type: object
      properties:
        variant:
          type: string
          enum:
            - claim
            - conversion
          example: claim
          description: The variant of the activation configuration
      required:
        - variant
    ReferralProgramReceiverBasicReward:
      type: object
      properties:
        reward:
          description: The reward
          allOf:
            - $ref: '#/components/schemas/BasicReward'
        activation:
          description: The activation configuration
          allOf:
            - $ref: >-
                #/components/schemas/ReferralProgramReceiverBasicRewardActivation
        deactivation:
          oneOf:
            - $ref: >-
                #/components/schemas/ReferralProgramReceiverBasicRewardNeverDeactivation
            - $ref: >-
                #/components/schemas/ReferralProgramReceiverBasicRewardIntervalDeactivation
          example:
            variant: never
          description: The deactivation configuration
      required:
        - reward
        - activation
        - deactivation
    ReferralProgramReceiverCreditRewardNeverDeactivation:
      type: object
      properties:
        variant:
          type: string
          enum:
            - never
          example: never
          description: The variant of the deactivation configuration
      required:
        - variant
    ReferralProgramReceiverCreditRewardIntervalDeactivation:
      type: object
      properties:
        variant:
          type: string
          enum:
            - interval
          example: interval
          description: The variant of the deactivation configuration
        duration:
          type: integer
          example: 1
          description: The duration of the deactivation configuration
        period:
          type: string
          enum:
            - days
            - months
            - years
          example: days
          description: The period of the deactivation configuration
      required:
        - variant
        - duration
        - period
    ReferralProgramReceiverCreditRewardActivation:
      type: object
      properties:
        variant:
          type: string
          enum:
            - claim
            - conversion
          example: claim
          description: The variant of the activation configuration
      required:
        - variant
    ReferralProgramReceiverCreditReward:
      type: object
      properties:
        reward:
          description: The reward
          allOf:
            - $ref: '#/components/schemas/CreditReward'
        activation:
          description: The activation configuration
          allOf:
            - $ref: >-
                #/components/schemas/ReferralProgramReceiverCreditRewardActivation
        deactivation:
          oneOf:
            - $ref: >-
                #/components/schemas/ReferralProgramReceiverCreditRewardNeverDeactivation
            - $ref: >-
                #/components/schemas/ReferralProgramReceiverCreditRewardIntervalDeactivation
          example:
            variant: never
          description: The deactivation configuration
      required:
        - reward
        - activation
        - deactivation
    ReferralProgramReceiverOfferCodeRewardNeverDeactivation:
      type: object
      properties:
        variant:
          type: string
          enum:
            - never
          example: never
          description: The variant of the deactivation configuration
      required:
        - variant
    ReferralProgramReceiverOfferCodeRewardIntervalDeactivation:
      type: object
      properties:
        variant:
          type: string
          enum:
            - interval
          example: interval
          description: The variant of the deactivation configuration
        duration:
          type: integer
          example: 1
          description: The duration of the deactivation configuration
        period:
          type: string
          enum:
            - days
            - months
            - years
          example: days
          description: The period of the deactivation configuration
      required:
        - variant
        - duration
        - period
    ReferralProgramReceiverOfferCodeRewardActivation:
      type: object
      properties:
        variant:
          type: string
          enum:
            - claim
          example: claim
          description: The variant of the activation configuration
      required:
        - variant
    ReferralProgramReceiverOfferCodeReward:
      type: object
      properties:
        reward:
          description: The reward
          allOf:
            - $ref: '#/components/schemas/OfferCodeReward'
        activation:
          description: The activation configuration
          allOf:
            - $ref: >-
                #/components/schemas/ReferralProgramReceiverOfferCodeRewardActivation
        deactivation:
          oneOf:
            - $ref: >-
                #/components/schemas/ReferralProgramReceiverOfferCodeRewardNeverDeactivation
            - $ref: >-
                #/components/schemas/ReferralProgramReceiverOfferCodeRewardIntervalDeactivation
          example:
            variant: never
          description: The deactivation configuration
      required:
        - reward
        - activation
        - deactivation
    ReferralProgramReceiverGooglePlayPromoCodeRewardNeverDeactivation:
      type: object
      properties:
        variant:
          type: string
          enum:
            - never
          example: never
          description: The variant of the deactivation configuration
      required:
        - variant
    ReferralProgramReceiverGooglePlayPromoCodeRewardIntervalDeactivation:
      type: object
      properties:
        variant:
          type: string
          enum:
            - interval
          example: interval
          description: The variant of the deactivation configuration
        duration:
          type: integer
          example: 1
          description: The duration of the deactivation configuration
        period:
          type: string
          enum:
            - days
            - months
            - years
          example: days
          description: The period of the deactivation configuration
      required:
        - variant
        - duration
        - period
    ReferralProgramReceiverGooglePlayPromoCodeRewardActivation:
      type: object
      properties:
        variant:
          type: string
          enum:
            - claim
          example: claim
          description: The variant of the activation configuration
      required:
        - variant
    ReferralProgramReceiverGooglePlayPromoCodeReward:
      type: object
      properties:
        reward:
          description: The reward
          allOf:
            - $ref: '#/components/schemas/GooglePlayPromoCodeReward'
        activation:
          description: The activation configuration
          allOf:
            - $ref: >-
                #/components/schemas/ReferralProgramReceiverGooglePlayPromoCodeRewardActivation
        deactivation:
          oneOf:
            - $ref: >-
                #/components/schemas/ReferralProgramReceiverGooglePlayPromoCodeRewardNeverDeactivation
            - $ref: >-
                #/components/schemas/ReferralProgramReceiverGooglePlayPromoCodeRewardIntervalDeactivation
          example:
            variant: never
          description: The deactivation configuration
      required:
        - reward
        - activation
        - deactivation
    ReferralProgramReceiverRevenueCatEntitlementRewardNeverDeactivation:
      type: object
      properties:
        variant:
          type: string
          enum:
            - never
          example: never
          description: The variant of the deactivation configuration
      required:
        - variant
    ReferralProgramReceiverRevenueCatEntitlementRewardIntervalDeactivation:
      type: object
      properties:
        variant:
          type: string
          enum:
            - interval
          example: interval
          description: The variant of the deactivation configuration
        duration:
          type: integer
          example: 1
          description: The duration of the deactivation configuration
        period:
          type: string
          enum:
            - days
            - months
            - years
          example: days
          description: The period of the deactivation configuration
      required:
        - variant
        - duration
        - period
    ReferralProgramReceiverRevenueCatEntitlementRewardActivation:
      type: object
      properties:
        variant:
          type: string
          enum:
            - claim
            - conversion
          example: claim
          description: The variant of the activation configuration
      required:
        - variant
    ReferralProgramReceiverRevenueCatEntitlementReward:
      type: object
      properties:
        reward:
          description: The reward
          allOf:
            - $ref: '#/components/schemas/RevenueCatEntitlementReward'
        activation:
          description: The activation configuration
          allOf:
            - $ref: >-
                #/components/schemas/ReferralProgramReceiverRevenueCatEntitlementRewardActivation
        deactivation:
          oneOf:
            - $ref: >-
                #/components/schemas/ReferralProgramReceiverRevenueCatEntitlementRewardNeverDeactivation
            - $ref: >-
                #/components/schemas/ReferralProgramReceiverRevenueCatEntitlementRewardIntervalDeactivation
          example:
            variant: never
          description: The deactivation configuration
      required:
        - reward
        - activation
        - deactivation
    ReferralProgramReceiverRevenueCatOfferingRewardNeverDeactivation:
      type: object
      properties:
        variant:
          type: string
          enum:
            - never
          example: never
          description: The variant of the deactivation configuration
      required:
        - variant
    ReferralProgramReceiverRevenueCatOfferingRewardIntervalDeactivation:
      type: object
      properties:
        variant:
          type: string
          enum:
            - interval
          example: interval
          description: The variant of the deactivation configuration
        duration:
          type: integer
          example: 1
          description: The duration of the deactivation configuration
        period:
          type: string
          enum:
            - days
            - months
            - years
          example: days
          description: The period of the deactivation configuration
      required:
        - variant
        - duration
        - period
    ReferralProgramReceiverRevenueCatOfferingRewardActivation:
      type: object
      properties:
        variant:
          type: string
          enum:
            - claim
          example: claim
          description: The variant of the activation configuration
      required:
        - variant
    ReferralProgramReceiverRevenueCatOfferingReward:
      type: object
      properties:
        reward:
          description: The reward
          allOf:
            - $ref: '#/components/schemas/RevenueCatOfferingReward'
        activation:
          description: The activation configuration
          allOf:
            - $ref: >-
                #/components/schemas/ReferralProgramReceiverRevenueCatOfferingRewardActivation
        deactivation:
          oneOf:
            - $ref: >-
                #/components/schemas/ReferralProgramReceiverRevenueCatOfferingRewardNeverDeactivation
            - $ref: >-
                #/components/schemas/ReferralProgramReceiverRevenueCatOfferingRewardIntervalDeactivation
          example:
            variant: never
          description: The deactivation configuration
      required:
        - reward
        - activation
        - deactivation
    ReferralProgramReceiverRewards:
      type: object
      properties:
        basic:
          description: The program basic rewards
          type: array
          items:
            $ref: '#/components/schemas/ReferralProgramReceiverBasicReward'
        credit:
          description: The program credit rewards
          type: array
          items:
            $ref: '#/components/schemas/ReferralProgramReceiverCreditReward'
        offer_code:
          description: The program offer code rewards
          type: array
          items:
            $ref: '#/components/schemas/ReferralProgramReceiverOfferCodeReward'
        googleplay_promo_code:
          description: The program Google Play promo code rewards
          type: array
          items:
            $ref: >-
              #/components/schemas/ReferralProgramReceiverGooglePlayPromoCodeReward
        revenuecat_entitlement:
          description: The program RevenueCat entitlement rewards
          type: array
          items:
            $ref: >-
              #/components/schemas/ReferralProgramReceiverRevenueCatEntitlementReward
        revenuecat_offering:
          description: The program RevenueCat offering rewards
          type: array
          items:
            $ref: >-
              #/components/schemas/ReferralProgramReceiverRevenueCatOfferingReward
      required:
        - basic
        - credit
        - offer_code
        - googleplay_promo_code
        - revenuecat_entitlement
        - revenuecat_offering
    ReferralProgramRewards:
      type: object
      properties:
        sender:
          description: The program sender rewards
          allOf:
            - $ref: '#/components/schemas/ReferralProgramSenderRewards'
        receiver:
          description: The program receiver rewards
          allOf:
            - $ref: '#/components/schemas/ReferralProgramReceiverRewards'
      required:
        - sender
        - receiver
    ReferralProgram:
      type: object
      properties:
        id:
          type: string
          example: 123e4567-e89b-12d3-a456-426614174000
          description: The program id
        name:
          type: string
          example: 'Referral Program #1'
          description: The program name
        description:
          type: string
          nullable: true
          example: This is a referral program
          description: The program description
        metadata:
          type: object
          nullable: true
          example: {}
          description: The program metadata
        distribution_percentage:
          type: integer
          example: 100
          description: The program distribution percentage
        limit:
          type: integer
          example: 0
          description: The program limit
        rewards:
          description: The program rewards
          allOf:
            - $ref: '#/components/schemas/ReferralProgramRewards'
        created_at:
          format: date-time
          type: string
          example: '2021-01-01T00:00:00.000Z'
          description: The program created at
        updated_at:
          format: date-time
          type: string
          nullable: true
          example: '2021-01-01T00:00:00.000Z'
          description: The program updated at
      required:
        - id
        - name
        - description
        - metadata
        - distribution_percentage
        - limit
        - rewards
        - created_at
        - updated_at
    UserAffiliateCode:
      type: object
      properties:
        code:
          type: string
          example: XYZ123
          description: The affiliate code.
        code_link:
          type: string
          nullable: true
          example: https://appname.wwk.link/XYZ123
          description: >-
            The shareable link for the code. Null when the app has turned code
            links off for the affiliate group.
      description: A code the affiliate can promote on this app.
      required:
        - code
        - code_link
    UserAffiliateStats:
      type: object
      properties:
        claims:
          type: integer
          example: 0
          description: The number of users who have claimed one of their codes.
        conversions:
          type: integer
          example: 0
          description: The number of users who have converted to premium.
        earnings:
          type: integer
          example: 0
          description: >-
            The commission accrued all-time, in USD cents. Gross and cumulative
            — not a balance, and not an amount available to withdraw.
      description: The affiliate's totals on this app.
      required:
        - claims
        - conversions
        - earnings
    UserAffiliate:
      type: object
      properties:
        id:
          type: string
          example: 821fae4b5-1a2d-4c1e-9152-5297086a161c
          description: The unique identifier of the affiliate.
        status:
          type: string
          enum:
            - pending
            - withdrawn
            - approved
            - rejected
            - archived
            - deactivated
            - banned
          example: approved
          description: >-
            Where the affiliate stands with this app. `banned` is terminal;
            `rejected`, `withdrawn`, `archived` and `deactivated` describe
            affiliates who may apply again.
        codes:
          description: >-
            The codes the affiliate can currently promote, oldest first. Empty
            until they create one — an approved affiliate with no code yet is a
            normal state.
          type: array
          items:
            $ref: '#/components/schemas/UserAffiliateCode'
        stats:
          description: The affiliate's totals on this app.
          allOf:
            - $ref: '#/components/schemas/UserAffiliateStats'
      description: The user's affiliate standing with this app.
      required:
        - id
        - status
        - codes
        - stats
    User:
      type: object
      properties:
        app_user_id:
          type: string
          example: 821fae4b5-1a2d-4c1e-9152-5297086a161c
          description: The unique identifier of the user in your app.
        referral_code:
          type: string
          example: XYZ123
          nullable: true
          description: The referral code of the user.
        referral_code_link:
          type: string
          nullable: true
          example: https://appname.wwk.link/XYZ123
          description: The referral code link of the user.
        is_trial:
          type: boolean
          nullable: true
          example: false
          description: Whether the user is a trial user.
        is_premium:
          type: boolean
          nullable: true
          example: false
          description: Whether the user is a premium user.
        first_seen_at:
          format: date-time
          type: string
          nullable: true
          example: '2024-11-10T10:28:18.104Z'
          description: The date when the user was first seen at.
        last_seen_at:
          format: date-time
          type: string
          nullable: true
          deprecated: true
          example: null
          description: >-
            The date when the user was last seen at. Deprecated, always returns
            null and will be removed in the future.
        metadata:
          type: object
          nullable: true
          example: {}
          description: The metadata of the user.
        stripe_customer_id:
          type: string
          nullable: true
          example: cus_1234567890
          description: The unique identifier of the user in Stripe.
        claim_code_eligibility:
          description: The claim code eligibility of the user.
          allOf:
            - $ref: '#/components/schemas/UserClaimCodeEligibility'
        referred_by:
          nullable: true
          description: The referred by object of the user.
          allOf:
            - $ref: '#/components/schemas/UserReferredBy'
        stats:
          description: The stats of the user.
          allOf:
            - $ref: '#/components/schemas/UserStats'
        rewards:
          description: The rewards of the user.
          allOf:
            - $ref: '#/components/schemas/UserRewards'
        referral_program:
          nullable: true
          description: The program of the user.
          allOf:
            - $ref: '#/components/schemas/ReferralProgram'
        affiliate:
          nullable: true
          description: >-
            The affiliate this user was recruited into on this app, or null if
            they are not one.
          allOf:
            - $ref: '#/components/schemas/UserAffiliate'
      required:
        - app_user_id
        - referral_code
        - referral_code_link
        - is_trial
        - is_premium
        - first_seen_at
        - last_seen_at
        - metadata
        - stripe_customer_id
        - claim_code_eligibility
        - referred_by
        - stats
        - rewards
        - referral_program
        - affiliate
    UserWithdrawCreditsResponseData:
      type: object
      properties:
        withdraw_result:
          description: The withdraw result
          allOf:
            - $ref: '#/components/schemas/UserWithdrawCreditsResult'
        user:
          description: The user
          allOf:
            - $ref: '#/components/schemas/User'
      required:
        - withdraw_result
        - user
    UserWithdrawCreditsResponse:
      type: object
      properties:
        data:
          $ref: '#/components/schemas/UserWithdrawCreditsResponseData'
      required:
        - data
    UserGrantRewardRequest:
      type: object
      properties:
        key:
          type: string
          example: discounted-offering
          description: The key of the reward to grant
        operation_id:
          type: string
          nullable: true
          example: 821fae4b5-0123-4567-9152-5297086a161c
          description: >-
            An optional operation id that ensures the same operation won't be
            performed again
      required:
        - key
    UserRewardsGranted:
      type: object
      properties:
        basic:
          description: The referral user basic rewards
          type: array
          items:
            $ref: '#/components/schemas/UserBasicRewardActive'
        credit:
          description: The referral user credit rewards
          type: array
          items:
            $ref: '#/components/schemas/UserCreditRewardActive'
        offer_code:
          description: The referral user offer code rewards
          type: array
          items:
            $ref: '#/components/schemas/UserOfferCodeRewardActive'
        googleplay_promo_code:
          description: The referral user Google Play promo code rewards
          type: array
          items:
            $ref: '#/components/schemas/UserGooglePlayPromoCodeRewardActive'
        revenuecat_entitlement:
          description: The referral user RevenueCat entitlement rewards
          type: array
          items:
            $ref: '#/components/schemas/UserRevenueCatEntitlementRewardActive'
        revenuecat_offering:
          description: The referral user RevenueCat offering rewards
          type: array
          items:
            $ref: '#/components/schemas/UserRevenueCatOfferingRewardActive'
      required:
        - basic
        - credit
        - offer_code
        - googleplay_promo_code
        - revenuecat_entitlement
        - revenuecat_offering
    UserGrantRewardResponseData:
      type: object
      properties:
        rewards_granted:
          description: The rewards granted to the user.
          allOf:
            - $ref: '#/components/schemas/UserRewardsGranted'
        user:
          description: The updated user.
          allOf:
            - $ref: '#/components/schemas/User'
      required:
        - rewards_granted
        - user
    UserGrantRewardResponse:
      type: object
      properties:
        data:
          $ref: '#/components/schemas/UserGrantRewardResponseData'
      required:
        - data
    UserCreateRequest:
      type: object
      properties:
        app_user_id:
          type: string
          nullable: false
          example: 821fae4b5-1a2d-4c1e-9152-5297086a161c
          description: The unique identifier of the referral user in your app.
        is_trial:
          type: boolean
          nullable: true
          example: false
          description: Whether the user is a trial user.
        is_premium:
          type: boolean
          nullable: true
          example: false
          description: Whether the user is a premium user.
        first_seen_at:
          format: date-time
          type: string
          nullable: true
          example: '2024-11-10T10:28:18.104Z'
          description: The date when the user was first seen at.
        last_seen_at:
          format: date-time
          type: string
          nullable: true
          deprecated: true
          example: null
          description: >-
            The date when the user was last seen at. Deprecated and will be
            removed in the future.
        metadata:
          type: object
          nullable: true
          example: {}
          description: The metadata of the user.
        stripe_customer_id:
          type: string
          nullable: true
          example: cus_1234567890
          description: The unique identifier of the user in Stripe.
      required:
        - app_user_id
    UserResponseData:
      type: object
      properties:
        user:
          description: The user
          allOf:
            - $ref: '#/components/schemas/User'
      required:
        - user
    UserResponse:
      type: object
      properties:
        data:
          $ref: '#/components/schemas/UserResponseData'
      required:
        - data
    UserAffiliateApplyLinkRequest:
      type: object
      properties:
        group_slug:
          type: string
          nullable: true
          example: creators
          description: >-
            The affiliate group to apply to. Omit to link to the app's default
            group.
    UserAffiliateApplyLinkResponseData:
      type: object
      properties:
        link:
          type: string
          example: https://appname.wwk.link/apply/creators?intent_token=v1...
          description: >-
            The apply link to open, for the requested affiliate group or the
            app's default group. It carries a short-lived token identifying the
            user, so the affiliate they become is attributed back to them.
      required:
        - link
    UserAffiliateApplyLinkResponse:
      type: object
      properties:
        data:
          $ref: '#/components/schemas/UserAffiliateApplyLinkResponseData'
      required:
        - data
    UserRegisterAppStoreTransactionRequest:
      type: object
      properties:
        original_transaction_id:
          type: string
          nullable: false
          example: '2000000123456789'
          description: Apple's originalTransactionId from StoreKit.
        app_account_token:
          type: string
          nullable: true
          example: 550e8400-e29b-41d4-a716-446655440000
          description: StoreKit 2 appAccountToken UUID.
      required:
        - original_transaction_id
    UserRegisterGooglePlayTransactionRequest:
      type: object
      properties:
        purchase_token:
          type: string
          nullable: false
          example: opaque-purchase-token-string
          description: Google Play's purchaseToken from the purchase flow.
        obfuscated_external_account_id:
          type: string
          nullable: true
          example: user-account-id-hash
          description: >-
            Set in BillingFlowParams.setObfuscatedAccountId() — used for better
            matching.
      required:
        - purchase_token
    UserClaimCodeRequest:
      type: object
      properties:
        code:
          type: string
          example: XYZ123
          description: The code to claim. Can be affiliate, promo or referral code.
      required:
        - code
    UserClaimCodeResponseData:
      type: object
      properties:
        rewards_granted:
          description: The rewards granted to the user.
          allOf:
            - $ref: '#/components/schemas/UserRewardsGranted'
        user:
          description: The updated user.
          allOf:
            - $ref: '#/components/schemas/User'
      required:
        - rewards_granted
        - user
    UserClaimCodeResponse:
      type: object
      properties:
        data:
          $ref: '#/components/schemas/UserClaimCodeResponseData'
      required:
        - data
