---
ai:
  exclude: true
search:
  tags:
    - Attachments
    - PUT
seo:
  description: >-
    Update the non-binary data of an… Reference for the PUT
    /rest/api/content/{id}/child/attachment/{attachmentId} endpoint in the
    Confluence Data Center API.
sidebar:
  label: Update non-binary data of an Attachment
  badge: PUT
title: Update non-binary data of an Attachment
type: openapi-operation
---
Update the non-binary data of an attachment.This resource can be used to update an attachment's filename, media-type, comment, and parent container.

`PUT /rest/api/content/{id}/child/attachment/{attachmentId}`

**Request body** (`application/json`)

- `id` (string)
- `type` (string)
- `status` (string)
- `title` (string)
- `links` (object)
- `space` (Space)
- `history` (History)
- `version` (Version)
- `ancestors` (Content[])
- `position` (integer<int32>)
- `operations` (OperationCheckResult[])
- `children` (object)
- `descendants` (object)
- `container` (Container)
- `body` (object)
- `metadata` (object)
- `extensions` (object)
- `restrictions` (object)
- `historyRef` (ReferenceHistory)
- `spaceRef` (ReferenceSpace)
- `containerRef` (ReferenceContainer)
- `versionRef` (ReferenceVersion)

Request body example:

```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": {}
  }
}
```

**Responses**

- `200` — returns a JSON representation of the attachment after being updated.
- `400` — Returned if the attachment id or the attachment version number are invalid.
- `403` — Returned if you are not permitted to update or move the attachment to a different container.
- `404` — Returned if no attachment is found for the attachmentId.
- `409` — Returned if the version of the supplied Attachment does not match the exact version of the Attachment stored in the database.

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": {}
  }
}
```
