Update a branch
const url = 'https://api.emite.cr/v1/tenants/example/branches/example';const options = { method: 'PATCH', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"name":"Sucursal Central","isDefault":true}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request PATCH \ --url https://api.emite.cr/v1/tenants/example/branches/example \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "name": "Sucursal Central", "isDefault": true }'Only name and isDefault can change; the code is fixed once the branch is created (a body that sends it answers 400). isDefault: true makes it the default branch and clears the flag on the previous one. isDefault: false on the current default only clears it: the company is then left with NO default branch, and creating a document that names no branchCode answers 412 TENANT_NOT_CONFIGURED until another branch is made the default.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”Tenant UUID.
Branch UUID.
Request Bodyrequired
Section titled “Request Bodyrequired”object
New name for the branch. Omit it to keep the current one.
Example
Sucursal Centraltrue makes it the company's default branch (the one a document uses when it names no branchCode) and clears the flag on the previous one. false only clears it here: a company left with no default branch cannot emit a document that names none (412 TENANT_NOT_CONFIGURED).
Example
trueResponses
Section titled “Responses”object
Id of the branch — the {branchId} of the branch and terminal routes.
Branch number, 3 digits: the first three digits of every consecutivo issued from it, and the branchCode a document names to be issued from it. Fixed once created.
Name of the branch, for the app and the API; documents do not show it.
Whether it is the company's default branch — the one a document uses when it names no branchCode. At most one branch is the default; with none, creating a document that names no branch answers 412 TENANT_NOT_CONFIGURED.
Example
{ "code": "001", "name": "Casa Matriz"}Missing or invalid JWT / API key
Tenant boundary violation or insufficient scope.
Branch not found.