Redeem a purchase code (validate identity)
const url = 'https://dev-api.tsp.cl/firma_digital/dev/api/partners/v1/certificate_request';const options = { method: 'POST', headers: {'x-gw': '<x-gw>', 'Content-Type': 'application/json'}, body: '{"pCode":"example","referenceId":"example","dni":"18925910-7","email":"hello@example.com","pin":"example","serialNumber":"example","names":"example","fLastname":"example","mLastname":"example","phone":"+56911111111","claveUnica":"example","dniFront":"example","dniBack":"example","partnerCopy":"hello@example.com","fechaVencimiento":"21/09/2034"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://dev-api.tsp.cl/firma_digital/dev/api/partners/v1/certificate_request \ --header 'Content-Type: application/json' \ --header 'x-gw: <x-gw>' \ --data '{ "pCode": "example", "referenceId": "example", "dni": "18925910-7", "email": "hello@example.com", "pin": "example", "serialNumber": "example", "names": "example", "fLastname": "example", "mLastname": "example", "phone": "+56911111111", "claveUnica": "example", "dniFront": "example", "dniBack": "example", "partnerCopy": "hello@example.com", "fechaVencimiento": "21/09/2034" }'Validates the identity of the holder of a purchase code already issued (via POST /pcode on the partner-pcode Worker). It does not deliver the certificate in this call — that’s what certificate_claim is for — unless the partner is configured in B2B mode, in which case the certificate is generated and delivered automatically (webhook and/or email to the partner) in this same call, with no separate claim step for the end user.
Which fields are required depends on partner_config.require_cedula_serie, not on this call: a partner with the reduced flow (require_cedula_serie=1) must not send names/fLastname/phone (names come from the civil registry) but must send serialNumber; a partner with the full flow must send names/fLastname/phone and additionally validates against Clave Única.
Authorizations
Section titled “Authorizations”Request Bodyrequired
Section titled “Request Bodyrequired”object
Purchase code previously generated for this partner.
The partner’s own identifier for this transaction.
Holder’s RUT (Chilean national ID), with check digit.
Example
18925910-74 digits — doubles as the resulting PFX’s password.
ID card serial number. Required if the partner has the reduced flow (require_cedula_serie=1).
Holder’s first name(s). Required only in the full flow.
Paternal last name. Required only in the full flow.
Required only in the full flow.
Example
+56911111111Clave Única token, if the partner’s flow requires it.
Extra email address to CC the certificate to (full flow).
ID card expiration date as entered by the user, YYYY-MM-DD or DD-MM-YYYY/DD/MM/YYYY (day first). Compared against the real civil registry date if the partner has validate_vencimiento=1.
Example
21/09/2034Responses
Section titled “ Responses ”Identity validated. status indicates whether the certificate still needs to be claimed (VALIDATED, B2C flow) or was already issued and delivered (EMITTED, B2B flow).
object
object
object
Only present when status is EMITTED (B2B partner).
object
Example
{ "success": true, "data": { "status": "VALIDATED", "titular": { "rut": "18925910-7", "nombreCompleto": "FABIAN JESUS AGUILAR ALISTE" } }}Missing required field or invalid format.
object
Example
{ "success": false, "error": "VALIDATION_ERROR"}Invalid or missing API Key.
The purchase code does not exist.
Business rejection: required serial number missing, RUT does not match the purchase code, email already used by another holder, another purchase code has an ongoing validation, ID card does not match the civil registry, or expiration date does not match.
object
Example
{ "success": false, "error": "VALIDATION_ERROR"}The purchase code is permanently blocked.
ID validation attempt limit reached (security lock), or the emission rate limit was exceeded (10 requests/minute per partner).