Skip to content

Upload (or replace) `.p12` + ATV credentials for one environment

PUT
/v1/tenants/{tenantId}/credentials/{environment}
curl --request PUT \
--url https://api.emite.cr/v1/tenants/example/credentials/sandbox \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: multipart/form-data' \
--form p12=@file \
--form pin=example \
--form atvUsername=example \
--form atvPassword=example \
--form atvClientId=example \
--form atvClientSecret=example

The .p12 is validated with the supplied PIN before storage. All sensitive fields are AES-256-GCM encrypted at rest using ENCRYPTION_KEY. Per-environment isolation: sandbox and production are entirely independent — re-uploading one doesn't touch the other. Saving credentials that Hacienda had refused clears the refusal, and the documents that waited for them go to Hacienda on their own.

tenantId
required
string
environment
required
string
Allowed values: sandbox production
Media typemultipart/form-data
object
p12
string format: binary
pin
string
atvUsername
string
atvPassword
string
atvClientId
string
atvClientSecret
string
Media typeapplication/json
object
message
required

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.

string
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.