Skip to main content

Create Process

This article explains how to create a document capture process using the REST API of the Unico IDDocs.

All validation in this flow is done after the user has captured their biometrics and documents. Upload the captured images and the person's information.

The images are processed after successful upload.

How to use it?

Make a POST request to the /processes/v1 endpoint

With a valid Access token, make a request to the endpoint (POST/processes/v1) sending the following parameters:

{
"subject": {
"Code": "CPF_holder",
"Name": "NAME",
"Email": "EMAIL",
"Phone": "PHONE_NUMBER"
},
"document": {
"purpose": "Purpose_Sharing_Document",
"files": [
{
"data": "IMAGE_Document1"
},
{
"data": "IMAGE_Document2"
}
]
},
"imagebase64": "IMAGE_SELFIE"
}

Parameters:

  • HEADER PARAMETERS
NameTypeMandatory/OptionalDescription
APIKEYStringMandatoryAPI key
AuthorizationStringMandatoryAccess token
Content-TypeStringMandatory"application/json"
  • REQUEST BODY SCHEMA
NameTypeMandatory/OptionalDescription
subject.CodeStringMandatoryValid CPF.
subject.NameStringMandatoryPerson's name
subject.EmailStringOptionalEmail of the person.
subject.PhoneStringOptionalPhone number of the person
document.PurposeStringMandatoryIndicates the purpose of sharing the document.
One of the following options must be sent:
  • creditprocess: Sent if the document was captured for the purpose of a credit granting process.
  • carpurchase: Sent if the document was captured in a vehicle sale process.
  • paybypaycheck: Sent if the document was captured for the purpose of a payroll loan process.
  • onboarding: Sent if the document was captured for the purpose of an onboarding process.
  • fgts: Sent if the document was captured for the purpose of a credit granting process through fgts.

If the purposes mentioned above do not match your existing scenario/flow, please contact the Help Center.
document.filesListMandatoryFiles is a list of document.files.data because you may need to upload more than one image to the same document.
Example: The photo of the open ID card (1 image) or the front photo separated from the back (2 images).
document.files.dataListMandatoryDocument image. The image must be base64 (png, jpg, jpeg).
imagebase64StringMandatoryPhoto of the person. The image must be base64 (png, jpg, jpeg). If the photo is captured using the Unico SDK with Liveness, the image sent must be a Json Web Token (.jwt). The .jwt must be sent within 10 minutes to prevent the image from expiring. And this .jwt can only be used once.
Important

The subject.Name parameter cannot contain two spaces between the names.

Correct parameter submission:
  "subject.Name": "Ronald Richards"
Wrong parameter submission:
  "subject.Name": "Ronald  Richards"

Request example:

JSON File
{
"subject": {
"code": "45875596922",
"name": "Roberto Flavio",
"email": "random@unico.io",
"phone": "5511999999999"
},
"document": {
"purpose": "creditprocess",
"files": [
{
"data": "iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAAgSURBVDhPY/wPBAwUACYoTTYYNWDUABAYNWDgDWBgAABrygQclUTopgAAAABJRU5ErkJggg=="
}
]
},
"imageBase64": "iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAAgSURBVDhPY/wPBAwUACYoTTYYNWDUABAYNWDgDWBgAABrygQclUTopgAAAABJRU5ErkJggg=="
}

Successful request

If the request was executed successfully, the return response is a JSON as follows:

Synchronous APIKey:

{
"id": "016ba203-ca11-4690-aeb7-3573c9a03935",
"status": 3,
"unicoId": {
"result": "yes"
},
"document": {
"id": "aa58c722-15fa-44e4-9edc-59acf6c5ba57",
"type": "CNH"
}
}

Asynchronous APIKey:

{
"id": "6ab1771e-dfab-4e47-8316-2452268e5481"
}

The return parameters are:

NameTypeDescription
idstringIndicates the process ID created by sending the photo.
statusintegerIndicates the status of the Process, used to indicate whether it is completed or not. The complete list can be seen at Process Status.
unicoId.resultstringIndicates the authenticity of the CPF. Values can be Yes or Inconclusive.
document.idstringIndicates the ID of the document created.
document.typestringIndicates the type of document returned by the typification. The complete list can be seen at Document Type.

Request error

If an error occurs, the return response is a JSON containing the error code and description:

{
"Error": {
"code": "10700",
"description": "Error description"
}
}

For more information on the errors returned, see the list available in the article Response Errors.

Any concerns?

Missing something or still need help? If you are already a customer or partner, you can contact us through the Help Center.