---
title: locationActivate - GraphQL Admin
description: |-
Activates a location so that you can stock inventory at the location. Refer to the
[`isActive`](https://shopify.dev/docs/api/admin-graphql/latest/objects/Location#field-isactive) and
[`activatable`](https://shopify.dev/docs/api/admin-graphql/latest/objects/Location#field-activatable)
fields on the `Location` object.
> Caution:
> As of 2026-01, this mutation supports an optional idempotency key using the `@idempotent` directive.
As of 2026-04, the idempotency key is required and must be provided using the `@idempotent` directive.
For more information, see the [idempotency documentation](https://shopify.dev/docs/api/usage/idempotent-requests).
api_version: 2026-01
api_name: admin
type: mutation
api_type: graphql
source_url:
html: https://shopify.dev/docs/api/admin-graphql/latest/mutations/locationactivate
md: https://shopify.dev/docs/api/admin-graphql/latest/mutations/locationactivate.md
---
# locationActivate
mutation
Requires `write_locations` access scope.
Activates a location so that you can stock inventory at the location. Refer to the [`isActive`](https://shopify.dev/docs/api/admin-graphql/latest/objects/Location#field-isactive) and [`activatable`](https://shopify.dev/docs/api/admin-graphql/latest/objects/Location#field-activatable) fields on the `Location` object.
***
**Caution:** As of 2026-01, this mutation supports an optional idempotency key using the \@idempotent\ directive. As of 2026-04, the idempotency key is required and must be provided using the \@idempotent\ directive. For more information, see the \idempotency documentation\.
***
## Arguments
* locationId
[ID!](https://shopify.dev/docs/api/admin-graphql/latest/scalars/ID)
required
The ID of a location to activate.
***
## LocationActivatePayload returns
* location
[Location](https://shopify.dev/docs/api/admin-graphql/latest/objects/Location)
The location that was activated.
* locationActivateUserErrors
[\[LocationActivateUserError!\]!](https://shopify.dev/docs/api/admin-graphql/latest/objects/LocationActivateUserError)
non-null
The list of errors that occurred from executing the mutation.
***
## Examples
* ### Activate a deactivated location
#### Query
```graphql
mutation {
locationActivate(locationId: "gid://shopify/Location/658095763") {
location {
id
isActive
}
}
}
```
#### cURL
```bash
curl -X POST \
https://your-development-store.myshopify.com/admin/api/2026-01/graphql.json \
-H 'Content-Type: application/json' \
-H 'X-Shopify-Access-Token: {access_token}' \
-d '{
"query": "mutation { locationActivate(locationId: \"gid://shopify/Location/658095763\") { location { id isActive } } }"
}'
```
#### 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 {
locationActivate(locationId: "gid://shopify/Location/658095763") {
location {
id
isActive
}
}
}`,
);
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 {
locationActivate(locationId: "gid://shopify/Location/658095763") {
location {
id
isActive
}
}
}
QUERY
response = client.query(query: query)
```
#### Node.js
```javascript
const client = new shopify.clients.Graphql({session});
const data = await client.query({
data: `mutation {
locationActivate(locationId: "gid://shopify/Location/658095763") {
location {
id
isActive
}
}
}`,
});
```
#### Shopify CLI
```bash
shopify app execute \
--query \
'mutation {
locationActivate(locationId: "gid://shopify/Location/658095763") {
location {
id
isActive
}
}
}'
```
#### Response
```json
{
"locationActivate": {
"location": {
"id": "gid://shopify/Location/658095763",
"isActive": true
}
}
}
```
* ### Activate a deactivated location
#### Query
```graphql
mutation {
locationActivate(locationId: "gid://shopify/Location/658095763") {
location {
id
isActive
}
}
}
```
#### cURL
```bash
curl -X POST \
https://your-development-store.myshopify.com/admin/api/2026-01/graphql.json \
-H 'Content-Type: application/json' \
-H 'X-Shopify-Access-Token: {access_token}' \
-d '{
"query": "mutation { locationActivate(locationId: \"gid://shopify/Location/658095763\") { location { id isActive } } }"
}'
```
#### 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 {
locationActivate(locationId: "gid://shopify/Location/658095763") {
location {
id
isActive
}
}
}`,
);
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 {
locationActivate(locationId: "gid://shopify/Location/658095763") {
location {
id
isActive
}
}
}
QUERY
response = client.query(query: query)
```
#### Node.js
```javascript
const client = new shopify.clients.Graphql({session});
const data = await client.query({
data: `mutation {
locationActivate(locationId: "gid://shopify/Location/658095763") {
location {
id
isActive
}
}
}`,
});
```
#### Shopify CLI
```bash
shopify app execute \
--query \
'mutation {
locationActivate(locationId: "gid://shopify/Location/658095763") {
location {
id
isActive
}
}
}'
```
#### Response
```json
{
"locationActivate": {
"location": {
"id": "gid://shopify/Location/658095763",
"isActive": true
}
}
}
```
* ### Activate a deactivated location with idempotency enabled (2026-01 onwards)
#### Query
```graphql
mutation locationActivate($locationId: ID!, $idempotencyKey: String!) {
locationActivate(locationId: $locationId) @idempotent(key: $idempotencyKey) {
location {
id
isActive
}
locationActivateUserErrors {
field
message
code
}
}
}
```
#### Variables
```json
{
"locationId": "gid://shopify/Location/658095763",
"idempotencyKey": "550e8400-e29b-41d4-a716-446655440000"
}
```
#### cURL
```bash
curl -X POST \
https://your-development-store.myshopify.com/admin/api/2026-01/graphql.json \
-H 'Content-Type: application/json' \
-H 'X-Shopify-Access-Token: {access_token}' \
-d '{
"query": "mutation locationActivate($locationId: ID!, $idempotencyKey: String!) { locationActivate(locationId: $locationId) @idempotent(key: $idempotencyKey) { location { id isActive } locationActivateUserErrors { field message code } } }",
"variables": {
"locationId": "gid://shopify/Location/658095763",
"idempotencyKey": "550e8400-e29b-41d4-a716-446655440000"
}
}'
```
#### 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 locationActivate($locationId: ID!, $idempotencyKey: String!) {
locationActivate(locationId: $locationId) @idempotent(key: $idempotencyKey) {
location {
id
isActive
}
locationActivateUserErrors {
field
message
code
}
}
}`,
{
variables: {
"locationId": "gid://shopify/Location/658095763",
"idempotencyKey": "550e8400-e29b-41d4-a716-446655440000"
},
},
);
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 locationActivate($locationId: ID!, $idempotencyKey: String!) {
locationActivate(locationId: $locationId) @idempotent(key: $idempotencyKey) {
location {
id
isActive
}
locationActivateUserErrors {
field
message
code
}
}
}
QUERY
variables = {
"locationId": "gid://shopify/Location/658095763",
"idempotencyKey": "550e8400-e29b-41d4-a716-446655440000"
}
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 locationActivate($locationId: ID!, $idempotencyKey: String!) {
locationActivate(locationId: $locationId) @idempotent(key: $idempotencyKey) {
location {
id
isActive
}
locationActivateUserErrors {
field
message
code
}
}
}`,
"variables": {
"locationId": "gid://shopify/Location/658095763",
"idempotencyKey": "550e8400-e29b-41d4-a716-446655440000"
},
},
});
```
#### Shopify CLI
```bash
shopify app execute \
--query \
'mutation locationActivate($locationId: ID!, $idempotencyKey: String!) {
locationActivate(locationId: $locationId) @idempotent(key: $idempotencyKey) {
location {
id
isActive
}
locationActivateUserErrors {
field
message
code
}
}
}' \
--variables \
'{
"locationId": "gid://shopify/Location/658095763",
"idempotencyKey": "550e8400-e29b-41d4-a716-446655440000"
}'
```
#### Response
```json
{
"locationActivate": {
"location": {
"id": "gid://shopify/Location/658095763",
"isActive": true
},
"locationActivateUserErrors": []
}
}
```
* ### locationActivate reference