--- title: tagsAdd - GraphQL Admin description: Add tags to an order, a draft order, a customer, a product, or an online store article. api_version: 2025-10 api_name: admin type: mutation api_type: graphql source_url: html: https://shopify.dev/docs/api/admin-graphql/latest/mutations/tagsadd md: https://shopify.dev/docs/api/admin-graphql/latest/mutations/tagsadd.md --- # tags​Add mutation Add tags to an order, a draft order, a customer, a product, or an online store article. ## Arguments * id [ID!](https://shopify.dev/docs/api/admin-graphql/latest/scalars/ID) required The ID of a resource to add tags to. * tags [\[String!\]!](https://shopify.dev/docs/api/admin-graphql/latest/scalars/String) required A list of tags to add to the resource. Can be an array of strings or a single string composed of a comma-separated list of values. Example values: `["tag1", "tag2", "tag3"]`, `"tag1, tag2, tag3"`. *** ## Tags​Add​Payload returns * node [Node](https://shopify.dev/docs/api/admin-graphql/latest/interfaces/Node) The object that was updated. * user​Errors [\[User​Error!\]!](https://shopify.dev/docs/api/admin-graphql/latest/objects/UserError) non-null The list of errors that occurred from executing the mutation. *** ## Examples * ### Add tags to a customer #### Query ```graphql mutation addTags($id: ID!, $tags: [String!]!) { tagsAdd(id: $id, tags: $tags) { node { id } userErrors { message } } } ``` #### Variables ```json { "id": "gid://shopify/Customer/544365967", "tags": "one, two, three" } ``` #### cURL ```bash curl -X POST \ https://your-development-store.myshopify.com/admin/api/2025-10/graphql.json \ -H 'Content-Type: application/json' \ -H 'X-Shopify-Access-Token: {access_token}' \ -d '{ "query": "mutation addTags($id: ID!, $tags: [String!]!) { tagsAdd(id: $id, tags: $tags) { node { id } userErrors { message } } }", "variables": { "id": "gid://shopify/Customer/544365967", "tags": "one, two, three" } }' ``` #### React Router ```javascript import { authenticate } from "../shopify.server"; export const loader = async ({request}) => { const { admin } = await authenticate.admin(request); const response = await admin.graphql( `#graphql mutation addTags($id: ID!, $tags: [String!]!) { tagsAdd(id: $id, tags: $tags) { node { id } userErrors { message } } }`, { variables: { "id": "gid://shopify/Customer/544365967", "tags": "one, two, three" }, }, ); const json = await response.json(); return json.data; } ``` #### Ruby ```ruby session = ShopifyAPI::Auth::Session.new( shop: "your-development-store.myshopify.com", access_token: access_token ) client = ShopifyAPI::Clients::Graphql::Admin.new( session: session ) query = <<~QUERY mutation addTags($id: ID!, $tags: [String!]!) { tagsAdd(id: $id, tags: $tags) { node { id } userErrors { message } } } QUERY variables = { "id": "gid://shopify/Customer/544365967", "tags": "one, two, three" } response = client.query(query: query, variables: variables) ``` #### Node.js ```javascript const client = new shopify.clients.Graphql({session}); const data = await client.query({ data: { "query": `mutation addTags($id: ID!, $tags: [String!]!) { tagsAdd(id: $id, tags: $tags) { node { id } userErrors { message } } }`, "variables": { "id": "gid://shopify/Customer/544365967", "tags": "one, two, three" }, }, }); ``` #### Response ```json { "tagsAdd": { "node": { "id": "gid://shopify/Customer/544365967" }, "userErrors": [] } } ``` * ### Add tags to a product #### Query ```graphql mutation addTags($id: ID!, $tags: [String!]!) { tagsAdd(id: $id, tags: $tags) { node { id } userErrors { message } } } ``` #### Variables ```json { "id": "gid://shopify/Product/20995642", "tags": "one, two, three" } ``` #### cURL ```bash curl -X POST \ https://your-development-store.myshopify.com/admin/api/2025-10/graphql.json \ -H 'Content-Type: application/json' \ -H 'X-Shopify-Access-Token: {access_token}' \ -d '{ "query": "mutation addTags($id: ID!, $tags: [String!]!) { tagsAdd(id: $id, tags: $tags) { node { id } userErrors { message } } }", "variables": { "id": "gid://shopify/Product/20995642", "tags": "one, two, three" } }' ``` #### React Router ```javascript import { authenticate } from "../shopify.server"; export const loader = async ({request}) => { const { admin } = await authenticate.admin(request); const response = await admin.graphql( `#graphql mutation addTags($id: ID!, $tags: [String!]!) { tagsAdd(id: $id, tags: $tags) { node { id } userErrors { message } } }`, { variables: { "id": "gid://shopify/Product/20995642", "tags": "one, two, three" }, }, ); const json = await response.json(); return json.data; } ``` #### Ruby ```ruby session = ShopifyAPI::Auth::Session.new( shop: "your-development-store.myshopify.com", access_token: access_token ) client = ShopifyAPI::Clients::Graphql::Admin.new( session: session ) query = <<~QUERY mutation addTags($id: ID!, $tags: [String!]!) { tagsAdd(id: $id, tags: $tags) { node { id } userErrors { message } } } QUERY variables = { "id": "gid://shopify/Product/20995642", "tags": "one, two, three" } response = client.query(query: query, variables: variables) ``` #### Node.js ```javascript const client = new shopify.clients.Graphql({session}); const data = await client.query({ data: { "query": `mutation addTags($id: ID!, $tags: [String!]!) { tagsAdd(id: $id, tags: $tags) { node { id } userErrors { message } } }`, "variables": { "id": "gid://shopify/Product/20995642", "tags": "one, two, three" }, }, }); ``` #### Response ```json { "tagsAdd": { "node": { "id": "gid://shopify/Product/20995642" }, "userErrors": [] } } ``` * ### Attempt to add tags to an product that does not exist #### Query ```graphql mutation addTags($id: ID!, $tags: [String!]!) { tagsAdd(id: $id, tags: $tags) { node { id } userErrors { message } } } ``` #### Variables ```json { "id": "gid://shopify/Product/12345", "tags": "one, two, three" } ``` #### cURL ```bash curl -X POST \ https://your-development-store.myshopify.com/admin/api/2025-10/graphql.json \ -H 'Content-Type: application/json' \ -H 'X-Shopify-Access-Token: {access_token}' \ -d '{ "query": "mutation addTags($id: ID!, $tags: [String!]!) { tagsAdd(id: $id, tags: $tags) { node { id } userErrors { message } } }", "variables": { "id": "gid://shopify/Product/12345", "tags": "one, two, three" } }' ``` #### React Router ```javascript import { authenticate } from "../shopify.server"; export const loader = async ({request}) => { const { admin } = await authenticate.admin(request); const response = await admin.graphql( `#graphql mutation addTags($id: ID!, $tags: [String!]!) { tagsAdd(id: $id, tags: $tags) { node { id } userErrors { message } } }`, { variables: { "id": "gid://shopify/Product/12345", "tags": "one, two, three" }, }, ); const json = await response.json(); return json.data; } ``` #### Ruby ```ruby session = ShopifyAPI::Auth::Session.new( shop: "your-development-store.myshopify.com", access_token: access_token ) client = ShopifyAPI::Clients::Graphql::Admin.new( session: session ) query = <<~QUERY mutation addTags($id: ID!, $tags: [String!]!) { tagsAdd(id: $id, tags: $tags) { node { id } userErrors { message } } } QUERY variables = { "id": "gid://shopify/Product/12345", "tags": "one, two, three" } response = client.query(query: query, variables: variables) ``` #### Node.js ```javascript const client = new shopify.clients.Graphql({session}); const data = await client.query({ data: { "query": `mutation addTags($id: ID!, $tags: [String!]!) { tagsAdd(id: $id, tags: $tags) { node { id } userErrors { message } } }`, "variables": { "id": "gid://shopify/Product/12345", "tags": "one, two, three" }, }, }); ``` #### Response ```json { "tagsAdd": { "node": null, "userErrors": [ { "message": "Product does not exist" } ] } } ``` * ### tagsAdd reference [Open in GraphiQL](http://localhost:3457/graphiql?query=mutation%20addTags\(%24id%3A%20ID!%2C%20%24tags%3A%20%5BString!%5D!\)%20%7B%0A%20%20tagsAdd\(id%3A%20%24id%2C%20tags%3A%20%24tags\)%20%7B%0A%20%20%20%20node%20%7B%0A%20%20%20%20%20%20id%0A%20%20%20%20%7D%0A%20%20%20%20userErrors%20%7B%0A%20%20%20%20%20%20message%0A%20%20%20%20%7D%0A%20%20%7D%0A%7D\&variables=%7B%0A%20%20%22id%22%3A%20%22gid%3A%2F%2Fshopify%2FCustomer%2F544365967%22%2C%0A%20%20%22tags%22%3A%20%22one%2C%20two%2C%20three%22%0A%7D) ```javascript import { authenticate } from "../shopify.server"; export const loader = async ({request}) => { const { admin } = await authenticate.admin(request); const response = await admin.graphql( `#graphql mutation addTags($id: ID!, $tags: [String!]!) { tagsAdd(id: $id, tags: $tags) { node { id } userErrors { message } } }`, { variables: { "id": "gid://shopify/Customer/544365967", "tags": "one, two, three" }, }, ); const json = await response.json(); return json.data; } ``` ## Input variables JSON ```json { "id": "gid://shopify/Customer/544365967", "tags": "one, two, three" } ``` ## Response JSON ```json { "tagsAdd": { "node": { "id": "gid://shopify/Customer/544365967" }, "userErrors": [] } } ```