---
title: "Upload Consent Attachment"
method: POST
path: "/rest/api/preferences/v1/attachments"
tags: ["Consent Attachments"]
---

# Upload Consent Attachment

`POST /rest/api/preferences/v1/attachments`

## Request

- Base URL: `https://hostname`
- URL: `https://hostname/rest/api/preferences/v1/attachments`
- Auth: OAuth 2
  - Client credentials
  - Token URL: `https://{hostname}/api/access/v1/oauth/token` scopes: `CONSENT`

Use this API to upload and store files which contain written consent of data subjects' transactions.

> 🗒 Things to Know
> 
> - The size of uploaded files must be less than 4MB.
> 
> - The following file formats are allowed: .pdf, .jpeg, .jpg, and .png.
> 
> - The `RefID` parameter returned within the response body can be used to attach file references to incoming data subject consents using the [Create Consent Receipts](https://developer.onetrust.com/onetrust/reference/createconsentreceiptusingpost) API.
> 
> - File references can be attached to a given data subject or data subject purpose by using the `attachments` or `PurposeAttachments` parameters in the [Create Consent Receipts](https://developer.onetrust.com/onetrust/reference/createconsentreceiptusingpost) API respectively.

## Request body `multipart/form-data`

- object
  - `file` string, binary, required: The file to upload. Supported formats: .pdf, .jpeg, .jpg, .png. Max size: 4MB.

## Response `200`

File uploaded successfully.

- DSPreferneceCacheUploadDataDto
  - `refId` string, uuid: Reference ID for the uploaded file.
  - `filename` string: Original name of the uploaded file.
  - `fileSize` integer: Size of the uploaded file in bytes.
  - `contentType` string: MIME type of the uploaded file.
  - `qualifiedName` string: Fully qualified name/path of the uploaded file in storage.

## Other responses

- `400`: Bad Request
- `401`: Unauthorized
- `403`: Forbidden
- `429`: Too Many Requests. For more information, see [API Rate Limits](https://developer.onetrust.com/onetrust/reference/rate-limits-overview).
- `500`: Internal Server Error

---

[API](https://skmtc.dev/onetrust/apis/consent-preferences-universal-consent-preference-management.md) - [All operations](https://skmtc.dev/onetrust/apis/consent-preferences-universal-consent-preference-management/llms.txt) - [OpenAPI document](https://skmtc.dev/onetrust/apis/consent-preferences-universal-consent-preference-management/revisions/fe4a0697ec9d?raw)
