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

# Get Code

> Resolves a code to its type (affiliate, promo or referral) and returns the relevant data for that type. Requires no app user id.



## OpenAPI

````yaml get /codes/{code}
openapi: 3.0.0
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
servers:
  - url: https://api.winwinkit.com
    description: Production
security: []
tags:
  - name: Users
    description: User endpoints
  - name: Claim Actions
    description: Claim actions endpoints
  - name: Rewards Actions
    description: Rewards actions endpoints
paths:
  /codes/{code}:
    get:
      tags:
        - Codes
      summary: Get Code
      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'
components:
  schemas:
    CodeResponse:
      type: object
      properties:
        data:
          $ref: '#/components/schemas/Code'
      required:
        - data
    ErrorsResponse:
      type: object
      properties:
        errors:
          type: array
          items:
            $ref: '#/components/schemas/ErrorObject'
      description: Errors Response
      required:
        - errors
    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
    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
    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
    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
    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
    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
    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
    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
    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
    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
    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
    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
    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
    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
    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
    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
    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
    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

````