# giftCards - admin-graphql - QUERY Version: 2025-01 ## Description Returns a list of gift cards. ### Access Scopes `read_gift_cards` access scope. ## Arguments * [after](/docs/api/admin-graphql/2025-01/scalars/String): String - The elements that come after the specified [cursor](https://shopify.dev/api/usage/pagination-graphql). * [before](/docs/api/admin-graphql/2025-01/scalars/String): String - The elements that come before the specified [cursor](https://shopify.dev/api/usage/pagination-graphql). * [first](/docs/api/admin-graphql/2025-01/scalars/Int): Int - The first `n` elements from the [paginated list](https://shopify.dev/api/usage/pagination-graphql). * [last](/docs/api/admin-graphql/2025-01/scalars/Int): Int - The last `n` elements from the [paginated list](https://shopify.dev/api/usage/pagination-graphql). * [query](/docs/api/admin-graphql/2025-01/scalars/String): String - A filter made up of terms, connectives, modifiers, and comparators. | name | type | description | acceptable_values | default_value | example_use | | ---- | ---- | ---- | ---- | ---- | ---- | | default | string | Searched fields: code. | | | - `query=Bob Norman`<br/> - `query=title:green hoodie` | | balance_status | string | | - `full`<br/> - `partial`<br/> - `empty`<br/> - `full_or_partial` | | - `balance_status:full` | | created_at | time | | | | - `created_at:>=2020-01-01T12:00:00Z` | | expires_on | date | | | | - `expires_on:>=2020-01-01` | | id | id | Filter by `id` range. | | | - `id:1234`<br/> - `id:>=1234`<br/> - `id:<=1234` | | initial_value | string | | | | - `initial_value:>=100` | | source | string | | - `manual`<br/> - `purchased`<br/> - `api_client` | | - `source:manual` | | status | string | | - `disabled`<br/> - `enabled`<br/> - `expired`<br/> - `expiring` | | - `status:disabled OR status:expired` | You can apply one or more filters to a query. Learn more about [Shopify API search syntax](https://shopify.dev/api/usage/search-syntax). * [reverse](/docs/api/admin-graphql/2025-01/scalars/Boolean): Boolean - Reverse the order of the underlying list. * [savedSearchId](/docs/api/admin-graphql/2025-01/scalars/ID): ID - The ID of a [saved search](https://shopify.dev/api/admin-graphql/latest/objects/savedsearch#field-id). The search’s query string is used as the query argument. * [sortKey](/docs/api/admin-graphql/2025-01/enums/GiftCardSortKeys): GiftCardSortKeys - Sort the underlying list using a key. If your query is slow or returns an error, then [try specifying a sort key that matches the field used in the search](https://shopify.dev/api/usage/pagination-graphql#search-performance-considerations). ## Returns * [edges](/docs/api/admin-graphql/2025-01/objects/GiftCardEdge): GiftCardEdge! The connection between the node and its parent. Each edge contains a minimum of the edge's cursor and the node. * [nodes](/docs/api/admin-graphql/2025-01/objects/GiftCard): GiftCard! A list of nodes that are contained in GiftCardEdge. You can fetch data about an individual node, or you can follow the edges to fetch data about a collection of related nodes. At each node, you specify the fields that you want to retrieve. * [pageInfo](/docs/api/admin-graphql/2025-01/objects/PageInfo): PageInfo! An object that’s used to retrieve [cursor information](https://shopify.dev/api/usage/pagination-graphql) about the current page. ## Examples ### Get the first 5 enabled gift cards Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2025-01/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"query { giftCards(first: 5, query: \\\"status:enabled\\\") { edges { node { id enabled } } } }\"\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: `query {\n giftCards(first: 5, query: \"status:enabled\") {\n edges {\n node {\n id\n enabled\n }\n }\n }\n }`,\n});\n" Ruby example: "session = ShopifyAPI::Auth::Session.new(\n shop: \"your-development-store.myshopify.com\",\n access_token: access_token\n)\nclient = ShopifyAPI::Clients::Graphql::Admin.new(\n session: session\n)\n\nquery = <<~QUERY\n query {\n giftCards(first: 5, query: \"status:enabled\") {\n edges {\n node {\n id\n enabled\n }\n }\n }\n }\nQUERY\n\nresponse = client.query(query: query)\n" Remix example: "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n query {\n giftCards(first: 5, query: \"status:enabled\") {\n edges {\n node {\n id\n enabled\n }\n }\n }\n }`,\n);\n\nconst data = await response.json();\n" Graphql query: "query {\n giftCards(first: 5, query: \"status:enabled\") {\n edges {\n node {\n id\n enabled\n }\n }\n }\n}" #### Graphql Input null #### Graphql Response { "data": { "giftCards": { "edges": [ { "node": { "id": "gid://shopify/GiftCard/63396415", "enabled": true } }, { "node": { "id": "gid://shopify/GiftCard/292935194", "enabled": true } }, { "node": { "id": "gid://shopify/GiftCard/411106674", "enabled": true } }, { "node": { "id": "gid://shopify/GiftCard/566141102", "enabled": true } }, { "node": { "id": "gid://shopify/GiftCard/636946744", "enabled": true } } ] } } } ### Get up to 5 gift cards with the last characters "1234" Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2025-01/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"query { giftCards(first: 5, query: \\\"1234\\\") { edges { node { id lastCharacters } } } }\"\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: `query {\n giftCards(first: 5, query: \"1234\") {\n edges {\n node {\n id\n lastCharacters\n }\n }\n }\n }`,\n});\n" Ruby example: "session = ShopifyAPI::Auth::Session.new(\n shop: \"your-development-store.myshopify.com\",\n access_token: access_token\n)\nclient = ShopifyAPI::Clients::Graphql::Admin.new(\n session: session\n)\n\nquery = <<~QUERY\n query {\n giftCards(first: 5, query: \"1234\") {\n edges {\n node {\n id\n lastCharacters\n }\n }\n }\n }\nQUERY\n\nresponse = client.query(query: query)\n" Remix example: "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n query {\n giftCards(first: 5, query: \"1234\") {\n edges {\n node {\n id\n lastCharacters\n }\n }\n }\n }`,\n);\n\nconst data = await response.json();\n" Graphql query: "query {\n giftCards(first: 5, query: \"1234\") {\n edges {\n node {\n id\n lastCharacters\n }\n }\n }\n}" #### Graphql Input null #### Graphql Response { "data": { "giftCards": { "edges": [ { "node": { "id": "gid://shopify/GiftCard/411106674", "lastCharacters": "1234" } } ] } } } ### Retrieves a list of gift cards Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2025-01/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"query { giftCards(first: 10) { edges { node { id } } } }\"\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: `query {\n giftCards(first: 10) {\n edges {\n node {\n id\n }\n }\n }\n }`,\n});\n" Ruby example: "session = ShopifyAPI::Auth::Session.new(\n shop: \"your-development-store.myshopify.com\",\n access_token: access_token\n)\nclient = ShopifyAPI::Clients::Graphql::Admin.new(\n session: session\n)\n\nquery = <<~QUERY\n query {\n giftCards(first: 10) {\n edges {\n node {\n id\n }\n }\n }\n }\nQUERY\n\nresponse = client.query(query: query)\n" Remix example: "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n query {\n giftCards(first: 10) {\n edges {\n node {\n id\n }\n }\n }\n }`,\n);\n\nconst data = await response.json();\n" Graphql query: "query {\n giftCards(first: 10) {\n edges {\n node {\n id\n }\n }\n }\n}" #### Graphql Input null #### Graphql Response { "data": { "giftCards": { "edges": [ { "node": { "id": "gid://shopify/GiftCard/63396415" } }, { "node": { "id": "gid://shopify/GiftCard/83783397" } }, { "node": { "id": "gid://shopify/GiftCard/292935194" } }, { "node": { "id": "gid://shopify/GiftCard/411106674" } }, { "node": { "id": "gid://shopify/GiftCard/566141102" } }, { "node": { "id": "gid://shopify/GiftCard/636946744" } }, { "node": { "id": "gid://shopify/GiftCard/638517611" } }, { "node": { "id": "gid://shopify/GiftCard/665558842" } }, { "node": { "id": "gid://shopify/GiftCard/746346263" } }, { "node": { "id": "gid://shopify/GiftCard/842921201" } } ] } } } ### Searches for gift cards Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2025-01/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"query GiftCardList($first: Int, $query: String) { giftCards(first: $first, query: $query) { edges { node { id balance { amount currencyCode } } } } }\",\n \"variables\": {\n \"first\": 5,\n \"query\": \"status:enabled\"\n }\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: {\n \"query\": `query GiftCardList($first: Int, $query: String) {\n giftCards(first: $first, query: $query) {\n edges {\n node {\n id\n balance {\n amount\n currencyCode\n }\n }\n }\n }\n }`,\n \"variables\": {\n \"first\": 5,\n \"query\": \"status:enabled\"\n },\n },\n});\n" Ruby example: "session = ShopifyAPI::Auth::Session.new(\n shop: \"your-development-store.myshopify.com\",\n access_token: access_token\n)\nclient = ShopifyAPI::Clients::Graphql::Admin.new(\n session: session\n)\n\nquery = <<~QUERY\n query GiftCardList($first: Int, $query: String) {\n giftCards(first: $first, query: $query) {\n edges {\n node {\n id\n balance {\n amount\n currencyCode\n }\n }\n }\n }\n }\nQUERY\n\nvariables = {\n \"first\": 5,\n \"query\": \"status:enabled\"\n}\n\nresponse = client.query(query: query, variables: variables)\n" Remix example: "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n query GiftCardList($first: Int, $query: String) {\n giftCards(first: $first, query: $query) {\n edges {\n node {\n id\n balance {\n amount\n currencyCode\n }\n }\n }\n }\n }`,\n {\n variables: {\n \"first\": 5,\n \"query\": \"status:enabled\"\n },\n },\n);\n\nconst data = await response.json();\n" Graphql query: "query GiftCardList($first: Int, $query: String) {\n giftCards(first: $first, query: $query) {\n edges {\n node {\n id\n balance {\n amount\n currencyCode\n }\n }\n }\n }\n}" #### Graphql Input { "first": 5, "query": "status:enabled" } #### Graphql Response { "data": { "giftCards": { "edges": [ { "node": { "id": "gid://shopify/GiftCard/63396415", "balance": { "amount": "10.0", "currencyCode": "USD" } } }, { "node": { "id": "gid://shopify/GiftCard/292935194", "balance": { "amount": "75.0", "currencyCode": "EUR" } } }, { "node": { "id": "gid://shopify/GiftCard/411106674", "balance": { "amount": "25.0", "currencyCode": "USD" } } }, { "node": { "id": "gid://shopify/GiftCard/566141102", "balance": { "amount": "0.23", "currencyCode": "USD" } } }, { "node": { "id": "gid://shopify/GiftCard/636946744", "balance": { "amount": "75.0", "currencyCode": "USD" } } } ] } } }