Skip to main content

Document from G2L

Overview

You can use use this API request to migrate document from GladToLink to Legale.
Response will return the detail of document that is created from Legale. This API request doesn't trigger any sign flow from legale, it just saves document and workflow info into db.
The difference between V1 is that we added here attached files.
Since G2L API doesn't support multi-level JSON structure, we implemented prefix and suffix rules to API request JSON body.

The Rule is:

  • document__ prefix to all the keys related to document data.
  • attached_file__ prefix and __{{ index }} suffix to all the keys related to the attached files data.
  • workflow__ prefix to flow type data.
  • workflow__signer__ prefix and __{{ index }} suffix to keys related to workflow signer data.

Important: All the prefix and suffix should be connected using double underscore __, suffix index should be from 1.
You can see detailed example request body below.

API detail

Request

  • URL: /migrate/g2l-document/
  • Method: POST
  • Content-Type: application/json
  • Body:
{
"document__file_name": "Test",
"document__description": "3",
"document__sign_status": 1,
"document__folder": "Migration/V2/G2L",
"document__file": "JVBERi0...",
"attached_file__file__1": "/9j/4AAQS...",
"attached_file__file_name__1": "attached.png",
"workflow__flow_type": "priority",
"workflow__signer__sign_method__1": "no_sms",
"workflow__signer__sign_status__1": 2,
"workflow__signer__email__1": "signer1@gmail.com",
"workflow__signer__firstname__1": "Signer",
"workflow__signer__lastname1__1": "1",
"workflow__signer__lastname2__1": "",
"workflow__signer__sign_method__2": "certification",
"workflow__signer__sign_status__2": 0,
"workflow__signer__email__2": "signer2@gmail.com",
"workflow__signer__firstname__2": "Signer",
"workflow__signer__lastname1__2": "2",
"workflow__signer__lastname2__2": ""
}

Request body details

ValueTypeIs requiredDescription
document__file_namestrYesThe name of file you wanna to save as
document__descriptionstrYesDescription of document, maximum 1023 characters
document__folderstrNoFolder path that you wanna to save document in. If folder structure is not matched to current existing structure, system will create it.
document__sign_statusintNoDocument sign status, default is 0. Available values are 0(Not signed), 1(Signed), 2(Rejected).
document__filestrYesBase64 string of document you wanna upload
attached_file__file__1strNoBase64 string of the attached file
attached_file__file_name__1strNoThe name of file you wanna to save as, it should be a valid file name including extension
workflow__flow_typestrNoSign workflow type, available values are priority, simultaneously
workflow__signer__sign_method__1strNoSign method you wanna to use to sign document, you can see more details from here.
workflow__signer__sign_status__1intNoSign status of the signer in workflow. Default is 0. Available values are 0(Not signed), 1(In sign process), 2(Signed), 3(Rejected).
workflow__signer__email__1strNoSigner email, this field is required.
workflow__signer__phone__1strNoSigner phone to use receive OTP. This parameter is needed when you set sign_method as sms
workflow__signer__firstname__1strNoSigner first name
workflow__signer__lastname1__1strNoSigner first last name
workflow__signer__lastname2__1strNoSigner second last name

Response

Success

  • Status code: 201
  • Body:
{
"GUID": "0fe75c65-70cc-4517-ac7f-ebba85bfa63e",
"doc_id": "50361222",
"document": "https://api.legale.io/media/document/0fe75c65-70cc-4517-ac7f-ebba85bfa63e.pdf",
"file_name": "test from postman.pdf",
"description": "test from postman",
"created_at": "2021-10-19T16:05:44.158662Z",
"updated_at": "2021-10-19T16:05:44.158662Z",
"sign_status": 0,
"comment": null,
"callback_url": null,
"callback_key": null,
}

Error

  • Status code: 400
  • Body:
{
"code": "NO_SERVICE_NUMBER",
"message": "Service number is not enough",
}
Error codeTypeDescription
NO_SERVICE_NUMBERstrYou run out your storage in legale service, to continue, you should buy it in legale store.