--- title: "Custom Document Data" slug: "custom-document-data" updated: 2025-07-02T17:47:19Z published: 2025-07-02T17:47:19Z canonical: "docs.onespan.com/custom-document-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 Document Data [Java SDK](/v1/docs/custom-document-data#java-sdk) [.NET SDK](/v1/docs/custom-document-data#net-sdk) [REST API](/v1/docs/custom-document-data#rest-api) ## Java SDK To download the full code sample see our [Code Share](https://community.onespan.com/documentation/onespan-sign/codeshare/document-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 [Package Attributes](/v1/docs/custom-transaction-data#java-sdk). The following code sample illustrates the simplest way to create a package with customized document attributes. This example illustrates how to create customized attributes with the keys Department, and Employee. The customized attribute data is constructed as a map. ```plaintext DocumentPackage pkg = eslClient.getPackageService().getPackage(packageId); Document doc = pkg.getDocument(DOCUMENT_NAME); Map < String, Object > attributes = doc.getData(); for (Map.Entry < String, Object > entry: attributes.entrySet()) { System.out.println("Key : " + entry.getKey() + " Value : " + entry.getValue()); } ``` ### Retrieving your Attributes To retrieve these attributes, use the following code: ```plaintext DocumentPackage pkg = eslClient.getPackageService().getPackage(packageId);   Document doc = pkg.getDocument(DOCUMENT_NAME);   Map attributes = doc.getData();   for (Map.Entry entry : attributes.entrySet()){   System.out.println("Key : " + entry.getKey() + " Value : " + 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/java-300x77.png?sv=2026-02-06&spr=https&st=2026-11-13T09%3A51%3A04Z&se=2026-11-13T10%3A51%3A04Z&sr=c&sp=r&sig=Gwn%2Fij8uX%2BOxlxSWgYE5sdQj5VCS%2FbUFBvvJkekuF3E%3D) ## .NET SDK To download the full code sample see our [Code Share](https://community.onespan.com/documentation/onespan-sign/codeshare/document-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 [Package Attributes](/v1/docs/custom-transaction-data#net-sdk). The following code sample illustrates the simplest way to create a package with customized document attributes. This example illustrates how to create customized attributes with the keys Department, and Employee. The customized attribute data is constructed as a map. ```csharp DocumentPackage superDuperPackage = PackageBuilder.NewPackageNamed(PackageName).DescribedAs("This is a package created using the OneSpan Sign SDK").WithSigner(SignerBuilder.NewSignerWithEmail(email1).WithCustomId("Client1").WithFirstName("John").WithLastName("Smith").WithTitle("Managing Director").WithCompany("Acme Inc.")).WithDocument(DocumentBuilder.NewDocumentNamed(DOCUMENT_NAME).FromStream(fileStream1, DocumentType.PDF).WithSignature(SignatureBuilder.SignatureFor(email1).OnPage(0).AtPosition(100, 100)).WithData(DocumentAttributesBuilder.NewDocumentAttributes().AddAttribute("Department", "1806").AddAttribute("Employee", "135526"))).Build(); ``` ### Retrieving your Attributes To retrieve these attributes, use the following code: ```csharp DocumentPackage pkg = eslClient.GetPackage(packageId); Document doc = pkg.GetDocument("sample doc"); IDictionary < string, object > attributes = doc.Data; foreach(var attribute in attributes) { Debug.WriteLine("Key : " + attribute.Key + " Value : " + attribute.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_document_data(1).png?sv=2026-02-06&spr=https&st=2026-11-13T09%3A51%3A04Z&se=2026-11-13T10%3A51%3A04Z&sr=c&sp=r&sig=Gwn%2Fij8uX%2BOxlxSWgYE5sdQj5VCS%2FbUFBvvJkekuF3E%3D) ## REST API To download the full code sample see our [Code Share](https://community.onespan.com/documentation/onespan-sign/codeshare/document-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 [Package Attributes](/v1/docs/custom-transaction-data#rest-api). The following code sample illustrates the simplest way to create a package with customized document attributes. This example illustrates how to create customized attributes with the keys Department, and Employee. The customized attribute data is constructed as a map. #### HTTP Request `POST /api/packages` #### HTTP Headers ```http Accept: application/json   Content-Type: multipart/form-data   Authorization: Basic api_key ``` #### Request Payload ```http ------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"   {   "autocomplete": true,   "documents": [   {   "approvals": [   {   "fields": [   {   "extract": false,   "height": 50,   "left": 100,   "page": 0,   "subtype": "FULLNAME",   "top": 100,   "type": "SIGNATURE",   "width": 200   }   ],   "role": "Client1"   }   ],   "data": {   "Department": "1806",   "Employee": "135526"   },   "name": "sample doc"   }   ],   "name": "Document Attributes Example",   "roles": [   {   "id": "Client1",   "name": "Client1",   "signers": [   {   "company": "Acme Inc.",   "email": "mail32@example.com",   "firstName": "John",   "id": "Client1",   "lastName": "Smith",   "title": "Managing Director"   }   ]   }   ],   "trashed": false,   "type": "PACKAGE",   "visibility": "ACCOUNT"   }   ------WebKitFormBoundary1bNO60n7FqP5WO4t-- ``` For a complete description of each field, see the Request Payload table below. #### Response Payload ```json {   "id": "9sKhW-h-qS9m6Ho3zRv3n2a-rkI="   } ``` If you want to retrieve your attributes at a later stage, you can do so by simply retrieving your document JSON: ```json GET https://sandbox.esignlive.com/api/packages/{packageId}/documents/{documentId} ``` Then, loop through the data field property. ### 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_document_data.png?sv=2026-02-06&spr=https&st=2026-11-13T09%3A51%3A04Z&se=2026-11-13T10%3A51%3A04Z&sr=c&sp=r&sig=Gwn%2Fij8uX%2BOxlxSWgYE5sdQj5VCS%2FbUFBvvJkekuF3E%3D) ### Request Payload Table | Property | Type | Editable | Required | Default | Sample Values | | --- | --- | --- | --- | --- | --- | | status | string | Yes | No | DRAFT | DRAFT / SENT / COMPLETED / ARCHIVED / DECLINED / OPTED_OUT / EXPIRED | | autoComplete | boolean | Yes | No | true | true / false | | type | string | Yes | No | PACKAGE | PACKAGE / TEMPLATE / LAYOUT | | name | string | Yes | Yes | n/a | Document Attributes Example | | trashed | boolean | Yes | No | false | true / false | | visibility | string | Yes | No | ACCOUNT | ACCOUNT / SENDER | | documents | | | | | | | name | string | Yes | No | n/a | sample doc | | 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 | Client1 | | data | | | | | | | Department | string | Yes | No | n/a | 1806 | | Employee | string | Yes | No | n/a | 135526 | | 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 |