Skip to main content

Create Document Process

This endpoint handles two document flows that share the same path but differ in body parameters:

  • New capture — submits document image(s) in base64 for processing (document.files required).
  • Reuse — skips capture by referencing a previously captured document (document.documentId required).

The active flow is determined by whether document.documentId is provided in the request body.

Before creating a document process, use Get Reusable Documents to check if the user already has a document available for reuse.

For the full integration flow, see API Overview.

Endpoint

EnvironmentURL
ProductionPOST https://api.id.unico.app/processes/v1
SandboxPOST https://api.id.uat.unico.app/processes/v1

Request

Headers
HeaderValue
AuthorizationBearer <access_token> (see Authentication)
APIKEYProvisioned API key with Document Capture and Reuse enabled.
Content-Typeapplication/json
Body parameters
FieldTypeRequiredDescription
subject.duiTypestringyesIdentifier type. Possible values: DUI_TYPE_BR_CPF, DUI_TYPE_MX_CURP, DUI_TYPE_US_SSN, DUI_TYPE_NG_NIN, DUI_TYPE_AR_DNI, DUI_TYPE_ID_NIK.
subject.codestringyesUser identifier value as defined by subject.duiType. No dots or dashes.
subject.namestringnoFull name.
subject.genderstringnoM or F.
subject.birthDatestring (ISO 8601)noDate of birth (YYYY-MM-DD).
subject.emailstringnoEmail address.
subject.phonestringnoE.164 phone number.
document.purposestringyesBusiness purpose. Values: creditprocess, carpurchase, paybypaycheck, onboarding, fgts.
document.authProcessIdstringyesID of the biometric process linked to this document capture.
document.filesarrayyesDocument images in base64 (front and/or back).
document.files[].datastringyesDocument image in base64 (PNG, JPEG or WebP, max 800 KB).
subsidiaryIdstringnoBranch ID — required only if multiple branches exist.

Example

curl -X POST https://api.id.unico.app/processes/v1 \
-H "Authorization: Bearer $TOKEN" \
-H "APIKEY: $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"subject": {
"duiType": "DUI_TYPE_BR_CPF",
"code": "12345678909",
"name": "Luke Skywalker"
},
"document": {
"purpose": "onboarding",
"authProcessId": "80371b2a-3ac7-432e-866d-57fe37896ac6",
"files": [
{ "data": "/9j/4AAQSkZJR..." }
]
}
}'

Responses

200 OK
{
"id": "80371b2a-3ac7-432e-866d-57fe37896ac6",
"status": 3,
"document": {
"id": "doc-abc-123",
"type": "unico.moja.dictionary.br.cnh.v2.Cnh",
"cpfMatch": true,
"faceMatch": true,
"content": {
"numero": "12345678",
"nomeCivil": "Luke Skywalker",
"dataNascimento": "2000-05-20T00:00:00Z",
"categoria": "B",
"dataExpiracao": "2030-05-20T00:00:00Z"
},
"fileUrls": [
"https://storage.unico.app/documents/doc-abc-123/front.jpg"
]
}
}
FieldTypeDescription
idstring (UUID)Process identifier.
statusinteger3 (finished with success), 5 (finished with failure).
document.idstringCaptured document identifier. Use this value in future document.documentId requests for reuse.
document.typestringIdentified document type. Possible values: unico.moja.dictionary.br.rg.v2.Rg, unico.moja.dictionary.br.cnh.v2.Cnh, unico.moja.dictionary.br.cin.v1.Cin, unico.moja.dictionary.br.passaporte.v1.Passaporte.
document.cpfMatchbooleantrue if the identifier extracted from the document matches subject.code.
document.faceMatchbooleantrue if the document face matches the biometric selfie from document.authProcessId.
document.contentobjectFields extracted via OCR. Structure varies by document type — see below.
document.fileUrlsarrayTemporary URLs (10-minute validity) for downloading the document images.
400 Bad Request

The payload is malformed, the image is invalid, or required fields are missing. See Error Codes below.

403 Forbidden

Bearer token or APIKEY missing, expired, or invalid. See Authentication.

409 Conflict

The processId provided already exists for this tenant. See Error Codes below.

Error Codes

CodeMessageDescription
99989The document is invalid.document object has an invalid structure.
99988The document is empty.document object is missing from the request body.
20900O base64 informado não é válido.The base64 parameter is invalid. Possible causes: it's not an image or it's an injection attempt.
20807A imagem precisa estar no padrão HD ou possuir uma resolução superior a 640 x 480.The resolution of the uploaded image is too low.
20509The subject.name field is invalid.subject.name contains invalid characters.
20508The subject.gender field is invalid.subject.gender must be M or F.
20507O parâmetro subject.code é inválido.Non-standard or non-existent identifier value.
20506O base64 informado é muito grande. O tamanho máximo suportado é até 800kb.Image size exceeds 800 KB; compress to JPEG92.
20505O base64 informado não é suportado. Os formatos aceitos são png, jpeg e webp.The base64 format is invalid or unsupported.
20068The document.documentId or document.files parameter must be present.Neither document.documentId nor document.files were provided.
20067The document.purpose parameter is invalid.Unrecognized value in document.purpose.
20066The document.authProcessId parameter is invalid.Invalid value in document.authProcessId.
20062The useCase field is invalid.Unrecognized value in the useCase field.
20021The subject.phone field is invalid.subject.phone format is invalid (IDD + area code + number, 13 chars).
20019The subject.birthDate field is invalid.subject.birthDate is outside ISO 8601 format (YYYY-MM-DD).
20009O parâmetro imagebase64 não foi informado.The document image parameter is missing.
20008The subject.email field is invalid.Invalid email format in subject.email.
20005O parâmetro subject.code não foi informado.The subject.code parameter is missing.
20004O parâmetro subject não foi informado.The subject parameter is missing.
20003The request body is missing or invalid.Null or invalid payload.
20002O parâmetro APIKey não foi informado.The APIKEY parameter is missing from the request header.
20001O parâmetro authtoken não foi informado.The integration token parameter is missing from the request header.
10508The JWT with the captured face has already been used.The JWT can only be used once.
10507The JWT with the captured face is expired.JWT expired; must be sent within 10 minutes.
10506The imageBase64 field is not a valid JWT from SDK.The imageBase64 is not a valid JWT generated by the SDK.

What's next

  • To check if a document is already available before this call, see Get Reusable Documents.
  • For biometric process creation (required for document.authProcessId), see Create Process.