Get tenant credentials info (both environments)
const url = 'https://api.emite.cr/v1/tenants/example/credentials';const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request GET \ --url https://api.emite.cr/v1/tenants/example/credentials \ --header 'Authorization: Bearer <token>'Returns the public metadata for the sandbox and production credentials (cert subject, notBefore/notAfter, ATV username/clientId/hasClientSecret) plus the activeEnvironment flag; an environment without credentials is null. Sensitive fields (.p12 binary, PIN, ATV password, client secret) are NEVER returned. atvRejectedAt is set while Hacienda refuses the stored ATV user and password: documents keep their number and wait signed (waitingDocuments), and go to Hacienda on their own once the credentials are saved again or POST …/verify succeeds.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”UUID of the caller's own company.
Responses
Section titled “Responses”object
The company's active environment: where documents created from a member's session are issued, and whose credentials they use. Changed with PATCH …/credentials/active-environment.
The sandbox credentials; null when none are uploaded.
object
The environment these credentials belong to.
The ATV user stored for this environment. Its password is never returned.
Client id of Hacienda's IdP the credentials are presented to: api-stag for sandbox, api-prod for production.
Whether a non-empty IdP client secret is stored. The secret itself is never returned.
Common name (CN) of the subject of the stored .p12 certificate. null when the stored certificate could not be read.
Start of the certificate validity. null when the stored certificate could not be read.
End of the certificate validity — upload a new certificate before then. null when the stored certificate could not be read.
When credentials were uploaded for this environment. Replacing or updating them keeps this date and moves updatedAt.
When these credentials were last saved: uploaded, replaced or updated.
Since when Hacienda's IdP refuses the stored ATV user and password; null while they work (or nothing is known against them). While set, documents are not sent with them: they keep their number and wait signed (waitingDocuments), and go to Hacienda on their own once the credentials are saved again or POST …/verify answers restored.
The refusal in the words of Hacienda's IdP; null while nothing is known against the credentials.
How many numbered, signed documents of this environment wait for these credentials to reach Hacienda. 0 while they work.
The production credentials; null when none are uploaded.
object
The environment these credentials belong to.
The ATV user stored for this environment. Its password is never returned.
Client id of Hacienda's IdP the credentials are presented to: api-stag for sandbox, api-prod for production.
Whether a non-empty IdP client secret is stored. The secret itself is never returned.
Common name (CN) of the subject of the stored .p12 certificate. null when the stored certificate could not be read.
Start of the certificate validity. null when the stored certificate could not be read.
End of the certificate validity — upload a new certificate before then. null when the stored certificate could not be read.
When credentials were uploaded for this environment. Replacing or updating them keeps this date and moves updatedAt.
When these credentials were last saved: uploaded, replaced or updated.
Since when Hacienda's IdP refuses the stored ATV user and password; null while they work (or nothing is known against them). While set, documents are not sent with them: they keep their number and wait signed (waitingDocuments), and go to Hacienda on their own once the credentials are saved again or POST …/verify answers restored.
The refusal in the words of Hacienda's IdP; null while nothing is known against the credentials.
How many numbered, signed documents of this environment wait for these credentials to reach Hacienda. 0 while they work.
Example
{ "activeEnvironment": "sandbox", "sandbox": { "environment": "sandbox", "atvUsername": "cpf-12-3456-789012@stag.comprobanteselectronicos.go.cr", "atvClientId": "api-stag", "certSubjectCn": "EMPRESA EJEMPLO SOCIEDAD ANONIMA", "atvRejectionDetail": "invalid_grant: Invalid user credentials", "waitingDocuments": 0 }, "production": { "environment": "sandbox", "atvUsername": "cpf-12-3456-789012@stag.comprobanteselectronicos.go.cr", "atvClientId": "api-stag", "certSubjectCn": "EMPRESA EJEMPLO SOCIEDAD ANONIMA", "atvRejectionDetail": "invalid_grant: Invalid user credentials", "waitingDocuments": 0 }}Missing or invalid JWT / API key
:tenantId is not the caller's company, or insufficient scope — credentials:* is never granted to an API key.