---
title: customerAddressCreate - GraphQL Admin
description: |-
  Creates a new [`MailingAddress`](https://shopify.dev/docs/api/admin-graphql/latest/objects/MailingAddress) for a [`Customer`](https://shopify.dev/docs/api/admin-graphql/latest/objects/Customer). You can optionally set the address as the customer's default address.

  You can only add addresses to existing customers. Each customer can have multiple addresses.
api_version: 2026-10
source_url:
  html: https://shopify.dev/docs/api/admin-graphql/latest/mutations/customeraddresscreate
  md: https://shopify.dev/docs/api/admin-graphql/latest/mutations/customeraddresscreate.md
---

# customerAddressCreate

mutation

Requires `write_customers` access scope.

Creates a new [`MailingAddress`](https://shopify.dev/docs/api/admin-graphql/latest/objects/MailingAddress) for a [`Customer`](https://shopify.dev/docs/api/admin-graphql/latest/objects/Customer). You can optionally set the address as the customer's default address.

You can only add addresses to existing customers. Each customer can have multiple addresses.

## Arguments

* address

  [MailingAddressInput!](https://shopify.dev/docs/api/admin-graphql/latest/input-objects/MailingAddressInput)

  required

  Specifies the fields to use when creating the address.

* customerId

  [ID!](https://shopify.dev/docs/api/admin-graphql/latest/scalars/ID)

  required

  The ID of the customer.

* setAsDefault

  [Boolean](https://shopify.dev/docs/api/admin-graphql/latest/scalars/Boolean)

  Whether to set the address as the customer's default address.

***

## CustomerAddressCreatePayload returns

* address

  [MailingAddress](https://shopify.dev/docs/api/admin-graphql/latest/objects/MailingAddress)

  The created address.

* userErrors

  [\[UserError!\]!](https://shopify.dev/docs/api/admin-graphql/latest/objects/UserError)

  non-null

  The list of errors that occurred from executing the mutation.

***

## Examples

* ### Create a customer address

  #### Description

  Add a new address to a customer's list of addresses. Without \`setAsDefault\`, an existing default address stays the default. If the customer has no default address yet, the new address becomes the default.

  #### Query

  ```graphql
  mutation customerAddressCreate($customerId: ID!, $address: MailingAddressInput!) {
    customerAddressCreate(customerId: $customerId, address: $address) {
      address {
        id
        firstName
        lastName
        address1
        city
        province
        country
        zip
        phone
      }
      userErrors {
        field
        message
      }
    }
  }
  ```

  #### Variables

  ```json
  {
    "customerId": "gid://shopify/Customer/624407574",
    "address": {
      "firstName": "Jane",
      "lastName": "Doe",
      "address1": "123 Main Street",
      "city": "Nashville",
      "provinceCode": "TN",
      "countryCode": "US",
      "zip": "37201",
      "phone": "+16155550123"
    }
  }
  ```

  #### cURL

  ```bash
  curl -X POST \
  https://your-development-store.myshopify.com/admin/api/2026-10/graphql.json \
  -H 'Content-Type: application/json' \
  -H 'X-Shopify-Access-Token: {access_token}' \
  -d '{
  "query": "mutation customerAddressCreate($customerId: ID!, $address: MailingAddressInput!) { customerAddressCreate(customerId: $customerId, address: $address) { address { id firstName lastName address1 city province country zip phone } userErrors { field message } } }",
   "variables": {
      "customerId": "gid://shopify/Customer/624407574",
      "address": {
        "firstName": "Jane",
        "lastName": "Doe",
        "address1": "123 Main Street",
        "city": "Nashville",
        "provinceCode": "TN",
        "countryCode": "US",
        "zip": "37201",
        "phone": "+16155550123"
      }
    }
  }'
  ```

  #### 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 customerAddressCreate($customerId: ID!, $address: MailingAddressInput!) {
      customerAddressCreate(customerId: $customerId, address: $address) {
        address {
          id
          firstName
          lastName
          address1
          city
          province
          country
          zip
          phone
        }
        userErrors {
          field
          message
        }
      }
    }`,
    {
      variables: {
          "customerId": "gid://shopify/Customer/624407574",
          "address": {
              "firstName": "Jane",
              "lastName": "Doe",
              "address1": "123 Main Street",
              "city": "Nashville",
              "provinceCode": "TN",
              "countryCode": "US",
              "zip": "37201",
              "phone": "+16155550123"
          }
      },
    },
    );
    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 customerAddressCreate($customerId: ID!, $address: MailingAddressInput!) {
      customerAddressCreate(customerId: $customerId, address: $address) {
        address {
          id
          firstName
          lastName
          address1
          city
          province
          country
          zip
          phone
        }
        userErrors {
          field
          message
        }
      }
    }
  QUERY

  variables = {
    "customerId": "gid://shopify/Customer/624407574",
    "address": {
      "firstName": "Jane",
      "lastName": "Doe",
      "address1": "123 Main Street",
      "city": "Nashville",
      "provinceCode": "TN",
      "countryCode": "US",
      "zip": "37201",
      "phone": "+16155550123"
    }
  }

  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 customerAddressCreate($customerId: ID!, $address: MailingAddressInput!) {
        customerAddressCreate(customerId: $customerId, address: $address) {
          address {
            id
            firstName
            lastName
            address1
            city
            province
            country
            zip
            phone
          }
          userErrors {
            field
            message
          }
        }
      }`,
      "variables": {
          "customerId": "gid://shopify/Customer/624407574",
          "address": {
              "firstName": "Jane",
              "lastName": "Doe",
              "address1": "123 Main Street",
              "city": "Nashville",
              "provinceCode": "TN",
              "countryCode": "US",
              "zip": "37201",
              "phone": "+16155550123"
          }
      },
    },
  });
  ```

  #### Shopify CLI

  ```bash
  shopify app execute \
  --query \
  'mutation customerAddressCreate($customerId: ID!, $address: MailingAddressInput!) {
    customerAddressCreate(customerId: $customerId, address: $address) {
      address {
        id
        firstName
        lastName
        address1
        city
        province
        country
        zip
        phone
      }
      userErrors {
        field
        message
      }
    }
  }' \
  --variables \
  '{
    "customerId": "gid://shopify/Customer/624407574",
    "address": {
      "firstName": "Jane",
      "lastName": "Doe",
      "address1": "123 Main Street",
      "city": "Nashville",
      "provinceCode": "TN",
      "countryCode": "US",
      "zip": "37201",
      "phone": "+16155550123"
    }
  }'
  ```

  #### Direct API Access

  ```javascript
  const response = await fetch('shopify:admin/api/2026-10/graphql.json', {
    method: 'POST',
    body: JSON.stringify({
      query: `
        mutation customerAddressCreate($customerId: ID!, $address: MailingAddressInput!) {
          customerAddressCreate(customerId: $customerId, address: $address) {
            address {
              id
              firstName
              lastName
              address1
              city
              province
              country
              zip
              phone
            }
            userErrors {
              field
              message
            }
          }
        }
      `,
      variables: {
          "customerId": "gid://shopify/Customer/624407574",
          "address": {
              "firstName": "Jane",
              "lastName": "Doe",
              "address1": "123 Main Street",
              "city": "Nashville",
              "provinceCode": "TN",
              "countryCode": "US",
              "zip": "37201",
              "phone": "+16155550123"
          }
      },
    }),
  });

  const { data } = await response.json();
  console.log(data);
  ```

  #### Response

  ```json
  {
    "customerAddressCreate": {
      "address": {
        "id": "gid://shopify/MailingAddress/1053317289?model_name=CustomerAddress",
        "firstName": "Jane",
        "lastName": "Doe",
        "address1": "123 Main Street",
        "city": "Nashville",
        "province": "Tennessee",
        "country": "United States",
        "zip": "37201",
        "phone": "+16155550123"
      },
      "userErrors": []
    }
  }
  ```

* ### Create an address and set it as the default address

  #### Description

  Add a new address to a customer and make it the customer's default address by passing \`setAsDefault: true\`.

  #### Query

  ```graphql
  mutation customerAddressCreate($customerId: ID!, $address: MailingAddressInput!, $setAsDefault: Boolean) {
    customerAddressCreate(customerId: $customerId, address: $address, setAsDefault: $setAsDefault) {
      address {
        id
        address1
        city
        provinceCode
        countryCodeV2
        zip
      }
      userErrors {
        field
        message
      }
    }
  }
  ```

  #### Variables

  ```json
  {
    "customerId": "gid://shopify/Customer/624407574",
    "address": {
      "address1": "500 Broadway",
      "city": "Nashville",
      "provinceCode": "TN",
      "countryCode": "US",
      "zip": "37203"
    },
    "setAsDefault": true
  }
  ```

  #### cURL

  ```bash
  curl -X POST \
  https://your-development-store.myshopify.com/admin/api/2026-10/graphql.json \
  -H 'Content-Type: application/json' \
  -H 'X-Shopify-Access-Token: {access_token}' \
  -d '{
  "query": "mutation customerAddressCreate($customerId: ID!, $address: MailingAddressInput!, $setAsDefault: Boolean) { customerAddressCreate(customerId: $customerId, address: $address, setAsDefault: $setAsDefault) { address { id address1 city provinceCode countryCodeV2 zip } userErrors { field message } } }",
   "variables": {
      "customerId": "gid://shopify/Customer/624407574",
      "address": {
        "address1": "500 Broadway",
        "city": "Nashville",
        "provinceCode": "TN",
        "countryCode": "US",
        "zip": "37203"
      },
      "setAsDefault": true
    }
  }'
  ```

  #### 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 customerAddressCreate($customerId: ID!, $address: MailingAddressInput!, $setAsDefault: Boolean) {
      customerAddressCreate(customerId: $customerId, address: $address, setAsDefault: $setAsDefault) {
        address {
          id
          address1
          city
          provinceCode
          countryCodeV2
          zip
        }
        userErrors {
          field
          message
        }
      }
    }`,
    {
      variables: {
          "customerId": "gid://shopify/Customer/624407574",
          "address": {
              "address1": "500 Broadway",
              "city": "Nashville",
              "provinceCode": "TN",
              "countryCode": "US",
              "zip": "37203"
          },
          "setAsDefault": true
      },
    },
    );
    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 customerAddressCreate($customerId: ID!, $address: MailingAddressInput!, $setAsDefault: Boolean) {
      customerAddressCreate(customerId: $customerId, address: $address, setAsDefault: $setAsDefault) {
        address {
          id
          address1
          city
          provinceCode
          countryCodeV2
          zip
        }
        userErrors {
          field
          message
        }
      }
    }
  QUERY

  variables = {
    "customerId": "gid://shopify/Customer/624407574",
    "address": {
      "address1": "500 Broadway",
      "city": "Nashville",
      "provinceCode": "TN",
      "countryCode": "US",
      "zip": "37203"
    },
    "setAsDefault": true
  }

  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 customerAddressCreate($customerId: ID!, $address: MailingAddressInput!, $setAsDefault: Boolean) {
        customerAddressCreate(customerId: $customerId, address: $address, setAsDefault: $setAsDefault) {
          address {
            id
            address1
            city
            provinceCode
            countryCodeV2
            zip
          }
          userErrors {
            field
            message
          }
        }
      }`,
      "variables": {
          "customerId": "gid://shopify/Customer/624407574",
          "address": {
              "address1": "500 Broadway",
              "city": "Nashville",
              "provinceCode": "TN",
              "countryCode": "US",
              "zip": "37203"
          },
          "setAsDefault": true
      },
    },
  });
  ```

  #### Shopify CLI

  ```bash
  shopify app execute \
  --query \
  'mutation customerAddressCreate($customerId: ID!, $address: MailingAddressInput!, $setAsDefault: Boolean) {
    customerAddressCreate(customerId: $customerId, address: $address, setAsDefault: $setAsDefault) {
      address {
        id
        address1
        city
        provinceCode
        countryCodeV2
        zip
      }
      userErrors {
        field
        message
      }
    }
  }' \
  --variables \
  '{
    "customerId": "gid://shopify/Customer/624407574",
    "address": {
      "address1": "500 Broadway",
      "city": "Nashville",
      "provinceCode": "TN",
      "countryCode": "US",
      "zip": "37203"
    },
    "setAsDefault": true
  }'
  ```

  #### Direct API Access

  ```javascript
  const response = await fetch('shopify:admin/api/2026-10/graphql.json', {
    method: 'POST',
    body: JSON.stringify({
      query: `
        mutation customerAddressCreate($customerId: ID!, $address: MailingAddressInput!, $setAsDefault: Boolean) {
          customerAddressCreate(customerId: $customerId, address: $address, setAsDefault: $setAsDefault) {
            address {
              id
              address1
              city
              provinceCode
              countryCodeV2
              zip
            }
            userErrors {
              field
              message
            }
          }
        }
      `,
      variables: {
          "customerId": "gid://shopify/Customer/624407574",
          "address": {
              "address1": "500 Broadway",
              "city": "Nashville",
              "provinceCode": "TN",
              "countryCode": "US",
              "zip": "37203"
          },
          "setAsDefault": true
      },
    }),
  });

  const { data } = await response.json();
  console.log(data);
  ```

  #### Response

  ```json
  {
    "customerAddressCreate": {
      "address": {
        "id": "gid://shopify/MailingAddress/1053317288?model_name=CustomerAddress",
        "address1": "500 Broadway",
        "city": "Nashville",
        "provinceCode": "TN",
        "countryCodeV2": "US",
        "zip": "37203"
      },
      "userErrors": []
    }
  }
  ```

* ### customerAddressCreate reference