# updateCustomer

Mutation · GraphQL API

Update a customer's information.

## Authentication

- SERVER

## Input

- `input` (`UpdateCustomerInput!`) — required

## Returns [UpdateCustomerPayload](/braintree/graphql/reference/types/update-customer-payload)

Top-level fields returned when updating a customer.

### Returned fields

- `clientMutationId` (`String`): An identifier used to reconcile requests and responses. 255 characters maximum.
- `customer` (`Customer`): Information about the customer that was updated.

## Examples

### Update customer

Top-level field for updating a customer.

```graphql
mutation updateCustomer($input: UpdateCustomerInput!) {
  updateCustomer(input: $input) {
    clientMutationId
    customer {
      __typename
      id
      legacyId
      company
      createdAt
      customFields {
        name
        value
      }
      defaultPaymentMethod {
        __typename
        id
        legacyId
      }
      email
      firstName
      lastName
      phoneNumber
      fax
      website
    }
  }
}
```

### Update a customer's email and phone

Updates only the email and phone number for an existing customer, demonstrating partial updates where omitted fields are not changed.


```graphql
mutation updateCustomer($input: UpdateCustomerInput!) {
  updateCustomer(input: $input) {
    clientMutationId
    customer {
      id
      legacyId
      company
      createdAt
      customFields {
        name
        value
      }
      defaultPaymentMethod {
        id
        legacyId
      }
      email
      firstName
      lastName
      phoneNumber
      fax
      website
    }
  }
}
```

#### Variables

```json
{
  "input": {
    "clientMutationId": "update-cust-001",
    "customerId": "Y3VzdG9tZXJfYWxpY2U",
    "customer": {
      "email": "alice.new@example.com",
      "phoneNumber": "+15559876543"
    }
  }
}
```

#### Response

```json
{
  "data": {
    "updateCustomer": {
      "clientMutationId": "update-cust-001",
      "customer": {
        "id": "Y3VzdG9tZXJfYWxpY2U",
        "legacyId": "customer_alice_001",
        "firstName": "Alice",
        "lastName": "Smith",
        "email": "alice.new@example.com",
        "company": "Acme Corp",
        "phoneNumber": "+15559876543",
        "website": "https://acme.example.com",
        "createdAt": "2024-06-15T10:00:00.000Z",
        "customFields": [
          {
            "name": "loyalty_tier",
            "value": "gold"
          }
        ],
        "defaultPaymentMethod": {
          "id": "cGF5bWVudG1ldGhvZF92aXNh",
          "legacyId": "visa_token_001"
        }
      }
    }
  },
  "extensions": {
    "requestId": "update-cust-request-id"
  }
}
```

---

[View the complete GraphQL schema on GitHub](https://raw.githubusercontent.com/braintree/graphql-api/refs/heads/master/schema.graphql)