Skip to main content

Data to API

Overview

The Data to API feature allows Legale to send structured information from a Smart Template or CSV file to an external API endpoint.
Each time a signing workflow starts or finishes, Legale sends a JSON payload containing your defined fields through the configured callback URL.


Launch Callback

Triggered when the workflow starts (before any signature result).

Request

  • URL: your_callback_url
  • Method: POST
  • Content-Type: application/json

Example JSON

{
"GUID": "10cbafgdebd-6133-458a-aeab-af743a3439jfda",
"file_name": "Document_Name.pdf",
"folder": "root/Folder/Contracts",
"meta_data": {
"date": "2025-11-01",
"document_type": "Contract"
},
"sign_url": "https://sign.legale.io/session/example",
"data_to_api": {
"first_name": "Example",
"last_name": "User",
"city": "Example City",
"date": "2025-11-05",
"email": "example.user@example.com"
}
}
ValueTypeIs requiredDescription
GUIDstrYesUnique document identifier
file_namestrYesName of the document
folderstrNoFolder path in Legale
meta_dataobjectNoDocument metadata (e.g. date, document_type)
sign_urlstrYesURL to open or continue the signing session
data_to_apiobjectNoCustom fields defined in the automation (flat structure only)

Sign Callback

Triggered when the workflow finishes (after signing or rejection).

Request

  • URL: your_callback_url
  • Method: POST
  • Content-Type: application/json

Example JSON

{
"GUID": "10cbafgdebd-6133-458a-aeab-af743a3439jfda",
"sign_status": 1,
"file_name": "Document_Name_Signed.pdf",
"folder": "root/Folder/API_Test",
"meta_data": {
"date": "2025-11-01",
"document_type": "Contract"
},
"data_to_api": {
"first_name": "Example",
"last_name": "User",
"city": "Example City",
"date": "2025-11-05",
"email": "example.user@example.com"
},
"attached_files": []
}

ValueTypeIs requiredDescription
GUIDstrYesUnique document identifier
sign_statusintYesSigning result (1 = signed, 2 = rejected)
file_namestrYesFinal signed document name
folderstrNoFolder path in Legale
meta_dataobjectNoMetadata about the document
data_to_apiobjectNoCustom user-defined fields
attached_filesarrayNoOptional list of attached files (empty if not configured)

Notes

  • Use flat keys for data_to_api fields (no nested objects).
  • Field names should use lowercase English words (e.g. first_name, city, email).
  • Launch Callback sends data when the process starts.
  • Sign Callback sends data when the process ends.

⚠️ Important:
If the CSV file used in the automation is modified, this may cause column misalignment.
When updating or re-uploading the CSV, make sure that the columns are added in the same order as before to preserve the correct field mapping.