**Source URL:** https://limited.veevavault.dev/regulatory/vault-api/api-reference/22.1/documents/document-attachments/create-document-attachment.md

# Create Document Attachment



Create an attachment on the latest version of a document. If the attachment already exists, Vault uploads the attachment as a new version of the existing attachment. Learn more about [attachment versioning in Vault Help](https://platform.veevavault.help/en/lr/24287).

To create a version-specific attachment, or to create multiple attachments at once, use the [bulk API](/vault-api/api-reference/22.1/documents/document-attachments/create-multiple-document-attachments).

<Endpoint path="/api/{version}/objects/documents/{doc_id}/attachments" method="POST"></Endpoint>

## Headers {#headers}

<FieldTable>
| Name | Description |
| --- | --- |
| `Content-Type` | `multipart/form-data` |
| `Accept` | `application/json` (default) or `application/xml` |
</FieldTable>

## URI Path Parameters {#uri-path-parameters}

<FieldTable>
| Name | Description |
| --- | --- |
| `{doc_id}` | The document `id` field value. |
</FieldTable>

## File Upload {#file-upload}

To upload the file, use the multi-part attachment with the file component `"file={file_name}"`. The maximum allowed file size is 2GB.

## Request {#request}

<CodeExample title="">
```
curl -X POST -H "Authorization: {SESSION_ID}" \
-H "Content-Type: multipart/form-data" \
-F "file=my_attachment_file.png" \
https://myvault.veevavault.com/api/v15.0/objects/documents/565/attachments

```
</CodeExample>

## Response {#response}

<CodeExample title="">
```
{
    "responseStatus": "SUCCESS",
    "data":
    {
        "id": "567",
        "version__v": 3
    }
}

```
</CodeExample>

## Response Details {#response-details}

On SUCCESS, the response will contain the attachment ID and version of the newly added attachment. Document attachments are automatically bound to all versions of a document. The following attribute values are determined based on the file in the request: `filename__v`, `format__v`, `size__v`.



---

**Previous:** [Delete Multiple Document Attachments](/regulatory/vault-api/api-reference/22.1/documents/document-attachments/delete-multiple-document-attachments)  
**Next:** [Create Multiple Document Attachments](/regulatory/vault-api/api-reference/22.1/documents/document-attachments/create-multiple-document-attachments)