# updateCustomers - Customer Module Reference

This documentation provides a reference to the `updateCustomers` method. This belongs to the Customer Module.

You should only use this methods when implementing complex customizations. For common cases, check out [available workflows instead](https://docs.medusajs.com/medusa-workflows-reference).

## updateCustomers(customerId, data, sharedContext?): Promise\<[CustomerDTO](https://docs.medusajs.com/var/task/www/apps/resources/references/customer/interfaces/customer.CustomerDTO)>

This method updates an existing customer.

### Example

```ts
const customer = await customerModuleService.updateCustomers(
  "cus_123",
  {
    first_name: "Matt",
  }
)
```

### Parameters

- customerId: (\`string\`) The customer's ID.
- data: (\[CustomerUpdatableFields]\(../../../interfaces/customer.CustomerUpdatableFields/page.mdx)) The updatable fields of a customer.

  - company\_name: (\`null\` \\| \`string\`) The company name of the customer.

  - first\_name: (\`null\` \\| \`string\`) The first name of the customer.

  - last\_name: (\`null\` \\| \`string\`) The last name of the customer.

  - email: (\`null\` \\| \`string\`) The email of the customer.

  - phone: (\`null\` \\| \`string\`) The phone of the customer.

  - metadata: (\[MetadataType]\(../../../types/customer.MetadataType/page.mdx)) Holds custom data in key-value pairs.
- sharedContext: (\[Context]\(../../../interfaces/customer.Context/page.mdx)) A context used to share resources, such as transaction manager, between the application and the module.

  - transactionManager: (TManager) An instance of a transaction manager of type \`TManager\`, which is a typed parameter passed to the context to specify the type of the \`transactionManager\`.

  - manager: (TManager) An instance of a manager, typically an entity manager, of type \`TManager\`, which is a typed parameter passed to the context to specify the type of the \`manager\`.

  - isolationLevel: (\`string\`) A string indicating the isolation level of the context. Possible values are \`READ UNCOMMITTED\`, \`READ COMMITTED\`, \`REPEATABLE READ\`, or \`SERIALIZABLE\`.

  - enableNestedTransactions: (\`boolean\`) A boolean value indicating whether nested transactions are enabled.

  - eventGroupId: (\`string\`) A string indicating the ID of the group to aggregate the events to be emitted at a later point.

  - transactionId: (\`string\`) A string indicating the ID of the current transaction.

  - runId: (\`string\`) A string indicating the ID of the current run.

  - messageAggregator: (\[IMessageAggregator]\(../../../interfaces/customer.IMessageAggregator/page.mdx)) An instance of a message aggregator, which is used to aggregate messages to be emitted at a later point.

  - requestId: (\`string\`) A string indicating the ID of the current request.

  - idempotencyKey: (\`string\`) A string indicating the idempotencyKey of the current workflow execution.

  - parentStepIdempotencyKey: (\`string\`) A string indicating the idempotencyKey of the parent workflow execution.

  - preventReleaseEvents: (\`boolean\`) preventReleaseEvents

  - isCancelling: (\`boolean\`) A boolean value indicating whether the current workflow execution is being cancelled.

  - cancelingFromParentStep: (\`boolean\`) Weither or not a sub workflow cancellation is being triggered from a parent step.
    If true, the parent step will not be triggered by the sub workflow.

### Returns

- Promise: (Promise\&#60;\[CustomerDTO]\(../../../interfaces/customer.CustomerDTO/page.mdx)\&#62;) The updated customer.

  - id: (\`string\`) The ID of the customer.

  - email: (\`string\`) The email of the customer.

  - has\_account: (\`boolean\`) A flag indicating if customer has an account or not.

  - default\_billing\_address\_id: (\`null\` \\| \`string\`) The associated default billing address's ID.

  - default\_shipping\_address\_id: (\`null\` \\| \`string\`) The associated default shipping address's ID.

  - company\_name: (\`null\` \\| \`string\`) The company name of the customer.

  - first\_name: (\`null\` \\| \`string\`) The first name of the customer.

  - last\_name: (\`null\` \\| \`string\`) The last name of the customer.

  - addresses: (\[CustomerAddressDTO]\(../../../interfaces/customer.CustomerAddressDTO/page.mdx)\[]) The addresses of the customer.

    - id: (\`string\`) The ID of the customer address.

    - is\_default\_shipping: (\`boolean\`) Whether the customer address is default shipping.

    - is\_default\_billing: (\`boolean\`) Whether the customer address is default billing.

    - customer\_id: (\`string\`) The associated customer's ID.

    - created\_at: (\`string\`) The created at of the customer address.

    - updated\_at: (\`string\`) The updated at of the customer address.

    - address\_name: (\`string\`) The address name of the customer address.

    - company: (\`string\`) The company of the customer address.

    - first\_name: (\`string\`) The first name of the customer address.

    - last\_name: (\`string\`) The last name of the customer address.

    - address\_1: (\`string\`) The address 1 of the customer address.

    - address\_2: (\`string\`) The address 2 of the customer address.

    - city: (\`string\`) The city of the customer address.

    - country\_code: (\`string\`) The country code of the customer address.

    - province: (\`string\`) The lower-case \[ISO 3166-2]\(https://en.wikipedia.org/wiki/ISO\\\_3166-2) province of the customer address.

    - postal\_code: (\`string\`) The postal code of the customer address.

    - phone: (\`string\`) The phone of the customer address.

    - metadata: (\`Record\<string, unknown>\`) Holds custom data in key-value pairs.

  - phone: (\`null\` \\| \`string\`) The phone of the customer.

  - groups: (\`object\`\[]) The groups of the customer.

    - id: (\`string\`) The ID of the group.

    - name: (\`string\`) The name of the group.

  - metadata: (\`Record\<string, unknown>\`) Holds custom data in key-value pairs.

  - created\_by: (\`null\` \\| \`string\`) Who created the customer.

  - deleted\_at: (\`null\` \\| \`string\` \\| \`Date\`) The deletion date of the customer.

  - created\_at: (\`string\` \\| \`Date\`) The creation date of the customer.

  - updated\_at: (\`string\` \\| \`Date\`) The update date of the customer.

## updateCustomers(customerIds, data, sharedContext?): Promise\<[CustomerDTO](https://docs.medusajs.com/var/task/www/apps/resources/references/customer/interfaces/customer.CustomerDTO)\[]>

This method updates existing customers.

### Example

```ts
const customers = await customerModuleService.updateCustomers(
  ["cus_123", "cus_321"],
  {
    company_name: "Acme",
  }
)
```

### Parameters

- customerIds: (\`string\`\[]) The IDs of customers to update.
- data: (\[CustomerUpdatableFields]\(../../../interfaces/customer.CustomerUpdatableFields/page.mdx)) The attributes to update in the customers.

  - company\_name: (\`null\` \\| \`string\`) The company name of the customer.

  - first\_name: (\`null\` \\| \`string\`) The first name of the customer.

  - last\_name: (\`null\` \\| \`string\`) The last name of the customer.

  - email: (\`null\` \\| \`string\`) The email of the customer.

  - phone: (\`null\` \\| \`string\`) The phone of the customer.

  - metadata: (\[MetadataType]\(../../../types/customer.MetadataType/page.mdx)) Holds custom data in key-value pairs.
- sharedContext: (\[Context]\(../../../interfaces/customer.Context/page.mdx)) A context used to share resources, such as transaction manager, between the application and the module.

  - transactionManager: (TManager) An instance of a transaction manager of type \`TManager\`, which is a typed parameter passed to the context to specify the type of the \`transactionManager\`.

  - manager: (TManager) An instance of a manager, typically an entity manager, of type \`TManager\`, which is a typed parameter passed to the context to specify the type of the \`manager\`.

  - isolationLevel: (\`string\`) A string indicating the isolation level of the context. Possible values are \`READ UNCOMMITTED\`, \`READ COMMITTED\`, \`REPEATABLE READ\`, or \`SERIALIZABLE\`.

  - enableNestedTransactions: (\`boolean\`) A boolean value indicating whether nested transactions are enabled.

  - eventGroupId: (\`string\`) A string indicating the ID of the group to aggregate the events to be emitted at a later point.

  - transactionId: (\`string\`) A string indicating the ID of the current transaction.

  - runId: (\`string\`) A string indicating the ID of the current run.

  - messageAggregator: (\[IMessageAggregator]\(../../../interfaces/customer.IMessageAggregator/page.mdx)) An instance of a message aggregator, which is used to aggregate messages to be emitted at a later point.

  - requestId: (\`string\`) A string indicating the ID of the current request.

  - idempotencyKey: (\`string\`) A string indicating the idempotencyKey of the current workflow execution.

  - parentStepIdempotencyKey: (\`string\`) A string indicating the idempotencyKey of the parent workflow execution.

  - preventReleaseEvents: (\`boolean\`) preventReleaseEvents

  - isCancelling: (\`boolean\`) A boolean value indicating whether the current workflow execution is being cancelled.

  - cancelingFromParentStep: (\`boolean\`) Weither or not a sub workflow cancellation is being triggered from a parent step.
    If true, the parent step will not be triggered by the sub workflow.

### Returns

- Promise: (Promise\&#60;\[CustomerDTO]\(../../../interfaces/customer.CustomerDTO/page.mdx)\[]\&#62;) The updated customers.

  - CustomerDTO\[]: (\[CustomerDTO]\(../../../interfaces/customer.CustomerDTO/page.mdx)\[])

    - id: (\`string\`) The ID of the customer.

    - email: (\`string\`) The email of the customer.

    - has\_account: (\`boolean\`) A flag indicating if customer has an account or not.

    - default\_billing\_address\_id: (\`null\` \\| \`string\`) The associated default billing address's ID.

    - default\_shipping\_address\_id: (\`null\` \\| \`string\`) The associated default shipping address's ID.

    - company\_name: (\`null\` \\| \`string\`) The company name of the customer.

    - first\_name: (\`null\` \\| \`string\`) The first name of the customer.

    - last\_name: (\`null\` \\| \`string\`) The last name of the customer.

    - addresses: (\[CustomerAddressDTO]\(../../../interfaces/customer.CustomerAddressDTO/page.mdx)\[]) The addresses of the customer.

      - id: (\`string\`) The ID of the customer address.

      - is\_default\_shipping: (\`boolean\`) Whether the customer address is default shipping.

      - is\_default\_billing: (\`boolean\`) Whether the customer address is default billing.

      - customer\_id: (\`string\`) The associated customer's ID.

      - created\_at: (\`string\`) The created at of the customer address.

      - updated\_at: (\`string\`) The updated at of the customer address.

      - address\_name: (\`string\`) The address name of the customer address.

      - company: (\`string\`) The company of the customer address.

      - first\_name: (\`string\`) The first name of the customer address.

      - last\_name: (\`string\`) The last name of the customer address.

      - address\_1: (\`string\`) The address 1 of the customer address.

      - address\_2: (\`string\`) The address 2 of the customer address.

      - city: (\`string\`) The city of the customer address.

      - country\_code: (\`string\`) The country code of the customer address.

      - province: (\`string\`) The lower-case \[ISO 3166-2]\(https://en.wikipedia.org/wiki/ISO\\\_3166-2) province of the customer address.

      - postal\_code: (\`string\`) The postal code of the customer address.

      - phone: (\`string\`) The phone of the customer address.

      - metadata: (\`Record\<string, unknown>\`) Holds custom data in key-value pairs.

    - phone: (\`null\` \\| \`string\`) The phone of the customer.

    - groups: (\`object\`\[]) The groups of the customer.

      - id: (\`string\`) The ID of the group.

      - name: (\`string\`) The name of the group.

    - metadata: (\`Record\<string, unknown>\`) Holds custom data in key-value pairs.

    - created\_by: (\`null\` \\| \`string\`) Who created the customer.

    - deleted\_at: (\`null\` \\| \`string\` \\| \`Date\`) The deletion date of the customer.

    - created\_at: (\`string\` \\| \`Date\`) The creation date of the customer.

    - updated\_at: (\`string\` \\| \`Date\`) The update date of the customer.

## updateCustomers(selector, data, sharedContext?): Promise\<[CustomerDTO](https://docs.medusajs.com/var/task/www/apps/resources/references/customer/interfaces/customer.CustomerDTO)\[]>

This method updates existing customers.

### Example

```ts
const customers = await customerModuleService.updateCustomers(
  { company_name: "Acme" },
  {
    company_name: "Acme Inc.",
  }
)
```

### Parameters

- selector: (\[FilterableCustomerProps]\(../../../interfaces/customer.FilterableCustomerProps/page.mdx)) The filters that specify which API keys should be updated.

  - q: (\`string\`) Searches for customers by properties such as name and email using this search term.

  - id: (\`string\` \\| \`string\`\[]) The IDs to filter the customer by.

  - email: (\`string\` \\| \`string\`\[] \\| \[OperatorMap]\(../../../types/customer.OperatorMap/page.mdx)\&#60;string\&#62;) Filter by email.

    - $and: (\[Query]\(../../../types/customer.Query/page.mdx)\&#60;T\&#62;\[])

    - $or: (\[Query]\(../../../types/customer.Query/page.mdx)\&#60;T\&#62;\[])

    - $eq: (\[ExpandScalar]\(../../../types/customer.ExpandScalar/page.mdx)\&#60;T\&#62; \\| \[ExpandScalar]\(../../../types/customer.ExpandScalar/page.mdx)\&#60;T\&#62;\[])

    - $ne: (\[ExpandScalar]\(../../../types/customer.ExpandScalar/page.mdx)\&#60;T\&#62;)

    - $in: (\[ExpandScalar]\(../../../types/customer.ExpandScalar/page.mdx)\&#60;T\&#62;\[])

    - $nin: (\[ExpandScalar]\(../../../types/customer.ExpandScalar/page.mdx)\&#60;T\&#62;\[])

    - $not: (\[Query]\(../../../types/customer.Query/page.mdx)\&#60;T\&#62;) API wrapper around the remoteQuery

    - $gt: (\[ExpandScalar]\(../../../types/customer.ExpandScalar/page.mdx)\&#60;T\&#62;)

    - $gte: (\[ExpandScalar]\(../../../types/customer.ExpandScalar/page.mdx)\&#60;T\&#62;)

    - $lt: (\[ExpandScalar]\(../../../types/customer.ExpandScalar/page.mdx)\&#60;T\&#62;)

    - $lte: (\[ExpandScalar]\(../../../types/customer.ExpandScalar/page.mdx)\&#60;T\&#62;)

    - $like: (\`string\`)

    - $re: (\`string\`)

    - $ilike: (\`string\`)

    - $fulltext: (\`string\`)

    - $overlap: (\`string\`\[])

    - $contains: (\`string\`\[])

    - $contained: (\`string\`\[])

    - $exists: (\`boolean\`)

  - groups: (\`string\` \\| \`string\`\[] \\| \[FilterableCustomerGroupProps]\(../../../interfaces/customer.FilterableCustomerGroupProps/page.mdx)) Filter by associated customer group.

    - q: (\`string\`) Searches for customer groups by name using this search term.

    - id: (\`string\` \\| \`string\`\[]) The IDs to filter the customer group by.

    - name: (\`string\` \\| \[OperatorMap]\(../../../types/customer.OperatorMap/page.mdx)\&#60;string\&#62;) Filter customer groups by name.

    - customers: (\`string\` \\| \`string\`\[] \\| \[FilterableCustomerProps]\(../../../interfaces/customer.FilterableCustomerProps/page.mdx)) Filter customer groups by associated customers.

    - created\_by: (\`null\` \\| \`string\` \\| \`string\`\[]) Filter customer groups by their \`created\_by\` attribute.

    - created\_at: (\[OperatorMap]\(../../../types/customer.OperatorMap/page.mdx)\&#60;string\&#62;) Filter customer groups by created date.

    - updated\_at: (\[OperatorMap]\(../../../types/customer.OperatorMap/page.mdx)\&#60;string\&#62;) Filter customer groups by updated date.

    - $and: ((\[FilterableCustomerGroupProps]\(../../../interfaces/customer.FilterableCustomerGroupProps/page.mdx) \\| \[BaseFilterable]\(../../../interfaces/customer.BaseFilterable/page.mdx)\&#60;\[FilterableCustomerGroupProps]\(../../../interfaces/customer.FilterableCustomerGroupProps/page.mdx)\&#62;)\[]) An array of filters to apply on the entity, where each item in the array is joined with an "and" condition.

    - $or: ((\[FilterableCustomerGroupProps]\(../../../interfaces/customer.FilterableCustomerGroupProps/page.mdx) \\| \[BaseFilterable]\(../../../interfaces/customer.BaseFilterable/page.mdx)\&#60;\[FilterableCustomerGroupProps]\(../../../interfaces/customer.FilterableCustomerGroupProps/page.mdx)\&#62;)\[]) An array of filters to apply on the entity, where each item in the array is joined with an "or" condition.

  - default\_billing\_address\_id: (\`null\` \\| \`string\` \\| \`string\`\[]) Filter by the associated default billing address's ID.

  - default\_shipping\_address\_id: (\`null\` \\| \`string\` \\| \`string\`\[]) Filter by the associated default shipping address's ID.

  - company\_name: (\`null\` \\| \`string\` \\| \`string\`\[] \\| \[OperatorMap]\(../../../types/customer.OperatorMap/page.mdx)\&#60;string\&#62;) Filter by company name.

    - $and: (\[Query]\(../../../types/customer.Query/page.mdx)\&#60;T\&#62;\[])

    - $or: (\[Query]\(../../../types/customer.Query/page.mdx)\&#60;T\&#62;\[])

    - $eq: (\[ExpandScalar]\(../../../types/customer.ExpandScalar/page.mdx)\&#60;T\&#62; \\| \[ExpandScalar]\(../../../types/customer.ExpandScalar/page.mdx)\&#60;T\&#62;\[])

    - $ne: (\[ExpandScalar]\(../../../types/customer.ExpandScalar/page.mdx)\&#60;T\&#62;)

    - $in: (\[ExpandScalar]\(../../../types/customer.ExpandScalar/page.mdx)\&#60;T\&#62;\[])

    - $nin: (\[ExpandScalar]\(../../../types/customer.ExpandScalar/page.mdx)\&#60;T\&#62;\[])

    - $not: (\[Query]\(../../../types/customer.Query/page.mdx)\&#60;T\&#62;) API wrapper around the remoteQuery

    - $gt: (\[ExpandScalar]\(../../../types/customer.ExpandScalar/page.mdx)\&#60;T\&#62;)

    - $gte: (\[ExpandScalar]\(../../../types/customer.ExpandScalar/page.mdx)\&#60;T\&#62;)

    - $lt: (\[ExpandScalar]\(../../../types/customer.ExpandScalar/page.mdx)\&#60;T\&#62;)

    - $lte: (\[ExpandScalar]\(../../../types/customer.ExpandScalar/page.mdx)\&#60;T\&#62;)

    - $like: (\`string\`)

    - $re: (\`string\`)

    - $ilike: (\`string\`)

    - $fulltext: (\`string\`)

    - $overlap: (\`string\`\[])

    - $contains: (\`string\`\[])

    - $contained: (\`string\`\[])

    - $exists: (\`boolean\`)

  - first\_name: (\`null\` \\| \`string\` \\| \`string\`\[] \\| \[OperatorMap]\(../../../types/customer.OperatorMap/page.mdx)\&#60;string\&#62;) Filter by first name.

    - $and: (\[Query]\(../../../types/customer.Query/page.mdx)\&#60;T\&#62;\[])

    - $or: (\[Query]\(../../../types/customer.Query/page.mdx)\&#60;T\&#62;\[])

    - $eq: (\[ExpandScalar]\(../../../types/customer.ExpandScalar/page.mdx)\&#60;T\&#62; \\| \[ExpandScalar]\(../../../types/customer.ExpandScalar/page.mdx)\&#60;T\&#62;\[])

    - $ne: (\[ExpandScalar]\(../../../types/customer.ExpandScalar/page.mdx)\&#60;T\&#62;)

    - $in: (\[ExpandScalar]\(../../../types/customer.ExpandScalar/page.mdx)\&#60;T\&#62;\[])

    - $nin: (\[ExpandScalar]\(../../../types/customer.ExpandScalar/page.mdx)\&#60;T\&#62;\[])

    - $not: (\[Query]\(../../../types/customer.Query/page.mdx)\&#60;T\&#62;) API wrapper around the remoteQuery

    - $gt: (\[ExpandScalar]\(../../../types/customer.ExpandScalar/page.mdx)\&#60;T\&#62;)

    - $gte: (\[ExpandScalar]\(../../../types/customer.ExpandScalar/page.mdx)\&#60;T\&#62;)

    - $lt: (\[ExpandScalar]\(../../../types/customer.ExpandScalar/page.mdx)\&#60;T\&#62;)

    - $lte: (\[ExpandScalar]\(../../../types/customer.ExpandScalar/page.mdx)\&#60;T\&#62;)

    - $like: (\`string\`)

    - $re: (\`string\`)

    - $ilike: (\`string\`)

    - $fulltext: (\`string\`)

    - $overlap: (\`string\`\[])

    - $contains: (\`string\`\[])

    - $contained: (\`string\`\[])

    - $exists: (\`boolean\`)

  - last\_name: (\`null\` \\| \`string\` \\| \`string\`\[] \\| \[OperatorMap]\(../../../types/customer.OperatorMap/page.mdx)\&#60;string\&#62;) Filter by last name.

    - $and: (\[Query]\(../../../types/customer.Query/page.mdx)\&#60;T\&#62;\[])

    - $or: (\[Query]\(../../../types/customer.Query/page.mdx)\&#60;T\&#62;\[])

    - $eq: (\[ExpandScalar]\(../../../types/customer.ExpandScalar/page.mdx)\&#60;T\&#62; \\| \[ExpandScalar]\(../../../types/customer.ExpandScalar/page.mdx)\&#60;T\&#62;\[])

    - $ne: (\[ExpandScalar]\(../../../types/customer.ExpandScalar/page.mdx)\&#60;T\&#62;)

    - $in: (\[ExpandScalar]\(../../../types/customer.ExpandScalar/page.mdx)\&#60;T\&#62;\[])

    - $nin: (\[ExpandScalar]\(../../../types/customer.ExpandScalar/page.mdx)\&#60;T\&#62;\[])

    - $not: (\[Query]\(../../../types/customer.Query/page.mdx)\&#60;T\&#62;) API wrapper around the remoteQuery

    - $gt: (\[ExpandScalar]\(../../../types/customer.ExpandScalar/page.mdx)\&#60;T\&#62;)

    - $gte: (\[ExpandScalar]\(../../../types/customer.ExpandScalar/page.mdx)\&#60;T\&#62;)

    - $lt: (\[ExpandScalar]\(../../../types/customer.ExpandScalar/page.mdx)\&#60;T\&#62;)

    - $lte: (\[ExpandScalar]\(../../../types/customer.ExpandScalar/page.mdx)\&#60;T\&#62;)

    - $like: (\`string\`)

    - $re: (\`string\`)

    - $ilike: (\`string\`)

    - $fulltext: (\`string\`)

    - $overlap: (\`string\`\[])

    - $contains: (\`string\`\[])

    - $contained: (\`string\`\[])

    - $exists: (\`boolean\`)

  - has\_account: (\`boolean\` \\| \[OperatorMap]\(../../../types/customer.OperatorMap/page.mdx)\&#60;boolean\&#62;) Filter by whether the customer has an account.

    - $and: (\[Query]\(../../../types/customer.Query/page.mdx)\&#60;T\&#62;\[])

    - $or: (\[Query]\(../../../types/customer.Query/page.mdx)\&#60;T\&#62;\[])

    - $eq: (\[ExpandScalar]\(../../../types/customer.ExpandScalar/page.mdx)\&#60;T\&#62; \\| \[ExpandScalar]\(../../../types/customer.ExpandScalar/page.mdx)\&#60;T\&#62;\[])

    - $ne: (\[ExpandScalar]\(../../../types/customer.ExpandScalar/page.mdx)\&#60;T\&#62;)

    - $in: (\[ExpandScalar]\(../../../types/customer.ExpandScalar/page.mdx)\&#60;T\&#62;\[])

    - $nin: (\[ExpandScalar]\(../../../types/customer.ExpandScalar/page.mdx)\&#60;T\&#62;\[])

    - $not: (\[Query]\(../../../types/customer.Query/page.mdx)\&#60;T\&#62;) API wrapper around the remoteQuery

    - $gt: (\[ExpandScalar]\(../../../types/customer.ExpandScalar/page.mdx)\&#60;T\&#62;)

    - $gte: (\[ExpandScalar]\(../../../types/customer.ExpandScalar/page.mdx)\&#60;T\&#62;)

    - $lt: (\[ExpandScalar]\(../../../types/customer.ExpandScalar/page.mdx)\&#60;T\&#62;)

    - $lte: (\[ExpandScalar]\(../../../types/customer.ExpandScalar/page.mdx)\&#60;T\&#62;)

    - $like: (\`string\`)

    - $re: (\`string\`)

    - $ilike: (\`string\`)

    - $fulltext: (\`string\`)

    - $overlap: (\`string\`\[])

    - $contains: (\`string\`\[])

    - $contained: (\`string\`\[])

    - $exists: (\`boolean\`)

  - created\_by: (\`null\` \\| \`string\` \\| \`string\`\[]) Filter by the \`created\_by\` attribute.

  - created\_at: (\[OperatorMap]\(../../../types/customer.OperatorMap/page.mdx)\&#60;string\&#62;) Filter by created date.

    - $and: (\[Query]\(../../../types/customer.Query/page.mdx)\&#60;T\&#62;\[])

    - $or: (\[Query]\(../../../types/customer.Query/page.mdx)\&#60;T\&#62;\[])

    - $eq: (\[ExpandScalar]\(../../../types/customer.ExpandScalar/page.mdx)\&#60;T\&#62; \\| \[ExpandScalar]\(../../../types/customer.ExpandScalar/page.mdx)\&#60;T\&#62;\[])

    - $ne: (\[ExpandScalar]\(../../../types/customer.ExpandScalar/page.mdx)\&#60;T\&#62;)

    - $in: (\[ExpandScalar]\(../../../types/customer.ExpandScalar/page.mdx)\&#60;T\&#62;\[])

    - $nin: (\[ExpandScalar]\(../../../types/customer.ExpandScalar/page.mdx)\&#60;T\&#62;\[])

    - $not: (\[Query]\(../../../types/customer.Query/page.mdx)\&#60;T\&#62;) API wrapper around the remoteQuery

    - $gt: (\[ExpandScalar]\(../../../types/customer.ExpandScalar/page.mdx)\&#60;T\&#62;)

    - $gte: (\[ExpandScalar]\(../../../types/customer.ExpandScalar/page.mdx)\&#60;T\&#62;)

    - $lt: (\[ExpandScalar]\(../../../types/customer.ExpandScalar/page.mdx)\&#60;T\&#62;)

    - $lte: (\[ExpandScalar]\(../../../types/customer.ExpandScalar/page.mdx)\&#60;T\&#62;)

    - $like: (\`string\`)

    - $re: (\`string\`)

    - $ilike: (\`string\`)

    - $fulltext: (\`string\`)

    - $overlap: (\`string\`\[])

    - $contains: (\`string\`\[])

    - $contained: (\`string\`\[])

    - $exists: (\`boolean\`)

  - updated\_at: (\[OperatorMap]\(../../../types/customer.OperatorMap/page.mdx)\&#60;string\&#62;) Filter by updated date.

    - $and: (\[Query]\(../../../types/customer.Query/page.mdx)\&#60;T\&#62;\[])

    - $or: (\[Query]\(../../../types/customer.Query/page.mdx)\&#60;T\&#62;\[])

    - $eq: (\[ExpandScalar]\(../../../types/customer.ExpandScalar/page.mdx)\&#60;T\&#62; \\| \[ExpandScalar]\(../../../types/customer.ExpandScalar/page.mdx)\&#60;T\&#62;\[])

    - $ne: (\[ExpandScalar]\(../../../types/customer.ExpandScalar/page.mdx)\&#60;T\&#62;)

    - $in: (\[ExpandScalar]\(../../../types/customer.ExpandScalar/page.mdx)\&#60;T\&#62;\[])

    - $nin: (\[ExpandScalar]\(../../../types/customer.ExpandScalar/page.mdx)\&#60;T\&#62;\[])

    - $not: (\[Query]\(../../../types/customer.Query/page.mdx)\&#60;T\&#62;) API wrapper around the remoteQuery

    - $gt: (\[ExpandScalar]\(../../../types/customer.ExpandScalar/page.mdx)\&#60;T\&#62;)

    - $gte: (\[ExpandScalar]\(../../../types/customer.ExpandScalar/page.mdx)\&#60;T\&#62;)

    - $lt: (\[ExpandScalar]\(../../../types/customer.ExpandScalar/page.mdx)\&#60;T\&#62;)

    - $lte: (\[ExpandScalar]\(../../../types/customer.ExpandScalar/page.mdx)\&#60;T\&#62;)

    - $like: (\`string\`)

    - $re: (\`string\`)

    - $ilike: (\`string\`)

    - $fulltext: (\`string\`)

    - $overlap: (\`string\`\[])

    - $contains: (\`string\`\[])

    - $contained: (\`string\`\[])

    - $exists: (\`boolean\`)

  - $and: ((\[FilterableCustomerProps]\(../../../interfaces/customer.FilterableCustomerProps/page.mdx) \\| \[BaseFilterable]\(../../../interfaces/customer.BaseFilterable/page.mdx)\&#60;\[FilterableCustomerProps]\(../../../interfaces/customer.FilterableCustomerProps/page.mdx)\&#62;)\[]) An array of filters to apply on the entity, where each item in the array is joined with an "and" condition.

    - q: (\`string\`) Searches for customers by properties such as name and email using this search term.

    - id: (\`string\` \\| \`string\`\[]) The IDs to filter the customer by.

    - email: (\`string\` \\| \`string\`\[] \\| \[OperatorMap]\(../../../types/customer.OperatorMap/page.mdx)\&#60;string\&#62;) Filter by email.

    - groups: (\`string\` \\| \`string\`\[] \\| \[FilterableCustomerGroupProps]\(../../../interfaces/customer.FilterableCustomerGroupProps/page.mdx)) Filter by associated customer group.

    - default\_billing\_address\_id: (\`null\` \\| \`string\` \\| \`string\`\[]) Filter by the associated default billing address's ID.

    - default\_shipping\_address\_id: (\`null\` \\| \`string\` \\| \`string\`\[]) Filter by the associated default shipping address's ID.

    - company\_name: (\`null\` \\| \`string\` \\| \`string\`\[] \\| \[OperatorMap]\(../../../types/customer.OperatorMap/page.mdx)\&#60;string\&#62;) Filter by company name.

    - first\_name: (\`null\` \\| \`string\` \\| \`string\`\[] \\| \[OperatorMap]\(../../../types/customer.OperatorMap/page.mdx)\&#60;string\&#62;) Filter by first name.

    - last\_name: (\`null\` \\| \`string\` \\| \`string\`\[] \\| \[OperatorMap]\(../../../types/customer.OperatorMap/page.mdx)\&#60;string\&#62;) Filter by last name.

    - has\_account: (\`boolean\` \\| \[OperatorMap]\(../../../types/customer.OperatorMap/page.mdx)\&#60;boolean\&#62;) Filter by whether the customer has an account.

    - created\_by: (\`null\` \\| \`string\` \\| \`string\`\[]) Filter by the \`created\_by\` attribute.

    - created\_at: (\[OperatorMap]\(../../../types/customer.OperatorMap/page.mdx)\&#60;string\&#62;) Filter by created date.

    - updated\_at: (\[OperatorMap]\(../../../types/customer.OperatorMap/page.mdx)\&#60;string\&#62;) Filter by updated date.

    - $and: ((\[FilterableCustomerProps]\(../../../interfaces/customer.FilterableCustomerProps/page.mdx) \\| \[BaseFilterable]\(../../../interfaces/customer.BaseFilterable/page.mdx)\&#60;\[FilterableCustomerProps]\(../../../interfaces/customer.FilterableCustomerProps/page.mdx)\&#62;)\[]) An array of filters to apply on the entity, where each item in the array is joined with an "and" condition.

    - $or: ((\[FilterableCustomerProps]\(../../../interfaces/customer.FilterableCustomerProps/page.mdx) \\| \[BaseFilterable]\(../../../interfaces/customer.BaseFilterable/page.mdx)\&#60;\[FilterableCustomerProps]\(../../../interfaces/customer.FilterableCustomerProps/page.mdx)\&#62;)\[]) An array of filters to apply on the entity, where each item in the array is joined with an "or" condition.

  - $or: ((\[FilterableCustomerProps]\(../../../interfaces/customer.FilterableCustomerProps/page.mdx) \\| \[BaseFilterable]\(../../../interfaces/customer.BaseFilterable/page.mdx)\&#60;\[FilterableCustomerProps]\(../../../interfaces/customer.FilterableCustomerProps/page.mdx)\&#62;)\[]) An array of filters to apply on the entity, where each item in the array is joined with an "or" condition.

    - q: (\`string\`) Searches for customers by properties such as name and email using this search term.

    - id: (\`string\` \\| \`string\`\[]) The IDs to filter the customer by.

    - email: (\`string\` \\| \`string\`\[] \\| \[OperatorMap]\(../../../types/customer.OperatorMap/page.mdx)\&#60;string\&#62;) Filter by email.

    - groups: (\`string\` \\| \`string\`\[] \\| \[FilterableCustomerGroupProps]\(../../../interfaces/customer.FilterableCustomerGroupProps/page.mdx)) Filter by associated customer group.

    - default\_billing\_address\_id: (\`null\` \\| \`string\` \\| \`string\`\[]) Filter by the associated default billing address's ID.

    - default\_shipping\_address\_id: (\`null\` \\| \`string\` \\| \`string\`\[]) Filter by the associated default shipping address's ID.

    - company\_name: (\`null\` \\| \`string\` \\| \`string\`\[] \\| \[OperatorMap]\(../../../types/customer.OperatorMap/page.mdx)\&#60;string\&#62;) Filter by company name.

    - first\_name: (\`null\` \\| \`string\` \\| \`string\`\[] \\| \[OperatorMap]\(../../../types/customer.OperatorMap/page.mdx)\&#60;string\&#62;) Filter by first name.

    - last\_name: (\`null\` \\| \`string\` \\| \`string\`\[] \\| \[OperatorMap]\(../../../types/customer.OperatorMap/page.mdx)\&#60;string\&#62;) Filter by last name.

    - has\_account: (\`boolean\` \\| \[OperatorMap]\(../../../types/customer.OperatorMap/page.mdx)\&#60;boolean\&#62;) Filter by whether the customer has an account.

    - created\_by: (\`null\` \\| \`string\` \\| \`string\`\[]) Filter by the \`created\_by\` attribute.

    - created\_at: (\[OperatorMap]\(../../../types/customer.OperatorMap/page.mdx)\&#60;string\&#62;) Filter by created date.

    - updated\_at: (\[OperatorMap]\(../../../types/customer.OperatorMap/page.mdx)\&#60;string\&#62;) Filter by updated date.

    - $and: ((\[FilterableCustomerProps]\(../../../interfaces/customer.FilterableCustomerProps/page.mdx) \\| \[BaseFilterable]\(../../../interfaces/customer.BaseFilterable/page.mdx)\&#60;\[FilterableCustomerProps]\(../../../interfaces/customer.FilterableCustomerProps/page.mdx)\&#62;)\[]) An array of filters to apply on the entity, where each item in the array is joined with an "and" condition.

    - $or: ((\[FilterableCustomerProps]\(../../../interfaces/customer.FilterableCustomerProps/page.mdx) \\| \[BaseFilterable]\(../../../interfaces/customer.BaseFilterable/page.mdx)\&#60;\[FilterableCustomerProps]\(../../../interfaces/customer.FilterableCustomerProps/page.mdx)\&#62;)\[]) An array of filters to apply on the entity, where each item in the array is joined with an "or" condition.
- data: (\[CustomerUpdatableFields]\(../../../interfaces/customer.CustomerUpdatableFields/page.mdx)) The attributes to update in the customers.

  - company\_name: (\`null\` \\| \`string\`) The company name of the customer.

  - first\_name: (\`null\` \\| \`string\`) The first name of the customer.

  - last\_name: (\`null\` \\| \`string\`) The last name of the customer.

  - email: (\`null\` \\| \`string\`) The email of the customer.

  - phone: (\`null\` \\| \`string\`) The phone of the customer.

  - metadata: (\[MetadataType]\(../../../types/customer.MetadataType/page.mdx)) Holds custom data in key-value pairs.
- sharedContext: (\[Context]\(../../../interfaces/customer.Context/page.mdx)) A context used to share resources, such as transaction manager, between the application and the module.

  - transactionManager: (TManager) An instance of a transaction manager of type \`TManager\`, which is a typed parameter passed to the context to specify the type of the \`transactionManager\`.

  - manager: (TManager) An instance of a manager, typically an entity manager, of type \`TManager\`, which is a typed parameter passed to the context to specify the type of the \`manager\`.

  - isolationLevel: (\`string\`) A string indicating the isolation level of the context. Possible values are \`READ UNCOMMITTED\`, \`READ COMMITTED\`, \`REPEATABLE READ\`, or \`SERIALIZABLE\`.

  - enableNestedTransactions: (\`boolean\`) A boolean value indicating whether nested transactions are enabled.

  - eventGroupId: (\`string\`) A string indicating the ID of the group to aggregate the events to be emitted at a later point.

  - transactionId: (\`string\`) A string indicating the ID of the current transaction.

  - runId: (\`string\`) A string indicating the ID of the current run.

  - messageAggregator: (\[IMessageAggregator]\(../../../interfaces/customer.IMessageAggregator/page.mdx)) An instance of a message aggregator, which is used to aggregate messages to be emitted at a later point.

  - requestId: (\`string\`) A string indicating the ID of the current request.

  - idempotencyKey: (\`string\`) A string indicating the idempotencyKey of the current workflow execution.

  - parentStepIdempotencyKey: (\`string\`) A string indicating the idempotencyKey of the parent workflow execution.

  - preventReleaseEvents: (\`boolean\`) preventReleaseEvents

  - isCancelling: (\`boolean\`) A boolean value indicating whether the current workflow execution is being cancelled.

  - cancelingFromParentStep: (\`boolean\`) Weither or not a sub workflow cancellation is being triggered from a parent step.
    If true, the parent step will not be triggered by the sub workflow.

### Returns

- Promise: (Promise\&#60;\[CustomerDTO]\(../../../interfaces/customer.CustomerDTO/page.mdx)\[]\&#62;) The updated customers.

  - CustomerDTO\[]: (\[CustomerDTO]\(../../../interfaces/customer.CustomerDTO/page.mdx)\[])

    - id: (\`string\`) The ID of the customer.

    - email: (\`string\`) The email of the customer.

    - has\_account: (\`boolean\`) A flag indicating if customer has an account or not.

    - default\_billing\_address\_id: (\`null\` \\| \`string\`) The associated default billing address's ID.

    - default\_shipping\_address\_id: (\`null\` \\| \`string\`) The associated default shipping address's ID.

    - company\_name: (\`null\` \\| \`string\`) The company name of the customer.

    - first\_name: (\`null\` \\| \`string\`) The first name of the customer.

    - last\_name: (\`null\` \\| \`string\`) The last name of the customer.

    - addresses: (\[CustomerAddressDTO]\(../../../interfaces/customer.CustomerAddressDTO/page.mdx)\[]) The addresses of the customer.

      - id: (\`string\`) The ID of the customer address.

      - is\_default\_shipping: (\`boolean\`) Whether the customer address is default shipping.

      - is\_default\_billing: (\`boolean\`) Whether the customer address is default billing.

      - customer\_id: (\`string\`) The associated customer's ID.

      - created\_at: (\`string\`) The created at of the customer address.

      - updated\_at: (\`string\`) The updated at of the customer address.

      - address\_name: (\`string\`) The address name of the customer address.

      - company: (\`string\`) The company of the customer address.

      - first\_name: (\`string\`) The first name of the customer address.

      - last\_name: (\`string\`) The last name of the customer address.

      - address\_1: (\`string\`) The address 1 of the customer address.

      - address\_2: (\`string\`) The address 2 of the customer address.

      - city: (\`string\`) The city of the customer address.

      - country\_code: (\`string\`) The country code of the customer address.

      - province: (\`string\`) The lower-case \[ISO 3166-2]\(https://en.wikipedia.org/wiki/ISO\\\_3166-2) province of the customer address.

      - postal\_code: (\`string\`) The postal code of the customer address.

      - phone: (\`string\`) The phone of the customer address.

      - metadata: (\`Record\<string, unknown>\`) Holds custom data in key-value pairs.

    - phone: (\`null\` \\| \`string\`) The phone of the customer.

    - groups: (\`object\`\[]) The groups of the customer.

      - id: (\`string\`) The ID of the group.

      - name: (\`string\`) The name of the group.

    - metadata: (\`Record\<string, unknown>\`) Holds custom data in key-value pairs.

    - created\_by: (\`null\` \\| \`string\`) Who created the customer.

    - deleted\_at: (\`null\` \\| \`string\` \\| \`Date\`) The deletion date of the customer.

    - created\_at: (\`string\` \\| \`Date\`) The creation date of the customer.

    - updated\_at: (\`string\` \\| \`Date\`) The update date of the customer.


---

The best way to deploy Medusa is through Medusa Cloud where you get autoscaling production infrastructure fine tuned for Medusa. Create an account by signing up at cloud.medusajs.com/signup.
