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

# Getgiftcarddetails

> ### Get Gift Card Details

Retrieves comprehensive details for a specific gift card including current balance,
status, and optionally the complete transaction history.

**Card Information**:
- Current balance and initial value
- Card status (pending, active, expired, voided, depleted)
- Card number (16 digits) and last four digits
- Customer information (email, name, ID)
- Merchant identifier
- Expiration and activation dates
- Physical/digital card indicator
- Design template and custom message

**Business Rules**:
- Card number is returned in full (security code is never exposed)
- Status reflects current card state
- Timestamps in UTC
- Optional transaction history sorted newest first

**Path Parameters**:
- `programId`: MongoDB ObjectId of the loyalty program
- `cardId`: MongoDB ObjectId of the gift card

**Query Parameters**:
- `include_transactions`: Include full transaction history (default: false)
  - Use `?include_transactions=true` to include all transactions
  - Transactions sorted by createdAt descending (newest first)

**Returns**:
- Gift card details object
- Optional: transactions array if include_transactions=true

**Response Example (without transactions)**:
```json
{
    "id": "507f191e810c19729de860ea",
    "cardNumber": "4000123456789012",
    "lastFourDigits": "9012",
    "balance": 100.00,
    "initialValue": 100.00,
    "status": "active",
    "createdAt": "2025-01-01T00:00:00Z",
    "updatedAt": "2025-01-15T10:30:00Z",
    "activatedAt": "2025-01-02T14:20:00Z",
    "expiresAt": "2026-01-01T00:00:00Z",
    "customerId": "customer_456",
    "customerEmail": "customer@example.com",
    "customerName": "John Doe",
    "merchantId": "merchant_123",
    "isPhysical": false,
    "designTemplate": "birthday",
    "customMessage": "Happy Birthday!"
}
```

**Response Example (with transactions)**:
```json
{
    "id": "507f191e810c19729de860ea",
    ...card details...,
    "transactions": [
        {
            "id": "507f1f77bcf86cd799439011",
            "transactionType": "REDEMPTION",
            "amount": -25.50,
            "balanceBefore": 100.00,
            "balanceAfter": 74.50,
            ...transaction details...
        }
    ]
}
```

**Status Codes**:
- 200: Gift card details retrieved successfully
- 404: Gift card not found or doesn't belong to program
- 401: Unauthorized



## OpenAPI

````yaml https://api.loyalty.dog/openapi.json get /v2/giftcards/programs/{programId}/cards/{cardId}
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/programs/{programId}/cards/{cardId}:
    get:
      tags:
        - Gift Cards
      summary: Getgiftcarddetails
      description: >-
        ### Get Gift Card Details


        Retrieves comprehensive details for a specific gift card including
        current balance,

        status, and optionally the complete transaction history.


        **Card Information**:

        - Current balance and initial value

        - Card status (pending, active, expired, voided, depleted)

        - Card number (16 digits) and last four digits

        - Customer information (email, name, ID)

        - Merchant identifier

        - Expiration and activation dates

        - Physical/digital card indicator

        - Design template and custom message


        **Business Rules**:

        - Card number is returned in full (security code is never exposed)

        - Status reflects current card state

        - Timestamps in UTC

        - Optional transaction history sorted newest first


        **Path Parameters**:

        - `programId`: MongoDB ObjectId of the loyalty program

        - `cardId`: MongoDB ObjectId of the gift card


        **Query Parameters**:

        - `include_transactions`: Include full transaction history (default:
        false)
          - Use `?include_transactions=true` to include all transactions
          - Transactions sorted by createdAt descending (newest first)

        **Returns**:

        - Gift card details object

        - Optional: transactions array if include_transactions=true


        **Response Example (without transactions)**:

        ```json

        {
            "id": "507f191e810c19729de860ea",
            "cardNumber": "4000123456789012",
            "lastFourDigits": "9012",
            "balance": 100.00,
            "initialValue": 100.00,
            "status": "active",
            "createdAt": "2025-01-01T00:00:00Z",
            "updatedAt": "2025-01-15T10:30:00Z",
            "activatedAt": "2025-01-02T14:20:00Z",
            "expiresAt": "2026-01-01T00:00:00Z",
            "customerId": "customer_456",
            "customerEmail": "customer@example.com",
            "customerName": "John Doe",
            "merchantId": "merchant_123",
            "isPhysical": false,
            "designTemplate": "birthday",
            "customMessage": "Happy Birthday!"
        }

        ```


        **Response Example (with transactions)**:

        ```json

        {
            "id": "507f191e810c19729de860ea",
            ...card details...,
            "transactions": [
                {
                    "id": "507f1f77bcf86cd799439011",
                    "transactionType": "REDEMPTION",
                    "amount": -25.50,
                    "balanceBefore": 100.00,
                    "balanceAfter": 74.50,
                    ...transaction details...
                }
            ]
        }

        ```


        **Status Codes**:

        - 200: Gift card details retrieved successfully

        - 404: Gift card not found or doesn't belong to program

        - 401: Unauthorized
      operationId: getGiftCardDetails_v2_giftcards_programs__programId__cards__cardId__get
      parameters:
        - name: programId
          in: path
          required: true
          schema:
            anyOf:
              - $ref: '#/components/schemas/PydanticObjectId'
              - type: 'null'
            title: Programid
        - name: cardId
          in: path
          required: true
          schema:
            anyOf:
              - $ref: '#/components/schemas/PydanticObjectId'
              - type: 'null'
            title: Cardid
        - name: include_transactions
          in: query
          required: false
          schema:
            type: boolean
            default: false
            title: Include Transactions
        - name: X-Eposn-Customer-Token
          in: header
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: X-Eposn-Customer-Token
        - 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: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    PydanticObjectId:
      type: string
      maxLength: 24
      minLength: 24
      pattern: ^[0-9a-f]{24}$
      example: 5eb7cf5a86d9755df3a6c593
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    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.

````