# publishedProductsCount - admin-graphql - QUERY Version: 2024-10 ## Description Returns a count of published products by publication ID. ### Access Scopes `read_publications` access scope. ## Arguments * [publicationId](/docs/api/admin-graphql/2024-10/scalars/ID): ID! - The ID of the publication that the products are published to. ## Returns * [count](/docs/api/admin-graphql/2024-10/scalars/Int): Int! The count of elements. * [precision](/docs/api/admin-graphql/2024-10/enums/CountPrecision): CountPrecision! The count's precision, or the exactness of the value. ## Examples ### Retrieve a count of products that are published to your app Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2024-10/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"query PublishedProductCount($publicationId: ID!) { publishedProductsCount(publicationId: $publicationId) { count precision } }\",\n \"variables\": {\n \"publicationId\": \"gid://shopify/Publication/244171671\"\n }\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: {\n \"query\": `query PublishedProductCount($publicationId: ID!) {\n publishedProductsCount(publicationId: $publicationId) {\n count\n precision\n }\n }`,\n \"variables\": {\n \"publicationId\": \"gid://shopify/Publication/244171671\"\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 PublishedProductCount($publicationId: ID!) {\n publishedProductsCount(publicationId: $publicationId) {\n count\n precision\n }\n }\nQUERY\n\nvariables = {\n \"publicationId\": \"gid://shopify/Publication/244171671\"\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 PublishedProductCount($publicationId: ID!) {\n publishedProductsCount(publicationId: $publicationId) {\n count\n precision\n }\n }`,\n {\n variables: {\n \"publicationId\": \"gid://shopify/Publication/244171671\"\n },\n },\n);\n\nconst data = await response.json();\n" Graphql query: "query PublishedProductCount($publicationId: ID!) {\n publishedProductsCount(publicationId: $publicationId) {\n count\n precision\n }\n}" #### Graphql Input { "publicationId": "gid://shopify/Publication/244171671" } #### Graphql Response { "data": { "publishedProductsCount": { "count": 6, "precision": "EXACT" } } }