> ## 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 social posts

> Fetch social posts with pagination and filtering options. Note: Rank is calculated for top 20,000 posts only. Posts beyond this threshold will have a null rank.



## OpenAPI

````yaml /api-reference/openapi.documented.json get /api/loyalty/posts
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/posts:
    get:
      tags:
        - Social Posts
      summary: Get social posts
      description: >-
        Fetch social posts with pagination and filtering options. Note: Rank is
        calculated for top 20,000 posts only. Posts beyond this threshold will
        have a null rank.
      parameters:
        - name: websiteId
          in: query
          description: UUID of the website to fetch social posts for
          schema:
            type: string
            format: uuid
            title: Website ID
            example: 123e4567-e89b-12d3-a456-426614174000
        - name: organizationId
          in: query
          description: UUID of the organization to fetch social posts for
          schema:
            type: string
            format: uuid
            title: Organization ID
            example: 123e4567-e89b-12d3-a456-426614174001
        - name: userGroupId
          in: query
          description: Optional UUID of the user group to filter posts
          schema:
            type: string
            format: uuid
            title: User Group ID
            example: 123e4567-e89b-12d3-a456-426614174004
        - name: userId
          in: query
          description: Optional UUID of the user to filter posts
          schema:
            oneOf:
              - type: string
                format: uuid
              - type: array
                items:
                  type: string
                  format: uuid
                minItems: 1
            title: User ID
            example: 123e4567-e89b-12d3-a456-426614174003
        - name: loyaltyPostId
          in: query
          description: Optional UUID of the loyalty post to filter posts
          schema:
            oneOf:
              - type: string
                format: uuid
              - type: array
                items:
                  type: string
                  format: uuid
                minItems: 1
            title: Loyalty Post ID
            example: 123e4567-e89b-12d3-a456-426614174003
        - name: cursor
          in: query
          description: Cursor for pagination
          schema:
            type: string
            title: Cursor
            example: 123e4567-e89b-12d3-a456-426614174003
        - name: limit
          in: query
          description: Number of posts to fetch per page
          schema:
            default: 20
            type: integer
            minimum: 1
            maximum: 100
            title: Limit
            example: 10
        - name: sortBy
          in: query
          description: Sort posts by createdAt or rank
          schema:
            default: rank
            type: string
            enum:
              - rank
              - createdAt
            title: Sort By
            example: rank
      responses:
        '200':
          description: '200'
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: array
                    items:
                      type: object
                      properties:
                        id:
                          type: string
                          format: uuid
                        text:
                          type: string
                        mediaUrl:
                          type: string
                        previewUrl:
                          type: string
                        mediaType:
                          type: string
                          enum:
                            - image
                            - video
                        platform:
                          type: string
                          enum:
                            - twitter
                            - tiktok
                        postType:
                          type: string
                          enum:
                            - post
                            - comment
                            - repost
                        externalIdentifier:
                          type: string
                          nullable: true
                        parentPostId:
                          type: string
                          format: uuid
                        likeCount:
                          type: number
                        commentCount:
                          type: number
                        repostCount:
                          type: number
                        viewCount:
                          type: number
                        manualRank:
                          type: number
                          nullable: true
                        dynamicScore:
                          type: number
                          nullable: true
                        rank:
                          type: number
                          nullable: true
                        latestReward:
                          type: number
                          nullable: true
                        loyaltyCurrencyId:
                          type: string
                          format: uuid
                        loyaltyRuleId:
                          type: string
                          format: uuid
                        contentQualityScore:
                          type: number
                          nullable: true
                        sentimentScore:
                          type: integer
                          minimum: 1
                          maximum: 100
                          nullable: true
                        postedAt:
                          type: string
                          format: date-time
                          nullable: true
                        isSeen:
                          type: boolean
                        authorId:
                          type: string
                        userId:
                          type: string
                          format: uuid
                        createdAt:
                          type: string
                          format: date-time
                        updatedAt:
                          type: string
                          format: date-time
                        userMetadata:
                          type: object
                          properties:
                            userId:
                              type: string
                              format: uuid
                            logoUrl:
                              type: string
                            twitterUser:
                              type: string
                            twitterUserId:
                              type: string
                              format: uuid
                            twitterUserFollowersCount:
                              type: number
                            twitterVerifiedAccount:
                              type: boolean
                          required:
                            - userId
                            - twitterUser
                            - twitterUserId
                            - twitterUserFollowersCount
                            - twitterVerifiedAccount
                      required:
                        - id
                        - mediaType
                        - platform
                        - postType
                        - loyaltyCurrencyId
                        - loyaltyRuleId
                        - isSeen
                        - authorId
                        - userId
                        - createdAt
                        - updatedAt
                        - userMetadata
                      title: Social Post
                      description: A social media post
                  hasNextPage:
                    type: boolean
                required:
                  - data
                  - hasNextPage
                title: Social Posts Response
                description: Response containing social posts with pagination info
        '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

````