---
ai:
  exclude: true
search:
  tags:
    - Attachments
    - POST
seo:
  description: >-
    Update the binary data of an… Reference for the POST
    /rest/api/content/{id}/child/attachment/{attachmentId}/data endpoint in the
    Confluence Data Center API.
sidebar:
  label: Update binary data of an attachment
  badge: POST
title: Update binary data of an attachment
type: openapi-operation
---
Update the binary data of an Attachment, and optionally the comment and the minor edit field.

This adds a new version of the attachment, containing the new binary data, filename, and content-type.

**When updating the binary data of an attachment**, the comment related to it together with the field that specifies if it's a minor edit can be updated as well, but are not required.

If an update is considered to be a minor edit, notifications will not be sent to the watchers of that content.

This resource expects a multipart post. The media-type multipart/form-data is defined in RFC 1867. Most client libraries have classes that make dealing with multipart posts simple. For instance, in Java the Apache HTTP Components library provides a `MultiPartEntity` that makes it simple to submit a multipart POST.

In order to protect against XSRF attacks, because this method accepts multipart/form-data, it has XSRF protection on it. This means you must submit a header of `X-Atlassian-Token: nocheck` with the request, otherwise it will be blocked.

The name of the multipart/form-data parameter that contains attachments must be 'file'.

`POST /rest/api/content/{id}/child/attachment/{attachmentId}/data`

**Request body** (`multipart/form-data`)

The attachment to be updated.

- `file` (string) — The name of the multipart/form-data parameter that contains attachments must be \\"file\\".
- `comment` (string) — (optional) a list of \\"comments\\" matching the list of attachment data.\\nIf supplied, the size of this list must match the size of the fileParts list.
- `minorEdit` (boolean) — (optional) form parameter indicating whether the attachments should be \\"minorEdits\\".If \\"minorEdits\\" is set to true, no notification email will be generated for that attachment.
- `hidden` (boolean) — (optional) form parameter indicating whether the attachments should be \\"hidden\\".If \\"hidden\\" is set to true, no notification email or activity stream will be generated for that attachment.

Request body example:

```json
{
  "file": "string",
  "comment": "string",
  "minorEdit": true,
  "hidden": true
}
```

**Responses**

- `200` — returns JSON representation of the updated attachment.
- `400` — Returned if the attachment id is invalid.
- `404` — Returned if no attachment is found for the attachmentId.

Response example, 200:

```json
{
  "id": "123456",
  "type": "page",
  "status": "current",
  "title": "My Page",
  "links": {},
  "space": {
    "id": 123456,
    "key": "TEST",
    "name": "Test Space",
    "status": "current",
    "icon": {
      "expanded": true,
      "idProperties": {}
    },
    "description": {},
    "homepage": {
      "expanded": true,
      "idProperties": {}
    },
    "links": {},
    "type": "global",
    "metadata": {
      "labels": [
        "label1",
        "label2"
      ]
    },
    "retentionPolicy": {
      "expanded": true,
      "idProperties": {}
    }
  },
  "history": {
    "previousVersion": {
      "expanded": true,
      "idProperties": {}
    },
    "nextVersion": {
      "expanded": true,
      "idProperties": {}
    },
    "lastUpdated": {
      "expanded": true,
      "idProperties": {}
    },
    "latest": true,
    "createdBy": {
      "profilePicture": {
        "path": "http://www.example.com/path/to/image.png",
        "width": 16,
        "height": 16,
        "isDefault": true
      },
      "displayName": "Joe Smith",
      "type": "string"
    },
    "createdDate": "2020-01-01T00:00:00Z",
    "contributors": {
      "expanded": true,
      "idProperties": {}
    },
    "lastUpdatedRef": {
      "expanded": true,
      "idProperties": {}
    },
    "nextVersionRef": {
      "expanded": true,
      "idProperties": {}
    },
    "previousVersionRef": {
      "expanded": true,
      "idProperties": {}
    },
    "contentParentRef": {
      "expanded": true,
      "idProperties": {}
    }
  },
  "version": {
    "by": {
      "profilePicture": {
        "path": "http://www.example.com/path/to/image.png",
        "width": 16,
        "height": 16,
        "isDefault": true
      },
      "displayName": "Joe Smith",
      "type": "string"
    },
    "when": "2020-01-01T00:00:00Z",
    "message": "A message",
    "number": 1,
    "minorEdit": true,
    "hidden": true,
    "syncRev": "123456",
    "content": {
      "expanded": true,
      "idProperties": {}
    },
    "contentRef": {
      "expanded": true,
      "idProperties": {}
    }
  },
  "ancestors": [
    {}
  ],
  "position": 1,
  "operations": [
    {
      "operation": "read",
      "targetType": "page"
    }
  ],
  "children": {},
  "descendants": {},
  "container": null,
  "body": {},
  "metadata": {
    "key": "value"
  },
  "extensions": {
    "key": "value"
  },
  "restrictions": {
    "use": {
      "operation": "use",
      "restrictions": []
    }
  },
  "historyRef": {
    "expanded": true,
    "idProperties": {}
  },
  "spaceRef": {
    "expanded": true,
    "idProperties": {}
  },
  "containerRef": {
    "expanded": true,
    "idProperties": {}
  },
  "versionRef": {
    "expanded": true,
    "idProperties": {}
  }
}
```
