Skip to main content

Create Process

This article explains how to create a process in By Unico via the REST API.

How to use it?

Make a POST request for the endpoint:

With a valid access token, make a request to the endpoint sending the following parameters:

{
"callbackUri": "/path/to/url",
"flow": "<FLOW_TYPE>",
"person": {
"duiType": "<DUI_TYPE>",
"duiValue": "<DUI_VALUE>",
"friendlyName": "<USER_FRIENDLY_NAME>",
"phone": "<USER_PHONE_NUMBER>",
"email": "<USER_EMAIL>",
"notifications": [
{
"notificationChannel": "NOTIFICATION_CHANNEL_WHATSAPP"
},
{
"notificationChannel": "NOTIFICATION_CHANNEL_SMS"
}
],
},
"purpose": "<DATA_COLLECT_PURPOSE>",
"payload": [],
"expiresIn": "<EXPIRES_IN>",
"contextualization": {
"currency": "BRL",
"price": "<FLOAT_NUMBER>",
"locale": {
"ptBr": {
"reason": "<REASON_PTBR>"
},
"enUs": {
"reason": "<REASON_ENUS>"
},
"esMX": {
"reason": "<REASON_ESMX>"
}
}
}
}

Request parameters

NameTypeMandatory/OptionalDescription
flowStringMandatoryDefines the journey to be executed.

id: Identity validation flow with facial biometrics.
idcheck: Identity validation flow with facial biometrics with score in the case of inclusion.
iddocs: Identity validation flow with document capture and reuse (RG or CNH).
idsign: Identity validation flow with electronic signature.
iddocssign: Identity validation flow, capture/reuse of documents (RG or CNH) and electronic signature.
callbackUriStringMandatoryDefines where the user will be redirected at the end of the process.

URL: You can use a URL for a web page in your flow. Example: https://developers.unico.io/callback. You can customize as you wish.

URL Scheme: You can also perform redirection to native mobile applications. Example: br.com.meupacote.app://callback. This callback needs to be registered in your mobile application.

No redirection: If you are using the solution in a message flow, use the value / to avoid a redirection at the end of the flow.
person.personDuiTypeStringMandatoryDefines the user identifier type.

DUI_TYPE_BR_CPF: To use CPF as an identifier.
person.personDuiValueStringMandatorySets the value of the user identifier specified in the personDuiType field.

Example: If using the identifier DUI_TYPE_BR_CPF for CPF, use a valid CPF without formatting: 73689290074.

Note: Mandatory in SMS and WhatsAPP flows.
person.friendlyNameStringOptionalSets the user name. Ex.: John Doe.
person.phoneStringOptional(*)Sets the user's phone number. Ex.: 5511900000000

| person.email | String | Optional | Defines the user's email. | | notifications.notificationChannel | String | Optional | notifications: It is an array that defines the notification sending channel. The field must be filled in with the desired notifications: SMS, or WhatsApp, or both channels.

Example of use:

notificationChannel: NOTIFICATION_CHANNEL_SMS

notificationChannel: NOTIFICATION_CHANNEL_WHATSAPP

Do not send notification fields in case of receiving URL only.| | purpose | String | Mandatory | Defines the purpose of using and collecting user data. It aims to provide transparency and ensure correct data processing under the LGPD.

creditprocess: If you are using the solution to offer credit to the user.

biometryonboarding: If you are using the solution to perform user onboarding.

carpurchase: If you are using the solution to purchase a vehicle. | | bioTokenId | String | Optional() | Define the transaction Id that you want to compare with the validation of the idtoken flow.

The value of this field can be the value of the id field or authenticationInfo.authenticationId of the process returned when performing the GetProcess of an
idcheck process. | | payload | Array | Mandatory | The payload field is an Array that offers a place to insert files necessary for some specific flows, such as idsign.

Within the payload Array another Array can be used to create signature flow envelopes.

The documents field is an
Array that receives the documents that make up each envelope, which can be 1 or more.

Each
Object document has:
- documentName: Name of the document.
- fileContents: Base64 of the PDF to be signed.

This field is
required for integration with IDSign. | | expiresIn | String | Optional | This field defines the time in seconds for the process expiration, based on the created_at date. Example: to expire in 24 hours, use "expires_in": "86400s". The default is 7 days if not specified. | | contextualization.price | float | Optional | Defines the value to be displayed in the process contextualization. | | contextualization.currency | String | Optional (*) | Defines the currency that will be used to format the price field. | | contextualization.locale.ptBr.Reason | String | Optional | Defines the information displayed in the Reason field of the process when the pt-br language is selected. | | contextualization.locale.enUs.Reason | String | Optional | Defines the information displayed in the Reason field of the process when the en-us language is selected. | | contextualization.locale.esMx.Reason | String | Optional | Defines the information displayed in the Reason field of the process when the es-mx language is selected. | | companyBranchId | String | Optional | Defines the id of the branch to which the created process is related. |

Note

(*) The person.phone parameter becomes Mandatory when the notifications.notificationChannel field is filled in.

(**) The bioTokenId parameter becomes mandatory when the flow field is of type idtoken. The creation of the idtoken flow is only possible after the successful completion of an idcheck flow.

(***) The contextualization.currency parameter becomes mandatory when the contextualization.price field is filled. Example of how the user interface will look with the contextualization:

Important

For the idtoken flow, the CPF is only validated if the value provided is the id field of the process. If the value passed in the idtoken field is authenticationInfo.authenticationId, the CPF will not be guaranteed.

Process Creation with Branch

For the creation of processes with a service account that has permission for only one branch, it is not necessary to provide the companyBranchId field.

For a service account that has permission for more than one branch, it is necessary to provide the companyBranchId field with the desired branch id value.

Request example

{
"callbackUri": "/path/to/url",
"flow": "idsign",
"person": {
"duiType": "DUI_TYPE_BR_CPF",
"duiValue": "73689290074",
"friendlyName": "John Doe",
"notifications": [
{
"notificationChannel": "NOTIFICATION_CHANNEL_WHATSAPP"
},
{
"notificationChannel": "NOTIFICATION_CHANNEL_SMS"
}
],
},
"purpose": "creditprocess",
"payload": [
{
"envelopePayload": {
"documents": [
{
"documentName": "FileToSign",
"fileContents": "JVBERi0xLjMNCiXi48/[...]DQoNCnN0YXJ0eHJlZg0KMjcxNA0KJSVFT0YNCg=="
}
]
}
}
],
"companyBranchId": "9ea8e39a-188a-4295-b5d7-3dd8791ab199",
"expiresIn": "86400s",
"contextualization": {
"currency": "BRL",
"price": 15990.9,
"locale": {
"ptBr": {
"reason": "Validação de identidade"
},
"enUs": {
"reason": "Identity validation"
}
}
}
}

For more examples, see Request Examples

Ways of making a request (request)

curl -X 'POST' \
'https://api.cadastro.uat.unico.app/client/v1/process/' \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer {{TOKEN}}'
-d '{
"callbackUri": "/",
"flow": "id",
"person": {
"duiType": "DUI_TYPE_BR_CPF",
"duiValue": "73689290074"
},
"purpose": "creditprocess"
}'

Request executed successfully

If the request was successful, the return response is a 200 OK and a JSON containing the following parameters:

{
"process": {
"id": "057f8d90-6ff6-4f52-ba05-ead6123f73bd",
"flow": "idcheck",
"callbackUri": "https://unico.io",
"userRedirectUrl": "https://cadastro.dev.unico.app/process/6291d10b-0450-453e-a5e8-5a6b2fe060e0",
"state": "PROCESS_STATE_CREATED",
"createdAt": "2024-07-18T18:34:30.328743Z",
"expiresAt": "2024-07-25T18:34:30.328743Z",
"person": {
"duiType": "DUI_TYPE_BR_CPF",
"duiValue": "73689290074",
"friendlyName": "John Doe"
},
"purpose": "creditprocess",
"authenticationInfo": {},
"capacities": [
"PROCESS_CAPACITY_IDLIVE",
"PROCESS_CAPACITY_IDUNICO",
"PROCESS_CAPACITY_IDCHECK"
],
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c"
}
}

The return parameters are:

NameDescription
idThe process identifier.
flowDefines the journey that was created.

id: Identity validation flow with facial biometrics.
idcheck: Identity validation flow with facial biometrics with score in the case of inclusion.
iddocs: Identity validation flow with document capture and reuse (RG or CNH).
idsign: Identity validation flow with electronic signature.
iddocssign: Identity validation flow, capture/reuse of documents (RG or CNH) and electronic signature.
callbackUriDefines where the user will be redirected at the end of the process.

More details in Request Parameters.
userRedirectUrlURL where you should redirect the user to complete the journey
stateIndicates the current state of the process, as it is of the type:

PROCESS_STATE_CREATED: Process created and not yet finished by the user.

PROCESS_STATE_FINISHED: Process completed by the user successfully.

PROCESS_STATE_FAILED: Process created or terminated with error.
resultIndicates the result of the user journey process, which may be of the type:

PROCESS_RESULT_OK: Process completed successfully.

PROCESS_RESULT_WARNING: Process ended with alert.

PROCESS_RESULT_ERROR: Process ended with some type of error.

PROCESS_RESULT_UNSPECIFIED: It is returned when the client uses the IDUnico alone. Process ended with unspecified result.
person.personDuiTypeDefines the user identifier type.

DUI_TYPE_BR_CPF: For CPF as identifier.
person.personDuiValueSets the value of the user identifier specified in the personDuiType field.
person.friendlyNameSets the user name, for example, John Doe.
createdAtIndicates the moment the process was created.
expiresAtIndicates the moment when the process will expire/has expired, and the value of this field is calculated from the expires_in field provided during the creation of the process, based on the creation date, created_at.
tokenSigned token that contains the necessary parameters to initialize the by Unico web SDK, allowing integration via iFrame.

Request error

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

API Reference

For more information about this endpoint, consult the API Reference.

Example of contextualization in the interface

Captura Manual

Any concerns?

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