# patchCustomerData

Audience: Developer

Apply RFC 6902 JSON Patch operations to the customer's data field.

Apply RFC 6902 JSON Patch operations to the customer's data field.

**Served by:** [maindata](https://docs.pyck.cloud/api/services/maindata.md)

## Arguments

| Name | Type |
| --- | --- |
| `id` | ID! |
| `patches` | \[[JSONPatchInput](https://docs.pyck.cloud/api/inputs/jsonpatchinput.md)!\]! |

## Returns

[Customer](https://docs.pyck.cloud/api/types/customer.md)

## Example

Applies RFC 6902 JSON Patch operations to the customer's data field. Only changed fields are modified; untouched fields are preserved. See https://datatracker.ietf.org/doc/html/rfc6902 for the specification.

```graphql
mutation PatchCustomerData($id: ID!, $patches: [JSONPatchInput!]!) {
  patchCustomerData(id: $id, patches: $patches) {
    createdAt
    createdBy
    data
    dataTypeID
    dataTypeSlug
    deletedAt
    deletedBy
    id
    tenantID
    updatedAt
    updatedBy
  }
}
```

**Variables**

```json
{
  "id": "<customer id to patch>",
  "patches": [
    {
      "op": "REPLACE",
      "path": "/tier",
      "value": "\"diamond\""
    },
    {
      "op": "REPLACE",
      "path": "/contacts",
      "value": "10"
    }
  ]
}
```
