> For the complete documentation index, see [llms.txt](https://docs.pyck.cloud/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.pyck.cloud/graphql-api/mutations/updatecustomer.md).

# Update Customer

Update Customer Mutation

Updates an existing customer entity in the system.

## Arguments

| Name    | Type                   | Description                          |
| ------- | ---------------------- | ------------------------------------ |
| `id`    | `ID!`                  | The ID of the customer to update     |
| `input` | `UpdateCustomerInput!` | Input data for updating the customer |

## Return Type

`Customer` - The updated customer object.

## Input Fields

`UpdateCustomerInput`:

| Field               | Type      | Description                  |
| ------------------- | --------- | ---------------------------- |
| `dataTypeID`        | `UUID`    | Optional data type ID        |
| `clearDataTypeID`   | `Boolean` | Clear the data type ID       |
| `dataTypeSlug`      | `String`  | Optional data type slug      |
| `clearDataTypeSlug` | `Boolean` | Clear the data type slug     |
| `data`              | `Map`     | Custom data for the customer |
| `clearData`         | `Boolean` | Clear all custom data        |

## Usage Example

```graphql
mutation {
  updateCustomer(
    id: "cust_123456789"
    input: {
      data: {
        "name": "John Smith Jr.",
        "email": "john.smith.jr@example.com",
        "phone": "+1-555-0789",
        "address": {
          "street": "789 New Address Lane",
          "city": "Los Angeles",
          "state": "CA",
          "zip": "90210",
          "country": "USA"
        },
        "creditLimit": 7500.00,
        "preferredLanguage": "es",
        "loyaltyTier": "gold"
      }
    }
  ) {
    id
    dataTypeSlug
    data
    updatedAt
  }
}
```

```graphql
mutation {
  # Update customer category
  updateCustomer(
    id: "cust_987654321"
    input: {
      dataTypeSlug: "vip_customer"
      data: {
        "vipStatus": true,
        "assignedAccountManager": "Sarah Wilson",
        "specialDiscountRate": 0.15,
        "prioritySupport": true
      }
    }
  ) {
    id
    dataTypeSlug
    data
  }
}
```

```graphql
mutation {
  # Clear specific fields
  updateCustomer(
    id: "cust_111222333"
    input: {
      clearDataTypeSlug: true
      data: {
        "marketingOptIn": false,
        "notes": "Customer requested no marketing communications"
      }
    }
  ) {
    id
    dataTypeSlug
    data
  }
}
```

## Update Strategies

### Partial Updates

The mutation performs partial updates - only the fields you specify in the `data` object will be updated. Existing fields not mentioned remain unchanged.

### Field Clearing

Use the `clear*` boolean fields to explicitly remove values:

* `clearDataTypeID: true` - Removes the data type ID
* `clearDataTypeSlug: true` - Removes the data type slug
* `clearData: true` - Removes all custom data

### Data Merging

When updating the `data` field, the new data is merged with existing data at the top level. To remove specific data fields, omit them from the update or use `clearData: true` to start fresh.

## Common Update Scenarios

* **Contact Information**: Update email, phone, address
* **Customer Status**: Change customer tier, VIP status, account status
* **Financial Information**: Modify credit limits, payment terms
* **Preferences**: Update language, communication preferences
* **Business Information**: Change company details, tax information

## Notes

* Only specify the fields you want to update
* Use clear flags to explicitly remove optional fields
* The `data` field supports nested objects for complex customer attributes
* Consider updating related entities (orders, invoices) if customer information affects them


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.pyck.cloud/graphql-api/mutations/updatecustomer.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
