Document Creation
/document/saveprivate keyprk_This service allows generating a document dynamically from an Auco template or a previously created custom document. Unlike directly uploading a PDF file, in this flow the document is not attached as a file. Instead, only the information (variables) required by the template or base document is sent, which will be used to automatically generate the document and enable the signing flow.
Before integrating this endpoint you may need to see how to define signature positions and identity validation configurations.
Steps to create a document:
- Query available templates or custom documents: You should start by querying the available resources (own or Auco templates) to identify the base document you want to use.
- Obtain the identifier (_id) of the base document: Once the desired template or document is identified, obtain its _id to continue the process.
- Query required variables of the selected document: Use the corresponding service to retrieve the list of variables that need to be filled. This step is essential to correctly construct the document creation request.
- Build and send the creation request: With the variable information, you can assemble the request body (POST) to generate the document.
Below are the necessary parameters for this service, along with examples and possible system responses.
Authentication
Include your private key in the Authorization header.
Authorization: prk_xxx...
Creation Parameters
| Name | Type | Description |
|---|---|---|
email | String required | Email of the process creator. |
document | String required | ID of the custom document or Auco template. |
sign | Boolean required | Parameter that defines if the process will be done through digital and electronic signature. Default is false, in which case the document will be sent by email for printing. |
name | String required | Name of the document signing process, only if the attachment process includes document signing. |
message | String conditional | Message that will be included in the email body notifying the signers or approvers of the document. Required when any participant is notified by email. |
subject | String conditional | Subject with which the notification email will be sent to the signers or approvers. Required when any participant is notified by email. |
folder | String conditional | If you want to save this process in a specific folder, you must enter the path of that folder in this parameter. Note that the folder must exist and belong to the process creator. |
remember | Number conditional | Parameter that enables automatic reminders with the time interval (hours) between each notification. |
expiredDate | Date optional | Document expiration date. This must be greater than 3 days from the process creation date and is sent in JSON Date format. |
camera | Boolean optional | This parameter indicates if photo validation is mandatory, default is false. |
otpCode | Boolean optional | This parameter indicates if OTP code validation is mandatory, default is false. |
options | Object optional | This parameter indicates the specifications of the identity validation. See more |
notification | Boolean optional | Defines whether Auco notifies participants once the process is created. Default is true. Applies to every signer, except those the template marks with their own notification in the signatureProfile. |
targetWebhooks | Array[String] optional | If you have several webhooks, you can send the name of the webhook to which you want the updates of this process to be notified. |
tags | Array[String] optional | If you want to classify processes with tags, you can send the names of the tags to relate the process to (They must exist). |
data | Array optional | This parameter sends all the data the template needs to generate the document. |
data[x].key | String required | Name of the parameter registered in the template. |
data[x].value | String required | Value assigned to the parameter. |
readers | Array optional | This parameter is a list of objects that defines participants who are not part of the signing process, but who should be able to observe each phase of the signing process. |
readers[x].name | String required | Reader's name. |
readers[x].email | String required | Reader's email. |
🧪 Usage Examples
You can copy any of the examples according to your preferred language.
- Remember that email addresses and phone numbers among signers must not be repeated.
- Readers will receive notifications for each update in the signing process.
- Date format:
'DD/MM/YYYY' - Phone numbers must include the country code, for example:
+57, +1, +52...
Base signing process
- curl
- Python
- Node.js
curl --location 'https://api.auco.ai/v1.5/ext/document/save' \
--header 'Authorization: prk_private_key_company' \
--header 'Content-Type: application/json' \
--data-raw '{
"email": "example@auco.ai",
"name": "PRUEBA 1",
"notification": false,
"data": [
{
"key": "name_customer",
"value": "Frimante 1"
},
{
"key": "document_type_customer",
"value": "cc"
},
{
"key": "cedula_customer",
"value": "1234156"
},
{
"key": "email_customer",
"value": "example@auco.ai"
},
{
"key": "phone_customer",
"value": "+573173654513"
}
],
"document": "64823dc5ce28a265e02d68f3",
"sign": true
}'
import requests
import json
url = "https://api.auco.ai/v1.5/ext/document/save"
payload = json.dumps({
"email": "example@auco.ai",
"name": "PRUEBA 1",
"notification": False,
"data": [
{
"key": "name_customer",
"value": "Frimante 1"
},
{
"key": "document_type_customer",
"value": "cc"
},
{
"key": "cedula_customer",
"value": "1234156"
},
{
"key": "email_customer",
"value": "example@auco.ai"
},
{
"key": "phone_customer",
"value": "+573173654513"
}
],
"document": "64823dc5ce28a265e02d68f3",
"sign": True
})
headers = {
'Authorization': 'prk_private_key_company',
'Content-Type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
const axios = require('axios');
let data = JSON.stringify({
email: 'example@auco.ai',
name: 'PRUEBA 1',
notification: false,
data: [
{
key: 'name_customer',
value: 'Frimante 1',
},
{
key: 'document_type_customer',
value: 'cc',
},
{
key: 'cedula_customer',
value: '1234156',
},
{
key: 'email_customer',
value: 'example@auco.ai',
},
{
key: 'phone_customer',
value: '+573173654513',
},
],
document: '64823dc5ce28a265e02d68f3',
sign: true,
});
let config = {
method: 'post',
maxBodyLength: Infinity,
url: 'https://api.auco.ai/v1.5/ext/document/save',
headers: {
Authorization: 'prk_private_key_company',
'Content-Type': 'application/json',
},
data: data,
};
axios
.request(config)
.then((response) => {
console.log(JSON.stringify(response.data));
})
.catch((error) => {
console.log(error);
});
📥 Response Examples
Process creation
{
"document": "DOCUMENTCODE",
"signProfile": [
{
"id": "ZR",
"email": "example@auco.ai"
}
]
}
📋 Response Fields
| Field | Type | Description |
|---|---|---|
document | String | Code of the created process. It is the value the rest of the services take as code: GET /document, GET /document/roadmap and the others. |
signProfile | Array<Object> | Optional. Returned when some participant is left unnotified by Auco. It carries one element per participant in the process; those Auco does notify come without id. |
signProfile[].id | String | Identifier of the participant within the process. It is the value that services such as GET /whatsapp/records take as userId. |
signProfile[].email | String | Email of the participant. |
signProfile is only returned if some participant is left unnotifiedThe example above sends notification: false. With that value Auco does not notify the
participants, so the response hands them back with their id and you can distribute the process
yourself. A participant the template marks with notification: true in its signatureProfile
is notified by Auco and comes without id. With notification set to true —the default— the
response only carries document.
⚠️ Error Responses
| Code | Description |
|---|---|
| 400 | Missing parameters, or some validations do not meet applicability conditions |
| 401 | Invalid or missing authentication |