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.filesrequired). - Reuse — skips capture by referencing a previously captured document (
document.documentIdrequired).
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
| Environment | URL |
|---|---|
| Production | POST https://api.id.unico.app/processes/v1 |
| Sandbox | POST https://api.id.uat.unico.app/processes/v1 |
Request
| Header | Value |
|---|---|
Authorization | Bearer <access_token> (see Authentication) |
APIKEY | Provisioned API key with Document Capture and Reuse enabled. |
Content-Type | application/json |
- New capture
- Reuse
| Field | Type | Required | Description |
|---|---|---|---|
subject.duiType | integer | yes | Document type identifier. See duiType values below. |
subject.code | string | yes | User identifier value as defined by subject.duiType. No dots or dashes. |
subject.name | string | no | Full name. |
subject.gender | string | no | M or F. |
subject.birthDate | string (ISO 8601) | no | Date of birth (YYYY-MM-DD). |
subject.email | string | no | Email address. |
subject.phone | string | no | E.164 phone number. |
document.purpose | string | yes | Business purpose. Values: creditprocess, carpurchase, paybypaycheck, onboarding, fgts. |
document.authProcessId | string | yes | ID of the biometric process linked to this document capture. |
document.files | array | yes | Document images in base64 (front and/or back). |
document.files[].data | string | yes | Document image in base64 (PNG, JPEG or WebP, max 800 KB). |
subsidiaryId | string | no | Branch ID — required only if multiple branches exist. |
| Field | Type | Required | Description |
|---|---|---|---|
subject.duiType | integer | yes | Document type identifier. See duiType values below. |
subject.code | string | yes | User identifier value as defined by subject.duiType. No dots or dashes. |
subject.name | string | no | Full name. |
subject.gender | string | no | M or F. |
subject.birthDate | string (ISO 8601) | no | Date of birth (YYYY-MM-DD). |
subject.email | string | no | Email address. |
subject.phone | string | no | E.164 phone number. |
document.purpose | string | yes | Business purpose. Values: creditprocess, carpurchase, paybypaycheck, onboarding, fgts. |
document.authProcessId | string | yes | ID of the biometric process linked to this document. |
document.documentId | string | yes | ID of a previously captured document (obtained from Get Reusable Documents). When provided, document.files can be omitted. |
subsidiaryId | string | no | Branch ID — required only if multiple branches exist. |
duiType values
| Country | Code | Description |
|---|---|---|
| BR | 1 | Brazilian CPF |
| MX | 2 | Mexican CURP |
| US | 4 | United States SSN |
| BR | 5 | Brazilian Passport |
| AR | 6 | Argentine Passport |
| AR | 7 | Argentine DNI |
| NG | 8 | Nigerian NIN |
| CL | 9 | Chilean RUN |
| EC | 10 | Ecuadorian NI |
| US | 11 | United States Passport |
| GT | 12 | Guatemalan CUI |
| UY | 13 | Uruguayan CI |
| BR | 14 | Brazilian CNPJ |
| ZZ | 15 | Email address |
| ID | 16 | Indonesian NIK |
| ZZ | 17 | Phone number |
| US | 18 | United States Driver's License |
| NG | 20 | Nigerian Bank Verification Number (BVN) |
| US | 21 | United States Passport Card |
| US | 22 | United States Polycarbonate Passport |
| US | 23 | United States ID Card |
| TR | 24 | Turkish Identification Number (TCKN) |
| MX | 25 | Mexican RFC (Persona Física) |
| CO | 26 | Colombian NIT |
| PE | 27 | Peruvian RUC |
| CA | 28 | Canadian SIN |
| DK | 29 | Danish CPR |
| GB | 30 | British National Insurance Number (NINO) |
| PL | 31 | Polish PESEL |
| SE | 32 | Swedish Personal Number (PNR) |
| CH | 33 | Swiss AHV/AVS Number |
| AT | 34 | Austrian Tax Number (STNR) |
| FI | 35 | Finnish Personal Identity Code (HETU) |
| BE | 36 | Belgian National Number (NN) |
| IT | 37 | Italian Codice Fiscale (CF) |
| SE | 38 | Swedish Coordination Number (Samordningsnummer) |
| NO | 39 | Norwegian National Identity Number (Fødselsnummer) |
| PE | 40 | Peruvian DNI |
| DE | 41 | German Tax Identification Number (IdNr) |
| NL | 42 | Dutch Citizen Service Number (BSN) |
| NG | 43 | Nigerian BVN Token (hashed) |
| NG | 44 | Nigerian NIN Token (hashed) |
| PT | 45 | Portuguese Tax Identification Number (NIF) |
| FR | 46 | French Tax Reference Number (SPI) |
| IE | 47 | Irish Personal Public Service Number (PPSN) |
| LU | 48 | Luxembourg National Identification Number (Matricule) |
| AR | 49 | Argentine Driving Licence (Licencia Nacional de Conducir) |
| ES | 50 | Spanish Foreigner Identity Number (NIE) |
| ES | 51 | Spanish National Identity Document (DNI) |
| CL | 52 | Chilean Passport |
| CO | 53 | Colombian Passport |
| PE | 54 | Peruvian Passport |
| CO | 55 | Colombian Driving Licence (Licencia de Conducción) |
| CO | 56 | Colombian Citizenship Card (Cédula de Ciudadanía) |
| CL | 57 | Chilean Driving Licence (Licencia de Conducir) |
| MX | 58 | Mexican Driving Licence (Licencia de Conducir) |
| — | 0 | Unspecified |
| — | 3 | Internal Unico identifier |
Example
- New capture — cURL
- New capture — Node.js
- Reuse — cURL
- Reuse — Node.js
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": 1,
"code": "12345678909",
"name": "Luke Skywalker"
},
"document": {
"purpose": "onboarding",
"authProcessId": "80371b2a-3ac7-432e-866d-57fe37896ac6",
"files": [
{ "data": "/9j/4AAQSkZJR..." }
]
}
}'
import fetch from 'node-fetch';
const res = await fetch('https://api.id.unico.app/processes/v1', {
method: 'POST',
headers: {
'Authorization': `Bearer ${process.env.UNICO_ACCESS_TOKEN}`,
'APIKEY': process.env.UNICO_API_KEY,
'Content-Type': 'application/json'
},
body: JSON.stringify({
subject: {
duiType: 1,
code: '12345678909',
name: 'Luke Skywalker'
},
document: {
purpose: 'onboarding',
authProcessId: '80371b2a-3ac7-432e-866d-57fe37896ac6',
files: [{ data: documentImageBase64 }]
}
})
});
const result = await res.json();
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": 1,
"code": "12345678909"
},
"document": {
"purpose": "onboarding",
"authProcessId": "80371b2a-3ac7-432e-866d-57fe37896ac6",
"documentId": "doc-abc-123"
}
}'
import fetch from 'node-fetch';
const res = await fetch('https://api.id.unico.app/processes/v1', {
method: 'POST',
headers: {
'Authorization': `Bearer ${process.env.UNICO_ACCESS_TOKEN}`,
'APIKEY': process.env.UNICO_API_KEY,
'Content-Type': 'application/json'
},
body: JSON.stringify({
subject: {
duiType: 1,
code: '12345678909'
},
document: {
purpose: 'onboarding',
authProcessId: '80371b2a-3ac7-432e-866d-57fe37896ac6',
documentId: 'doc-abc-123'
}
})
});
const result = await res.json();
Responses
{
"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"
]
}
}
| Field | Type | Description |
|---|---|---|
id | string (UUID) | Process identifier. |
status | integer | 3 (finished with success), 5 (finished with failure). |
document.id | string | Captured document identifier. Use this value in future document.documentId requests for reuse. |
document.type | string | Identified document type, as a fully qualified dictionary name. See document.type values below. |
document.cpfMatch | boolean | true if the identifier extracted from the document matches subject.code. |
document.faceMatch | boolean | true if the document face matches the biometric selfie from document.authProcessId. |
document.content | object | Fields extracted via OCR. Structure varies by document type — click here for field details. |
document.fileUrls | array | Temporary URLs (10-minute validity) for downloading the document images. |
Only fields successfully extracted are present in document.content; anything the OCR could not read is omitted rather than returned empty.
document.type values
All document types that use the unified schema — unified_schema in the field reference — are reported in document.type as unico.moja.dictionary.<country>.generic.v1.<DocumentType>, where <country> is the lowercase ISO 3166-1 alpha-2 code and <DocumentType> the identified type. For instance:
unico.moja.dictionary.ar.generic.v1.IdCard: Argentinian ID cardunico.moja.dictionary.us.generic.v1.PolycarbonatePassport: U.S. polycarbonate passport
Document types that use their own field schema — listed under specific_document_schemas in the field reference — are shown in the table below:
| Country | Value | Document |
|---|---|---|
| BR | unico.moja.dictionary.br.rg.v2.Rg | RG |
| BR | unico.moja.dictionary.br.cnh.v2.Cnh | CNH (driver's license) |
| BR | unico.moja.dictionary.br.cin.v1.Cin | CIN |
| BR | unico.moja.dictionary.br.passaporte.v1.Passaporte | Passport |
| MX | unico.moja.dictionary.mx.ine.v1.Ine | INE voter credential |
| MX | unico.moja.dictionary.mx.lpc.v1.Lpc | Licencia para conducir (driver's license) |
| MX | unico.moja.dictionary.mx.pasaporte.v1.Pasaporte | Passport |
| — | unico.moja.dictionary.other.unknown.v1.Unknown | Type could not be identified — document.content is empty |
No OCR extraction is performed and no field is reported when document.type is unico.moja.dictionary.other.unknown.v1.Unknown.
Error Codes
- 400 Bad Request
- 403 Forbidden
- 409 Conflict
- 500 Internal Server Error
| Code | Message | Description |
|---|---|---|
99989 | The document is invalid. | document object has an invalid structure. |
99988 | The document is empty. | document object is missing from the request body. |
20900 | O base64 informado não é válido. | The base64 parameter is invalid. Possible causes: it's not an image or it's an injection attempt. |
20807 | A 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. |
20509 | The subject.name field is invalid. | subject.name contains invalid characters. |
20508 | The subject.gender field is invalid. | subject.gender must be M or F. |
20507 | O parâmetro subject.code é inválido. | Non-standard or non-existent identifier value. |
20506 | O base64 informado é muito grande. O tamanho máximo suportado é até 800kb. | Image size exceeds 800 KB; compress to JPEG92. |
20505 | O base64 informado não é suportado. Os formatos aceitos são png, jpeg e webp. | The base64 format is invalid or unsupported. |
20068 | The document.documentId or document.files parameter must be present. | Neither document.documentId nor document.files were provided. |
20067 | The document.purpose parameter is invalid. | Unrecognized value in document.purpose. |
20066 | The document.authProcessId parameter is invalid. | Invalid value in document.authProcessId. |
20062 | The useCase field is invalid. | Unrecognized value in the useCase field. |
20021 | The subject.phone field is invalid. | subject.phone format is invalid (IDD + area code + number, 13 chars). |
20019 | The subject.birthDate field is invalid. | subject.birthDate is outside ISO 8601 format (YYYY-MM-DD). |
20009 | O parâmetro imagebase64 não foi informado. | The document image parameter is missing. |
20008 | The subject.email field is invalid. | Invalid email format in subject.email. |
20005 | O parâmetro subject.code não foi informado. | The subject.code parameter is missing. |
20004 | O parâmetro subject não foi informado. | The subject parameter is missing. |
20003 | The request body is missing or invalid. | Null or invalid payload. |
20002 | O parâmetro APIKey não foi informado. | The APIKEY parameter is missing from the request header. |
20001 | O parâmetro authtoken não foi informado. | The integration token parameter is missing from the request header. |
10508 | The JWT with the captured face has already been used. | The JWT can only be used once. |
10507 | The JWT with the captured face is expired. | JWT expired; must be sent within 10 minutes. |
10506 | The imageBase64 field is not a valid JWT from SDK. | The imageBase64 is not a valid JWT generated by the SDK. |
Bearer token or APIKEY missing, expired, or invalid. See Authentication.
| Code | Message | Description |
|---|---|---|
30017 | User does not have permission to perform this action. | Malformed JWT or user without permission to perform this operation. |
10502 | O token informado está expirado. | The access-token has expired. |
10501 | O token informado é inválido. | The authentication token is invalid. |
10201 | O AppKey informado é inválido. | The APIKEY is invalid or does not exist. |
| Code | Message | Description |
|---|---|---|
20073 | The processID already exists. | The processId provided already exists for this tenant. |
| Code | Message | Description |
|---|---|---|
99999 | Internal failure! Try again later | When there is an internal error. |
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.