Skip to content

Upload .p12 + PIN + ATV credentials for an environment

PUT
/v1/partner/tenants/{id}/credentials/{environment}
curl --request PUT \
--url https://api.emite.cr/v1/partner/tenants/example/credentials/example \
--header 'Content-Type: multipart/form-data' \
--form pin=1234 \
--form atvUsername=cpf-12-3456-789012@stag.comprobanteselectronicos.go.cr \
--form 'atvPassword=AtvP4ssw0rd!' \
--form atvClientId=api-stag \
--form atvClientSecret=optional-client-secret

Multipart: the .p12 file in the p12 field (400 P12_FILE_REQUIRED without it) plus pin, atvUsername, atvPassword, atvClientId and optionally atvClientSecret; environment is sandbox or production (400 ENVIRONMENT_INVALID). Nothing is stored unless the certificate belongs to the company (400 CERT_IDENTIFICATION_MISMATCH), the ATV user names the same identification (400 ATV_USER_IDENTIFICATION_MISMATCH) and Hacienda's identity provider accepts the user and password (400 ATV_CREDENTIALS_REJECTED; 502 when it does not answer). Replaces whatever that environment had; if Hacienda had refused the previous ones, the documents that waited for them go out again. Secrets pass through in transit only (encrypted at rest, never logged, never returned). Production uploads require the partner app to have production access (403 PARTNER_PRODUCTION_NOT_ENABLED).

id
required
string
environment
required
string
x-partner-key
string

Partner app credential (ecp_*)

Media typemultipart/form-data
object
pin
required

PIN of the .p12 signing certificate uploaded with it. The certificate must open with it (400 CERTIFICATE_INVALID otherwise) and belong to the company's own identification (400 CERT_IDENTIFICATION_MISMATCH). Stored encrypted, never returned.

string
Example
1234
atvUsername
required

The ATV user Hacienda issued for this environment. In Hacienda's usual form (cp<type>-<cédula>@…) the cédula must be the company's (400 ATV_USER_IDENTIFICATION_MISMATCH). The user, password and client are tried against the environment's Hacienda IdP before anything is saved: 400 ATV_CREDENTIALS_REJECTED when Hacienda refuses them.

string
Example
cpf-12-3456-789012@stag.comprobanteselectronicos.go.cr
atvPassword
required

Password of that ATV user. Stored encrypted, never returned.

string
Example
AtvP4ssw0rd!
atvClientId
required

Client id of Hacienda's IdP for the environment: api-stag for sandbox, api-prod for production.

string
Example
api-stag
atvClientSecret

Client secret for that IdP client, when there is one; omitted, an empty secret is sent. Stored encrypted, never returned.

string
Example
optional-client-secret
Media typeapplication/json
object
message
required

A fixed English confirmation — Credentials stored or Logo stored. The 200 status is what confirms it; nothing in the body needs parsing.

string
Example
{
"message": "Credentials stored"
}