# patchFileData

Audience: Programmer

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

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

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

## Arguments

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

## Returns

[File](https://docs.pyck.cloud/latest/api/types/file.md)

## Example

Applies RFC 6902 JSON Patch operations to the file'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 PatchFileData($id: ID!, $patches: [JSONPatchInput!]!) {
  patchFileData(id: $id, patches: $patches) {
    contentType
    createdAt
    createdBy
    data
    dataTypeID
    dataTypeSlug
    deletedAt
    deletedBy
    description
    id
    name
    publicAlias
    publicURL
    refid
    reftype
    size
    tenantID
    updatedAt
    updatedBy
    url
  }
}
```

**Variables**

```json
{
  "id": "<file id to patch>",
  "patches": [
    {
      "op": "REPLACE",
      "path": "/category",
      "value": "\"receipt\""
    },
    {
      "op": "REPLACE",
      "path": "/version",
      "value": "3"
    }
  ]
}
```
