Skip to main content

Get Reusable Documents

Markdown

Use this endpoint to check if a user already has a document available for reuse before starting a new Document capture flow. If a document is found, its documentId can be passed directly to POST /processes/v1 (Document type) to skip the capture step.

Endpoint​

EnvironmentURL
ProductionGET https://api.id.unico.app/documents/v1
SandboxGET https://api.id.uat.unico.app/documents/v1

Request​

Headers
HeaderValue
AuthorizationBearer <access_token> (see Authentication)
APIKEYProvisioned API key with Document Capture and Reuse enabled.
Query parameters
ParameterTypeRequiredDescription
codestringyesIdentifier of the person, without formatting (e.g., a CPF).
typestringyesType of the identifier in code. Use BR_CPF. Other identifier types, such as MX_CURP, are accepted only when enabled for your API key.
note

type identifies the person, not the document. The response lists every type of document the person can reuse.

Example​

curl -X GET "https://api.id.unico.app/documents/v1?code=12345678909&type=BR_CPF" \
-H "Authorization: Bearer $TOKEN" \
-H "APIKEY: $API_KEY"

Responses​

200 OK
{
"items": [
{
"documentType": "unico.moja.dictionary.br.cnh.v2.Cnh",
"documentId": "doc-abc-123"
}
]
}
FieldTypeDescription
itemsarrayDocuments the person already has and can reuse: at most one per document type, the most recent. Empty when the person has no reusable document.
items[].documentTypestringDocument type, as a dictionary name (e.g., unico.moja.dictionary.br.cnh.v2.Cnh). See document.type values in Create Document Process for the possible values.
items[].documentIdstringDocument identifier. Pass this value in document.documentId on POST /processes/v1 to reuse the document.

Using the documentId for reuse​

Once you have a documentId, pass it in the Document process request to skip capture:

{
"subject": {
"code": "12345678909",
"name": "Luke Skywalker"
},
"document": {
"purpose": "onboarding",
"authProcessId": "<biometric-process-id>",
"documentId": "doc-abc-123"
}
}
FieldDescription
document.purposeBusiness purpose for this document process. Accepted values: creditprocess, carpurchase, paybypaycheck, onboarding, fgts. These values are specific to the Document API and differ from the biometric SDK's purpose enum.
document.authProcessIdID of the biometric process previously created for this user (from POST /processes/v1).
document.documentIdDocument ID obtained from this endpoint's response. When provided, document.files can be omitted — the platform retrieves the previously captured document automatically.

For the full Document process request schema, see Create Document Process.

Error Codes​

CodeMessageDescription
20507The subject.code field is invalid.code or type is missing.
99989The document is invalid.The identifier in code is invalid for the type in type (e.g., a CPF with a wrong check digit).
20069The subject.duitype field is invalid.The value in type is not a known identifier type. Returned only when your API key accepts identifier types other than BR_CPF.
400HolderCodeType: argument is invalid.type is not BR_CPF and your API key does not accept other identifier types.
20002The APIKEY header is missing.Missing APIKEY header.
20001The authorization token is missing.Missing authentication token header.