importjava.net.URI;importjava.net.http.HttpClient;importjava.net.http.HttpRequest;importjava.net.http.HttpResponse;importjava.util.HashMap;importjava.util.Map;publicclassMain {publicstaticvoidmain(String[] args) {String apiUrl ="https://api.cadastro.uat.unico.app/client/v1/process/";String token ="<YOUR_TOKEN_HERE>";// Crie o corpo da solicitação em formato JSON String requestBody = "{\"callbackUri\":\"/\",\"flow\":\"id\",\"person\":{\"duiType\":\"DUI_TYPE_BR_CPF\",\"duiValue\":\"73689290074\"},\"purpose\":\"creditprocess\"}";
// Configure os cabeçalhos da solicitaçãoMap<String,String> headers =newHashMap<>();headers.put("Content-Type","application/json");headers.put("Authorization","Bearer "+ token);headers.put("accept","application/json");// Crie a instância do HttpClientHttpClient httpClient =HttpClient.newBuilder().build();// Crie a solicitação HTTP POSTHttpRequest request =HttpRequest.newBuilder().uri(URI.create(apiUrl)).headers(headers.entrySet().stream().map(e ->e.getKey() +":"+e.getValue()).toArray(String[]::new)).POST(HttpRequest.BodyPublishers.ofString(requestBody)).build();try {// Envie a solicitação e obtenha a respostaHttpResponse<String> response =httpClient.send(request,HttpResponse.BodyHandlers.ofString());// Exiba a resposta da APISystem.out.println("Status da resposta: "+response.statusCode());System.out.println("Corpo da resposta: "+response.body()); } catch (Exception e) {e.printStackTrace(); } }}
usingSystem;usingSystem.Net.Http;usingSystem.Text;usingSystem.Threading.Tasks;classProgram{staticasyncTaskMain() {string apiUrl ="https://api.cadastro.uat.unico.app/client/v1/process/";string token ="<YOUR_TOKEN_HERE>"; string requestBody = "{\"callbackUri\":\"/\",\"flow\":\"id\",\"person\":{\"duiType\":\"DUI_TYPE_BR_CPF\",\"duiValue\":\"73689290074\"},\"purpose\":\"creditprocess\"}";
HttpClient client =newHttpClient();client.DefaultRequestHeaders.Add("Content-Type","application/json");client.DefaultRequestHeaders.Add("Authorization","Bearer "+ token);client.DefaultRequestHeaders.Add("accept","application/json");try { HttpResponseMessage response = await client.PostAsync(apiUrl, new StringContent(requestBody, Encoding.UTF8, "application/json"));
if (response.IsSuccessStatusCode) {string responseBody =awaitresponse.Content.ReadAsStringAsync();Console.WriteLine("Status da resposta: "+response.StatusCode);Console.WriteLine("Corpo da resposta: "+ responseBody); }else {Console.WriteLine("Erro na solicitação. Status da resposta: "+response.StatusCode); } }catch (Exception e) {Console.WriteLine("Erro: "+e.Message); } }}
packagemainimport ("bytes""fmt""net/http")funcmain() { apiURL :="https://api.cadastro.uat.unico.app/client/v1/process/" token :="<YOUR_TOKEN_HERE>";// Crie o corpo da solicitação em formato JSON requestBody := []byte(`{ "callbackUri": "/path/to/url", "flow": "id", "person": { "duiType": "DUI_TYPE_BR_CPF", "duiValue": "73689290074" }, "purpose": "creditprocess" }`)// Crie um cliente HTTP client :=&http.Client{}// Crie uma solicitação HTTP POST req, err := http.NewRequest("POST", apiURL, bytes.NewBuffer(requestBody))if err !=nil { fmt.Println("Erro ao criar a solicitação HTTP:", err)return }// Defina os cabeçalhos da solicitação req.Header.Set("Content-Type", "application/json") req.Header.Set("Authorization", "Bearer "+token) req.Header.Set("accept", "application/json")// Faça a solicitação HTTP resp, err := client.Do(req)if err !=nil { fmt.Println("Erro ao fazer a solicitação HTTP:", err)return }defer resp.Body.Close()// Verifique o status da respostaif resp.StatusCode == http.StatusOK {// Leitura do corpo da respostavar responseBody []byte _, err := resp.Body.Read(responseBody)if err !=nil { fmt.Println("Erro ao ler o corpo da resposta:", err)return } fmt.Println("Status da resposta:", resp.Status) fmt.Println("Corpo da resposta:", string(responseBody)) } else { fmt.Println("Erro na solicitação. Status da resposta:", resp.Status) }}
Defines where the user will be redirected at the end of the process. Possible values are: an HTTPS URL for web page redirection, a URL schema for redirection in native mobile applications, or no redirection (include only '/').
Example: "/"
flow*string
Flow type. Possible flows: 'idlive', 'idcheck', 'iddocs', 'idsign', 'iddocssign', 'idcheckserpro', 'idtoken'. See flow details in the 'Overview' section of this documentation.
Example: "iddocssign"
companyBranchIdstring
The ID of the branch where the process will be created. If there is only one branch associated with the service account, this parameter does not need to be included.
Example: "60837cd3-ed3c-4038-ad7c-0a85ad64b03a"
bioTokenIdstring
Biometric token identification. Required for the 'idtoken' flow, and an ID from a completed process of any other identity verification flow must be used.
Example: "60837cd3-ed3c-4038-ad7c-0a85ad64b03a"
personobject
duiType*string
Type of identification document. Use "DUI_TYPE_BR_CPF" for CPF as the identifier.
Example: "DUI_TYPE_BR_CPF"
duiValue*string
Identification document value (e.g., CPF number).
Example: "12345678909"
friendlyNamestring
Person's name.
Example: "Luke Skywalker"
phonestring
Person's phone number. This is required if sending a notification via SMS or WhatsApp.
Example: "5511912345678"
emailstring
Person's email. This is required if sending a notification via Email.
Example: "teste@teste.com"
notificationsarray of object
notificationChannelstring
Notification channel. Possible values are - NOTIFICATION_CHANNEL_WHATSAPP, NOTIFICATION_CHANNEL_SMS, and NOTIFICATION_CHANNEL_EMAIL (notifications can also be sent to more than one place by specifying more than one.)
Example: "NOTIFICATION_CHANNEL_WHATSAPP"
purpose*string
Process purpose. Possible values are: 'creditprocess', 'biometryonboarding', or 'carpurchase'.
Example: "creditprocess"
expiresInstring
This is the process expiration time in seconds. If this information is not provided, the default value of 7 days will be used.
Example: "3600s"
payloadarray of object
envelopePayloadobject
documentsarray of object
documentNamestring
Document name. This is required if using any flow with electronic signature.
Example: "teste"
fileContentsstring
Document to be signed in base64. This is required if using any flow with electronic signature.