The REST Admin API is a legacy API as of October 1, 2024. Starting April 1, 2025, all new public apps must be built exclusively with the GraphQL Admin API. For details and migration steps, visit our migration guide.
Gift Card
gift_cards
access scope.You need to contact Shopify Support to request the write_gift_cards
and read_gift_cards
access scopes.
A gift card is an alternative payment method. Each gift card has a unique code that is entered during checkout. Its balance can be redeemed over multiple checkouts. Optionally, a gift card can assigned to a specific customer. Gift card codes cannot be retrieved after they're created—only the last four characters can be retrieved.
You can use the GiftCard resource to create, retrieve, and update gift cards for a store. After a gift card is created, only the expiry date, note, and template suffix can be updated.
You can't delete gift cards, but you can disable them. You can't enable gift cards that were previously disabled.
Endpoints
- post/admin/api/latest/gift_
cards. json Creates a gift card - post/admin/api/latest/gift_
cards/{gift_ card_ id}/disable. json Disables a gift card - get/admin/api/latest/gift_
cards. json?status=enabled Retrieves a list of gift cards - get/admin/api/latest/gift_
cards/{gift_ card_ id}. json Retrieves a single gift card - get/admin/api/latest/gift_
cards/count. json Retrieves a count of gift cards - get/admin/api/latest/gift_
cards/search. json?query=last_ characters:mnop Searches for gift cards - put/admin/api/latest/gift_
cards/{gift_ card_ id}. json Updates an existing gift card
The Gift Card resource
Properties
The ID of the client that issued the gift card.
The balance of the gift card.
The gift card code, which is a string of alphanumeric characters. For security reasons, this is available only upon creation of the gift card. (minimum: 8 characters, maximum: 20 characters)
The currency of the gift card.
The ID of the customer associated with this gift card.
The date and time (ISO 8601 format) when the gift card was disabled.
The date (YYYY-MM-DD
format) when the gift card expires. Returns null
if the gift card doesn't have an expiration date.
The ID of the gift card.
The initial value of the gift card when it was created.
The last four characters of the gift card code. Because gift cards are alternative payment methods, the full code cannot be retrieved.
The ID of the line item that initiated the creation of this gift card, if it was created by an order.
The Gift Card resource
Anchor to POST request, Creates a gift cardpostCreates a gift card
Creates a gift card.
There are additional optional parameters that can be specified in the body of the request when creating a gift card:
The ID of the customer that purchased the gift card.
The ID of the intended recipient of the gift card. This property should be used if the recipientis different from the purchaser. The customer with this ID must have an email address.
Create a gift card with a custom code
Create a gift card with a custom code
Show gift_card properties
An optional note that a merchant can attach to the gift card that isn't visible to customers.
The initial value of the gift card when it was created.
The gift card code, which is a string of alphanumeric characters. For security reasons, this is available only upon creation of the gift card. (minimum: 8 characters, maximum: 20 characters)
The suffix of the Liquid template that's used to render the gift card online. For example, if the value is birthday
,
then the gift card is rendered using the template gift_card.birthday.liquid
. When the value is null
,
the default gift_card.liquid
template is used.
Create a gift card with an automatically generated code
Create a gift card with an automatically generated code
Show gift_card properties
The initial value of the gift card when it was created.
Create a scheduled gift card with a recipient and a message
Create a scheduled gift card with a recipient and a message
Show gift_card properties
The initial value of the gift card when it was created.
/admin/api/2025-07/gift_ cards. json
Response
examples
Create a gift card with a custom code
curl -d '{"gift_card":{"note":"This is a note","initial_value":"100.00","code":"ABCD EFGH IJKL MNOP","template_suffix":"gift_cards.birthday.liquid"}}' \ -X POST "https://your-development-store.myshopify.com/admin/api/2025-07/gift_cards.json" \ -H "X-Shopify-Access-Token: {access_token}" \ -H "Content-Type: application/json"
const { admin, session } = await authenticate.admin(request); const gift_card = new admin.rest.resources.GiftCard({session: session}); gift_card.note = "This is a note"; gift_card.initial_value = "100.00"; gift_card.code = "ABCD EFGH IJKL MNOP"; gift_card.template_suffix = "gift_cards.birthday.liquid"; await gift_card.save({ update: true, });
# Session is activated via Authentication test_session = ShopifyAPI::Context.active_session gift_card = ShopifyAPI::GiftCard.new(session: test_session) gift_card.note = "This is a note" gift_card.initial_value = "100.00" gift_card.code = "ABCD EFGH IJKL MNOP" gift_card.template_suffix = "gift_cards.birthday.liquid" gift_card.save!
// Session is built by the OAuth process const gift_card = new shopify.rest.GiftCard({session: session}); gift_card.note = "This is a note"; gift_card.initial_value = "100.00"; gift_card.code = "ABCD EFGH IJKL MNOP"; gift_card.template_suffix = "gift_cards.birthday.liquid"; await gift_card.save({ update: true, });
response
HTTP/1.1 201 Created{"gift_card":{"id":1063936321,"balance":"100.00","created_at":"2025-07-01T14:43:49-04:00","updated_at":"2025-07-01T14:43:49-04:00","currency":"USD","initial_value":"100.00","disabled_at":null,"line_item_id":null,"api_client_id":755357713,"user_id":null,"customer_id":null,"note":"This is a note","expires_on":null,"template_suffix":"gift_cards.birthday.liquid","last_characters":"mnop","order_id":null,"code":"abcdefghijklmnop"}}
Create a gift card with an automatically generated code
curl -d '{"gift_card":{"initial_value":"25.00"}}' \ -X POST "https://your-development-store.myshopify.com/admin/api/2025-07/gift_cards.json" \ -H "X-Shopify-Access-Token: {access_token}" \ -H "Content-Type: application/json"
const { admin, session } = await authenticate.admin(request); const gift_card = new admin.rest.resources.GiftCard({session: session}); gift_card.initial_value = "25.00"; await gift_card.save({ update: true, });
# Session is activated via Authentication test_session = ShopifyAPI::Context.active_session gift_card = ShopifyAPI::GiftCard.new(session: test_session) gift_card.initial_value = "25.00" gift_card.save!
// Session is built by the OAuth process const gift_card = new shopify.rest.GiftCard({session: session}); gift_card.initial_value = "25.00"; await gift_card.save({ update: true, });
response
HTTP/1.1 201 Created{"gift_card":{"id":1063936316,"balance":"25.00","created_at":"2025-07-01T14:43:43-04:00","updated_at":"2025-07-01T14:43:43-04:00","currency":"USD","initial_value":"25.00","disabled_at":null,"line_item_id":null,"api_client_id":755357713,"user_id":null,"customer_id":null,"note":null,"expires_on":null,"template_suffix":null,"last_characters":"959e","order_id":null,"code":"3b89h943a539959e"}}
Create a scheduled gift card with a recipient and a message
curl -d '{"gift_card":{"initial_value":"100.00","recipient_id":207119551,"message":"Happy birthday!","send_on":"2023-12-31"}}' \ -X POST "https://your-development-store.myshopify.com/admin/api/2025-07/gift_cards.json" \ -H "X-Shopify-Access-Token: {access_token}" \ -H "Content-Type: application/json"
const { admin, session } = await authenticate.admin(request); const gift_card = new admin.rest.resources.GiftCard({session: session}); gift_card.initial_value = "100.00"; gift_card.recipient_id = 207119551; gift_card.message = "Happy birthday!"; gift_card.send_on = "2023-12-31"; await gift_card.save({ update: true, });
# Session is activated via Authentication test_session = ShopifyAPI::Context.active_session gift_card = ShopifyAPI::GiftCard.new(session: test_session) gift_card.initial_value = "100.00" gift_card.recipient_id = 207119551 gift_card.message = "Happy birthday!" gift_card.send_on = "2023-12-31" gift_card.save!
// Session is built by the OAuth process const gift_card = new shopify.rest.GiftCard({session: session}); gift_card.initial_value = "100.00"; gift_card.recipient_id = 207119551; gift_card.message = "Happy birthday!"; gift_card.send_on = "2023-12-31"; await gift_card.save({ update: true, });
response
HTTP/1.1 201 Created{"gift_card":{"id":1063936319,"balance":"100.00","created_at":"2023-11-30T19:00:00-05:00","updated_at":"2023-11-30T19:00:00-05:00","currency":"USD","initial_value":"100.00","disabled_at":null,"line_item_id":null,"api_client_id":755357713,"user_id":null,"customer_id":null,"note":null,"expires_on":null,"template_suffix":null,"last_characters":"7hb4","order_id":null,"code":"ff2a6a3f839c7hb4"}}
Anchor to POST request, Disables a gift cardpostDisables a gift card
Disables a gift card. This action can't be undone.
Disable a gift card
Disable a gift card
Show gift_card properties
The ID of the gift card.
/admin/api/2025-07/gift_ cards/1035197676/disable. json
Response
examples
Disable a gift card
curl -d '{"gift_card":{"id":1035197676}}' \ -X POST "https://your-development-store.myshopify.com/admin/api/2025-07/gift_cards/1035197676/disable.json" \ -H "X-Shopify-Access-Token: {access_token}" \ -H "Content-Type: application/json"
const { admin, session } = await authenticate.admin(request); const gift_card = new admin.rest.resources.GiftCard({session: session}); gift_card.id = 1035197676; await gift_card.disable({ body: {"gift_card": {"id": 1035197676}}, });
# Session is activated via Authentication test_session = ShopifyAPI::Context.active_session gift_card = ShopifyAPI::GiftCard.new(session: test_session) gift_card.id = 1035197676 gift_card.disable( session: test_session, body: {"gift_card" => {"id" => 1035197676}}, )
// Session is built by the OAuth process const gift_card = new shopify.rest.GiftCard({session: session}); gift_card.id = 1035197676; await gift_card.disable({ body: {"gift_card": {"id": 1035197676}}, });
response
HTTP/1.1 201 Created{"gift_card":{"disabled_at":"2025-07-01T14:43:55-04:00","template_suffix":null,"initial_value":"100.00","balance":"100.00","id":1035197676,"created_at":"2025-07-01T14:37:24-04:00","updated_at":"2025-07-01T14:43:55-04:00","currency":"USD","line_item_id":null,"api_client_id":null,"user_id":null,"customer_id":null,"note":null,"expires_on":null,"last_characters":"0d0d","order_id":null}}
Anchor to GET request, Retrieves a list of gift cardsgetRetrieves a list of gift cards
Retrieves a list of gift cards. Note: This endpoint implements pagination by using links that are provided in the response header. To learn more, refer to Make paginated requests to the REST Admin API.
Show only certain fields, specified by a comma-separated list of field names.
The maximum number of results to show.
Restrict results to after the specified ID.
Retrieve gift cards with a given status. Valid values:
Show status properties
enabled: Restrict results to only enabled gift cards
disabled: Restrict results to only disabled gift cards
Retrieve a list of all enabled gift cards
Retrieve a list of all enabled gift cards
Retrieve gift cards with a given status. Valid values:
Show status properties
enabled: Restrict results to only enabled gift cards
disabled: Restrict results to only disabled gift cards
Retrieve a list of all gift cards
Retrieve a list of all gift cards
/admin/api/2025-07/gift_ cards. json?status= enabled
Response
examples
Retrieve a list of all enabled gift cards
curl -X GET "https://your-development-store.myshopify.com/admin/api/2025-07/gift_cards.json?status=enabled" \ -H "X-Shopify-Access-Token: {access_token}"
await admin.rest.resources.GiftCard.all({ session: session, status: "enabled", });
# Session is activated via Authentication test_session = ShopifyAPI::Context.active_session ShopifyAPI::GiftCard.all( session: test_session, status: "enabled", )
// Session is built by the OAuth process await shopify.rest.GiftCard.all({ session: session, status: "enabled", });
response
HTTP/1.1 200 OK{"gift_cards":[{"id":766118925,"balance":"25.00","created_at":"2025-07-01T14:37:24-04:00","updated_at":"2025-07-01T14:37:24-04:00","currency":"USD","initial_value":"50.00","disabled_at":null,"line_item_id":null,"api_client_id":null,"user_id":null,"customer_id":null,"note":null,"expires_on":"2024-07-01","template_suffix":null,"notify":true,"last_characters":"0e0e","order_id":null},{"id":10274553,"balance":"0.00","created_at":"2025-07-01T14:37:24-04:00","updated_at":"2025-07-01T14:37:24-04:00","currency":"USD","initial_value":"50.00","disabled_at":null,"line_item_id":null,"api_client_id":null,"user_id":null,"customer_id":null,"note":null,"expires_on":null,"template_suffix":null,"notify":true,"last_characters":"0y0y","order_id":null}]}
Retrieve a list of all gift cards
curl -X GET "https://your-development-store.myshopify.com/admin/api/2025-07/gift_cards.json" \ -H "X-Shopify-Access-Token: {access_token}"
await admin.rest.resources.GiftCard.all({ session: session, });
# Session is activated via Authentication test_session = ShopifyAPI::Context.active_session ShopifyAPI::GiftCard.all( session: test_session, )
// Session is built by the OAuth process await shopify.rest.GiftCard.all({ session: session, });
response
HTTP/1.1 200 OK{"gift_cards":[{"id":1035197676,"balance":"100.00","created_at":"2025-07-01T14:37:24-04:00","updated_at":"2025-07-01T14:37:24-04:00","currency":"USD","initial_value":"100.00","disabled_at":null,"line_item_id":null,"api_client_id":null,"user_id":null,"customer_id":null,"note":null,"expires_on":null,"template_suffix":null,"notify":true,"last_characters":"0d0d","order_id":null},{"id":766118925,"balance":"25.00","created_at":"2025-07-01T14:37:24-04:00","updated_at":"2025-07-01T14:37:24-04:00","currency":"USD","initial_value":"50.00","disabled_at":null,"line_item_id":null,"api_client_id":null,"user_id":null,"customer_id":null,"note":null,"expires_on":"2024-07-01","template_suffix":null,"notify":true,"last_characters":"0e0e","order_id":null},{"id":10274553,"balance":"0.00","created_at":"2025-07-01T14:37:24-04:00","updated_at":"2025-07-01T14:37:24-04:00","currency":"USD","initial_value":"50.00","disabled_at":null,"line_item_id":null,"api_client_id":null,"user_id":null,"customer_id":null,"note":null,"expires_on":null,"template_suffix":null,"notify":true,"last_characters":"0y0y","order_id":null}]}
Anchor to GET request, Retrieves a single gift cardgetRetrieves a single gift card
Retrieves a single gift card by its ID
Retrieve a single gift card
Retrieve a single gift card
/admin/api/2025-07/gift_ cards/1035197676. json
Response
examples
Retrieve a single gift card
curl -X GET "https://your-development-store.myshopify.com/admin/api/2025-07/gift_cards/1035197676.json" \ -H "X-Shopify-Access-Token: {access_token}"
await admin.rest.resources.GiftCard.find({ session: session, id: 1035197676, });
# Session is activated via Authentication test_session = ShopifyAPI::Context.active_session ShopifyAPI::GiftCard.find( session: test_session, id: 1035197676, )
// Session is built by the OAuth process await shopify.rest.GiftCard.find({ session: session, id: 1035197676, });
response
HTTP/1.1 200 OK{"gift_card":{"id":1035197676,"balance":"100.00","created_at":"2025-07-01T14:37:24-04:00","updated_at":"2025-07-01T14:37:24-04:00","currency":"USD","initial_value":"100.00","disabled_at":null,"line_item_id":null,"api_client_id":null,"user_id":null,"customer_id":null,"note":null,"expires_on":null,"template_suffix":null,"last_characters":"0d0d","order_id":null}}
Anchor to GET request, Retrieves a count of gift cardsgetRetrieves a count of gift cards
Retrieves a count of gift cards with a given status.
Count gift cards with a given status. Valid values:
Show status properties
enabled: Count only enabled gift cards
disabled: Count only disabled gift cards
Retrieve a count of all gift cards
Retrieve a count of all gift cards
Retrieve a count of enabled gift cards
Retrieve a count of enabled gift cards
Count gift cards with a given status. Valid values:
Show status properties
enabled: Count only enabled gift cards
disabled: Count only disabled gift cards
/admin/api/2025-07/gift_ cards/count. json
Response
examples
Retrieve a count of all gift cards
curl -X GET "https://your-development-store.myshopify.com/admin/api/2025-07/gift_cards/count.json" \ -H "X-Shopify-Access-Token: {access_token}"
await admin.rest.resources.GiftCard.count({ session: session, });
# Session is activated via Authentication test_session = ShopifyAPI::Context.active_session ShopifyAPI::GiftCard.count( session: test_session, )
// Session is built by the OAuth process await shopify.rest.GiftCard.count({ session: session, });
response
HTTP/1.1 200 OK{"count":3}
Retrieve a count of enabled gift cards
curl -X GET "https://your-development-store.myshopify.com/admin/api/2025-07/gift_cards/count.json?status=enabled" \ -H "X-Shopify-Access-Token: {access_token}"
await admin.rest.resources.GiftCard.count({ session: session, status: "enabled", });
# Session is activated via Authentication test_session = ShopifyAPI::Context.active_session ShopifyAPI::GiftCard.count( session: test_session, status: "enabled", )
// Session is built by the OAuth process await shopify.rest.GiftCard.count({ session: session, status: "enabled", });
response
HTTP/1.1 200 OK{"count":3}
Anchor to GET request, Searches for gift cardsgetSearches for gift cards
Searches for gift cards that match a supplied query. The following fields are indexed by search:
created_at
updated_at
disabled_at
balance
initial_value
amount_spent
email
last_characters
Note: This endpoint implements pagination by using links that are provided in the response header. To learn more, refer to Make paginated requests to the REST Admin API.
Show gift cards created at or before date.
Show gift cards created at or after date.
Show only certain fields, specified by a comma-separated list of field names.
The maximum number of results to retrieve.
The field and direction to order results by.
The text to search for.
Show gift cards last updated at or before date.
Show gift cards last updated at or after date.
Retrieve all gift cards with the last characters "mnop"
Retrieve all gift cards with the last characters "mnop"
The text to search for.
/admin/api/2025-07/gift_ cards/search. json?query= last_characters:mnop
Response
examples
Retrieve all gift cards with the last characters "mnop"
curl -X GET "https://your-development-store.myshopify.com/admin/api/2025-07/gift_cards/search.json?query=last_characters%3Amnop" \ -H "X-Shopify-Access-Token: {access_token}"
await admin.rest.resources.GiftCard.search({ session: session, query: "last_characters:mnop", });
# Session is activated via Authentication test_session = ShopifyAPI::Context.active_session ShopifyAPI::GiftCard.search( session: test_session, query: "last_characters:mnop", )
// Session is built by the OAuth process await shopify.rest.GiftCard.search({ session: session, query: "last_characters:mnop", });
response
HTTP/1.1 200 OK{"gift_cards":[{"id":1063936317,"balance":"10.00","created_at":"2025-07-01T14:43:44-04:00","updated_at":"2025-07-01T14:43:44-04:00","currency":"USD","initial_value":"10.00","disabled_at":null,"line_item_id":null,"api_client_id":null,"user_id":null,"customer_id":null,"note":null,"expires_on":null,"template_suffix":null,"notify":true,"last_characters":"mnop","order_id":null}]}
Anchor to PUT request, Updates an existing gift cardputUpdates an existing gift card
Updates an existing gift card.
Expiry date, note, and template suffix properties of a gift card can be changed via the API.
A customer ID can only be set if the current value is `null`.
Update the expiry date of a gift card
Update the expiry date of a gift card
Show gift_card properties
The ID of the gift card.
The date (YYYY-MM-DD
format) when the gift card expires. Returns null
if the gift card doesn't have an expiration date.
Update the note of a gift card
Update the note of a gift card
Show gift_card properties
The ID of the gift card.
An optional note that a merchant can attach to the gift card that isn't visible to customers.
/admin/api/2025-07/gift_ cards/1035197676. json
Response
examples
Update the expiry date of a gift card
curl -d '{"gift_card":{"id":1035197676,"expires_on":"2020-01-01"}}' \ -X PUT "https://your-development-store.myshopify.com/admin/api/2025-07/gift_cards/1035197676.json" \ -H "X-Shopify-Access-Token: {access_token}" \ -H "Content-Type: application/json"
const { admin, session } = await authenticate.admin(request); const gift_card = new admin.rest.resources.GiftCard({session: session}); gift_card.id = 1035197676; gift_card.expires_on = "2020-01-01"; await gift_card.save({ update: true, });
# Session is activated via Authentication test_session = ShopifyAPI::Context.active_session gift_card = ShopifyAPI::GiftCard.new(session: test_session) gift_card.id = 1035197676 gift_card.expires_on = "2020-01-01" gift_card.save!
// Session is built by the OAuth process const gift_card = new shopify.rest.GiftCard({session: session}); gift_card.id = 1035197676; gift_card.expires_on = "2020-01-01"; await gift_card.save({ update: true, });
response
HTTP/1.1 200 OK{"gift_card":{"expires_on":"2020-01-01","template_suffix":null,"initial_value":"100.00","balance":"100.00","id":1035197676,"created_at":"2025-07-01T14:37:24-04:00","updated_at":"2025-07-01T14:43:53-04:00","currency":"USD","disabled_at":null,"line_item_id":null,"api_client_id":null,"user_id":null,"customer_id":null,"note":null,"last_characters":"0d0d","order_id":null}}
Update the note of a gift card
curl -d '{"gift_card":{"id":1035197676,"note":"Updating with a new note"}}' \ -X PUT "https://your-development-store.myshopify.com/admin/api/2025-07/gift_cards/1035197676.json" \ -H "X-Shopify-Access-Token: {access_token}" \ -H "Content-Type: application/json"
const { admin, session } = await authenticate.admin(request); const gift_card = new admin.rest.resources.GiftCard({session: session}); gift_card.id = 1035197676; gift_card.note = "Updating with a new note"; await gift_card.save({ update: true, });
# Session is activated via Authentication test_session = ShopifyAPI::Context.active_session gift_card = ShopifyAPI::GiftCard.new(session: test_session) gift_card.id = 1035197676 gift_card.note = "Updating with a new note" gift_card.save!
// Session is built by the OAuth process const gift_card = new shopify.rest.GiftCard({session: session}); gift_card.id = 1035197676; gift_card.note = "Updating with a new note"; await gift_card.save({ update: true, });
response
HTTP/1.1 200 OK{"gift_card":{"note":"Updating with a new note","template_suffix":null,"initial_value":"100.00","balance":"100.00","id":1035197676,"created_at":"2025-07-01T14:37:24-04:00","updated_at":"2025-07-01T14:43:54-04:00","currency":"USD","disabled_at":null,"line_item_id":null,"api_client_id":null,"user_id":null,"customer_id":null,"expires_on":null,"last_characters":"0d0d","order_id":null}}