Replace only the `.p12` of one environment (a renewed key)
const url = 'https://api.emite.cr/v1/tenants/example/credentials/sandbox/certificate';const form = new FormData();form.append('p12', 'file');form.append('pin', 'example');
const options = {method: 'PUT', headers: {Authorization: 'Bearer <token>'}};
options.body = form;
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request PUT \ --url https://api.emite.cr/v1/tenants/example/credentials/sandbox/certificate \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: multipart/form-data' \ --form p12=@file \ --form pin=exampleFor a key renewed in Tribu-CR: the new .p12 and its PIN replace the stored ones, and the ATV user and password stay as they are (they are not presented to Hacienda again). The certificate must open with the PIN, belong to the company and still be valid (400 CERTIFICATE_EXPIRED). 404 CREDENTIALS_NOT_FOUND when the environment has no credentials yet: upload them whole with PUT …/credentials/{environment}.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”Request Bodyrequired
Section titled “Request Bodyrequired”object
Responses
Section titled “Responses”object
A fixed confirmation, in English: Credentials uploaded successfully after PUT, Certificate replaced after PUT …/certificate, ATV credentials updated after PATCH. To read what is stored, use GET …/credentials.
Example
{ "message": "Credentials uploaded successfully"}Missing or invalid JWT / API key
:tenantId is not the caller's company, or insufficient scope — credentials:* is never granted to an API key.