Set Process Document
Sets the identification document (CPF, CURP, SSN or other duiType) on a process that was created without one. Once set, the document is immutable.
Only available for processes whose Custom Flow allows creation without a document — i.e., processes in the AWAITING_FOR_DOCUMENT state.
Endpoint
| Environment | URL |
|---|---|
| Production | POST https://api.idcloud.unico.app/client/v1/process/{processId}/document |
| Sandbox | POST https://api.idcloud.uat.unico.app/client/v1/process/{processId}/document |
Request
Headers
| Header | Value |
|---|---|
Authorization | Bearer <access_token> (see Authentication) |
Content-Type | application/json |
Path parameters
| Field | Type | Required | Description |
|---|---|---|---|
processId | string | yes | Process ID returned in process.id at creation. |
Body parameters
| Field | Type | Required | Description |
|---|---|---|---|
duiType | enum | yes | Document type. Values: DUI_TYPE_BR_CPF, DUI_TYPE_MX_CURP, DUI_TYPE_US_SSN. This endpoint supports a subset of the document types accepted by Create Process — Custom Flows that allow optional document creation are currently validated against this narrower list. |
duiValue | string | yes | Document number, without formatting. Maximum 320 characters (accommodates encoded or composite identifiers; standard document numbers such as CPF or CURP are significantly shorter). |
Example
- cURL
- Node.js
curl -X POST https://api.idcloud.unico.app/client/v1/process/abc-123/document \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{
"duiType": "DUI_TYPE_BR_CPF",
"duiValue": "12345678901"
}'
import fetch from 'node-fetch';
const res = await fetch(
'https://api.idcloud.unico.app/client/v1/process/abc-123/document',
{
method: 'POST',
headers: {
'Authorization': `Bearer ${process.env.UNICO_ACCESS_TOKEN}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
duiType: 'DUI_TYPE_BR_CPF',
duiValue: '12345678901',
}),
}
);
const { process: proc } = await res.json();
// proc.id, proc.person.duiType, proc.person.duiValue
Responses
200 OK
{
"process": {
"id": "abc-123",
"person": {
"duiType": "DUI_TYPE_BR_CPF",
"duiValue": "12345678901"
}
}
}
| Field | Type | Description |
|---|---|---|
process.id | string | Process identifier. |
process.person.duiType | string | Document type set on the process. |
process.person.duiValue | string | Document value set on the process. |
400 Bad Request
Returned when the request payload is malformed, required fields are missing, or the process state does not allow the operation.
401 Unauthorized
Bearer token missing, expired, or invalid. See Authentication.
404 Not Found
Process not found.
429 Too Many Requests
Rate limit reached. No detailed error code is provided — HTTP status only.
Error Codes
- 400 Bad Request
- 401 Unauthorized
- 404 Not Found
- 429 Too Many Requests
- 500 Internal Server Error
| Code | Message | Description |
|---|---|---|
3 | process id is invalid | When the process id is invalid. |
3 | dui_type is required | When the document type is not provided. |
3 | dui_value is required | When the document number is not provided. |
3 | dui_value exceeds maximum length | When the document number exceeds the maximum character limit. |
9 | process is not awaiting for document | When the specified process does not accept document submission. |
9 | process expired | When the specified process has expired. |
9 | document already set, cannot be modified | When the process already has a linked document. |
9 | process already finished | When the process has already been finalized. |
9 | flow does not allow optional document | When the document is mandatory for the flow executed by the process. |
| Message | Description |
|---|---|
| Jwt header is an invalid JSON | When the access token used contains incorrect characters. |
| Jwt is expired | When the access token used has expired. |
| Code | Message | Description |
|---|---|---|
5 | error getting process: rpc error: code = NotFound desc = process not found | When the process ID was not found. |
No detailed error code is provided for this status — HTTP status code only.
| Code | Message | Description |
|---|---|---|
99999 | Internal failure! Try again later | When an internal error occurs. |
What's next
- After setting the document, the process continues its pipeline. Call Get Process to fetch the result, or wait for the webhook.