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"
}
}
| Value | Type | Is required | Description |
|---|---|---|---|
GUID | str | Yes | Unique document identifier |
file_name | str | Yes | Name of the document |
folder | str | No | Folder path in Legale |
meta_data | object | No | Document metadata (e.g. date, document_type) |
sign_url | str | Yes | URL to open or continue the signing session |
data_to_api | object | No | Custom 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": []
}
| Value | Type | Is required | Description |
|---|---|---|---|
GUID | str | Yes | Unique document identifier |
sign_status | int | Yes | Signing result (1 = signed, 2 = rejected) |
file_name | str | Yes | Final signed document name |
folder | str | No | Folder path in Legale |
meta_data | object | No | Metadata about the document |
data_to_api | object | No | Custom user-defined fields |
attached_files | array | No | Optional list of attached files (empty if not configured) |
Notes
- Use flat keys for
data_to_apifields (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.