--- title: "Custom Transaction Data" slug: "custom-transaction-data" updated: 2025-07-02T17:48:42Z published: 2025-07-02T17:48:42Z canonical: "docs.onespan.com/custom-transaction-data" --- > ## 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. # Custom Transaction Data [Java SDK](/v1/docs/custom-transaction-data#java-sdk) [.NET SDK](/v1/docs/custom-transaction-data#net-sdk) [REST API](/v1/docs/custom-transaction-data#rest-api) [APEX SDK](/v1/docs/custom-transaction-data#apex-sdk) ## Java SDK To download the full code sample see our [Code Share](https://community.onespan.com/documentation/onespan-sign/codeshare/package-attributes-java-sdk/) site. Document attributes are customized data related to a document in a transaction, or to all data in a transaction. This data is not interpreted by OneSpan Sign. As such, the users of this data are free to store and interpret whatever data they want. Customized data can also be applied at the transaction level. For more information, see [Document Attributes](/v1/docs/custom-document-data). The following code shows you how to edit your DocumentPackage object to add package attributes. ```java DocumentPackage superDuperPackage1=newPackageNamed("Policy " + new SimpleDateFormat("HH:mm:ss").format(new Date())).describedAs("This is a package created using the e-SignLive SDK").expiresAt(new Date()).withEmailMessage("This message should be delivered to all signers").withSigner(newSignerWithEmail("signer1@xyz.com").withCustomId("Client1").withFirstName("John").withLastName("Smith").withTitle("Managing Director").withCompany("Acme Inc.")).withDocument(newDocumentWithName("First Document").fromStream(new java.io.FileInputStream(DOCUMENT_PATH), DocumentType.PDF).withSignature(signatureFor("signer1@xyz.com").onPage(0).withField(FieldBuilder.checkBox().onPage(0).atPosition(400, 200).withValue("x")).atPosition(100, 100))).withAttributes(newDocumentPackageAttributes().withAttribute("First Name", "Bill").withAttribute("Last Name", "Johnson").withAttribute("Signing Order", "1").build()).build();   ``` ### Retrieving your Attributes Attributes are set on a transaction level. To retrieve your attributes, you will first need to retrieve your transaction. Then, with your DocumentPackage object, use the getAttributes() and getContents() methods to retrieve your attributes. Attributes will be returned to you as a map. ```java  DocumentPackage retrievedPackage = eslClient.getPackage(packageId); Map < String, Object > attributes = retrievedPackage.getAttributes().getContents(); for (Map.Entry < String, Object > entry: attributes.entrySet()) { System.out.println(entry.getKey() + ": " + entry.getValue()); } ``` ### Results Here is an example of what you can expect to see once you have run your code. ![](https://cdn.document360.io/038f59a7-abd0-4c14-9de7-3434d28b49fd/Images/Documentation/3-300x70.png?sv=2026-02-06&spr=https&st=2026-11-06T06%3A15%3A21Z&se=2026-11-06T07%3A15%3A21Z&sr=c&sp=r&sig=tymG%2BoH6%2Ffpyc85eDDbvOfWmgQ4luVGStswD0wA0kZw%3D) ## .NET SDK To download the full code sample see our [Code Share](https://community.onespan.com/documentation/onespan-sign/codeshare/package-attributes-net-sdk/) site. Document attributes are customized data related to a document in a transaction, or to all data in a transaction. This data is not interpreted by OneSpan Sign. As such, the users of this data are free to store and interpret whatever data they want. Customized data can also be applied at the transaction level. For more information, see [Document Attributes](/v1/docs/custom-document-data). The following code shows you how to edit your DocumentPackage object to add package attributes. ```csharp  DocumentPackage superDuperPackage = PackageBuilder.NewPackageNamed("Policy " + DateTime.Now).DescribedAs("This is a package created using the e-SignLive SDK").ExpiresOn(DateTime.Now.AddMonths(1)).WithEmailMessage("This message should be delivered to all signers").WithSigner(SignerBuilder.NewSignerWithEmail("john.smith@example.com").WithCustomId("Client1").WithFirstName("John").WithLastName("Smith").WithTitle("Managing Director").WithCompany("Acme Inc.")).WithDocument(DocumentBuilder.NewDocumentNamed("First Document").FromFile(@ "C:/Users/hhaidary/Desktop/pdf/doc1.pdf").WithSignature(SignatureBuilder.SignatureFor("john.smith@example.com").OnPage(0).WithField(FieldBuilder.CheckBox().OnPage(0).AtPosition(400, 200).WithValue("x")).AtPosition(100, 100))).WithAttributes(new DocumentPackageAttributesBuilder().WithAttribute("First Name", "Bill").WithAttribute("Last Name", "Johnson").WithAttribute("Signing Order", "1").Build()).Build();   ``` ### Retrieving your Attributes Attributes are set on a transaction level. To retrieve your attributes, you will first need to retrieve your transaction. Then, with your DocumentPackage object, use the getAttributes() and getContents() methods to retrieve your attributes. Attributes will be returned to you as a map. ```plaintext  DocumentPackage retrievedPackage = eslClient.GetPackage(packageId); IDictionary < string, Object > attributes = retrievedPackage.Attributes.Contents; foreach(KeyValuePair < string, Object > entry in attributes) { Debug.WriteLine(entry.Key + ": " + entry.Value); } ``` ### Results Here is an example of what you can expect to see once you have run your code. ![](https://cdn.document360.io/038f59a7-abd0-4c14-9de7-3434d28b49fd/Images/Documentation/custom_data.png?sv=2026-02-06&spr=https&st=2026-11-06T06%3A15%3A21Z&se=2026-11-06T07%3A15%3A21Z&sr=c&sp=r&sig=tymG%2BoH6%2Ffpyc85eDDbvOfWmgQ4luVGStswD0wA0kZw%3D) ## REST API To download the full code sample see our [Code Share](https://community.onespan.com/documentation/onespan-sign/codeshare/package-attributes-rest-api/) site. Document attributes are customized data related to a document in a transaction, or to all data in a transaction. This data is not interpreted by OneSpan Sign. As such, the users of this data are free to store and interpret whatever data they want. Customized data can also be applied at the transaction level. For more information, see [Document Attributes](/v1/docs/custom-document-data). The following code shows you how to edit your DocumentPackage object to add package attributes. #### HTTP Request ```http POST /api/packages ``` #### HTTP Headers ```http Accept: application/json Content-Type: multipart/form-data Authorization: Basic api_key   ``` #### Request Payload ```json  -- -- --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" { "documents": [{ "approvals": [{ "id": "ExampleSignatureId", "role": "Signer1", "fields": [{ "page": 0, "top": 200, "subtype": "LABEL", "height": 50, "left": 100, "width": 200, "id": "myLabelField", "type": "INPUT", "value": "Example label field value" }, { "page": 0, "top": 100, "subtype": "FULLNAME", "height": 50, "left": 100, "width": 200, "type": "SIGNATURE", "name": "ExampleSignatureId" }], "name": "" }], "id": "sample-contract", "name": "Test Document" }], "status": "DRAFT", "type": "PACKAGE", "roles": [{ "id": "Signer1", "type": "SIGNER", "signers": [{ "email": "signer@example.com", "firstName": "John", "lastName": "Smith", "id": "Signer1" }], "name": "Signer1" }], "name": "Example Package", "data": { "First Name": "Bill", "Last Name": "Johnson", "Signing Order": "1" } }-- -- --WebKitFormBoundary1bNO60n7FqP5WO4t--   ``` For a complete description of each field, see the Request Payload table below. #### Response Payload ```plaintext  { "id": "9sKhW-h-qS9m6Ho3zRv3n2a-rkI=" }   ``` Attributes are set on a package level. Therefore, you will need to get your package JSON in order to retrieve your package attributes. ### Results Here is an example of what you can expect to see once you have run your code. ![](https://cdn.document360.io/038f59a7-abd0-4c14-9de7-3434d28b49fd/Images/Documentation/custom_data-1.png?sv=2026-02-06&spr=https&st=2026-11-06T06%3A15%3A21Z&se=2026-11-06T07%3A15%3A21Z&sr=c&sp=r&sig=tymG%2BoH6%2Ffpyc85eDDbvOfWmgQ4luVGStswD0wA0kZw%3D) ### Request Payload Table | Property | Type | Editable | Required | Default | Sample Values(s) | | --- | --- | --- | --- | --- | --- | | status | string | Yes | No | DRAFT | DRAFT / SENT / COMPLETED / ARCHIVED / DECLINED / OPTED_OUT / EXPIRED | | type | string | Yes | No | PACKAGE | PACKAGE / TEMPLATE / LAYOUT | | name | string | Yes | Yes | n/a | Document Attributes Example | | documents | | | | | | | name | string | Yes | No | n/a | sample doc | | id | string | Yes | No | n/a | sample-contract | | approvals | | | | | | | fields | | | | | | | subtype | string | Yes | No | n/a | FULLNAME / INITIALS / CAPTURE / MOBILE_CAPTURE / LABEL / TEXTFIELD / TEXTAREA / CHECKBOX / DATE / RADIO / LIST | | type | string | Yes | No | n/a | SIGNATURE / INPUT | | extract | boolean | Yes | No | false | true / false | | height | integer | Yes | No | 50 | 50 / 100 / 150 ... | | left | integer | Yes | No | 0 | 50 / 100 / 150 ... | | page | integer | Yes | No | 0 | 0 / 1 / 2 ... | | top | integer | Yes | No | 0 | 50 / 100 / 150 ... | | width | integer | Yes | No | 200 | 50 / 100 / 150 ... | | | | | | | | | role | string | Yes | No | n/a | Signer1 | | id | string | Yes | No | n/a | ExampleSignatureId | | roles | | | | | | | id | string | Yes | No | n/a | Client1 | | name | string | Yes | No | n/a | Client1 | | type | string | Yes | No | SIGNER | SIGNER / SENDER | | signers | | | | | | | email | string | Yes | Yes | n/a | preparer.email@example.com | | firstName | string | Yes | Yes | n/a | John | | lastName | string | Yes | Yes | n/a | Smith | | phone | string | Yes | No | n/a | 514-555-8888 | | id | string | Yes | No | n/a | Client1 | | company | string | Yes | No | n/a | Acme Inc. | | title | string | Yes | No | n/a | Managing Director | | data | | | | | | | First Name | string | Yes | No | n/a | Bill | | Last Name | string | Yes | No | n/a | Johnson | | Signing Order | string | Yes | No | n/a | 1 | ## APEX SDK To download the full code sample see our [Code Share](https://community.onespan.com/documentation/onespan-sign/codeshare/package-attributes-apex-sdk/) site. Document attributes are customized data related to a document in a transaction, or to all data in a transaction. This data is not interpreted by OneSpan Sign. As such, the users of this data are free to store and interpret whatever data they want. The first step is to create a package. 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). Once you have retrieved your package ID, use the following encapsulated function to pass the package ID and attributes in a Map as parameters. ```plaintext  public void addAttributes(String packageId, Map attributes)   ``` ### Retrieving your Attributes Use the following code to retrieve your attributes at a package level. These attributes are passed as a map, using the PackageID. ```plaintext  public Map getAttributes(String packageId)   ``` ### Results Here is an example of what you can expect to see once you have run your code. ![](https://cdn.document360.io/038f59a7-abd0-4c14-9de7-3434d28b49fd/Images/Documentation/package-attributes-1.png?sv=2026-02-06&spr=https&st=2026-11-06T06%3A15%3A21Z&se=2026-11-06T07%3A15%3A21Z&sr=c&sp=r&sig=tymG%2BoH6%2Ffpyc85eDDbvOfWmgQ4luVGStswD0wA0kZw%3D)