legaliza

View Categories

Backup

2 Docs

Documents to SharePoint backup via Power Automate

Last Updated: September 2, 2025

 Objective Automate the backup of workflow information from Legale.io to SharePoint using Power Automate and the built-in callback functions of the Legale.io platform. 1. Prerequisites – Administrator access to Legale.io – An account with permissions to use Microsoft Power Automate – A SharePoint Online site to store the backups – Basic knowledge of Power Automate 2. Configure Power Automate 2.1 Create a new flow Go to https://make.powerautomate.com Click ‘Create > Automated cloud flow’ Name the flow: Legale Callback Finished Backup Choose the trigger: ‘When an HTTP request is received’ 2.2 Define the trigger schema Use ‘Use sample payload to generate schema’ Use this sample payload: {   “workflow_id”: “1234567890”,   “event”: “workflow_finished”,   “document_name”: “signed_contract.pdf”,   “signed_at”: “2024-05-14T16:32:00Z”,   “signed_by”: [“user1@company.com”],   “download_url”: “https://legale.io/api/files/download/1234567890” } 2.3 Add SharePoint create file action Click ‘New step’ > ‘Create file’ (SharePoint) Configure: – Site Address: Your SharePoint site – Folder Path: /Documents/Legale-Backups/ – File Name: @{triggerBody()?[‘document_name’]} – File Content: will be obtained in the next step 2.4 Download the document from Legale.io Add an ‘HTTP’ action (premium) Configure: – Method: GET – URI: @{triggerBody()?[‘download_url’]} – Header Authorization: Bearer <your-token-if-required> 3. Get the webhook URL In the trigger ‘When an HTTP request is received’ Save the flow and copy the generated URL 4. Configure callback in Legale.io Log in to https://app.legale.io as an administrator On the left navigation menu, go to: Integration > Callback In the ‘Callback when Workflow finished’ section:    – Enable the toggle to ON    – Paste the Power Automate URL into the ‘Callback URL’ field    – Click Save (Optional) Do the same for ‘Callback when Workflow started’ if needed 5. Optional: headers or filters – Use a secret token in headers for authentication – Validate the workflow_id – Add custom headers in the ‘Request headers’ section of Legale.io Expected result When a workflow starts or finishes: – The callback is triggered automatically – Power Automate processes metadata and downloads the document – The document is saved in SharePoint Security recommendations – Use a secret token in the callback headers – Validate IP origin or domain in Power Automate – Avoid exposing endpoints without authentication

Backing up documents from Legale.io to an external repository using Legale.io APIs

Last Updated: September 2, 2025

Overview This guide outlines the complete process for backing up documents from Legale.io to an external repository using the Legale.io API. It assumes the external repository is capable of receiving and storing files via HTTPS requests or another integration pipeline. Two main approaches are described: Custom Script-Based Integration with any external repository (e.g., S3, Google Drive, etc.) No-Code Integration using SharePoint and Power Automate Prerequisites A valid Legale.io API token with permissions to access documents and signatures Access to an external repository (e.g., SharePoint, AWS S3, Google Drive, or a custom endpoint) Server or script execution environment (e.g., Node.js, Python, Bash) or Power Automate access Option 1: Custom script-based backup (All Repositories) Step 1: List all documents Endpoint: GET /v1/document/all Documentation: List Documents Action: Call this endpoint to retrieve a list of all documents available for the authenticated user. Example Request: GET https://api.legale.io/v1/document/all Authorization: Bearer YOUR_API_TOKEN Step 2: Get detailed information for each document Endpoint: GET /v1/document/{document_id} Documentation: Document Detail Action: Retrieve full document details using the ID. Step 3: Confirm signature status Endpoint: GET /v1/sign/status/{document_id} Documentation: Signature Status Action: Ensure all required parties have signed before backup. Step 4: Download the signed document Endpoint: GET /v1/sign/download/{document_id} Documentation: Download Signed Document Action: Download the signed PDF file. Step 5: Upload to external repository Example (SharePoint via Graph API): PUT https://graph.microsoft.com/v1.0/sites/{site-id}/drives/{drive-id}/items/{parent-id}:/{file-name}.pdf:/content Authorization: Bearer YOUR_MICROSOFT_GRAPH_TOKEN Content-Type: application/pdf <binary pdf content> Step 6: Archive Metadata (Optional) Store metadata alongside the file (title, ID, signers, etc.) Option 2: No-Code backup using Power Automate and SharePoint Step 1: Create a Power Automate flow Go to Power Automate Create a new Automated cloud flow Set a trigger, such as a scheduled recurrence or HTTP request received Step 2: Configure HTTP request to Legale.io Add an HTTP action to call GET https://api.legale.io/v1/document/all Set the method to GET, and add the header: Authorization: Bearer YOUR_API_TOKEN Parse the JSON response and loop through documents Step 3: Confirm signature status (Optional) Add a HTTP action to call GET /v1/sign/status/{document_id} for each document Check if signatures are complete before continuing Step 4: Download and upload to SharePoint Add an HTTP action to call GET /v1/sign/download/{document_id} Use a Create file action in SharePoint to upload the binary content: Site Address: your SharePoint site Folder Path: target backup folder File Name: dynamic content from document File Content: body from download step Step 5: Log metadata Optionally add metadata to SharePoint columns or store as a companion .json file Final recommendations Automate the backup process using a scheduled job or Power Automate schedule Apply retry logic for transient API errors (with Do Until loops in Power Automate or try-catch in scripts) Monitor API usage limits and maintain secure token storage Always verify signature completion before backup