Skip to main content

Document Data Prefill

POST /document/prebuild

This service allows you to create a signing process from a custom document by prefilling only part of the information and sending it to a recipient who will complete the remaining data. Unlike document creation, where all the values needed to generate the document are sent at once, here the process is created in an in progress state with the prefilled fields and waits for the recipient to fill in the pending information.

It is useful when one party (for example, your company) already knows some of the document's data and wants to leave it completed, while the other party (the recipient) must provide the rest before signing.

info

The fields that can be prefilled are defined in the custom document's configuration. Before integrating this endpoint you may need to query the document variables and, if applicable, how to define signature positions and identity validation configurations.

Steps to prefill a document:

  1. Query the custom document: Identify the custom document you want to use and obtain its _id.
  2. Identify the prefillable variables: Query the document variables to find out which ones you can prefill.
  3. Build the preBuild array: Assemble the list of key / value pairs with the data you want to leave filled in.
  4. Send the request: Make the request (POST) indicating the recipient (emailTo) who will complete the remaining information.

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...

Prefill Parameters

NameTypeRequiredDescription
emailStringRequiredEmail of the process creator.
nameStringRequiredName of the document process.
documentStringRequiredID of the custom document from which the process is created.
preBuildArrayRequiredList of objects with the data prefilled in the document. Only the variables enabled for prefill in the document configuration are accepted.
preBuild[x].keyStringRequiredName of the variable registered in the document.
preBuild[x].valueStringRequiredValue assigned to the variable.
signBooleanRequiredDefines if the process will be done through signature. If false, the document will be sent by email for printing.
notificationBooleanRequiredDefines if the recipient (emailTo) is notified once the process is created so they can complete the information.
emailToStringRequiredEmail of the recipient who must complete the remaining data of the document.
folderStringConditionalPath of the folder where the process will be saved. The folder must exist and belong to the process creator.
cameraBooleanOptionalIndicates if photo validation is mandatory, default is false.
otpCodeBooleanOptionalIndicates if OTP code validation is mandatory, default is false.
optionsObjectOptionalSpecifications of the identity validation. See more
expiredDateDateOptionalDocument expiration date. It must be greater than 3 days from the creation date and is sent in JSON Date format.

🧪 Usage Examples

tip

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

  • In preBuild you should only send the variables you want to prefill; the recipient will complete the rest.
  • Phone numbers must include the country code, for example: +57, +1, +52...

Data prefill

curl --location 'https://dev.auco.ai/v1.5/ext/document/prebuild' \
--header 'Authorization: prk_private_key_company' \
--header 'Content-Type: application/json' \
--data-raw '{
"email": "example@auco.ai",
"name": "Employment contract - Juan Pérez",
"document": "64823dc5ce28a265e02d68f3",
"sign": true,
"notification": true,
"emailTo": "juan.perez@example.com",
"preBuild": [
{
"key": "company_name",
"value": "Auco SAS"
},
{
"key": "position",
"value": "Backend Developer"
}
]
}'

📥 Response Examples

Process creation

{
"document": "DOCUMENTCODE"
}

⚠️ Error Responses

CodeDescription
400Missing parameters, the document does not exist, or a variable does not match the document configuration
401Invalid or missing authentication