Skip to main content

Overview

Manage customer data including profile updates, addresses, passwords, and customer groups through GraphQL mutations.

Update Active User

Update the authenticated user’s profile information.

GraphQL Mutation

mutation UpdateActiveUser($data: UserUpdateProfileInput!) {
  updateActiveUser(data: $data) {
    id
    name
    email
    phone
    onboardingStatus
    orderWebhookUrl
  }
}
data
UserUpdateProfileInput
required
User profile update data
email
String
User email address
name
String
Full name
phone
String
Phone number
onboardingStatus
String
Onboarding status (not_started, in_progress, completed, dismissed)
orderWebhookUrl
String
Webhook URL for order notifications (Openship integration)

Response

id
string
User unique identifier
name
string
Updated full name
email
string
Updated email address

Example

mutation {
  updateActiveUser(data: {
    name: "John Doe"
    email: "[email protected]"
    phone: "+1234567890"
  }) {
    id
    name
    email
  }
}

Update Active User Password

Change the password for the authenticated user.

GraphQL Mutation

mutation UpdateActiveUserPassword(
  $oldPassword: String!
  $newPassword: String!
  $confirmPassword: String!
) {
  updateActiveUserPassword(
    oldPassword: $oldPassword
    newPassword: $newPassword
    confirmPassword: $confirmPassword
  ) {
    id
    email
  }
}
oldPassword
String
required
Current password for verification
newPassword
String
required
New password (minimum 10 characters)
confirmPassword
String
required
Confirmation of new password

Create User Address

Add a new address to the authenticated user’s profile.

GraphQL Mutation

mutation CreateActiveUserAddress($data: AddressCreateInput!) {
  createActiveUserAddress(data: $data) {
    id
    addresses {
      id
      firstName
      lastName
      address1
      address2
      city
      province
      postalCode
      country {
        iso2
        name
      }
      phone
    }
  }
}
data
AddressCreateInput
required
Address data
firstName
String
required
First name
lastName
String
required
Last name
address1
String
required
Street address line 1
address2
String
Street address line 2 (optional)
city
String
required
City name
province
String
required
State/province
postalCode
String
required
Postal/ZIP code
phone
String
Contact phone number
isBilling
Boolean
Set as billing address

Update User Address

Update an existing address for the authenticated user.

GraphQL Mutation

mutation UpdateActiveUserAddress(
  $where: AddressWhereUniqueInput!
  $data: AddressUpdateInput!
) {
  updateActiveUserAddress(where: $where, data: $data) {
    id
    addresses {
      id
      firstName
      lastName
      address1
      city
    }
  }
}
where
AddressWhereUniqueInput
required
Address identifier
id
ID
Address unique ID
data
AddressUpdateInput
required
Updated address fields

Delete User Address

Remove an address from the authenticated user’s profile.

GraphQL Mutation

mutation DeleteActiveUserAddress($where: AddressWhereUniqueInput!) {
  deleteActiveUserAddress(where: $where) {
    id
    address1
    city
  }
}
where
AddressWhereUniqueInput
required
Address identifier
id
ID
Address unique ID

Regenerate Customer Token

Generate a new authentication token for the customer (used for Openship integration).

GraphQL Mutation

mutation RegenerateCustomerToken {
  regenerateCustomerToken {
    success
    token
  }
}

Response

success
boolean
Indicates if token generation was successful
token
string
New authentication token

Customer Groups

Manage customer group assignments using standard KeystoneJS mutations:

Create Customer Group

mutation CreateCustomerGroup($data: CustomerGroupCreateInput!) {
  createCustomerGroup(data: $data) {
    id
    name
    metadata
    users {
      id
      name
      email
    }
  }
}
data
CustomerGroupCreateInput
required
Customer group data
name
String
required
Group name
metadata
JSON
Additional metadata
users
UserRelateToManyInput
Users to add to the group

Update Customer Group

mutation UpdateCustomerGroup(
  $where: CustomerGroupWhereUniqueInput!
  $data: CustomerGroupUpdateInput!
) {
  updateCustomerGroup(where: $where, data: $data) {
    id
    name
    users {
      id
      name
    }
  }
}

Add Users to Customer Group

mutation {
  updateCustomerGroup(
    where: { id: "customer_group_id" }
    data: {
      users: {
        connect: [
          { id: "user_id_1" }
          { id: "user_id_2" }
        ]
      }
    }
  ) {
    id
    name
    users {
      id
      name
      email
    }
  }
}

Create User (Admin)

Create a new user account (requires admin permissions):
mutation CreateUser($data: UserCreateInput!) {
  createUser(data: $data) {
    id
    name
    email
    hasAccount
  }
}
data
UserCreateInput
required
User creation data
name
String
required
Full name
email
String
required
Unique email address
password
String
required
Password (minimum 10 characters)
phone
String
Phone number
hasAccount
Boolean
Has a registered account
customerGroups
CustomerGroupRelateToManyInput
Customer groups to assign

Build docs developers (and LLMs) love