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": []

}

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.: 551190000-0000
person.emailStringOptionalDefines the user's email.
notifications.notificationChannelStringOptionalnotifications: 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.
purposeStringMandatoryDefines 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.
payloadArrayMandatoryThe 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.
Note

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

Request example

{
"callbackUri": "/path/to/url",
"flow": "idcheck",
"person": {
"duiType": "DUI_TYPE_BR_CPF",
"duiValue": "73689290074"
},
"purpose": "biometryonboarding",
"payload": [
{
"envelopePayload": {
"documents": [
{
"documentName": "test",
"fileContents": "JVBERi0xLjMNCiXi48/[...]DQoNCnN0YXJ0eHJlZg0KMjcxNA0KJSVFT0YNCg=="
}
]
}
}
]
}

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",
"company": {
"code": "unico",
"friendlyName": "Orquestrador",
"logoUrl": "https://unico.io/wp-content/themes/theme_unico/img/logo/unico-color.svg"
},
"callbackUri": "https://unico.io",
"userRedirectUrl": "https://cadastro.dev.unico.app/process/057f8d90-6ff6-4f52-ba05-ead6123f73bd",
"state": "PROCESS_STATE_FINISHED",
"result": "PROCESS_RESULT_OK",
"person": {
"duiType": "DUI_TYPE_BR_CPF",
"duiValue": "11693205629",
"friendlyName": "Rodrigo"
},
"purpose": "creditprocess",
"authenticationInfo": {
"authenticationResult": "AUTHENTICATION_RESULT_INCONCLUSIVE",
"scoreEngineResult": {
"scoreEnabled": "SCORE_ENABLED_TRUE",
"score": 50
}
},
"createdAt": "2023-08-09T15:15:09.751991Z",
"finishedAt": "2023-08-09T15:15:25.417105Z"
}
}

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.
company.codeFlags the company code in the Unico ecosystem.
company.friendlyNameFlags the customer name displayed in the user journey.
company.logoUrlFlags the customer logo displayed in the user journey.
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.
authenticationInfo.authenticationResultResult of identity validation using ID.

AUTHENTICATION_RESULT_UNSPECIFIED: Waiting for the authentication process to return.

AUTHENTICATION_RESULT_INCONCLUSIVE: Inconclusive authentication result.

AUTHENTICATION_RESULT_POSITIVE: Positive authentication result.
authenticationInfo.authenticationResult.
scoreEngineResult.scoreEnabled
Indicates whether the process has Check enabled in case the ID is inconclusive.

SCORE_ENABLED_TRUE: Enabled.

SCORE_ENABLED_FALSE: Disabled.
authenticationInfo.authenticationResult.
scoreEngineResult.score
Indicates the result of the Check score.

0: If disabled.

-100 to 100: score result.
createdAtIndicates the moment the process was created.
finishedAtIndicates the moment at which the process was completed by the user.

Request error

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