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

# Query Audit Logs

> ### Query Audit Logs

Paginated query of audit log entries. Scoped by the authenticated user's
merchant context. Supports filtering by:

- `merchantId` — merchant identifier
- `subjectId` — customer/subject identifier (exact)
- `actorId` — the user who performed the action (exact)
- `subjectName` — customer/subject name or email (partial, case-insensitive)
- `actorName` — actor's name, email, or username (partial, case-insensitive)
- `merchantName` — merchant program name (partial, case-insensitive)
- `action` — one or more `AuditAction` values (e.g. `pii_access`, `login_failed`)
- `resourceType` — one or more `AuditResourceType` values
- `from` / `to` — ISO 8601 datetime range
- `page` / `limit` — pagination (max 200 per page)

MERCHANT_ADMIN and MERCHANT_STAFF can query. If `merchantId` is omitted,
defaults to the program ID from the authenticated session.



## OpenAPI

````yaml https://api.loyalty.dog/openapi.json get /v2/giftcards/audit-logs
openapi: 3.1.0
info:
  title: LoyaltyDog
  description: >-

    Welcome to the LoyaltyDog API! This API provides access to our loyalty
    program features, allowing you to integrate with various platforms and
    manage your loyalty data.


    Want to query LoyaltyDog via an AI assistant (Claude, Cursor, Windsurf)? See
    the [MCP Integration guide](https://loyaltydog.ai/playground#mcp).
        
  termsOfService: https://loyalty.dog/loyalty-program-terms-service
  contact:
    name: LoyaltyDog Support
    url: https://loyalty.dog/contact-us
    email: support@loyalty.dog
  version: 1.0.1
servers:
  - url: https://api.loyalty.dog
    description: Production
security:
  - bearerAuth: []
paths:
  /v2/giftcards/audit-logs:
    get:
      tags:
        - Audit Logs
      summary: Query Audit Logs
      description: >-
        ### Query Audit Logs


        Paginated query of audit log entries. Scoped by the authenticated user's

        merchant context. Supports filtering by:


        - `merchantId` — merchant identifier

        - `subjectId` — customer/subject identifier (exact)

        - `actorId` — the user who performed the action (exact)

        - `subjectName` — customer/subject name or email (partial,
        case-insensitive)

        - `actorName` — actor's name, email, or username (partial,
        case-insensitive)

        - `merchantName` — merchant program name (partial, case-insensitive)

        - `action` — one or more `AuditAction` values (e.g. `pii_access`,
        `login_failed`)

        - `resourceType` — one or more `AuditResourceType` values

        - `from` / `to` — ISO 8601 datetime range

        - `page` / `limit` — pagination (max 200 per page)


        MERCHANT_ADMIN and MERCHANT_STAFF can query. If `merchantId` is omitted,

        defaults to the program ID from the authenticated session.
      operationId: query_audit_logs_v2_giftcards_audit_logs_get
      parameters:
        - name: merchantId
          in: query
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: Merchantid
        - name: subjectId
          in: query
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: Subjectid
        - name: actorId
          in: query
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: Actorid
        - name: subjectName
          in: query
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: Subjectname
        - name: actorName
          in: query
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: Actorname
        - name: merchantName
          in: query
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: Merchantname
        - name: action
          in: query
          required: false
          schema:
            anyOf:
              - items:
                  type: string
                type: array
              - type: 'null'
            title: Action
        - name: resourceType
          in: query
          required: false
          schema:
            anyOf:
              - items:
                  type: string
                type: array
              - type: 'null'
            title: Resourcetype
        - name: from
          in: query
          required: false
          schema:
            anyOf:
              - type: string
                format: date-time
              - type: 'null'
            title: From
        - name: to
          in: query
          required: false
          schema:
            anyOf:
              - type: string
                format: date-time
              - type: 'null'
            title: To
        - name: page
          in: query
          required: false
          schema:
            type: integer
            minimum: 1
            default: 1
            title: Page
        - name: limit
          in: query
          required: false
          schema:
            type: integer
            maximum: 200
            minimum: 1
            default: 50
            title: Limit
        - name: X-Eposn-Merchant-Token
          in: header
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: X-Eposn-Merchant-Token
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AuditLogPage'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    AuditLogPage:
      properties:
        items:
          items:
            $ref: '#/components/schemas/AuditLogResponse'
          type: array
          title: Items
        total:
          type: integer
          title: Total
        page:
          type: integer
          title: Page
        pages:
          type: integer
          title: Pages
        limit:
          type: integer
          title: Limit
      type: object
      required:
        - items
        - total
        - page
        - pages
        - limit
      title: AuditLogPage
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    AuditLogResponse:
      properties:
        id:
          type: string
          title: Id
        action:
          type: string
          title: Action
        resourceType:
          type: string
          title: Resourcetype
        resourceId:
          anyOf:
            - type: string
            - type: 'null'
          title: Resourceid
        actorId:
          anyOf:
            - type: string
            - type: 'null'
          title: Actorid
        actorType:
          type: string
          title: Actortype
        subjectId:
          anyOf:
            - type: string
            - type: 'null'
          title: Subjectid
        merchantId:
          anyOf:
            - type: string
            - type: 'null'
          title: Merchantid
        ipAddress:
          anyOf:
            - type: string
            - type: 'null'
          title: Ipaddress
        userAgent:
          anyOf:
            - type: string
            - type: 'null'
          title: Useragent
        requestId:
          anyOf:
            - type: string
            - type: 'null'
          title: Requestid
        details:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Details
        timestamp:
          type: string
          format: date-time
          title: Timestamp
        actorName:
          anyOf:
            - type: string
            - type: 'null'
          title: Actorname
        subjectName:
          anyOf:
            - type: string
            - type: 'null'
          title: Subjectname
        merchantName:
          anyOf:
            - type: string
            - type: 'null'
          title: Merchantname
        resourceName:
          anyOf:
            - type: string
            - type: 'null'
          title: Resourcename
      type: object
      required:
        - id
        - action
        - resourceType
        - actorType
        - timestamp
      title: AuditLogResponse
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: JWT access token obtained from POST /v2/token.

````