companyquery
query
2024-10latest
Returns a Company
object by ID.
Arguments
The ID of the Company to return.
Was this section helpful?
Company possible returns
Represents information about a company which is also a customer of the shop.
Was this section helpful?
Code examples for QUERY: company
Query Reference for QUERY: company
"{\n company(id) {\n # Company fields\n }\n}"
Input Reference for QUERY: company
Schema Reference for QUERY: company
Display Examples for QUERY: company
[ { "example": { "type_name": "company", "title": "Get a company by its ID", "description": "Retrieves a company by ID, returning the fields specified in the query.", "query_string": "query {\n company(id: \"gid://shopify/Company/426793626\") {\n id\n name\n note\n externalId\n totalSpent {\n amount\n currencyCode\n }\n }\n}", "response": { "data": { "company": { "id": "gid://shopify/Company/426793626", "name": "Fancy Pants Inc.", "note": "test notes", "externalId": "external_id1", "totalSpent": { "amount": "120.0", "currencyCode": "USD" } } } }, "api_name": "admin", "minimum_api_version": "2023-10", "maximum_api_version": "unstable", "location": "/components/business_customers/test/unit/graph_api/admin/company_test.rb", "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 { company(id: \\\"gid://shopify/Company/426793626\\\") { id name note externalId totalSpent { amount currencyCode } } }\"\n}'\n", "remix_example": "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n query {\n company(id: \"gid://shopify/Company/426793626\") {\n id\n name\n note\n externalId\n totalSpent {\n amount\n currencyCode\n }\n }\n }`,\n);\n\nconst data = await response.json();\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 company(id: \"gid://shopify/Company/426793626\") {\n id\n name\n note\n externalId\n totalSpent {\n amount\n currencyCode\n }\n }\n }\nQUERY\n\nresponse = client.query(query: query)\n", "node_example": "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: `query {\n company(id: \"gid://shopify/Company/426793626\") {\n id\n name\n note\n externalId\n totalSpent {\n amount\n currencyCode\n }\n }\n }`,\n});\n", "php_example": "use Shopify\\Clients\\Graphql;\n\n$client = new Graphql(\"your-development-store.myshopify.com\", $accessToken);\n$query = <<<QUERY\n query {\n company(id: \"gid://shopify/Company/426793626\") {\n id\n name\n note\n externalId\n totalSpent {\n amount\n currencyCode\n }\n }\n }\nQUERY;\n\n$response = $client->query([\"query\" => $query]);\n" }, "titleStringKey": "arguments", "inputVariableEntries": [] }, { "example": { "type_name": "company", "title": "Get a metafield attached to a company", "description": "Get the metafield value identified by `my_fields.industry` on a specific company.", "query_string": "query CompanyMetafield($namespace: String!, $key: String!, $ownerId: ID!) {\n company(id: $ownerId) {\n industry: metafield(namespace: $namespace, key: $key) {\n value\n }\n }\n}", "variables": { "namespace": "my_fields", "key": "industry", "ownerId": "gid://shopify/Company/426793626" }, "response": { "data": { "company": { "industry": { "value": "retail" } } } }, "api_name": "admin", "minimum_api_version": "2023-10", "maximum_api_version": "unstable", "location": "/components/business_customers/test/unit/graph_api/admin/company_test.rb", "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 CompanyMetafield($namespace: String!, $key: String!, $ownerId: ID!) { company(id: $ownerId) { industry: metafield(namespace: $namespace, key: $key) { value } } }\",\n \"variables\": {\n \"namespace\": \"my_fields\",\n \"key\": \"industry\",\n \"ownerId\": \"gid://shopify/Company/426793626\"\n }\n}'\n", "remix_example": "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n query CompanyMetafield($namespace: String!, $key: String!, $ownerId: ID!) {\n company(id: $ownerId) {\n industry: metafield(namespace: $namespace, key: $key) {\n value\n }\n }\n }`,\n {\n variables: {\n \"namespace\": \"my_fields\",\n \"key\": \"industry\",\n \"ownerId\": \"gid://shopify/Company/426793626\"\n },\n },\n);\n\nconst data = await response.json();\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 CompanyMetafield($namespace: String!, $key: String!, $ownerId: ID!) {\n company(id: $ownerId) {\n industry: metafield(namespace: $namespace, key: $key) {\n value\n }\n }\n }\nQUERY\n\nvariables = {\n \"namespace\": \"my_fields\",\n \"key\": \"industry\",\n \"ownerId\": \"gid://shopify/Company/426793626\"\n}\n\nresponse = client.query(query: query, variables: variables)\n", "node_example": "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: {\n \"query\": `query CompanyMetafield($namespace: String!, $key: String!, $ownerId: ID!) {\n company(id: $ownerId) {\n industry: metafield(namespace: $namespace, key: $key) {\n value\n }\n }\n }`,\n \"variables\": {\n \"namespace\": \"my_fields\",\n \"key\": \"industry\",\n \"ownerId\": \"gid://shopify/Company/426793626\"\n },\n },\n});\n", "php_example": "use Shopify\\Clients\\Graphql;\n\n$client = new Graphql(\"your-development-store.myshopify.com\", $accessToken);\n$query = <<<QUERY\n query CompanyMetafield($namespace: String!, $key: String!, $ownerId: ID!) {\n company(id: $ownerId) {\n industry: metafield(namespace: $namespace, key: $key) {\n value\n }\n }\n }\nQUERY;\n\n$variables = [\n \"namespace\" => \"my_fields\",\n \"key\" => \"industry\",\n \"ownerId\" => \"gid://shopify/Company/426793626\",\n];\n\n$response = $client->query([\"query\" => $query, \"variables\" => $variables]);\n" }, "titleStringKey": "arguments", "inputVariableEntries": [] }, { "example": { "type_name": "company", "title": "Get metafields attached to a company", "description": "Get a page of metafields attached to a specific company.", "query_string": "query CompanyMetafields($ownerId: ID!) {\n company(id: $ownerId) {\n metafields(first: 3) {\n edges {\n node {\n namespace\n key\n value\n }\n }\n }\n }\n}", "variables": { "ownerId": "gid://shopify/Company/426793626" }, "response": { "data": { "company": { "metafields": { "edges": [ { "node": { "namespace": "my_fields", "key": "industry", "value": "retail" } } ] } } } }, "api_name": "admin", "minimum_api_version": "2023-10", "maximum_api_version": "unstable", "location": "/components/business_customers/test/unit/graph_api/admin/company_test.rb", "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 CompanyMetafields($ownerId: ID!) { company(id: $ownerId) { metafields(first: 3) { edges { node { namespace key value } } } } }\",\n \"variables\": {\n \"ownerId\": \"gid://shopify/Company/426793626\"\n }\n}'\n", "remix_example": "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n query CompanyMetafields($ownerId: ID!) {\n company(id: $ownerId) {\n metafields(first: 3) {\n edges {\n node {\n namespace\n key\n value\n }\n }\n }\n }\n }`,\n {\n variables: {\n \"ownerId\": \"gid://shopify/Company/426793626\"\n },\n },\n);\n\nconst data = await response.json();\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 CompanyMetafields($ownerId: ID!) {\n company(id: $ownerId) {\n metafields(first: 3) {\n edges {\n node {\n namespace\n key\n value\n }\n }\n }\n }\n }\nQUERY\n\nvariables = {\n \"ownerId\": \"gid://shopify/Company/426793626\"\n}\n\nresponse = client.query(query: query, variables: variables)\n", "node_example": "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: {\n \"query\": `query CompanyMetafields($ownerId: ID!) {\n company(id: $ownerId) {\n metafields(first: 3) {\n edges {\n node {\n namespace\n key\n value\n }\n }\n }\n }\n }`,\n \"variables\": {\n \"ownerId\": \"gid://shopify/Company/426793626\"\n },\n },\n});\n", "php_example": "use Shopify\\Clients\\Graphql;\n\n$client = new Graphql(\"your-development-store.myshopify.com\", $accessToken);\n$query = <<<QUERY\n query CompanyMetafields($ownerId: ID!) {\n company(id: $ownerId) {\n metafields(first: 3) {\n edges {\n node {\n namespace\n key\n value\n }\n }\n }\n }\n }\nQUERY;\n\n$variables = [\n \"ownerId\" => \"gid://shopify/Company/426793626\",\n];\n\n$response = $client->query([\"query\" => $query, \"variables\" => $variables]);\n" }, "titleStringKey": "arguments", "inputVariableEntries": [] }, { "example": { "type_name": "company", "title": "Get pinned metafield definitions associated with a company", "description": "Get names and types of the first page of pinned metafield definitions associated with a company.", "query_string": "query CompanyMetafieldDefinitions($ownerId: ID!, $first: Int, $pinnedStatus: MetafieldDefinitionPinnedStatus, $sortKey: MetafieldDefinitionSortKeys) {\n company(id: $ownerId) {\n metafieldDefinitions(first: $first, pinnedStatus: $pinnedStatus, sortKey: $sortKey) {\n edges {\n node {\n name\n namespace\n key\n type {\n name\n }\n }\n }\n }\n }\n}", "variables": { "pinnedStatus": "PINNED", "ownerId": "gid://shopify/Company/426793626", "first": 10, "sortKey": "PINNED_POSITION" }, "response": { "data": { "company": { "metafieldDefinitions": { "edges": [ { "node": { "name": "Website", "namespace": "my_fields", "key": "website", "type": { "name": "single_line_text_field" } } }, { "node": { "name": "Industry", "namespace": "my_fields", "key": "industry", "type": { "name": "single_line_text_field" } } } ] } } } }, "api_name": "admin", "minimum_api_version": "2023-10", "maximum_api_version": "unstable", "location": "/components/business_customers/test/unit/graph_api/admin/company_test.rb", "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 CompanyMetafieldDefinitions($ownerId: ID!, $first: Int, $pinnedStatus: MetafieldDefinitionPinnedStatus, $sortKey: MetafieldDefinitionSortKeys) { company(id: $ownerId) { metafieldDefinitions(first: $first, pinnedStatus: $pinnedStatus, sortKey: $sortKey) { edges { node { name namespace key type { name } } } } } }\",\n \"variables\": {\n \"pinnedStatus\": \"PINNED\",\n \"ownerId\": \"gid://shopify/Company/426793626\",\n \"first\": 10,\n \"sortKey\": \"PINNED_POSITION\"\n }\n}'\n", "remix_example": "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n query CompanyMetafieldDefinitions($ownerId: ID!, $first: Int, $pinnedStatus: MetafieldDefinitionPinnedStatus, $sortKey: MetafieldDefinitionSortKeys) {\n company(id: $ownerId) {\n metafieldDefinitions(first: $first, pinnedStatus: $pinnedStatus, sortKey: $sortKey) {\n edges {\n node {\n name\n namespace\n key\n type {\n name\n }\n }\n }\n }\n }\n }`,\n {\n variables: {\n \"pinnedStatus\": \"PINNED\",\n \"ownerId\": \"gid://shopify/Company/426793626\",\n \"first\": 10,\n \"sortKey\": \"PINNED_POSITION\"\n },\n },\n);\n\nconst data = await response.json();\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 CompanyMetafieldDefinitions($ownerId: ID!, $first: Int, $pinnedStatus: MetafieldDefinitionPinnedStatus, $sortKey: MetafieldDefinitionSortKeys) {\n company(id: $ownerId) {\n metafieldDefinitions(first: $first, pinnedStatus: $pinnedStatus, sortKey: $sortKey) {\n edges {\n node {\n name\n namespace\n key\n type {\n name\n }\n }\n }\n }\n }\n }\nQUERY\n\nvariables = {\n \"pinnedStatus\": \"PINNED\",\n \"ownerId\": \"gid://shopify/Company/426793626\",\n \"first\": 10,\n \"sortKey\": \"PINNED_POSITION\"\n}\n\nresponse = client.query(query: query, variables: variables)\n", "node_example": "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: {\n \"query\": `query CompanyMetafieldDefinitions($ownerId: ID!, $first: Int, $pinnedStatus: MetafieldDefinitionPinnedStatus, $sortKey: MetafieldDefinitionSortKeys) {\n company(id: $ownerId) {\n metafieldDefinitions(first: $first, pinnedStatus: $pinnedStatus, sortKey: $sortKey) {\n edges {\n node {\n name\n namespace\n key\n type {\n name\n }\n }\n }\n }\n }\n }`,\n \"variables\": {\n \"pinnedStatus\": \"PINNED\",\n \"ownerId\": \"gid://shopify/Company/426793626\",\n \"first\": 10,\n \"sortKey\": \"PINNED_POSITION\"\n },\n },\n});\n", "php_example": "use Shopify\\Clients\\Graphql;\n\n$client = new Graphql(\"your-development-store.myshopify.com\", $accessToken);\n$query = <<<QUERY\n query CompanyMetafieldDefinitions($ownerId: ID!, $first: Int, $pinnedStatus: MetafieldDefinitionPinnedStatus, $sortKey: MetafieldDefinitionSortKeys) {\n company(id: $ownerId) {\n metafieldDefinitions(first: $first, pinnedStatus: $pinnedStatus, sortKey: $sortKey) {\n edges {\n node {\n name\n namespace\n key\n type {\n name\n }\n }\n }\n }\n }\n }\nQUERY;\n\n$variables = [\n \"pinnedStatus\" => \"PINNED\",\n \"ownerId\" => \"gid://shopify/Company/426793626\",\n \"first\" => 10,\n \"sortKey\" => \"PINNED_POSITION\",\n];\n\n$response = $client->query([\"query\" => $query, \"variables\" => $variables]);\n" }, "titleStringKey": "arguments", "inputVariableEntries": [] } ]