Search Documentation
Search for a documentation page...
Gift Cards API
REST API endpoints for issuing, reading, editing and deactivating gift cards.
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 below) or bought by a shopper as a gift card product, in which case it is created once the order is paid. How refunds of orders paid with gift cards work is under Create Refund. For the merchant's side, see Sell and accept 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 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
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 |
Response
An unknown status or balance value returns 400.
Issue Gift Card
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 |
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 }whensendToEmailwas given,nullotherwise.sent: falsemeans the email did not go out; the card is issued either way, so hand the code over yourself.
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:
Get Gift Card
Returns one card by UUID, with its history. Never the code.
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 |
A card that does not exist, or belongs to another store, returns 404.
Update Gift Card
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 |
Response (200)
The card with its transactions, as Get Gift Card returns it. An empty body returns 400; an unknown card 404.
Deactivate Gift Card
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.
Response (200)
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) |
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 |