--- title: locationByIdentifier - GraphQL Admin description: Return a location by an identifier. api_version: 2025-10 api_name: admin type: query api_type: graphql source_url: html: https://shopify.dev/docs/api/admin-graphql/latest/queries/locationbyidentifier md: https://shopify.dev/docs/api/admin-graphql/latest/queries/locationbyidentifier.md --- # location​By​Identifier query Requires `read_locations` access scope. Return a location by an identifier. ## Arguments * identifier [Location​Identifier​Input!](https://shopify.dev/docs/api/admin-graphql/latest/input-objects/LocationIdentifierInput) required The identifier of the location. *** ## Possible returns * Location [Location](https://shopify.dev/docs/api/admin-graphql/latest/objects/Location) Represents the location where the physical good resides. You can stock inventory at active locations. Active locations that have `fulfills_online_orders: true` and are configured with a shipping rate, pickup enabled or local delivery will be able to sell from their storefront. *** ## Examples * ### Find a location by custom id #### Query ```graphql query($identifier: LocationIdentifierInput!) { location: locationByIdentifier(identifier: $identifier) { id name } } ``` #### Variables ```json { "identifier": { "customId": { "namespace": "custom", "key": "id", "value": "1001" } } } ``` #### 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": "query($identifier: LocationIdentifierInput!) { location: locationByIdentifier(identifier: $identifier) { id name } }", "variables": { "identifier": { "customId": { "namespace": "custom", "key": "id", "value": "1001" } } } }' ``` #### 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 query($identifier: LocationIdentifierInput!) { location: locationByIdentifier(identifier: $identifier) { id name } }`, { variables: { "identifier": { "customId": { "namespace": "custom", "key": "id", "value": "1001" } } }, }, ); 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 query($identifier: LocationIdentifierInput!) { location: locationByIdentifier(identifier: $identifier) { id name } } QUERY variables = { "identifier": { "customId": { "namespace": "custom", "key": "id", "value": "1001" } } } response = client.query(query: query, variables: variables) ``` #### Node.js ```javascript const client = new shopify.clients.Graphql({session}); const data = await client.query({ data: { "query": `query($identifier: LocationIdentifierInput!) { location: locationByIdentifier(identifier: $identifier) { id name } }`, "variables": { "identifier": { "customId": { "namespace": "custom", "key": "id", "value": "1001" } } }, }, }); ``` #### Response ```json { "location": { "id": "gid://shopify/Location/346779380", "name": "Ottawa Store" } } ``` ## Find a location by custom id [Open in GraphiQL](http://localhost:3457/graphiql?query=query\(%24identifier%3A%20LocationIdentifierInput!\)%20%7B%0A%20%20location%3A%20locationByIdentifier\(identifier%3A%20%24identifier\)%20%7B%0A%20%20%20%20id%0A%20%20%20%20name%0A%20%20%7D%0A%7D\&variables=%7B%0A%20%20%22identifier%22%3A%20%7B%0A%20%20%20%20%22customId%22%3A%20%7B%0A%20%20%20%20%20%20%22namespace%22%3A%20%22custom%22%2C%0A%20%20%20%20%20%20%22key%22%3A%20%22id%22%2C%0A%20%20%20%20%20%20%22value%22%3A%20%221001%22%0A%20%20%20%20%7D%0A%20%20%7D%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 query($identifier: LocationIdentifierInput!) { location: locationByIdentifier(identifier: $identifier) { id name } }`, { variables: { "identifier": { "customId": { "namespace": "custom", "key": "id", "value": "1001" } } }, }, ); const json = await response.json(); return json.data; } ``` ##### GQL ``` query($identifier: LocationIdentifierInput!) { location: locationByIdentifier(identifier: $identifier) { id name } } ``` ##### cURL ``` 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": "query($identifier: LocationIdentifierInput!) { location: locationByIdentifier(identifier: $identifier) { id name } }", "variables": { "identifier": { "customId": { "namespace": "custom", "key": "id", "value": "1001" } } } }' ``` ##### React Router ``` import { authenticate } from "../shopify.server"; export const loader = async ({request}) => { const { admin } = await authenticate.admin(request); const response = await admin.graphql( `#graphql query($identifier: LocationIdentifierInput!) { location: locationByIdentifier(identifier: $identifier) { id name } }`, { variables: { "identifier": { "customId": { "namespace": "custom", "key": "id", "value": "1001" } } }, }, ); const json = await response.json(); return json.data; } ``` ##### Node.js ``` const client = new shopify.clients.Graphql({session}); const data = await client.query({ data: { "query": `query($identifier: LocationIdentifierInput!) { location: locationByIdentifier(identifier: $identifier) { id name } }`, "variables": { "identifier": { "customId": { "namespace": "custom", "key": "id", "value": "1001" } } }, }, }); ``` ##### 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 query($identifier: LocationIdentifierInput!) { location: locationByIdentifier(identifier: $identifier) { id name } } QUERY variables = { "identifier": { "customId": { "namespace": "custom", "key": "id", "value": "1001" } } } response = client.query(query: query, variables: variables) ``` ## Input variables JSON ```json { "identifier": { "customId": { "namespace": "custom", "key": "id", "value": "1001" } } } ``` ## Response JSON ```json { "location": { "id": "gid://shopify/Location/346779380", "name": "Ottawa Store" } } ```