A gift card is stored value behind a 16-character code. A shopper spends it at checkout as a **payment**, not a discount: the card pays the order total, tax and shipping included, and the shopper's payment method pays whatever is left. Each card holds one currency, set when it is issued, and is spent only on a cart in that currency.

A card is either issued by hand (in the admin, or with [Issue Gift Card](#issue-gift-card) below) or bought by a shopper as a [gift card product](/docs/api-reference/products#gift-card-products), in which case it is created once the order is paid. How refunds of orders paid with gift cards work is under [Create Refund](/docs/api-reference/orders#gift-cards). For the merchant's side, see [Sell and accept gift cards](/help/payments/gift-cards).

Every endpoint on this page, reads included, needs the `catalog:write` scope. An OAuth app or MCP client acting for a team member also needs that member's permission to edit the catalog.

**The code is returned once.** [Issue Gift Card](#issue-gift-card) answers with the full code in `code`, and no other response ever carries it again. Every other response shows only `lastCharacters`, the code's last four characters. Store the code or hand it over when you issue the card.

## The Gift Card object

| Field | Type | Description |
|-------|------|-------------|
| `id` | `string` | UUID |
| `lastCharacters` | `string` | The code's last four characters, e.g. `6789`. The full code is never returned after the issue |
| `currency` | `string` | ISO 4217 code the card holds, e.g. `USD` |
| `initialValue` | `string` | Value at issue, in the smallest unit of `currency` (`"5000"` = 50.00 USD) |
| `balance` | `string` | What the card has left, in the smallest unit of `currency`. `"0"` once the card is deactivated |
| `status` | `string` | `active` (can be spent), `expired` (its `expiresAt` has passed) or `deactivated` (permanently switched off). A deactivated card reads `deactivated` whatever its expiry |
| `expiresAt` | `string \| null` | ISO 8601 date-time the card stops working; `null` = never |
| `deactivatedAt` | `string \| null` | ISO 8601 date-time the card was deactivated, or `null` |
| `customerId` | `string \| null` | The customer who bought the card; `null` for a card issued by hand |
| `createdAt` | `string` | ISO 8601 date-time the card was issued |

Money is a string in the smallest currency unit, like orders and refunds. No response carries the code after the issue, nor the card's recipient.

---

## List Gift Cards

```
GET /api/v1/gift-cards
```

Returns the store's gift cards, newest first.

### Query Parameters

| Parameter | Type | Default | Description |
|-----------|------|---------|-------------|
| `limit` | `number` | 20 | Gift cards per page (1-100) |
| `offset` | `number` | 0 | Gift cards to skip |
| `status` | `string` | `all` | `active`, `expired`, `deactivated` or `all` |
| `balance` | `string` | `all` | `full` (never spent), `partial`, `empty` or `all` |
| `query` | `string` | – | The last characters of a code (up to 4), or a whole code with or without spaces |

```bash
curl \
  -H "Authorization: Bearer your_api_key" \
  "https://your-store.yns.store/api/v1/gift-cards?status=active&balance=partial"
```

### Response

```json
{
  "data": [
    {
      "id": "0191abc0-1234-7def-8000-0000000000c1",
      "lastCharacters": "6789",
      "currency": "USD",
      "initialValue": "5000",
      "balance": "3500",
      "status": "active",
      "expiresAt": null,
      "deactivatedAt": null,
      "customerId": null,
      "createdAt": "2026-11-01T09:00:00.000Z"
    }
  ],
  "meta": {
    "count": 1,
    "offset": 0,
    "limit": 20
  }
}
```

An unknown `status` or `balance` value returns `400`.

---

## Issue Gift Card

```
POST /api/v1/gift-cards
```

Issues a gift card by hand, with the same checks as **Issue gift card** in the admin.

### Request Body

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `amount` | `number` | Yes | The card's value in units of `currency`, not cents (e.g. `25` or `25.50`). Above 0 and at most 2,000 |
| `currency` | `string` | No | ISO 4217 code: the store currency (the default) or one of the store's enabled currencies |
| `expiresAt` | `string \| null` | No | ISO 8601 date-time the card stops working, in the future. Omit it or send `null` for no expiry |
| `note` | `string` | No | Internal note, up to 1,000 characters, never shown to the customer |
| `sendToEmail` | `string` | No | Email the card to this address right after issuing it (the "New gift card" email). The address becomes the card's recipient |

```bash
curl -X POST \
  -H "Authorization: Bearer your_api_key" \
  -H "Content-Type: application/json" \
  -d '{"amount": 50, "note": "Sorry for the late parcel", "sendToEmail": "ana@example.com"}' \
  https://your-store.yns.store/api/v1/gift-cards
```

### Response (201)

The card, plus:

- `code`: the full code, in groups of four. **This is the only time the API returns it.** It is matched case- and space-insensitively at checkout.
- `email`: `{ to, sent }` when `sendToEmail` was given, `null` otherwise. `sent: false` means the email did not go out; the card is issued either way, so hand the code over yourself.

```json
{
  "id": "0191abc0-1234-7def-8000-0000000000c1",
  "lastCharacters": "6789",
  "currency": "USD",
  "initialValue": "5000",
  "balance": "5000",
  "status": "active",
  "expiresAt": null,
  "deactivatedAt": null,
  "customerId": null,
  "createdAt": "2026-11-12T10:00:00.000Z",
  "code": "abcd 2345 efgh 6789",
  "email": {
    "to": "ana@example.com",
    "sent": true
  }
}
```

### Errors (400)

A `400` issues nothing. It is returned for a missing `amount`, an `amount` of 0 or below, above 2,000, or that rounds to nothing in the currency, and for:

```json
{ "error": "`currency` must be the store currency or one of its enabled currencies" }
```

```json
{ "error": "`expiresAt` must be in the future" }
```

```json
{ "error": "`sendToEmail` is not a valid email address" }
```

---

## Get Gift Card

```
GET /api/v1/gift-cards/:id
```

Returns one card by UUID, with its history. Never the code.

```bash
curl \
  -H "Authorization: Bearer your_api_key" \
  https://your-store.yns.store/api/v1/gift-cards/0191abc0-1234-7def-8000-0000000000c1
```

### Response

The card, plus:

| Field | Type | Description |
|-------|------|-------------|
| `source` | `string` | `issued` (by hand) or `purchased` (bought as a gift card product) |
| `orderId` | `string \| null` | The order that bought the card, for a purchased card |
| `note` | `string \| null` | The internal note |
| `sentAt` | `string \| null` | When the card was last emailed |
| `transactions` | `object[]` | The card's ledger, newest first. See below |

Each transaction:

| Field | Type | Description |
|-------|------|-------------|
| `id` | `string` | UUID |
| `type` | `string` | `issue`, `redeem` (spent on an order), `refund` (credited back by a refund), `adjustment` or `deactivate` (the balance given up on deactivation) |
| `amount` | `string` | Signed, in the smallest currency unit: positive adds to the balance, negative takes from it |
| `status` | `string` | `pending` (held by a checkout in progress), `posted` or `void` (a hold that was let go) |
| `orderId` | `string \| null` | The order, when the transaction belongs to one |
| `orderNumber` | `number \| null` | That order's number |
| `refundId` | `string \| null` | The refund, for a `refund` transaction |
| `actorType` | `string` | Who made it: `user` (a team member), `customer`, `api` or `system` |
| `createdAt` | `string` | ISO 8601 date-time |

```json
{
  "id": "0191abc0-1234-7def-8000-0000000000c1",
  "lastCharacters": "6789",
  "currency": "USD",
  "initialValue": "5000",
  "balance": "3500",
  "status": "active",
  "expiresAt": null,
  "deactivatedAt": null,
  "customerId": null,
  "createdAt": "2026-11-01T09:00:00.000Z",
  "source": "issued",
  "orderId": null,
  "note": "Sorry for the late parcel",
  "sentAt": "2026-11-01T10:00:00.000Z",
  "transactions": [
    {
      "id": "0191abc0-1234-7def-8000-0000000000e2",
      "type": "redeem",
      "amount": "-1500",
      "status": "posted",
      "orderId": "0191abc0-1234-7def-8000-0000000000d1",
      "orderNumber": 1042,
      "refundId": null,
      "actorType": "customer",
      "createdAt": "2026-11-05T12:00:00.000Z"
    },
    {
      "id": "0191abc0-1234-7def-8000-0000000000e1",
      "type": "issue",
      "amount": "5000",
      "status": "posted",
      "orderId": null,
      "orderNumber": null,
      "refundId": null,
      "actorType": "user",
      "createdAt": "2026-11-01T09:00:00.000Z"
    }
  ]
}
```

A card that does not exist, or belongs to another store, returns `404`.

---

## Update Gift Card

```
PATCH /api/v1/gift-cards/:id
```

Changes the expiry and the internal note. Nothing else about a card can change: its value, currency and code are fixed at issue. Send at least one of the two fields.

### Request Body

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `expiresAt` | `string \| null` | No | ISO 8601 date-time the card stops working; `null` removes the expiry. An expired card can be given a new date |
| `note` | `string` | No | Internal note, up to 1,000 characters, never shown to the customer. An empty string clears it |

```bash
curl -X PATCH \
  -H "Authorization: Bearer your_api_key" \
  -H "Content-Type: application/json" \
  -d '{"expiresAt": "2027-12-31T23:59:59Z"}' \
  https://your-store.yns.store/api/v1/gift-cards/0191abc0-1234-7def-8000-0000000000c1
```

### Response (200)

The card with its transactions, as [Get Gift Card](#get-gift-card) returns it. An empty body returns `400`; an unknown card `404`.

---

## Deactivate Gift Card

```
POST /api/v1/gift-cards/:id/deactivate
```

Deactivates the card **for good**. A deactivated card can never be spent, reactivated or reloaded. Its open checkout holds are released, and its remaining balance is given up: a `deactivate` transaction records it and `balance` reads `"0"`. Deactivating a card that is already deactivated changes nothing and returns it as it is.

```bash
curl -X POST \
  -H "Authorization: Bearer your_api_key" \
  https://your-store.yns.store/api/v1/gift-cards/0191abc0-1234-7def-8000-0000000000c1/deactivate
```

### Response (200)

```json
{
  "id": "0191abc0-1234-7def-8000-0000000000c1",
  "lastCharacters": "6789",
  "currency": "USD",
  "initialValue": "5000",
  "balance": "0",
  "status": "deactivated",
  "expiresAt": null,
  "deactivatedAt": "2026-11-12T10:00:00.000Z",
  "customerId": null,
  "createdAt": "2026-11-01T09:00:00.000Z"
}
```

A card that does not exist returns `404`.

---

## Errors

| Status | Meaning |
|--------|---------|
| `400` | Invalid query parameters or body, or an issue the store refuses (see [Issue Gift Card](#errors-400)) |
| `401` | Missing or invalid API key |
| `403` | The key lacks the `catalog:write` scope, or the person behind an OAuth connection may not edit the catalog |
| `404` | Gift card not found |