---
title: "Configuring Optional Signatures"
slug: "configuring-optional-signatures"
updated: 2024-10-15T12:44:28Z
published: 2024-10-15T12:44:28Z
canonical: "docs.onespan.com/configuring-optional-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.

# Configuring Optional Signatures

[Java SDK](/v1/docs/configuring-optional-signatures#java-sdk) [.NET SDK](/v1/docs/configuring-optional-signatures#net-sdk) [REST API](/v1/docs/configuring-optional-signatures#rest-api)

## Java SDK

To download the full code sample see our [Code Share](https://community.onespan.com/documentation/onespan-sign/codeshare/text-tags-extraction-support-optional-signature-java-sdk) site.

Optional Signatures give your signers the flexibility to complete a transaction without having them sign all the signature fields in their documents. This feature is useful for documents that require the signer to either accept or decline sections of a form.

Note: At least one signer must have either a required signature or a separate Accept Only document for a transaction to be completed. This does not include the default consent form.

### Creating Optional Signatures

The following code will make the Signature object optional:

```java
Signature fullnameOptionalSignature = SignatureBuilder.signatureFor("signer1@example.com")
    .onPage(0)
    .atPosition(100, 100)
    .makeOptional()
    .build();

Signature fullnameOptionalSignature = SignatureBuilder.signatureFor("signer1@example.com")
    .onPage(0)
    .atPosition(100, 100)
    .makeOptional()
    .build();
```

Similarly, makeOptional() function is also available for other signature types:

```java
Signature captureOptionalSignature = SignatureBuilder.captureFor("signer1@example.com")
    .onPage(0)
    .atPosition(100, 200)
    .makeOptional()
    .build();

Signature initialsOptionalSignature = SignatureBuilder.initialsFor("signer1@example.com")
    .onPage(0)
    .atPosition(100, 300)
    .makeOptional()
    .build();

Signature mobileOptionalSignature = SignatureBuilder.mobileCaptureFor("signer1@example.com")
    .onPage(0)
    .atPosition(100, 400)
    .makeOptional()
    .build();
```

Any signature that has been denoted as being optional will be clearly indicated as such. Optional signatures do not have to be signed in order to confirm a transaction.

### Creating Optional Signatures With Document Extraction

To make a signature field optional, apply the following format to your PDF form:

```java
  [Signer.SigStyle#.Optional]  
```

The last .Optional part is extended in order to set the signature as optional. Here are a few more examples:

![](https://cdn.document360.io/038f59a7-abd0-4c14-9de7-3434d28b49fd/Images/Documentation/optional-signature-2.png)

> - Signatures are by default required, so only add .Optional when necessary.
> - PDF form name syntax is case insensitive, including the Role Name and Custom ID of the signer.[Agent1.Fullname1.Optional] is treated the same as [AGENT1.FULLNAME1.OPTIONAL].
> - This syntax extension is only available for signatures and will not be recognized when creating any other fields. Names like [Agent1.Fullname1.Textfield1.Optional] will not work.

Once the transaction is created, all signatures should appear as expected.

### Creating Optional Signatures With Text Tags Extraction

The following code demonstrates the syntax of a Text Tag:

```java
  {{Xesl[_fieldName]:roleName:fieldType[:parameter1,parameter2,...]}}  
```

To mark this signature as optional, change the third character, X, to a question mark, ?. Otherwise, all signatures will be required by default. Here are some examples:

![](https://cdn.document360.io/038f59a7-abd0-4c14-9de7-3434d28b49fd/Images/Documentation/2-20-3.png)

In this example, {{?esl:Signer1:Signature}} means an Optional Fullname Signature is bound to Signer1.

## .NET SDK

To download the full code sample see our [Code Share](https://community.onespan.com/documentation/onespan-sign/codeshare/text-tags-extraction-support-optional-signature-net-sdk) site.

Optional Signatures give your signers the flexibility to complete a transaction without having them sign all the signature fields in their documents. This feature is useful for documents that require the signer to either accept or decline sections of a form.

Note: At least one signer must have either a required signature or a separate Accept Only document for a transaction to be completed. This does not include the default consent form.

### Creating Optional Signatures

The following code will make the Signature object optional:

```csharp
Signature fullnameOptionalSignature = SignatureBuilder.SignatureFor("signer1@example.com")
    .OnPage(0)
    .AtPosition(100, 100)
    .MakeOptional()
    .Build();
```

Similarly, the MakeOptional() function is also available for other signature types:

```csharp
Signature captureOptionalSignature = SignatureBuilder.CaptureFor("signer1@example.com")
    .OnPage(0)
    .AtPosition(100, 200)
    .MakeOptional()
    .Build();

Signature initialsOptionalSignature = SignatureBuilder.InitialsFor("signer1@example.com")
    .OnPage(0)
    .AtPosition(100, 300)
    .MakeOptional()
    .Build();

Signature mobileOptionalSignature = SignatureBuilder.MobileCaptureFor("signer1@example.com")
    .OnPage(0)
    .AtPosition(100, 400)
    .MakeOptional()
    .Build();
```

### Results

Any signature that has been denoted as being optional will be clearly indicated as such. Optional signatures do not have to be signed in order to confirm a transaction.

### Creating Optional Signatures With Document Extraction

To make a signature field optional, apply the following format to your PDF form:

```plaintext
  [Signer.SigStyle#.Optional]  
```

The last .Optional part is extended in order to set the signature as optional. Here are a few more examples:

![](https://cdn.document360.io/038f59a7-abd0-4c14-9de7-3434d28b49fd/Images/Documentation/optional-signature-2(1).png)

> - Signatures are by default required, so only add .Optional when necessary.
> - PDF form name syntax is case insensitive, including the Role Name and Custom ID of the signer.[Agent1.Fullname1.Optional] is treated the same as [AGENT1.FULLNAME1.OPTIONAL].
> - This syntax extension is only available for signatures and will not be recognized when creating any other fields. Names like [Agent1.Fullname1.Textfield1.Optional] will not work.

Once the transaction is created, all signatures should appear as expected.

### Creating Optional Signatures With Text Tags Extraction

The following line demonstrates the syntax of a Text Tag:

```plaintext
  {{Xesl[_fieldName]:roleName:fieldType[:parameter1,parameter2,...]}}  
```

To mark this signature as optional, change the third character, X, to a question mark, ?. Otherwise, all signatures will be required by default. Here are some examples:

![](https://cdn.document360.io/038f59a7-abd0-4c14-9de7-3434d28b49fd/Images/Documentation/2-20-3(1).png)

In this example, {{?esl:Signer1:Signature}} means an Optional Fullname Signature is bound to Signer1.

## REST API

To download the full code sample see our [Code Share](https://community.onespan.com/documentation/onespan-sign/codeshare/optional-signature-usage-net-rest) site.

Optional Signatures give your signers the flexibility to complete a transaction without having them sign all the signature fields in their documents. This feature is useful for documents that require the signer to either accept or decline sections of a form.

Note: At least one signer must have either a required signature or a separate Accept Only document for a transaction to be completed. This does not include the default consent form.

### Creating Optional Signatures

The following code will make the Signature object optional:

If you need a comparison to the basic object creation procedure, or if this is the first time creating a transaction, see [](https://developer.esignlive.com/guides/quick-start/creating-and-sending-a-package-net/)[Creating and Sending a Transaction](/v1/docs/creating-and-sending-a-transaction#net-sdk).

#### HTTP Request

```http
POST /api/packages
```

#### HTTP Headers

```http
Accept: application/json   
Content-Type: application/json   
Authorization: Basic api_key
```

#### Request Payload

```json
 -- -- --WebKitFormBoundary1bNO60n7FqP5WO4t Content - Disposition: form - data;
name = "file";
filename = "optional signature basic usage.pdf"
Content - Type: application / pdf % PDF - 1.5 % ÂµÂµÂµÂµ 1 0 obj < >>> endobj....-- -- --WebKitFormBoundary1bNO60n7FqP5WO4t Content - Disposition: form - data;
name = "payload" {
   "documents": [{
      "approvals": [{
         "fields": [{
            "height": 50,
            "left": 100,
            "page": 0,
            "subtype": "FULLNAME",
            "top": 100,
            "type": "SIGNATURE",
            "width": 200
         }],
         "id": "signature1",
         "role": "Role1"
      }, {
         "fields": [{
            "height": 50,
            "left": 100,
            "page": 0,
            "subtype": "FULLNAME",
            "top": 300,
            "type": "SIGNATURE",
            "width": 200
         }],
         "id": "signature2",
         "role": "Role1",
         "optional": true
      }],
      "name": "Test Document"
   }],
   "name": "Optional Signature Basic Usage REST",
   "roles": [{
      "id": "Role1",
      "signers": [{
         "email": "signer1@example.com",
         "firstName": "1.firstname",
         "lastName": "1.lastname",
         "company": "OneSpan Sign"
      }]
   }],
   "type": "PACKAGE",
   "status": "SENT"
}-- -- --WebKitFormBoundary1bNO60n7FqP5WO4t--
```

For a complete description of each field, see the Request Payload table below.

#### Response Payload

```json
 {
  "id": "7g-LhL0zEzN0jZi7Yccell7y6jA="
}
```

### Results

Any signature that has been denoted as being optional will be clearly indicated as such. Optional signatures do not have to be signed in order to confirm a transaction.

### Creating Optional Signatures With Document Extraction

To make a signature field optional, apply the following format to your PDF form:

```plaintext
  [Signer.SigStyle#.Optional]  
```

The last .Optional part is extended in order to set the signature as optional. Here are a few more examples:

![](https://cdn.document360.io/038f59a7-abd0-4c14-9de7-3434d28b49fd/Images/Documentation/optional-signature-2(2).png)

> - Signatures are by default required, so only add .Optional when necessary.
> - PDF form name syntax is case insensitive, including the Role Name and Custom ID of the signer.[Agent1.Fullname1.Optional] is treated the same as [AGENT1.FULLNAME1.OPTIONAL].
> - This syntax extension is only available for signatures and will not be recognized when creating any other fields. Names like [Agent1.Fullname1.Textfield1.Optional] will not work.
