Organization
The tenant is the taxpayer. Its configuration — profile, locations, activities, credentials, branding — is environment-independent (shared by sandbox and production); only transactional data is environment-scoped.
Profile
Section titled “Profile”GET /v1/tenants/mePATCH /v1/tenants/:idIdentity fields (identification type/number) are immutable once set
(IMMUTABLE_FIELD, params.field: "identification") — the tenant is that
taxpayer. The legal name is not edited by hand either (params.field: "name"):
it follows Hacienda’s registry, and POST /v1/tenants/:id/hacienda-sync updates
it to the official value. Editable: commercial name, contact, default locale,
enabled currencies, notification preferences.
Branches & terminals
Section titled “Branches & terminals”Consecutivos are allocated per (branch, terminal, docType). Map each physical
location to a branch and each register/POS device to a terminal so numbering
never contends across devices.
GET /v1/tenants/:tenantId/branchesPOST /v1/tenants/:tenantId/branchesPATCH /v1/tenants/:tenantId/branches/:branchIdDELETE /v1/tenants/:tenantId/branches/:branchIdGET /v1/tenants/:tenantId/branches/:branchId/terminalsPOST /v1/tenants/:tenantId/branches/:branchId/terminalsPATCH /v1/tenants/:tenantId/branches/:branchId/terminals/:terminalIdDELETE /v1/tenants/:tenantId/branches/:branchId/terminals/:terminalIdA branch/terminal code referenced by issued documents is immutable — create a
new one instead of renumbering.
The company always has a default branch, and each branch a default terminal:
it is the one a document that names no other uses. To change it, send
isDefault: true to another one; sending isDefault: false to the default
answers 409 (BRANCH_DEFAULT_REQUIRED, TERMINAL_DEFAULT_REQUIRED), and
deleting it answers 422 (BRANCH_DEFAULT_CANNOT_BE_DELETED,
TERMINAL_DEFAULT_CANNOT_BE_DELETED).
Economic activities
Section titled “Economic activities”Your document must declare an economic activity registered to the taxpayer at Hacienda.
GET /v1/tenants/:tenantId/economic-activitiesPOST /v1/tenants/:tenantId/economic-activities/sync # sync from Hacienda's registryPATCH /v1/tenants/:tenantId/economic-activities/:activityId/default # set the defaultSyncing pulls the current activities from Hacienda’s padrón. If the default
activity is no longer registered, the sync applies nothing and answers 409
DEFAULT_ACTIVITY_DROPPED, with the activity that dropped in
error.details.removed and the taxpayer’s current ones in
error.details.suggested: call it again with newDefault, the code of one of
them. An empty suggested means Hacienda has no activity registered for the
company, which has to be registered before syncing. A newDefault that is not
in the registry answers 409 INVALID_NEW_DEFAULT, with the same list.
Hacienda credentials
Section titled “Hacienda credentials”The .p12 certificate + ATV credentials, per environment. Uploaded as
multipart/form-data; only opaque, non-secret metadata (cert expiry, ATV
username) is ever returned.
GET /v1/tenants/:tenantId/credentials # status per env (no secrets)PUT /v1/tenants/:tenantId/credentials/:environment # upload p12 + ATVPATCH /v1/tenants/:tenantId/credentials/:environment # rotate individual fieldsDELETE /v1/tenants/:tenantId/credentials/:environmentPATCH /v1/tenants/:tenantId/credentials/active-environment # switch active envPOST /v1/tenants/:tenantId/credentials/:environment/verify # one try of refused credentialsDeleting removes that env’s certificate, its PIN and its ATV credentials, even if
it is the active one: until new ones are uploaded, that env cannot sign or send
documents. Switching to an env with no credentials returns
TARGET_ENVIRONMENT_NOT_CONFIGURED.
When Hacienda refuses the stored credentials
Section titled “When Hacienda refuses the stored credentials”If Hacienda’s IdP refuses the stored ATV username and password (a password changed at Hacienda, an expired or locked account), EmiteCR stops presenting them: every refused login counts toward the account’s lockout at Hacienda, and the pipeline would otherwise keep trying around the clock. Nothing is lost meanwhile:
- Documents keep their number and issue date and wait
signed; none is markederror, and no 24-hour timeout runs while the credentials are refused. GET …/credentialsshowsatvRejectedAt, the IdP’s own words (atvRejectionDetail) and how many documents wait (waitingDocuments).- The company’s owner and administrators get an email at once and a reminder
every day; integrations subscribed to
credentials.rejectedget a webhook. - Saving the credentials again (
PUTorPATCH), or a successfulPOST …/verify(one try with the stored ones, at most once a minute — for when they were fixed at Hacienda without changing them here), clears the mark and everything that waited goes out on its own, followed bycredentials.restored. A daily probe does the same when Hacienda starts accepting them again without anyone touching them.
Logo & PDF branding
Section titled “Logo & PDF branding”PUT /v1/tenants/:id/logo # upload (multipart)GET /v1/tenants/:id/logo/raw # the stored imageDELETE /v1/tenants/:id/logoPOST /v1/tenants/me/pdf-branding/preview # render a sample PDF; nothing is savedThe logo appears on generated invoice PDFs on every plan. The colours and the
layout are saved with the rest of the settings:
PATCH /v1/tenants/me/settings with pdfBranding, where only the fields sent
change and null puts one back to its default. Changing them is gated by the
pdf_branding feature. The preview renders a sample invoice with the branding
sent in its body, without saving it.
Settings
Section titled “Settings”GET /v1/tenants/me/settingsPATCH /v1/tenants/me/settingsPreferences like enabled currencies and default currency live here. Disabling a
currency that still has draft invoices returns CURRENCY_HAS_DRAFTS — use the
disable-currency-impact preflight first.