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....",
"save_as_pdf": false,
"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",
}
],
}
| Value | Type | Is required | Description |
|---|---|---|---|
subject | str | No | Subject of document (Important in signing_portal) |
file_name | str | Yes | The name of file you wanna to save as |
description | str | Yes | Description of document, maximum 1023 characters |
folder | str | No | Folder path that you wanna to save document in. If folder structure is not matched to current existing structure, system will create it. |
file | str | Yes | Base64 string of document you wanna upload |
save_as_pdf | bool | No | Default value is true. Save document as PDF file and make it ready to start workflow. If you upload file that is not in PDF type, Legale will convert it to PDF, if you set this value as false, Legale will keep it's file type and will not convert it to PDF. Important: you should set the correct file name including extension (ex: contracts.xlsx) if your file is not in PDF type. |
callback_url | str | No | Callback url to send a request after completing sign process, you can see more details about the callback over here |
document_type | str | No | Document type that you can put any string you want save related to the document |
note | str | No | String data that you can put any string you want save related to the document |
date | str | No | Date string that you can put any date you want save related to the document |
GUID | str | No | If you set this value, document with this GUID will be replaced (For G2L only) |
attached_file
| Value | Type | Is required | Description |
|---|---|---|---|
file_name | str | Yes | The name of file you wanna to save as, should be the exact name with file extension, for example Test.pdf |
file | str | Yes | Base64 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 code | Type | Description |
|---|---|---|
NO_SERVICE_NUMBER | str | You run out your storage in legale service, to continue, you should buy it in legale store. |