Skip to main content

Document

Overview

You can use use this API request to migrate document from external services to Legale.
Response will return the GUID 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.

API detail

Request

  • URL: /migrate/document/
  • Method: POST
  • Content-Type: application/json
  • Body:
{
"document": {
"subject": "Subject of document",
"file_name": "file name of document",
"description": "description of document",
"folder": "Contract/Company1",
"sign_status": 1,
"file": "JVBERioxLjUNCiW1tbWiDQoxIDAgb2JDo9PC....",
"document_type": "Test",
"note": "Test",
"date": null
},
"workflow": {
"flow_type": "priority",
"signers": [
{
"sign_method": "no_sms",
"sign_status": 2,
"id_validation": false,
"selfie_validation": false,
"video_validation": false,
"signer": "signer_email@legale.io",
"email": "signer_email@legale.io",
"firstname": "Signer firstname",
"lastname1": "Signer lastname1",
"lastname2": "Signer lastname2",
"started_at": "2024-12-12 05:00:00",
"signed_at": "2024-12-12 06:00:00",
}
]
}
}

Request body details

  • document
ValueTypeIs requiredDescription
subjectstrNoSubject of document
file_namestrYesThe name of file you wanna to save as
descriptionstrYesDescription of document, maximum 1023 characters
folderstrNoFolder path that you wanna to save document in. If folder structure is not matched to current existing structure, system will create it.
sign_statusintNoDocument sign status, default is 0. Available values are 0(Not signed), 1(Signed), 2(Rejected).
filestrYesBase64 string of document you wanna upload
document_typestrNoDocument type that you can put any string you want save related to the document
notestrNoString data that you can put any string you want save related to the document
datestrNoDate string that you can put any date you want save related to the document
  • workflow

If you want to migrate document as well as signing workflow, you can use this parameter. If you don't specify this parameter, workflow will not be saved.

ValueTypeIs requiredDescription
flow_typestrNoSign workflow type, available values are priority, simultaneously
workflowlistNoList of Workflow information of every signer.
  • signers
ValueTypeIs requiredDescription
sign_methodstrYesSign method you wanna to use to sign document, you can see more details from here.
sign_statusintNoSign status of the signer in workflow. Default is 0. Available values are 0(Not signed), 1(In sign process), 2(Signed), 3(Rejected).
emailstrYesSigner email, this field is required.
phonestrNoSigner phone to use receive OTP. This parameter is needed when you set sign_method as sms
firstnamestrNoSigner first name
lastname1strNoSigner first last name
lastname2strNoSigner second last name
signerstrNoThis field should be set when you use sign_method - certification, local_certification, approve_legale.
video_validationboolNoTo require the video validation of signer in Remote and Remote SMS method
selfie_validationboolNoTo require the selfie validation of signer in Remote and Remote SMS
id_validationboolNoTo require the Identity Documentation validation of signer in Remote and Remote SMS
x1, y1, x2, y2floatNoSignature image position coordinate. (x1, y1) is the left bottom corner, (x2, y2) is the top right corner. Origin of coordinate is bottom left corner of document. Recommended ratio of width to height of signature image position is 3:1
pagenointNoPage number of document to insert the signature image in. The first page of document is 1.
anchorstrNoThe specific word in your document which you want to put the signature image on. The start point of anchor text will be the top left corner of the signature image. The sign image size will be 180 * 60 px rectangle by default.
started_atdatetimeNoThe datetime of sign flow is started in UTC.
signed_atdatetimeNoThe datetime of sign flow is finished in UTC.

Response

Success

  • Status code: 201
  • Body:
{
"GUID": "0fe75c65-70cc-4517-ac7f-ebba85bfa63e"
}

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.