---
title: "Upload File"
method: POST
path: "/api/document/v2/attachments"
tags: ["Attachments"]
---

# Upload File

`POST /api/document/v2/attachments`

## Request

- Base URL: `https://hostname`
- URL: `https://hostname/api/document/v2/attachments`
- Auth: OAuth 2
  - Client credentials
  - Token URL: `https://{hostname}/api/access/v1/oauth/token` scopes: `ATTACHMENT`, `ATTACHMENT_WRITE`

Use this API to upload a file up to 64MB to the OneTrust Platform. The response will include the `Id` and `FileName` parameters, which can be used to attach the file to a product within the platform.

> 🗒 Things to Know
> 
> - The extension of the uploaded file must be in one of the supported file formats. For more information, see [Using the Document Repository](https://my.onetrust.com/s/article/UUID-24981513-4770-b8a1-b365-cc8b7fdb1712).
> - The `attachment` parameter below includes the following information: 
>   - `Parameters & Descriptions` contains details on the list of parameters and expected parameter values. This should be used for reference only.
>   - `Attachment JSON Object` contains the required format in which the parameters and parameter values must be sent in the request.

## Request body `multipart/form-data`

- PlatformDocumentsAttachmentMultipartRequest
  - `attachment` union, required: The details of the file.
    - PlatformDocumentsAttachmentCreateRequestV2
      - `FileName` string, required: The name of the file, including its extension.
      - `Name` string: The display name of the file.
      - `RefIds` string[], required: The unique identifier of the record associated with the attached file.
      - `Comments` string: The notes about the file.
      - `Type` integer, required: The number associated with the content type of the file, as listed within Show Details.
      - `IsInternal` boolean: This flag indicates whether the file is marked for internal use.
      - `Encrypt` boolean: This flag indicates whether the file should be encrypted.
    - string, application/json
  - `file` string, binary, required: The file to upload to the OneTrust Platform. The file must be 64MB or less.

## Response `201`

OK

- PlatformDocumentsAttachmentResponse
  - `Id` string, uuid: The unique identifier of the uploaded file.
  - `Name` string: The display name of the file.
  - `FileName` string: The name of the file, including its extension.
  - `Comments` string: The notes about the file.
  - `FileSize` integer: The size of the file in bytes.
  - `FileType` 'pdf' | 'doc' | 'docx' | 'txt' | 'png' | 'jpg' | 'jpeg' | 'csv': The type of file, based on its extension.
  - `CreatedById` string, uuid: The unique identifier of the user who uploaded the file.
  - `CreatedBy` string: The name of the user who uploaded the file.
  - `CreatedDT` string, date-time: The date and time when the file was uploaded.
  - `Type` integer: The number associated with the content type of the file, as listed within Show Details.
  - `RefId` string, uuid: The unique identifier of the record associated with the attached file.
  - `IsInternal` boolean: This flag indicates whether the file is marked for internal use.

## 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/platform-documents.md) - [All operations](https://skmtc.dev/onetrust/apis/platform-documents/llms.txt) - [OpenAPI document](https://skmtc.dev/onetrust/apis/platform-documents/revisions/8e047aaa2825?raw)
