Skip to main content

Create

Overview

You can create document by using this API.
Response is just same as the document list response object.

API detail

Request

  • URL: /document/create
  • Method: POST
  • Content-Type: application/json
  • Body:
{
"subject": "Subject of document",
"file_name": "file name of document",
"description": "description of document",
"folder": "Contract/Company1",
"file": "JVBERioxLjUNCiW1tbWiDQoxIDAgb2JDo9PC....",
"callback_url": "https://your.service.com/callback",
"document_type": "Test",
"note": "Test",
"date": null,
"GUID": "0fe75c65-70cc-4517-ac7f-ebba85bfa63e",
"attach_file_list": [
{
"file": "JVBERioxLjUNCiW1tbWiDQoxIDAgb2JDo9PC....",
"file_name": "test_attached.pdf",
}
],
}
ValueTypeIs requiredDescription
subjectstrNoSubject of document (Important in signing_portal)
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.
filestrYesBase64 string of document you wanna upload
callback_urlstrNoCallback url to send a request after completing sign process, you can see more details about the callback over here
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
GUIDstrNoIf you set this value, document with this GUID will be replaced (For G2L only)
  • attached_file
ValueTypeIs requiredDescription
file_namestrYesThe name of file you wanna to save as, should be the exact name with file extension, for example Test.pdf
filestrYesBase64 string of file you wanna upload

Response

Success

  • Status code: 200
  • Body:
{
"data": {
"GUID": "0fe75c65-70cc-4517-ac7f-ebba85bfa63e",
"doc_id": "50361222",
"document": "https://api.legale.io/media/document/0fe75c65-70cc-4517-ac7f-ebba85bfa63e.pdf",
"folder": "root/Contract/Company1",
"file_name": "test from postman.pdf",
"subject": null,
"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,
},
"code": null,
"message": "",
}

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.