Skip to main content

✏️ Document Creation

POST /document/save

This service allows generating a document dynamically from an Auco template or a previously created custom document. Unlike directly uploading a PDF file, this flow does not attach the document as a file. Instead, only the information (variables) required by the base template or document is sent, which will be used to automatically generate the document and enable the signing flow.

info

Before integrating this endpoint, you may want to see how to define signature positions and identity validation settings.

Steps to Create a Document:

  1. Check available templates or custom documents: Start by checking the available resources (your own templates or Auco's) to identify the base document you want to use.
  2. Get the identifier (_id) of the base document: Once you have identified the desired template or document, obtain its _id to continue with the process.
  3. Check the required variables of the selected document: Use the corresponding service to retrieve the list of variables you need to complete. This step is essential to correctly build the document creation request.
  4. Build and send the creation request: With the variable information, you can assemble the request body (POST) to generate the document.

A continuación se describen los parámetros necesarios para este servicio, junto con ejemplos y posibles respuestas del sistema.


Authentication

Include your private key in the Authorization header.

Authorization: prk_xxx...

Creation Parameters

NameTypeRequiredDescription
emailStringRequiredEmail address of the process creator.
documentStringRequiredID of the custom document or Auco template.
signBooleanRequiredParameter that defines whether the process will be performed using digital and electronic signature. Default is false, in which case the document will be sent by email for printing.
nameStringRequiredName of the document signing process, only if the attachment process includes document signing.
messageStringRequiredMessage that will appear in the email body notifying signers or approvers of the document.
subjectStringRequiredSubject line for the notification email sent to signers or approvers.
fileStringConditionalIf you want to upload the document in the same request, send the PDF file in Base64 in this parameter. (Only for small files.)
folderStringConditionalIf you want to save this process in a specific folder, provide the path here. The folder must exist and belong to the process creator.
rememberNumberConditionalEnables automatic reminders with the time interval (hours) between each notification. Must be a multiple of 3
expiredDateDateOptionalExpiration date of the document. Must be at least 3 days after the process creation date, sent in JSON Date format.
cameraBooleanOptionalIndicates whether photo validation is required. Default is false.
otpCodeBooleanOptionalIndicates whether OTP code validation is required. Default is false.
optionsObjectOptionalSpecifies identity validation settings. See more
notificationBooleanOptionalDefines whether participants will be notified once the process is created. Default is true.
dataArrayOptionalAll data needed by the template to generate the document.
data[x].keyStringRequiredName of the parameter registered in the template.
data[x].valueStringRequiredValue assigned to the parameter.
readersArrayOptionalList of objects defining participants who are not part of the signing process but should observe each phase of the signing process.
readers[x].nameStringRequiredName of the reader.
readers[x].emailStringRequiredEmail of the reader.
signProfileArrayRequiredList of objects containing information for each signer or approver for notification and signing.
signProfile[x].nameStringRequiredName of the signer.
signProfile[x].emailStringRequiredEmail of the signer.
signProfile[x].phoneStringRequiredPhone number of the signer.
signProfile[x].roleStringConditionalRole of the participant, can be 'APPROVER' or 'SIGNER'.
signProfile[x].orderStringConditionalOrder in which the notification process for signing or approval will take place.
signProfile[x].positionArrayConditionalSignature positions for this signer on each page. Signature positions can be preloaded in templates. See more information in the documentation.
signProfile[x].typeArrayConditionalName identifying the type of signer if pre-saved in a template, e.g., 'codeudor'.
signProfile[x].labelBooleanConditionalIndicates if signature positioning will be done using labels in the PDF.
signProfile[x].optionsObjectOptionalAllows defining custom validations for a specific signer. For individual signer validations, see more.
signProfile[x].cameraBooleanOptionalFor individual validations per signer: set to true if photo or video validation is required. Default is false.
signProfile[x].otpCodeBooleanOptionalFor individual validations per signer: set to true if OTP validation is required. Default is false.
signProfile[x].bothBooleanOptionalFor individual validations per signer: set to true if the signing process can be done via WhatsApp and/or email. Default is false.

🧪 Usage Examples

tip

You can copy any of the examples according to your preferred language.

  • Remember that email addresses and phone numbers between 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, e.g., +57, +1, +52...

Basic Signing Process

curl --location 'https://dev.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
}'

📥 Response Examples

Process Creation

{
"document": "DOCUMENTCODE",
"signProfile": [
{
"id": "ZR",
"email": "example@auco.ai"
}
]
}

🔸 Sending the compress Attribute

info

The signed URL provided in the response is single-use and will only be available for 5 seconds. It must be used to upload the PDF document in binary format using an HTTP PUT request.

{
"package": "PROCESSID",
"code": "DOCUMENTCODE",
"url": "signed_url"
}

⚠️ Error Responses

CodeDescription
400Missing parameters, or some validations do not meet applicability conditions
401Invalid or missing authentication