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

# Activategiftcard

> ### Activate Gift Card

Activates a pending gift card and loads the initial balance. Creates an ACTIVATION transaction
for audit trail.

**Business Rules**:
- Only PENDING cards can be activated
- Card must not be expired
- Balance is set to initialValue upon activation
- Status changes from PENDING to ACTIVE
- Customer information can be updated during activation
- Activation creates a transaction record
- Authenticated customer session is required

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

**Request Body**:
- `customerEmail`: Customer email (optional, updates card if provided)
- `customerName`: Customer name (optional, updates card if provided)

**Returns**:
- Activated gift card details with updated balance and ACTIVE status
- Includes activatedAt timestamp

**Status Codes**:
- 200: Gift card activated successfully
- 400: Card cannot be activated (already active, expired, or invalid status)
- 404: Gift card not found or doesn't belong to program
- 409: Activation conflicted with concurrent update
- 401: Unauthorized

**Idempotency Scope**:
- Idempotency keys are scoped to `programId + activate + cardId`
- The same key may be reused for different cards or different gift card actions



## OpenAPI

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


        Activates a pending gift card and loads the initial balance. Creates an
        ACTIVATION transaction

        for audit trail.


        **Business Rules**:

        - Only PENDING cards can be activated

        - Card must not be expired

        - Balance is set to initialValue upon activation

        - Status changes from PENDING to ACTIVE

        - Customer information can be updated during activation

        - Activation creates a transaction record

        - Authenticated customer session is required


        **Path Parameters**:

        - `programId`: MongoDB ObjectId of the loyalty program

        - `cardId`: MongoDB ObjectId of the gift card


        **Request Body**:

        - `customerEmail`: Customer email (optional, updates card if provided)

        - `customerName`: Customer name (optional, updates card if provided)


        **Returns**:

        - Activated gift card details with updated balance and ACTIVE status

        - Includes activatedAt timestamp


        **Status Codes**:

        - 200: Gift card activated successfully

        - 400: Card cannot be activated (already active, expired, or invalid
        status)

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

        - 409: Activation conflicted with concurrent update

        - 401: Unauthorized


        **Idempotency Scope**:

        - Idempotency keys are scoped to `programId + activate + cardId`

        - The same key may be reused for different cards or different gift card
        actions
      operationId: >-
        activateGiftCard_v2_giftcards_programs__programId__cards__cardId__activate_post
      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: idempotency-key
          in: header
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: Idempotency-Key
        - 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
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ActivateGiftCardRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GiftCardResponse'
        '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
    ActivateGiftCardRequest:
      properties:
        customerEmail:
          anyOf:
            - type: string
              format: email
            - type: 'null'
          title: Customeremail
        customerPhone:
          anyOf:
            - type: string
              maxLength: 50
            - type: 'null'
          title: Customerphone
        customerName:
          anyOf:
            - type: string
              maxLength: 255
            - type: 'null'
          title: Customername
        securityCode:
          anyOf:
            - type: string
              maxLength: 6
            - type: 'null'
          title: Securitycode
          description: Security code required for customer self-activation
      type: object
      title: ActivateGiftCardRequest
    GiftCardResponse:
      properties:
        id:
          $ref: '#/components/schemas/PydanticObjectId'
        cardNumber:
          type: string
          title: Cardnumber
        balance:
          type: string
          title: Balance
        initialValue:
          type: string
          title: Initialvalue
        status:
          $ref: '#/components/schemas/GiftCardStatus'
        createdAt:
          type: string
          format: date-time
          title: Createdat
        updatedAt:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Updatedat
        activatedAt:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Activatedat
        expiresAt:
          type: string
          format: date-time
          title: Expiresat
        suspendedReason:
          anyOf:
            - type: string
            - type: 'null'
          title: Suspendedreason
        suspendedUntil:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Suspendeduntil
        suspendedAt:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Suspendedat
        customerId:
          anyOf:
            - $ref: '#/components/schemas/PydanticObjectId'
            - type: 'null'
        customerEmail:
          anyOf:
            - type: string
            - type: 'null'
          title: Customeremail
        customerPhone:
          anyOf:
            - type: string
            - type: 'null'
          title: Customerphone
        customerName:
          anyOf:
            - type: string
            - type: 'null'
          title: Customername
        senderName:
          anyOf:
            - type: string
            - type: 'null'
          title: Sendername
        merchantId:
          $ref: '#/components/schemas/PydanticObjectId'
        merchantName:
          anyOf:
            - type: string
            - type: 'null'
          title: Merchantname
        isPhysical:
          type: boolean
          title: Isphysical
        designTemplate:
          anyOf:
            - type: string
            - type: 'null'
          title: Designtemplate
        customMessage:
          anyOf:
            - type: string
            - type: 'null'
          title: Custommessage
        lastFourDigits:
          type: string
          title: Lastfourdigits
        programId:
          $ref: '#/components/schemas/PydanticObjectId'
        deliverAt:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Deliverat
        delivered:
          type: boolean
          title: Delivered
          default: false
        card:
          anyOf:
            - $ref: '#/components/schemas/PassCard'
            - type: 'null'
      type: object
      required:
        - id
        - cardNumber
        - balance
        - initialValue
        - status
        - createdAt
        - updatedAt
        - activatedAt
        - expiresAt
        - suspendedReason
        - suspendedUntil
        - suspendedAt
        - customerId
        - customerEmail
        - customerPhone
        - customerName
        - merchantId
        - isPhysical
        - designTemplate
        - customMessage
        - lastFourDigits
        - programId
        - card
      title: GiftCardResponse
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    GiftCardStatus:
      type: string
      enum:
        - pending
        - active
        - suspended
        - expired
        - voided
        - depleted
      title: GiftCardStatus
      description: Gift card status enumeration.
    PassCard:
      properties:
        serialNumber:
          type: string
          title: Serialnumber
        passTypeIdentifier:
          type: string
          title: Passtypeidentifier
        url:
          type: string
          minLength: 1
          format: uri
          title: Url
      type: object
      required:
        - serialNumber
        - passTypeIdentifier
        - url
      title: PassCard
      description: |-
        The customer card object

        Attributes:
            serialNumber (str): The serial number of the customer pass
            passTypeIdentifier (str): The pass type identifier of the customer pass
            url (str): The shareable URL of the customer pass
    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.

````