--- title: "Uploading & Deleting Documents" slug: "uploading-deleting-documents" updated: 2026-08-31T12:33:49Z published: 2026-08-31T12:33:49Z canonical: "docs.onespan.com/uploading-deleting-documents" --- > ## Documentation Index > Fetch the complete documentation index at: https://docs.onespan.com/llms.txt > Use this file to discover all available pages before exploring further. # Uploading & Deleting Documents [Java SDK](/v1/docs/configuring-document-visibility#java-sdk) [.NET SDK](/v1/docs/configuring-document-visibility#net-sdk) [REST API](/v1/docs/configuring-document-visibility#rest-api) [APEX SDK](/v1/docs/configuring-document-visibility#apex-sdk) ## Java SDK To download the full code sample see our [Code Share](https://community.onespan.com/documentation/onespan-sign/codeshare/document-operations-example-java-sdk/) site. This topic includes the following: - How to upload a document - How to replace an existing document - How to update the metadata in a document - How to set a document as read-only in the Designer - How to delete a document after you have created a package ### Uploading Documents To add a document to an existing package, you must first create the Document object. The following code will create a Document object: ```plaintext Document document = DocumentBuilder.newDocumentWithName("Example Document")    .fromFile("DOC_FILE_PATH")    //.fromStream( documentStream, DocumentType.PDF );    .withId("document1")    .withDescription("Sample Document Description")    .build(); ``` Once the Document object has been created, find the PackageId you wish to add the document to and then use the OneSpan Sign client to upload that document. The following code will do this: ```plaintext eslClient.uploadDocument(document, packageId); ``` You can also upload multiple documents within one call. To do this, build multiple Document objects locally and pass them as variable arguments or as a list into the following code: ```plaintext eslClient.uploadDocuments(packageId, doc1, doc2, doc3); eslClient.uploadDocuments(packageId, Arrays.asList(doc1, doc2, doc3)); ``` OneSpan Sign supports the following document types: - Adobe's *Portable Document Format* (*.pdf*) — PDFs on which OneSpan Sign can act generally have at least these permissions enabled: (1) Changing the Document; (2) Signing; (3) Filling of form fields. - Microsoft Word (*.doc* or *.docx*) - Open Office (*.odt*) - Text (*.txt*) - Rich Text Format (*.rtf*) In addition, the OneSpan Sign Print Driver supports any document that can be printed from a Windows-based application (e.g., Microsoft Word, Microsoft Excel, Microsoft PowerPoint). **File Size Constraints** - The maximum size of a single document is 16 MB. Smaller documents yield better performance — we recommend under 5 MB per document. - The maximum total size of all documents in a transaction is 39MB. However, the maximum size may vary, depending on the size of your overall payload. Should you receive an error message stating that the request size exceeds the maximum allowed size of 50MB even though your total document size is 39MB, remember that the actual limit depends on total payload size, and not just raw document size. - If your organization uses Salesforce or Microsoft SharePoint connectors, the file size maximum is 5 MB per document. - If your organization uses Salesforce connectors, the maximum number of documents that can be added to a transaction is ten (10). - If you enable email delivery while configuring a recipient, attachments larger than 5 MB are not supported. **File Name Constraints** - Document file names should not contain any of the following comma-separated characters: *, /, \, :, <, >, |, ?, ". **General File Constraints** - We recommend that you do not use PDF documents that make use of XML Forms Architecture. For more information, see XFA Support. - Do not upload password-protected or corrupted documents. These will generate an error. - OneSpan strongly recommends that you scan a PDF for syntax errors (e.g., by using Adobe's Preflight tool), and resolve any errors before you add the document to a transaction. - PDFs with the NeedAppearances flag set to true are not currently supported. ### Replacing an Existing Document Replacing an existing document in a transaction can also be done using the Upload function. This is useful, for example, if you would like to replace the document but still keep the layout of the fields and signatures. To do this, build a Document object that carries the same Document ID as the document you want to replace, and then use the OneSpan Sign client to upload it. The following code will do this: ```plaintext Document document = DocumentBuilder.newDocumentWithName("Document1")    .fromFile("path_to_your_file")    .withId("keep_the_same_document_id")    .build(); eslClient.uploadDocument(document, new PackageId("the_package_id")); ``` Similarly, you can replace multiple documents within a call. ```plaintext Document document = DocumentBuilder.newDocumentWithName("Updated Document1")    .fromFile("path_to_your_file ")    .withId("1dda69f88b10f2e0e6bd846aae9fca0a961aba793bf655b0")    .build(); Document document2 = DocumentBuilder.newDocumentWithName("Updated Document2")    .fromFile("path_to_your_file ")    .withId("c4a6128b646f50c650779d652e5951097663a1de16c4ce72")    .build(); eslClient.uploadDocuments(new PackageId("package_id"), Arrays.asList(document, document2)); ``` ### Updating Document Metadata To update the metadata for a document, simply create a Document object with the updates you want to make. For example: ```plaintext Document document = DocumentBuilder.newDocumentWithName("Example Document")    .withName("Updated document name")    .withDescription("Updated document description")    .build(); ``` Then, grab the DocumentPackage you wish to change this document in and then use the OneSpan Sign client to update the document metadata. The following code will do this: ```plaintext eslClient.getPackageService().updateDocumentMetadata(documentPackage, document); ``` ### Setting a Document as Read-Only in the Designer To prevent senders from modifying a document's field layout in the Designer, you can flag the document as read-only using the `designerReadOnly` property. This property can only be set through the API or SDK — it cannot be set from the Sender UI. When a document is flagged as read-only: - The document displays as read-only in the Designer, both within the Sender UI and when accessed via iFrame - The Accept-only button, Apply Layout button, and all fields on the document are disabled - A lock icon appears next to the document name in the Documents panel, with a "Locked document" tooltip - Hovering over a field on a locked document displays the tooltip "Fields cannot be edited on locked documents." - The Designer displays the message "This document is locked and cannot be modified." The read-only flag applies only to the flagged document within a transaction. All other documents remain fully viewable and editable in the Designer. To flag a document as read-only at upload time, set `designerReadOnly` to `true` when building the Document object: ```plaintext Document document = DocumentBuilder.newDocumentWithName("Example Document")    .fromFile("DOC_FILE_PATH")    .withId("document1")    .withDesignerReadOnly(true)    .build(); eslClient.uploadDocument(document, packageId); ``` You can also apply this property when updating an existing document's metadata: ```plaintext Document document = DocumentBuilder.newDocumentWithName("Example Document")    .withDesignerReadOnly(true)    .build(); eslClient.getPackageService().updateDocumentMetadata(documentPackage, document); ``` ### Deleting a Document To delete a document, call the deleteDocument function with the packageId and documentId string: ```plaintext eslClient.getPackageService().deleteDocument(packageId, document.getId().toString()); ``` ### Results After running your code, if you login to OneSpan Sign and navigate to your transaction, you will be able to log into your OneSpan Sign account and view the documents you just added. ## .NET SDK To download the full code sample see our [Code Share](https://community.onespan.com/documentation/onespan-sign/codeshare/document-operations-example-net-sdk/) site. This topic includes the following: - How to upload a document - How to replace an existing document - How to update the metadata in a document - How to set a document as read-only in the Designer - How to delete a document after you have created a package ### Uploading Documents To add a document to an existing package, you must first create the Document object. The following code will create a Document object: ```plaintext Document document = DocumentBuilder.NewDocumentNamed("Example Document")    .FromFile("DOC_FILE_PATH")    //.fromStream( documentStream, DocumentType.PDF );    .WithId("document1")    .WithDescription("Sample Document Description")    .Build(); ``` Once the Document object has been created, find the PackageId you wish to add the document to and then use the OneSpan Sign client to upload that document. The following code will do this: ```plaintext eslClient.UploadDocument(document, packageId); ``` You can also upload multiple documents within one call. To do this, build multiple Document objects locally and pass them as variable arguments or as a list into the following code: ```plaintext eslClient.UploadDocuments(packageId, doc1, doc2, doc3); eslClient.UploadDocuments(packageId, new List(){doc1,doc2,doc3}); ``` OneSpan Sign supports the following document types: - Adobe's *Portable Document Format* (*.pdf*) — PDFs on which OneSpan Sign can act generally have at least these permissions enabled: (1) Changing the Document; (2) Signing; (3) Filling of form fields. - Microsoft Word (*.doc* or *.docx*) - Open Office (*.odt*) - Text (*.txt*) - Rich Text Format (*.rtf*) In addition, the OneSpan Sign Print Driver supports any document that can be printed from a Windows-based application (e.g., Microsoft Word, Microsoft Excel, Microsoft PowerPoint). **File Size Constraints** - The maximum size of a single document is 16 MB. Smaller documents yield better performance — we recommend under 5 MB per document. - The maximum total size of all documents in a transaction is 39MB. However, the maximum size may vary, depending on the size of your overall payload. Should you receive an error message stating that the request size exceeds the maximum allowed size of 50MB even though your total document size is 39MB, remember that the actual limit depends on total payload size, and not just raw document size. - If your organization uses Salesforce or Microsoft SharePoint connectors, the file size maximum is 5 MB per document. - If your organization uses Salesforce connectors, the maximum number of documents that can be added to a transaction is ten (10). - If you enable email delivery while configuring a recipient, attachments larger than 5 MB are not supported. **File Name Constraints** - Document file names should not contain any of the following comma-separated characters: *, /, \, :, <, >, |, ?, ". **General File Constraints** - We recommend that you do not use PDF documents that make use of XML Forms Architecture. For more information, see XFA Support. - Do not upload password-protected or corrupted documents. These will generate an error. - OneSpan strongly recommends that you scan a PDF for syntax errors (e.g., by using Adobe's Preflight tool), and resolve any errors before you add the document to a transaction. - PDFs with the NeedAppearances flag set to true are not currently supported. ### Replacing an Existing Document Replacing an existing document in a transaction can also be done using the Upload function. This is useful, for example, if you would like to replace the document, but still keep the layout of the fields and signatures. To do this, build a Document object that carries the same Document ID as the document you want to replace, and then use the OneSpan Sign client to upload it. The following code will do this: ```plaintext Document document = DocumentBuilder.NewDocumentWithName("Document1")    .FromFile("path_to_your_file")    .WithId("keep_the_same_document_id")    .Build(); eslClient.UploadDocument(document, new PackageId("the_package_id")); ``` Similarly, you can replace multiple documents within a call. ```plaintext Document document = DocumentBuilder.NewDocumentWithName("Updated Document1")    .FromFile("path_to_your_file ")    .WithId("1dda69f88b10f2e0e6bd846aae9fca0a961aba793bf655b0")    .Build(); Document document2 = DocumentBuilder.NewDocumentWithName("Updated Document2")    .FromFile("path_to_your_file ")    .WithId("c4a6128b646f50c650779d652e5951097663a1de16c4ce72")    .Build(); eslClient.UploadDocuments(new PackageId("package_id"), new List(){document,document2}); ``` ### Updating Document Metadata To update the metadata for a document, simply create a Document object with the updates you want to make. For example: ```plaintext Document document = DocumentBuilder.NewDocumentNamed("Example Document")    .WithName("Updated document name")    .WithDescription("Updated document description")    .Build(); ``` Then, grab the DocumentPackage you wish to change this document in and then use the OneSpan Sign client to update the document metadata. The following code will do this: ```plaintext eslClient.PackageService.UpdateDocumentMetadata(documentPackage, document); ``` ### Setting a Document as Read-Only in the Designer To prevent senders from modifying a document's field layout in the Designer, you can flag the document as read-only using the `designerReadOnly` property. This property can only be set through the API or SDK — it cannot be set from the Sender UI. When a document is flagged as read-only: - The document displays as read-only in the Designer, both within the Sender UI and when accessed via iFrame - The Accept-only button, Apply Layout button, and all fields on the document are disabled - A lock icon appears next to the document name in the Documents panel, with a "Locked document" tooltip - Hovering over a field on a locked document displays the tooltip "Fields cannot be edited on locked documents." - The Designer displays the message "This document is locked and cannot be modified." The read-only flag applies only to the flagged document within a transaction. All other documents remain fully viewable and editable in the Designer. To flag a document as read-only at upload time, set `DesignerReadOnly` to `true` when building the Document object: ```plaintext Document document = DocumentBuilder.NewDocumentNamed("Example Document")    .FromFile("DOC_FILE_PATH")    .WithId("document1")    .WithDesignerReadOnly(true)    .Build(); eslClient.UploadDocument(document, packageId); ``` You can also apply this property when updating an existing document's metadata: ```plaintext Document document = DocumentBuilder.NewDocumentNamed("Example Document")    .WithDesignerReadOnly(true)    .Build(); eslClient.PackageService.UpdateDocumentMetadata(documentPackage, document); ``` ### Deleting a Document To delete a document, call the deleteDocument function with the packageId and documentId string: ```plaintext eslClient.PackageService.DeleteDocument(packageId, document.Id.ToString()); ``` ### Results After running your code, if you login to OneSpan Sign and navigate to your transaction, you will be able to log into your OneSpan Sign account and view the documents you just added. ## REST API To download the full code sample see our [Code Share](https://community.onespan.com/documentation/onespan-sign/codeshare/document-operations-example-rest-api/) site. This topic includes the following: - How to upload a document - How to replace an existing document - How to update the metadata in a document - How to set a document as read-only in the Designer - How to delete a document after you have created a package ### Uploading Documents #### Uploading a Single Document To upload a document after creating a package, you will need to make a multipart-form POST request. **HTTP Request** ```plaintext POST /api/packages/{packageId}/documents ``` **HTTP Headers** ```plaintext Accept: text/html Content-Type: multipart/form-data Authorization: Basic api_key ``` **Request Payload** ```plaintext ------WebKitFormBoundary1bNO60n7FqP5WO4t Content-Disposition: form-data; name="file"; filename="testDocumentExtraction.pdf" Content-Type: application/pdf %PDF-1.5 %µµµµ 1 0 obj <>>> endobj.... ------WebKitFormBoundary1bNO60n7FqP5WO4t Content-Disposition: form-data; name="payload" {    "name": "Example Document",    "description": "Example Description",    "id": "Document1" } ------WebKitFormBoundary1bNO60n7FqP5WO4t-- ``` For a complete description of each field, see the Request Payload section below. **Response Payload** ```plaintext {    "status": "",    "description": "Example Description",    "id": "Document1",    "data": {        "ese_document_texttag_extract_needed": "false"    },    "approvals": [        {            "id": "k1r2qMRtCsI5",            "role": "48d0c024-0609-4255-9087-941a66f80738",            "data": null,            "signed": null,            "accepted": null,            "fields": [],            "name": ""        }    ],    "pages": [        {            "id": "",            "top": 0,            "height": 1030,            "width": 796,            "left": 0,            "index": 0,            "version": 0        }    ],    "external": null,    "extract": false,    "signedHash": null,    "signerVerificationToken": null,    "index": 1,    "fields": [],    "name": "Example Document",    "size": 185808 } ``` #### Uploading Multiple Documents To upload multiple documents in one call, you would use the same API url but modify the request body in the following way: **HTTP Request** ```plaintext POST /api/packages/{packageId}/documents ``` **HTTP Headers** ```plaintext Accept: text/html Content-Type: multipart/form-data Authorization: Basic api_key ``` **Request Payload** ```plaintext ------WebKitFormBoundary1bNO60n7FqP5WO4t Content-Disposition: form-data; name="file"; filename="doc1.pdf" Content-Type: application/pdf %PDF-1.5 %µµµµ 1 0 obj <>>> endobj.... ------WebKitFormBoundary1bNO60n7FqP5WO4t Content-Disposition: form-data; name="file"; filename="doc2.pdf" Content-Type: application/pdf %PDF-1.5 %µµµµ 1 0 obj <>>> endobj.... ------WebKitFormBoundary1bNO60n7FqP5WO4t Content-Disposition: form-data; name="payload" [    {        "name": "Document1",        "description": "Example Description",        "id": "Document1"    },    {        "name": "Document2",        "description": "Example Description",        "id": "Document2"    } ] ------WebKitFormBoundary1bNO60n7FqP5WO4t-- ``` OneSpan Sign supports the following document types: - Adobe's *Portable Document Format* (*.pdf*) — PDFs on which OneSpan Sign can act generally have at least these permissions enabled: (1) Changing the Document; (2) Signing; (3) Filling of form fields. - Microsoft Word (*.doc* or *.docx*) - Open Office (*.odt*) - Text (*.txt*) - Rich Text Format (*.rtf*) In addition, the OneSpan Sign Print Driver supports any document that can be printed from a Windows-based application (e.g., Microsoft Word, Microsoft Excel, Microsoft PowerPoint). **File Size Constraints** - The maximum size of a single document is 16 MB. Smaller documents yield better performance — we recommend under 5 MB per document. - The maximum total size of all documents in a transaction is 39MB. However, the maximum size may vary, depending on the size of your overall payload. Should you receive an error message stating that the request size exceeds the maximum allowed size of 50MB even though your total document size is 39MB, remember that the actual limit depends on total payload size, and not just raw document size. - If your organization uses Salesforce or Microsoft SharePoint connectors, the file size maximum is 5 MB per document. - If your organization uses Salesforce connectors, the maximum number of documents that can be added to a transaction is ten (10). - If you enable email delivery while configuring a recipient, attachments larger than 5 MB are not supported. **File Name Constraints** - Document file names should not contain any of the following comma-separated characters: *, /, \, :, <, >, |, ?, ". **General File Constraints** - We recommend that you do not use PDF documents that make use of XML Forms Architecture. For more information, see XFA Support. - Do not upload password-protected or corrupted documents. These will generate an error. - OneSpan strongly recommends that you scan a PDF for syntax errors (e.g., by using Adobe's Preflight tool), and resolve any errors before you add the document to a transaction. - PDFs with the NeedAppearances flag set to true are not currently supported. ### Replacing an Existing Document Replacing an existing document in a transaction can also be done using the upload document API. This is useful, for example, if you would like to replace the document, but still keep the layout of the fields and signatures. To do so, make a multipart-form POST request where the document JSON payload carries the same document ID as the original document: #### HTTP Request ```plaintext POST /api/packages/{packageId}/documents ``` #### HTTP Headers ```plaintext Accept: text/html Content-Type: multipart/form-data Authorization: Basic api_key ``` #### Request Payload ```plaintext ------WebKitFormBoundary1bNO60n7FqP5WO4t Content-Disposition: form-data; name="file"; filename="doc1.pdf" Content-Type: application/pdf %PDF-1.5 %µµµµ 1 0 obj <>>> endobj.... ------WebKitFormBoundary1bNO60n7FqP5WO4t Content-Disposition: form-data; name="payload" {    "name": "Replaced Document",    "id": "keep_the_document_id_same" } ------WebKitFormBoundary1bNO60n7FqP5WO4t-- ``` Similarly, you can replace multiple documents, using the following request: #### Request Payload ```plaintext ------WebKitFormBoundary1bNO60n7FqP5WO4t Content-Disposition: form-data; name="file"; filename="doc1.pdf" Content-Type: application/pdf %PDF-1.5 %µµµµ 1 0 obj <>>> endobj.... ------WebKitFormBoundary1bNO60n7FqP5WO4t Content-Disposition: form-data; name="file"; filename="doc2.pdf" Content-Type: application/pdf %PDF-1.5 %µµµµ 1 0 obj <>>> endobj.... ------WebKitFormBoundary1bNO60n7FqP5WO4t Content-Disposition: form-data; name="payload" [    {        "name": "Replaced Document1",        "id": "keep_the_document1_id_same"    },    {        "name": "Replaced Document2",        "id": "keep_the_document2_id_same"    } ]------WebKitFormBoundary1bNO60n7FqP5WO4t-- ``` ### Updating Document Metadata To update the metadata for a document, you will need to create your JSON using the updated document metadata: ```plaintext {    "name": "Example Document",    "description": "Example Description" } ``` Then use the following command: ```plaintext PUT https://sandbox.esignlive.com/api/packages/{packageId}/documents/{documentId} ``` The call above will only update the document level attributes you defined in your new JSON payload and not any other embedded attributes that can be updated. ### Setting a Document as Read-Only in the Designer To prevent senders from modifying a document's field layout in the Designer, you can flag the document as read-only using the `designerReadOnly` property. This property can only be set through the API — it cannot be set from the Sender UI. When a document is flagged as read-only: - The document displays as read-only in the Designer, both within the Sender UI and when accessed via iFrame - The Accept-only button, Apply Layout button, and all fields on the document are disabled - A lock icon appears next to the document name in the Documents panel, with a "Locked document" tooltip - Hovering over a field on a locked document displays the tooltip "Fields cannot be edited on locked documents." - The Designer displays the message "This document is locked and cannot be modified." The read-only flag applies only to the flagged document within a transaction. All other documents remain fully viewable and editable in the Designer. To flag a document as read-only, include `designerReadOnly` in the JSON payload when uploading or updating a document: ```plaintext PUT https://sandbox.esignlive.com/api/packages/{packageId}/documents/{documentId} ``` ```plaintext {    "name": "Example Document",    "designerReadOnly": true } ``` The call above updates only the document-level attributes you define in the payload and does not affect any other embedded attributes. ### Deleting a Document To delete a document, make a DELETE request to the following URI: ```plaintext https://sandbox.esignlive.com/api/packages/{packageId}/documents/{documentId} ``` ### Results After running your code, if you login to OneSpan Sign and navigate to your transaction, you will be able to log into your OneSpan Sign account and view the documents you just added. ### Request Payload Table | Property | Type | Editable | Required | Default | Sample Values | | --- | --- | --- | --- | --- | --- | | name | string | Yes | No | n/a | Example Document | | description | string | Yes | No | n/a | Example Description | | id | string | Yes | No | n/a | Document1 | | designerReadOnly | boolean | Yes | No | false | true | ## APEX SDK To download the full code sample see our [Code Share](https://community.onespan.com/documentation/onespan-sign/codeshare/document-operations-example-apex-sdk/) site. This topic includes the following: - How to upload a document - How to replace an existing document - How to update the metadata in a document - How to delete a document after you have created a package ### Uploading Documents To add a document to an existing package, you must first create the Document object. The following code will create a Document object: ```plaintext StaticResource sr = [SELECT Id, Body FROM StaticResource WHERE Name = 'testdoc1' LIMIT 1]; Map doc = new Map(); doc.put('Sample Document', sr.Body); ESignLiveAPIObjects.Document document = new ESignLiveAPIObjects.Document(); document.name = 'Sample Contract'; document.id = 'document1'; ``` Once the Document object has been created, find the PackageId you wish to add the document to and then use the OneSpan Sign client to upload that document. The following code will do this: ```plaintext String documentResponse = sdk.createDocuments(packageId, document, doc); document = (ESignLiveAPIObjects.Document)JSON.deserialize(documentResponse, ESignLiveAPIObjects.Document.class); ``` OneSpan Sign supports the following document types: - Adobe's *Portable Document Format* (*.pdf*) — PDFs on which OneSpan Sign can act generally have at least these permissions enabled: (1) Changing the Document; (2) Signing; (3) Filling of form fields. - Microsoft Word (*.doc* or *.docx*) - Open Office (*.odt*) - Text (*.txt*) - Rich Text Format (*.rtf*) In addition, the OneSpan Sign Print Driver supports any document that can be printed from a Windows-based application (e.g., Microsoft Word, Microsoft Excel, Microsoft PowerPoint). **File Size Constraints** - The maximum size of a single document is 16 MB. Smaller documents yield better performance — we recommend under 5 MB per document. - The maximum total size of all documents in a transaction is 39MB. However, the maximum size may vary, depending on the size of your overall payload. Should you receive an error message stating that the request size exceeds the maximum allowed size of 50MB even though your total document size is 39MB, remember that the actual limit depends on total payload size, and not just raw document size. - If your organization uses Salesforce or Microsoft SharePoint connectors, the file size maximum is 5 MB per document. - If your organization uses Salesforce connectors, the maximum number of documents that can be added to a transaction is ten (10). - If you enable email delivery while configuring a recipient, attachments larger than 5 MB are not supported. **File Name Constraints** - Document file names should not contain any of the following comma-separated characters: *, /, \, :, <, >, |, ?, ". **General File Constraints** - We recommend that you do not use PDF documents that make use of XML Forms Architecture. For more information, see XFA Support. - Do not upload password-protected or corrupted documents. These will generate an error. - OneSpan strongly recommends that you scan a PDF for syntax errors (e.g., by using Adobe's Preflight tool), and resolve any errors before you add the document to a transaction. - PDFs with the NeedAppearances flag set to true are not currently supported. ### Replacing an Existing Document Replacing an existing document in a transaction can also be done using the Upload function. This is useful, for example, if you would like to replace the document, but still keep the layout of the fields and signatures. To do this, build a Document object that carries the same Document ID as the document you want to replace, and then use the OneSpan Sign client to upload it. The following code will do this: ```plaintext StaticResource sr = [SELECT Id, Body FROM StaticResource WHERE Name = 'testdoc1' LIMIT 1]; Map doc = new Map(); doc.put('Sample Document', sr.Body); ESignLiveAPIObjects.Document document = new ESignLiveAPIObjects.Document(); document.name = 'Updated Document'; document.id = 'keep_the_document_id_same'; String documentResponse = sdk.createDocuments(packageId, document, doc); ``` ### Updating Document Metadata To update the metadata for a document, simply create a Document object with the updates you want to make. For example: ```plaintext ESignLiveAPIObjects.Document document_updated = new ESignLiveAPIObjects.Document(); document_updated.name = 'updated document name'; document_updated.description = 'updated document description'; ``` Then, use below function to update the document metadata by passing in the package ID, document ID and updated Document object. ```plaintext sdk.updateDocument(packageId, document.id, document_updated); ``` ### Deleting a Document To delete a document, call the deleteDocument function with the packageId and documentId string: ```plaintext sdk.deleteDocument(packageId, document.id); ``` ### Results After running your code, if you login to OneSpan Sign and navigate to your transaction, you will be able to log into your OneSpan Sign account and view the documents you just added.