> ## 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.

# Create Loyalty Transaction

> Create a loyalty transaction to update account balances.



## OpenAPI

````yaml /api-reference/openapi.documented.json post /api/loyalty/transactions
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/transactions:
    post:
      tags:
        - Loyalty
      summary: Create Loyalty Transaction
      description: Create a loyalty transaction to update account balances.
      parameters: []
      requestBody:
        description: Body
        content:
          application/json:
            schema:
              type: object
              properties:
                description:
                  type: string
                  title: Description
                  description: Description of the loyalty transaction
                  example: Purchase of item X
                entries:
                  type: array
                  items:
                    type: object
                    properties:
                      walletAddress:
                        type: string
                        title: Wallet Address
                        description: The wallet address of the user
                        example: '0x1234567890abcdef1234567890abcdef12345678'
                      direction:
                        type: string
                        enum:
                          - credit
                          - debit
                        title: Direction
                        description: >-
                          Direction of the transaction entry for this wallet
                          address
                        example: credit
                      amount:
                        type: number
                        title: Amount
                        description: Transaction entry amount.
                        example: 5
                      idempotencyKey:
                        type: string
                        maxLength: 32
                        title: Idempotency Key
                        description: >-
                          Idempotency key for the transaction entry. Creation
                          will fail if already exists for this wallet address.
                        example: example-idempotency-key
                      loyaltyCurrencyId:
                        type: string
                        format: uuid
                        title: Loyalty Currency ID
                        description: >-
                          Unique identifier for the loyalty currency for the
                          wallet.  Can only use entry-level currency or
                          transaction-level currency.
                        example: 123e4567-e89b-12d3-a456-426614174090
                    required:
                      - amount
                  title: Entries
                  description: Array of transaction entries
                loyaltyCurrencyId:
                  type: string
                  format: uuid
                  title: Loyalty Currency ID
                  description: Unique identifier for the loyalty currency
                  example: 123e4567-e89b-12d3-a456-426614174090
                websiteId:
                  type: string
                  format: uuid
                organizationId:
                  type: string
                  format: uuid
              required:
                - description
                - entries
              title: Create Loyalty Transaction
              description: Schema for creating a loyalty transaction
      responses:
        '200':
          description: '200'
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: string
                    format: uuid
                  description:
                    type: string
                  entries:
                    type: array
                    items:
                      type: object
                      properties:
                        walletAddress:
                          type: string
                        amount:
                          type: number
                        direction:
                          type: string
                          enum:
                            - credit
                            - debit
                          title: Transaction Entry Direction
                          description: Direction of the transaction entry
                          example: credit
                        idempotencyKey:
                          type: string
                      required:
                        - walletAddress
                        - amount
                        - direction
                  createdAt:
                    type: string
                  updatedAt:
                    type: string
                required:
                  - id
                  - description
                  - entries
                  - createdAt
                  - updatedAt
        '400':
          description: '400'
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    title: Message
                    description: Error message
                    example: Request body is invalid
                required:
                  - message
                title: Bad Request Response
                description: Schema for bad request response
        '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

````