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

# Get badges (all or by id)

> This endpoint allows you to fetch badge(s) data.



## OpenAPI

````yaml /api-reference/openapi.documented.json get /api/loyalty/badges
openapi: 3.0.2
info:
  title: Snag Solutions - API Docs
  description: >-
    Documentation for Loyalty & Socials APIs. Some endpoints require an API key
    to authenticate. To obtain a key, reach out to the Snag Solutions team at
    support@snagsolutions.io.
  version: '0.1'
servers:
  - url: https://admin.snagsolutions.io/
    description: Production
security: []
paths:
  /api/loyalty/badges:
    get:
      tags:
        - Badge
      summary: Get badges (all or by id)
      description: This endpoint allows you to fetch badge(s) data.
      parameters:
        - name: organizationId
          in: query
          description: UUID of the organization (optional, converted to lowercase)
          schema:
            type: string
            format: uuid
            title: Organization ID
            example: 123e4567-e89b-12d3-a456-426614174222
        - name: websiteId
          in: query
          description: UUID of the website (optional, converted to lowercase)
          schema:
            type: string
            format: uuid
            title: Website ID
            example: 123e4567-e89b-12d3-a456-426614174111
        - name: badgeIds
          in: query
          description: Array of badge IDs (converted to lowercase) to fetch
          schema:
            oneOf:
              - type: string
                format: uuid
              - type: array
                items:
                  type: string
                  format: uuid
                minItems: 1
            title: Badge IDs
            example:
              - 123e4567-e89b-12d3-a456-426614174333
        - name: walletAddress
          in: query
          description: Wallet Address of the user, or array of wallet addresses.
          schema:
            oneOf:
              - type: string
              - type: array
                items:
                  type: string
                minItems: 1
            title: Wallet Address
            example: '0x1234567890abcdef1234567890abcdef12345678'
        - name: userId
          in: query
          description: UUID of the user, or array of UUID.
          schema:
            oneOf:
              - type: string
                format: uuid
              - type: array
                items:
                  type: string
                  format: uuid
                minItems: 1
            title: User ID
            example: 123e4567-e89b-12d3-a456-426614174222
        - name: userGroupId
          in: query
          description: UUID of the user group
          schema:
            type: string
            title: User Group ID
            example: 123e4567-e89b-12d3-a456-426614174222
        - name: userGroupExternalIdentifier
          in: query
          description: External identifier of the user group
          schema:
            type: string
            title: User Group External Identifier
            example: 123e4567-e89b-12d3-a456-426614174222
        - name: startingAfter
          in: query
          description: UUID of the badge to start after (converted to lowercase)
          schema:
            type: string
            format: uuid
            title: Starting After
            example: 123e4567-e89b-12d3-a456-426614174333
        - name: limit
          in: query
          description: Number of badges to fetch
          schema:
            type: integer
            minimum: 1
            maximum: 1000
            title: Limit
            example: 10
        - name: includeDeleted
          in: query
          description: Include deleted badges in the response
          schema:
            default: false
            type: boolean
            title: Include Deleted
            example: false
      responses:
        '200':
          description: '200'
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: array
                    items:
                      type: object
                      properties:
                        id:
                          type: string
                          format: uuid
                          title: Badge ID
                          description: UUID of the badge (converted to lowercase)
                          example: 123e4567-e89b-12d3-a456-426614174333
                        name:
                          type: string
                          title: Badge Name
                          description: The name of the badge
                          example: Example Badge
                        description:
                          type: string
                          nullable: true
                          title: Badge Description
                          description: The description of the badge
                          example: Example description
                        imageUrl:
                          type: string
                          format: uri
                          nullable: true
                          title: Image URL
                          description: The URL of the badge image
                          example: https://example.com/image.png
                        hideInUi:
                          default: false
                          type: boolean
                          title: Hide in UI
                          description: Whether to hide this badge in the user interface
                          example: false
                        loyaltyConditions:
                          type: array
                          items:
                            type: object
                            properties:
                              id:
                                type: string
                                format: uuid
                                title: Condition ID
                                description: UUID of the condition (converted to lowercase)
                                example: 123e4567-e89b-12d3-a456-426614174333
                              type:
                                type: string
                                enum:
                                  - rule
                                  - rules
                                  - points
                                  - section
                                  - level
                                  - api
                                  - badge
                                  - badges
                                  - csv
                                title: Condition Type
                                description: The type of the condition
                                example: rule
                              description:
                                type: string
                                nullable: true
                                title: Condition description
                                description: The description of the condition
                                example: Example description
                              amount:
                                type: number
                                nullable: true
                                title: Amount
                                description: The amount of the condition
                                example: 10
                              repeatCount:
                                type: number
                                nullable: true
                                title: Repeat Count
                                description: The repeat count of the condition
                                example: 5
                              requiredCount:
                                type: number
                                nullable: true
                                title: Required Count
                                description: The required count of the condition
                                example: 5
                              loyaltyRuleGroupId:
                                type: string
                                format: uuid
                                nullable: true
                                title: Rule Group ID
                                description: >-
                                  UUID of the rule group (converted to
                                  lowercase)
                                example: 123e4567-e89b-12d3-a456-426614174333
                              association:
                                type: array
                                items:
                                  type: object
                                  properties:
                                    loyaltyRule:
                                      type: object
                                      properties:
                                        id:
                                          type: string
                                          format: uuid
                                          title: Association ID
                                          description: >-
                                            UUID of the association (converted to
                                            lowercase)
                                        name:
                                          type: string
                                          title: Association Name
                                          description: The name of the association
                                      required:
                                        - id
                                        - name
                                      nullable: true
                                    loyaltyBadge:
                                      type: object
                                      properties:
                                        id:
                                          type: string
                                          format: uuid
                                          title: Association ID
                                          description: >-
                                            UUID of the association (converted to
                                            lowercase)
                                        name:
                                          type: string
                                          title: Association Name
                                          description: The name of the association
                                      required:
                                        - id
                                        - name
                                      nullable: true
                                    loyaltyRuleGroup:
                                      type: object
                                      properties:
                                        id:
                                          type: string
                                          format: uuid
                                          title: Association ID
                                          description: >-
                                            UUID of the association (converted to
                                            lowercase)
                                        name:
                                          type: string
                                          title: Association Name
                                          description: The name of the association
                                      required:
                                        - id
                                        - name
                                      nullable: true
                                    loyaltyCurrency:
                                      type: object
                                      properties:
                                        id:
                                          type: string
                                          format: uuid
                                          title: Association ID
                                          description: >-
                                            UUID of the association (converted to
                                            lowercase)
                                        name:
                                          type: string
                                          title: Association Name
                                          description: The name of the association
                                      required:
                                        - id
                                        - name
                                      nullable: true
                                    loyaltyLeaderboardView:
                                      type: object
                                      properties:
                                        id:
                                          type: string
                                          format: uuid
                                          title: Association ID
                                          description: >-
                                            UUID of the association (converted to
                                            lowercase)
                                        name:
                                          type: string
                                          title: Association Name
                                          description: The name of the association
                                      required:
                                        - id
                                        - name
                                      nullable: true
                                  required:
                                    - loyaltyRule
                                    - loyaltyBadge
                                    - loyaltyRuleGroup
                                    - loyaltyCurrency
                                    - loyaltyLeaderboardView
                              loyaltyCurrencyId:
                                type: string
                                format: uuid
                                nullable: true
                                title: Currency ID
                                description: UUID of the currency (converted to lowercase)
                              csvUrl:
                                type: string
                                format: uri
                                nullable: true
                                title: CSV URL
                                description: URL of the CSV file
                                example: https://example.com/csv
                              csvFiles:
                                type: array
                                items:
                                  type: object
                                  properties:
                                    id:
                                      type: string
                                      format: uuid
                                      title: CSV File ID
                                      description: >-
                                        UUID of the CSV file (converted to
                                        lowercase)
                                      example: 123e4567-e89b-12d3-a456-426614174333
                                    url:
                                      type: string
                                      format: uri
                                      nullable: true
                                      title: CSV File URL
                                      description: The URL of the CSV file
                                      example: https://example.com/file.csv
                                    name:
                                      type: string
                                      nullable: true
                                      title: CSV File Name
                                      description: The name of the CSV file
                                      example: file.csv
                                    description:
                                      type: string
                                      nullable: true
                                      title: CSV File Description
                                      description: The description of the CSV file
                                      example: Example description
                                  required:
                                    - id
                                    - url
                                    - name
                                    - description
                                title: CSV Files
                                description: >-
                                  Array of CSV files associated with the
                                  condition
                            required:
                              - id
                              - type
                              - description
                              - amount
                              - repeatCount
                              - requiredCount
                              - loyaltyRuleGroupId
                              - association
                              - loyaltyCurrencyId
                              - csvUrl
                            title: Loyalty Condition Schema
                            description: Schema for a loyalty condition rule.
                          title: Conditions
                          description: Array of conditions of the badge
                        rewards:
                          type: array
                          items:
                            type: object
                            properties:
                              id:
                                type: string
                                format: uuid
                                title: Reward ID
                                description: UUID of the badge reward
                                example: 123e4567-e89b-12d3-a456-426614174333
                              rewardType:
                                type: string
                                enum:
                                  - points
                                  - multiplier
                                  - badge
                                  - token
                                title: Reward Type
                                description: Type of reward (points or multiplier)
                                example: points
                              loyaltyCurrencyId:
                                type: string
                                format: uuid
                                nullable: true
                                title: Loyalty Currency ID
                                description: UUID of the loyalty currency for this reward
                                example: 123e4567-e89b-12d3-a456-426614174333
                              loyaltyCurrencyIds:
                                type: array
                                items:
                                  type: string
                                  format: uuid
                                title: Loyalty Currency IDs
                                description: >-
                                  Array of loyalty currency IDs for multiplier
                                  rewards (empty means all currencies)
                                example:
                                  - 123e4567-e89b-12d3-a456-426614174333
                              amount:
                                type: number
                                nullable: true
                                title: Reward Amount
                                description: >-
                                  Points amount to reward (for points reward
                                  type)
                                example: 100
                              multiplier:
                                type: number
                                nullable: true
                                title: Reward Multiplier
                                description: >-
                                  Multiplier to reward (for multiplier reward
                                  type)
                                example: 2.5
                              isRetroactive:
                                type: boolean
                                title: Is Retroactive
                                description: >-
                                  Whether the multiplier should be applied to
                                  the user's existing balance
                                example: false
                            required:
                              - id
                              - rewardType
                              - loyaltyCurrencyId
                              - amount
                              - multiplier
                              - isRetroactive
                          title: Rewards
                          description: Array of rewards granted when the badge is achieved
                        loyaltyBadgeUsers:
                          type: array
                          items:
                            type: object
                            properties:
                              id:
                                type: string
                                format: uuid
                                title: User Badge ID
                                description: >-
                                  UUID of the user badge (converted to
                                  lowercase)
                                example: 123e4567-e89b-12d3-a456-426614174333
                              userId:
                                type: string
                                format: uuid
                                title: User ID
                                description: UUID of the user (converted to lowercase)
                                example: 123e4567-e89b-12d3-a456-426614174222
                              websiteId:
                                type: string
                                format: uuid
                                title: Website ID
                                description: UUID of the website (converted to lowercase)
                                example: 123e4567-e89b-12d3-a456-426614174111
                              organizationId:
                                type: string
                                format: uuid
                                title: Organization ID
                                description: >-
                                  UUID of the organization (converted to
                                  lowercase)
                                example: 123e4567-e89b-12d3-a456-426614174222
                              hideInUi:
                                default: false
                                type: boolean
                                title: Hide in UI
                                description: >-
                                  Whether to hide this badge in the user
                                  interface
                                example: false
                              status:
                                type: string
                                enum:
                                  - active
                                  - inactive
                                  - revoked
                                title: Status
                                description: The status of the badge
                                example: active
                              loyaltyBadgeId:
                                type: string
                                format: uuid
                                title: Badge ID
                                description: UUID of the badge (converted to lowercase)
                                example: 123e4567-e89b-12d3-a456-426614174333
                              progress:
                                nullable: true
                                title: Progress
                                description: Array of progress for the badge
                              dismissedInUi:
                                type: boolean
                                title: Dismissed In UI
                                description: >-
                                  Whether the user has dismissed the badge in
                                  the UI
                                example: false
                              user:
                                type: object
                                properties:
                                  id:
                                    type: string
                                    format: uuid
                                    title: User ID
                                    description: UUID of the user (converted to lowercase)
                                    example: 123e4567-e89b-12d3-a456-426614174222
                                  walletAddress:
                                    type: string
                                    title: Wallet Address
                                    description: Wallet address of the user
                                    example: '0x1234567890abcdef1234567890abcdef12345678'
                                required:
                                  - id
                                  - walletAddress
                                title: User
                                description: User associated with the user badge
                              createdAt:
                                type: string
                                format: date-time
                                title: Created At
                                description: The date and time the user badge was created
                                example: '2021-01-01T00:00:00.000Z'
                              completedAt:
                                type: string
                                format: date-time
                                nullable: true
                                title: Completed At
                                description: The date and time the user badge was granted
                                example: '2021-01-01T00:00:00.000Z'
                              updatedAt:
                                type: string
                                format: date-time
                                title: Updated At
                                description: The date and time the user badge was updated
                                example: '2021-01-01T00:00:00.000Z'
                            required:
                              - id
                              - userId
                              - websiteId
                              - organizationId
                              - status
                              - loyaltyBadgeId
                              - createdAt
                              - updatedAt
                          title: User Badges
                          description: Array of user badges
                        loyaltyRules:
                          type: array
                          items:
                            type: object
                            properties:
                              id:
                                type: string
                                format: uuid
                                title: Loyalty Rule ID
                                description: >-
                                  UUID of the loyalty rule (converted to
                                  lowercase)
                                example: 123e4567-e89b-12d3-a456-426614174333
                              name:
                                type: string
                                title: Loyalty Rule Name
                                description: The name of the loyalty rule
                                example: Example Rule
                            required:
                              - id
                              - name
                          title: Loyalty Rules
                          description: Array of loyalty rules associated with the badge
                        dataJobs:
                          type: array
                          items:
                            type: object
                            properties:
                              id:
                                type: string
                                format: uuid
                                title: Data Job ID
                                description: UUID of the data job (converted to lowercase)
                                example: 123e4567-e89b-12d3-a456-426614174333
                              status:
                                type: string
                                enum:
                                  - pending
                                  - processing
                                  - complete
                                  - failed
                                  - cancelled
                                title: Data Job Status
                                description: The status of the data job
                                example: pending
                              message:
                                type: string
                                nullable: true
                                title: Data Job Message
                                description: The message associated with the data job
                                example: Data job is pending
                              createdAt:
                                type: string
                                format: date-time
                                title: Data Job Created At
                                description: The date and time the data job was created
                                example: '2021-01-01T00:00:00.000Z'
                              updatedAt:
                                type: string
                                format: date-time
                                title: Data Job Updated At
                                description: The date and time the data job was updated
                                example: '2021-01-01T00:00:00.000Z'
                            required:
                              - id
                              - status
                              - createdAt
                              - updatedAt
                          title: Data Jobs
                          description: Array of data jobs associated with the badge
                        createdAt:
                          type: string
                          format: date-time
                          title: Badge Created At
                          description: The date and time the badge was created
                          example: '2021-01-01T00:00:00.000Z'
                        updatedAt:
                          type: string
                          format: date-time
                          title: Badge Updated At
                          description: The date and time the badge was updated
                          example: '2021-01-01T00:00:00.000Z'
                      required:
                        - id
                        - name
                        - description
                        - imageUrl
                        - loyaltyConditions
                        - createdAt
                        - updatedAt
                      title: Get Badges Success Response
                      description: >-
                        Response returned upon successful fetching of the
                        badges.
                  hasNextPage:
                    type: boolean
                    title: Has Next Page
                    description: Indicates if there is a next page of results
                required:
                  - data
                  - hasNextPage
        '403':
          description: '403'
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    title: Message
                    description: Error message
                    example: Forbidden, Could not validate api key
                required:
                  - message
                title: Forbidden Response
                description: Schema for forbidden response
                example: Forbidden, Could not validate api key
        '500':
          description: '500'
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    title: Success
                    description: Indicates operation success
                    example: false
                  message:
                    type: string
                    title: Message
                    description: Error message
                    example: Internal server error
                  debugInfo:
                    type: string
                    title: Debug Info
                    description: Optional debug information
                    example: Stack trace or additional error details
                required:
                  - success
                  - message
                title: Internal Server Error Response
                description: Schema for internal server error response
      security:
        - apiKeyAuth: []
components:
  securitySchemes:
    apiKeyAuth:
      type: apiKey
      in: header
      name: X-API-KEY

````