---
title: "Creategiftcard"
method: POST
path: "/v2/giftcards/programs/{programId}/cards"
tags: ["Gift Cards"]
---

# Creategiftcard

`POST /v2/giftcards/programs/{programId}/cards`

Create a new gift card in pending status with a generated card number and security code.

Validates and sets the expiration (defaults to 1 year, must not exceed 5 years), sanitizes the provided custom message to prevent XSS, generates a unique 16-digit card number and a 6-digit security code, persists the card with a zero balance and the requested initialValue, and returns the persisted card representation.

Parameters:
    data (CreateGiftCardRequest): Request payload containing initialValue, merchantId, optional customer fields, expiration, isPhysical, designTemplate, and customMessage.

Returns:
    GiftCardResponse: The newly created gift card data (status will be "pending"); the security code is stored but not returned.

## Path parameters

- `programId` string, required

## Query parameters

- `cardId` string

## Headers

- `X-Eposn-Customer-Token` string, nullable
- `X-Eposn-Merchant-Token` string, nullable

## Request body

- CreateGiftCardRequest
  - `initialValue` union, required
    - number
    - string
  - `customerEmail` string, email, nullable
  - `customerPhone` string, phone, nullable
  - `customerName` string, nullable
  - `senderName` string, nullable
  - `merchantId` string, required
  - `expiresAt` string, date-time, nullable
  - `isPhysical` boolean
  - `designTemplate` string, nullable
  - `customMessage` string, nullable
  - `deliverAt` string, date-time, nullable

## Response `201`

Successful Response

- GiftCardResponse
  - `id` string, required
  - `cardNumber` string, required
  - `balance` string, required
  - `initialValue` string, required
  - `status` 'pending' | 'active' | 'suspended' | 'expired' | 'voided' | 'depleted', required — Gift card status enumeration.
  - `createdAt` string, date-time, required
  - `updatedAt` string, date-time, nullable, required
  - `activatedAt` string, date-time, nullable, required
  - `expiresAt` string, date-time, required
  - `suspendedReason` string, nullable, required
  - `suspendedUntil` string, date-time, nullable, required
  - `suspendedAt` string, date-time, nullable, required
  - `customerId` string, required
  - `customerEmail` string, nullable, required
  - `customerPhone` string, nullable, required
  - `customerName` string, nullable, required
  - `senderName` string, nullable
  - `merchantId` string, required
  - `merchantName` string, nullable
  - `isPhysical` boolean, required
  - `designTemplate` string, nullable, required
  - `customMessage` string, nullable, required
  - `lastFourDigits` string, required
  - `programId` string, required
  - `deliverAt` string, date-time, nullable
  - `delivered` boolean
  - `card` PassCard, required — 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
    - `serialNumber` string, required
    - `passTypeIdentifier` string, required
    - `url` string, uri, required

## Other responses

- `422` — Validation Error

---

[API](https://skmtc.net/loyalty/apis/loyaltydog.md) · [All operations](https://skmtc.net/loyalty/apis/loyaltydog/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/loyalty/loyaltydog/versions/42b7b22af2b6/schema)
