--- title: "Adding Signatures" slug: "adding-signatures" updated: 2025-07-02T18:46:25Z published: 2025-07-02T18:46:25Z canonical: "docs.onespan.com/adding-signatures" --- > ## 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. # Adding Signatures [Java SDK](/v1/docs/adding-signatures#java-sdk) [.NET SDK](/v1/docs/adding-signatures#net-sdk) [REST API](/v1/docs/adding-signatures#rest-api) [APEX SDK](/v1/docs/adding-signatures#apex-sdk) ## Java SDK To download the full code sample see our [Code Share](https://community.onespan.com/documentation/onespan-sign/codeshare/signature-operations-java-sdk/) site. ### Adding a Signature to a Document To add a signature to a document, you will first need to create your Signature object using the OneSpan Sign SignatureBuilder. The following code will do this: ```java // Fullname signature style Signature signature1 = SignatureBuilder.signatureFor("john.smith@example.com")    .onPage(0)    .atPosition(215, 510)    .withSize(200, 50)    .withId(new SignatureId("signature1"))    .build(); // Handwritten signature style Signature signature2 = SignatureBuilder.captureFor("john.smith@example.com")    .onPage(0)    .atPosition(215, 510)    .withSize(200, 50)    .withId(new SignatureId("signature2"))    .build(); // Initials signature style Signature signature3 = SignatureBuilder.initialsFor("john.smith@example.com")    .onPage(0)    .atPosition(215, 510)    .withSize(200, 50)    .withId(new SignatureId("signature3"))    .build(); DocumentPackage createdPackage = client.getPackageService().getPackage(packageId); ``` Once you have built your Signature object, retrieve your transaction using the OneSpan Sign client. Then, using the OneSpan Sign ApprovalService, add your signature to your document. Use the DocumentPackage, Signature objects, and documentID as parameters. The following code will do this: ```java client.getApprovalService().addSignature(createdPackage, documentId, signature1); ``` ### Updating a Signature On a Document You can update a signature that has already been associated with a document. The following code will do this: ```java Signature updatedSignature = SignatureBuilder.captureFor("john.smith@example.com")    .onPage(0)    .atPosition(215, 510)    .withSize(300, 50)    .withId(new SignatureId("signature1"))    .build(); List signatures = new ArrayList<>(); signatures.add(updatedSignature); DocumentPackage updatedPackage = client.getPackageService().getPackage(packageId); client.getApprovalService().updateSignatures(updatedPackage, documentId, signatures); ``` When updating a signature, your new Signature object must have the same id as the signature you want to update. ### Deleting a Signature From a Document Deleting a signature from a document is done using the OneSpan Sign ApprovalService. Use the PackageID, SignatureID, and documentID as parameters. The following code will do this: ```java client.getApprovalService().deleteSignature(packageId, documentId, new SignatureId("signature1")); ``` ### Results Once you have run your code, your signatures will appear in your transaction's documents. ## .NET SDK To download the full code sample see our [Code Share](https://community.onespan.com/documentation/onespan-sign/codeshare/signature-operations-net-sdk/) site. ### Adding a Signature to a Document To add a signature to a document, you will first need to create your Signature object using the OneSpan Sign SignatureBuilder. The following code will do this: ```csharp // Fullname signature style Signature signature1 = SignatureBuilder.SignatureFor("john.smith@example.com")    .OnPage(0)    .AtPosition(215, 510)    .WithSize(200, 50)    .WithId(new SignatureId("signature1"))    .Build(); // Handwritten signature style Signature signature2 = SignatureBuilder.CaptureFor("john.smith@example.com")    .OnPage(0)    .AtPosition(215, 510)    .WithSize(200, 50)    .WithId(new SignatureId("signature2"))    .Build(); // Initials signature style Signature signature3 = SignatureBuilder.InitialsFor("john.smith@example.com")    .OnPage(0)    .AtPosition(215, 510)    .WithSize(200, 50)    .WithId(new SignatureId("signature3"))    .Build(); DocumentPackage createdPackage = client.GetPackage(packageId); ``` Once you have built your Signature object, retrieve your transaction using the OneSpan Sign client. Then, using the OneSpan Sign ApprovalService, add your signature to your document. Use the DocumentPackage, Signature objects, and documentID as parameters. The following code will do this: ```csharp client.ApprovalService.AddApproval(createdPackage, documentId, signature1); ``` ### Updating a Signature On a Document You can update a signature that has already been associated with a document. The following code will do this: ```csharp Signature updatedSignature = SignatureBuilder    .CaptureFor("john.smith@example.com")    .OnPage(0)    .AtPosition(215, 510)    .WithSize(300, 50)    .WithId(new SignatureId("signature1"))    .Build(); IList signatures = new List(); signatures.Add(updatedSignature); DocumentPackage updatedPackage = client.GetPackage(packageId); client.ApprovalService.UpdateApprovals(updatedPackage, documentId, signatures); ``` When updating a signature, your new Signature object must have the same id as the signature you want to update. ### Deleting a Signature From a Document Deleting a signature from a document is done using the OneSpan Sign ApprovalService. Use the PackageID, SignatureID, and documentID as parameters. The following code will do this: ```csharp Signature updatedSignature = SignatureBuilder    .CaptureFor("john.smith@example.com")    .OnPage(0)    .AtPosition(215, 510)    .WithSize(300, 50)    .WithId(new SignatureId("signature1"))    .Build(); IList signatures = new List(); signatures.Add(updatedSignature); DocumentPackage updatedPackage = client.GetPackage(packageId); client.ApprovalService.UpdateApprovals(updatedPackage, documentId, signatures); // Deleting the approval client.ApprovalService.DeleteApproval(packageId, documentId, "signature1"); ``` ### Results Once you have run your code, your signatures will appear in your transaction's documents. ## REST API To download the full code sample see our [Code Share](https://community.onespan.com/documentation/onespan-sign/codeshare/signature-operations-rest-api/) site. ### Adding a Signature to a Document To add a signature to a document, you will first need to edit the fields object. The following code will do this: #### HTTP Request ```http POST /api/packages/{packageId}/documents/{documentId}/approvals ``` #### HTTP Headers ```http Accept: application/json   Content-Type: application/json   Authorization: Basic api_key ``` #### Request Payload ```json {    "role": "Signer1",    "id": "signature1",    "fields": [        {            "top": 510,            "left": 215,            "width": 200,            "height": 50,            "page": 0,            "type": "SIGNATURE",            "subtype": "FULLNAME"        }    ] } ``` ```json {    "role": "Signer1",    "id": "signature1",    "fields": [        {            "top": 510,            "left": 215,            "width": 200,            "height": 50,            "page": 0,            "type": "SIGNATURE",            "subtype": "CAPTURE"        }    ] } ``` ```json {    "role": "Signer1",    "id": "signature1",    "fields": [        {            "top": 510,            "left": 215,            "width": 200,            "height": 50,            "page": 0,            "type": "SIGNATURE",            "subtype": "INITIALS"        }    ] } ``` For a complete description of each field, see the Request Payload table below. #### Response Payload ```json {    "signed": null,    "role": "Signer1",    "accepted": null,    "id": "signature1",    "data": null,    "fields": [        {            "top": 50,            "left": 300,            "height": 50,            "page": 0,            "type": "SIGNATURE",            "validation": null,            "binding": null,            "width": 200,            "subtype": "FULLNAME",            "extract": false,            "extractAnchor": null,            "id": "tx1qz7485780",            "data": null,            "value": "",            "name": ""        }    ],    "name": "" } ``` ### Updating a Signature On a Document You can update a signature that has already been associated with a document. To update a signature, you will need to make a PUT request to: ```http https://sandbox.esignlive.com/api/packages/{packageId}/documents/{documentId}/approvals/{signatureId}/ ``` With the updated signature parameters: ```json {    "role": "Signer1",    "fields": [        {            "top": 510,            "left": 215,            "width": 300,            "height": 50,            "id": "signature1",            "page": 0,            "type": "SIGNATURE",            "subtype": "CAPTURE"        }    ] } ``` When updating a signature, your new Signature object must have the same id as the signature you want to update. ### Deleting a Signature From a Document Finally, deleting a signature is done by making a DELETE request to: ```http https://sandbox.esignlive.com/api/packages/{packageId}/documents/{documentId}/approvals/{signatureId}/ ``` ### Results Once you have run your code, your signatures will appear in your transaction's documents. ### Request Payload Table | Property | Type | Editable | Required | Default | Sample Values | | --- | --- | --- | --- | --- | --- | | role | string | Yes | No | n/a | Signer1 | | id | string | Yes | No | n/a | signature1 | | fields | | | | | | | top | integer | Yes | No | 0 | 510 | | left | integer | Yes | No | 0 | 215 | | width | integer | Yes | No | 200 | 200 | | height | integer | Yes | No | 50 | 50 | | page | integer | Yes | No | 0 | 0 | | type | string | Yes | No | n/a | SIGNATURE / INPUT | | subtype | string | Yes | No | n/a | FULLNAME / INITIALS / CAPTURE / MOBILE_CAPTURE / LABEL / TEXTFIELD / TEXTAREA / CHECKBOX / DATE / RADIO / LIST | ## APEX SDK To download the full code sample see our [Code Share](https://community.onespan.com/documentation/onespan-sign/codeshare/signature-operations-apex-sdk/) site. ### Adding a Signature to a Document To add a signature to a document, you will first need to create your Approvalobject. The following code will do this: ```plaintext // #1. Add signature // Fullname signature style ESignLiveAPIObjects.Field field_fullname = new ESignLiveAPIObjects.Field(); field_fullname.id = 'field_fullname'; field_fullname.type = 'SIGNATURE'; field_fullname.subtype = 'FULLNAME'; field_fullname.page = 0; field_fullname.top = 100.0; field_fullname.left = 50.0; field_fullname.width = 150.0; field_fullname.height = 50.0; ESignLiveAPIObjects.Approval approval_fullname = new ESignLiveAPIObjects.Approval(); approval_fullname.fields = new List{field_fullname}; approval_fullname.id = 'approval_fullname'; approval_fullname.role = roleId; // Capture signature style ESignLiveAPIObjects.Field field_capture = new ESignLiveAPIObjects.Field(); field_capture.id = 'field_capture'; field_capture.type = 'SIGNATURE'; field_capture.subtype = 'CAPTURE'; field_capture.page = 0; field_capture.top = 200.0; field_capture.left = 50.0; field_capture.width = 150.0; field_capture.height = 50.0; ESignLiveAPIObjects.Approval approval_capture = new ESignLiveAPIObjects.Approval(); approval_capture.fields = new List{field_capture}; approval_capture.id = 'approval_capture'; approval_capture.role = roleId; // Initials signature style ESignLiveAPIObjects.Field field_initials = new ESignLiveAPIObjects.Field(); field_initials.id = 'field_initials'; field_initials.type = 'SIGNATURE'; field_initials.subtype = 'INITIALS'; field_initials.page = 0; field_initials.top = 300.0; field_initials.left = 50.0; field_initials.width = 150.0; field_initials.height = 50.0; ESignLiveAPIObjects.Approval approval_initials = new ESignLiveAPIObjects.Approval(); approval_initials.fields = new List{field_initials}; approval_initials.id = 'approval_initials'; approval_initials.role = roleId; ``` Once you have built your Signature object, use the OneSpan Sign SDK client to add your signature to your document. Use the PackageID, Signature object, and documentID as parameters. The following code will do this: ```plaintext  ESignLiveSDK sdk = new ESignLiveSDK();   //String packageId, String documentId,ESignLiveAPIObjects.Approval approval   sdk.addSignature(packageId, documentId, approval_fullname);   sdk.addSignature(packageId, documentId, approval_capture);   sdk.addSignature(packageId, documentId, approval_initials); ``` ### Updating a Signature On a Document You can update a signature that has already been associated with a document. The following code will do this: ```plaintext ESignLiveSDK sdk = new ESignLiveSDK(); // String packageId, String documentId, ESignLiveAPIObjects.Approval approval sdk.addSignature(packageId, documentId, approval_fullname); sdk.addSignature(packageId, documentId, approval_capture); sdk.addSignature(packageId, documentId, approval_initials); ``` When updating a signature, your new Signature object must have the same id as the signature you want to update. ### Deleting a Signature From a Document Deleting a signature from a document is done using the OneSpan Sign SDK Client. Use the PackageID, ApprovalID, and documentID as parameters. The following code will do this: ```plaintext // #4. Delete signature sdk.deleteApproval(packageId, documentId, 'approval_fullname'); ``` ### Results Once you have run your code, your signatures will appear in your transaction's documents.